Compare commits
236 Commits
release_30
...
release_32
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1b3775e38c | ||
![]() |
864e2aaa4c | ||
![]() |
0919dbaab3 | ||
![]() |
9bae2a9dc5 | ||
![]() |
9d5e9d3d66 | ||
![]() |
22b781bf0c | ||
![]() |
ff9267709d | ||
![]() |
73c85c7725 | ||
![]() |
4af2cf38f0 | ||
![]() |
9c0df1416f | ||
![]() |
eac2a01863 | ||
![]() |
1c0be3864a | ||
![]() |
999fc97ef2 | ||
![]() |
1dc6f7ab97 | ||
![]() |
75536baae7 | ||
![]() |
95c0e9f9e1 | ||
![]() |
155ff6e95a | ||
![]() |
8d36c432f2 | ||
![]() |
c25d158c62 | ||
![]() |
c004e2e7d7 | ||
![]() |
3c6fefdf44 | ||
![]() |
2d3f4ee99f | ||
![]() |
a585de645c | ||
![]() |
7eb9f1e3a3 | ||
![]() |
6cb977bf0c | ||
![]() |
33be35effe | ||
![]() |
5c90cbad38 | ||
![]() |
460b4cadde | ||
![]() |
cf115d2cc6 | ||
![]() |
c417a802ed | ||
![]() |
70e441a9b0 | ||
![]() |
a5160283a4 | ||
![]() |
3882d397c4 | ||
![]() |
37bdf0e6bd | ||
![]() |
d57de091c3 | ||
![]() |
d305d3c1a2 | ||
![]() |
ec423cb8d4 | ||
![]() |
e7d59f2601 | ||
![]() |
8540d4c9d2 | ||
![]() |
08a0b48c09 | ||
![]() |
ffab05833f | ||
![]() |
96c60b482e | ||
![]() |
a0852ffbe8 | ||
![]() |
4ae952ab9a | ||
![]() |
364e94575b | ||
![]() |
2a03b71f09 | ||
![]() |
e87514aa94 | ||
![]() |
4490c4aaed | ||
![]() |
584db4287b | ||
![]() |
e103a3d69b | ||
![]() |
6886dd19c4 | ||
![]() |
4b2f4203a2 | ||
![]() |
cd99236231 | ||
![]() |
069bdd52c1 | ||
![]() |
63b2f4f2dc | ||
![]() |
ef793f2513 | ||
![]() |
403f91ad2c | ||
![]() |
6d39f9f356 | ||
![]() |
ee7a0bf265 | ||
![]() |
65f059b842 | ||
![]() |
7a7b6d8283 | ||
![]() |
30055c68d4 | ||
![]() |
5fec82dc0d | ||
![]() |
116ce6a312 | ||
![]() |
afcac1ac46 | ||
![]() |
8b5bb3c5af | ||
![]() |
ca8eb830dd | ||
![]() |
f3d62ea57f | ||
![]() |
0405cc4ae0 | ||
![]() |
8131a01a9c | ||
![]() |
8bf01ddd30 | ||
![]() |
6e1d851be8 | ||
![]() |
c8f7413908 | ||
![]() |
499c61f999 | ||
![]() |
46623a09ee | ||
![]() |
f57bd564fd | ||
![]() |
bd143086ac | ||
![]() |
410f2def47 | ||
![]() |
c83960a9e4 | ||
![]() |
fe4c9dd747 | ||
![]() |
d06a640ba7 | ||
![]() |
08bce1754d | ||
![]() |
03d7181b0e | ||
![]() |
e41f475a44 | ||
![]() |
7d87f6be1b | ||
![]() |
af3473404e | ||
![]() |
c425307238 | ||
![]() |
473f838128 | ||
![]() |
1ca23672a0 | ||
![]() |
591e32d624 | ||
![]() |
d586248597 | ||
![]() |
a58402abb9 | ||
![]() |
46e9493c68 | ||
![]() |
384608e90d | ||
![]() |
90d8723476 | ||
![]() |
74f26f251b | ||
![]() |
4eebfc3394 | ||
![]() |
5394c1ed30 | ||
![]() |
a0b5befbd3 | ||
![]() |
9b12f23e30 | ||
![]() |
cac0c46abb | ||
![]() |
71499ad176 | ||
![]() |
7a44515588 | ||
![]() |
820e00755a | ||
![]() |
518d150040 | ||
![]() |
2d62229b96 | ||
![]() |
67c8082a18 | ||
![]() |
fe59276f04 | ||
![]() |
f9b6e7eeef | ||
![]() |
caee2b093f | ||
![]() |
dbd9eacde0 | ||
![]() |
6467aeb7c9 | ||
![]() |
cbdd0896d3 | ||
![]() |
635ce1d127 | ||
![]() |
3e3e5ebc72 | ||
![]() |
51065657aa | ||
![]() |
9b763e0945 | ||
![]() |
0855ddeb24 | ||
![]() |
f20f0d3fc5 | ||
![]() |
e9e4b855b8 | ||
![]() |
762657693d | ||
![]() |
ffa7fbef7b | ||
![]() |
b3cf4b5b54 | ||
![]() |
f867f6326b | ||
![]() |
d2da6d2322 | ||
![]() |
f07a529b77 | ||
![]() |
87073e4bfb | ||
![]() |
c756f5b4e8 | ||
![]() |
9efdc0bd5f | ||
![]() |
300c67ab92 | ||
![]() |
6186c7fe6a | ||
![]() |
b2292091cb | ||
![]() |
d3eca759a2 | ||
![]() |
1ee87fa41a | ||
![]() |
0341c820a0 | ||
![]() |
616e92d748 | ||
![]() |
2a5349ba66 | ||
![]() |
271a1c03c3 | ||
![]() |
8efd3dac5d | ||
![]() |
60cb7d267f | ||
![]() |
2cf89a71df | ||
![]() |
27b4fd30ef | ||
![]() |
dc1345fd44 | ||
![]() |
9aa4e11451 | ||
![]() |
87c61a61fe | ||
![]() |
1378397721 | ||
![]() |
21a84cfb8f | ||
![]() |
f2533a8798 | ||
![]() |
b407d45d83 | ||
![]() |
558ae17391 | ||
![]() |
05b57d5cdf | ||
![]() |
b56a4ada33 | ||
![]() |
b6e7c305d4 | ||
![]() |
26cba271cb | ||
![]() |
fcbaf48f21 | ||
![]() |
d0ed21e94d | ||
![]() |
ea2741973a | ||
![]() |
997e454139 | ||
![]() |
f2b2cc6440 | ||
![]() |
8fa14e97ca | ||
![]() |
1e8b3f96c0 | ||
![]() |
4a13b2dce9 | ||
![]() |
0438ea241e | ||
![]() |
a231c37df7 | ||
![]() |
9d84832741 | ||
![]() |
8417c46f8d | ||
![]() |
896baa2547 | ||
![]() |
4300839b5f | ||
![]() |
b9344c218b | ||
![]() |
7786188d15 | ||
![]() |
3fadda314a | ||
![]() |
d41b60b2b4 | ||
![]() |
335b1518e4 | ||
![]() |
e0c3b1e55c | ||
![]() |
3074a05cdc | ||
![]() |
6df1412ca6 | ||
![]() |
3508b3836b | ||
![]() |
01198b313c | ||
![]() |
e1642e1c00 | ||
![]() |
1e9f55f2d2 | ||
![]() |
2848444954 | ||
![]() |
b04ad4162d | ||
![]() |
d7a2ad6a99 | ||
![]() |
e5285fd6b6 | ||
![]() |
b0bfd9bdd6 | ||
![]() |
5f3f35fe64 | ||
![]() |
982331b66e | ||
![]() |
67872dde14 | ||
![]() |
3c8432fb5b | ||
![]() |
dea7f39af1 | ||
![]() |
b1bc0c4975 | ||
![]() |
1dd5ccf06c | ||
![]() |
a18778751c | ||
![]() |
6e4971fafe | ||
![]() |
798e880364 | ||
![]() |
ca1f44d19f | ||
![]() |
b9b932fdef | ||
![]() |
fcf7bd1ffe | ||
![]() |
e1a7b04c58 | ||
![]() |
ae8b16e047 | ||
![]() |
571994088f | ||
![]() |
e4d24cec24 | ||
![]() |
8292d74270 | ||
![]() |
5586c020c9 | ||
![]() |
6cc99fa338 | ||
![]() |
83b2c84a3c | ||
![]() |
8e84350ebf | ||
![]() |
0a63119a76 | ||
![]() |
8e50a9cf73 | ||
![]() |
f8880d0b85 | ||
![]() |
d4cf215e08 | ||
![]() |
c00f75dc75 | ||
![]() |
40c13d31c5 | ||
![]() |
cf2654bae7 | ||
![]() |
2891675aad | ||
![]() |
62453ea71d | ||
![]() |
f836d531b4 | ||
![]() |
e814a90f74 | ||
![]() |
f6d875f7f5 | ||
![]() |
438377c051 | ||
![]() |
ec3773c2da | ||
![]() |
9996844df0 | ||
![]() |
66c6f9733b | ||
![]() |
34869adacb | ||
![]() |
0dd0b4d758 | ||
![]() |
704f09b212 | ||
![]() |
91a8272cbd | ||
![]() |
c13b147280 | ||
![]() |
ce6884cc76 | ||
![]() |
6cd051bc34 | ||
![]() |
9f8884e6c1 | ||
![]() |
8faa95ff8c | ||
![]() |
78b6828f14 | ||
![]() |
f46fc939cb | ||
![]() |
8db4acad3b | ||
![]() |
08e17472e4 |
@@ -87,17 +87,17 @@ macro(append_if list condition var)
|
||||
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)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
|
||||
if (LIBCXX_ENABLE_WERROR)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
|
||||
endif()
|
||||
if (LIBCXX_ENABLE_PEDANTIC)
|
||||
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
|
||||
endif()
|
||||
|
||||
# Get feature flags.
|
||||
@@ -119,7 +119,8 @@ if (NOT LIBCXX_ENABLE_RTTI)
|
||||
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
|
||||
endif()
|
||||
# Assert
|
||||
if (LLVM_ENABLE_ASSERTIONS)
|
||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
|
||||
if (LIBCXX_ENABLE_ASSERTIONS)
|
||||
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
|
||||
if (NOT MSVC)
|
||||
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
|
||||
|
46
CREDITS.TXT
46
CREDITS.TXT
@@ -13,8 +13,8 @@ E: hhinnant@apple.com
|
||||
D: Architect and primary author of libc++
|
||||
|
||||
N: Marshall Clow
|
||||
E: mclow.lists@gmail.com
|
||||
E: marshall@idio.com
|
||||
E: mclow@qualcomm.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Bjorn Reese
|
||||
@@ -23,7 +23,7 @@ D: Initial regex prototype
|
||||
|
||||
N: David Chisnall
|
||||
E: theraven at theravensnest dot org
|
||||
D: FreeBSD port and libcxxrt support.
|
||||
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
|
||||
|
||||
N: Ruben Van Boxem
|
||||
E: vanboxem dot ruben at gmail dot com
|
||||
@@ -32,3 +32,45 @@ D: Initial Windows patches.
|
||||
N: Arvid Picciani
|
||||
E: aep at exys dot org
|
||||
D: Minor patches and musl port.
|
||||
|
||||
N: Craig Silverstein
|
||||
E: csilvers@google.com
|
||||
D: Implemented Cityhash as the string hash function on 64-bit machines
|
||||
|
||||
N: Google Inc.
|
||||
D: Copyright owner and contributor of the CityHash algorithm
|
||||
|
||||
N: Jeffrey Yasskin
|
||||
E: jyasskin@gmail.com
|
||||
E: jyasskin@google.com
|
||||
D: Linux fixes.
|
||||
|
||||
N: Jonathan Sauer
|
||||
D: Minor patches, mostly related to constexpr
|
||||
|
||||
N: Richard Smith
|
||||
D: Minor patches.
|
||||
|
||||
N: Andrew Morrow
|
||||
E: andrew.c.morrow@gmail.com
|
||||
D: Minor patches and Linux fixes.
|
||||
|
||||
N: Hyeon-bin Jeong
|
||||
E: tuhertz@gmail.com
|
||||
D: Minor patches and bug fixes.
|
||||
|
||||
N: Michel Morin
|
||||
E: mimomorin@gmail.com
|
||||
D: Minor patches to is_convertible.
|
||||
|
||||
N: Dimitry Andric
|
||||
E: dimitry@andric.com
|
||||
D: Visibility fixes, minor FreeBSD portability patches.
|
||||
|
||||
N: Holger Arnold
|
||||
E: holgerar@gmail.com
|
||||
D: Minor fix.
|
||||
|
||||
N: Argyrios Kyrtzidis
|
||||
E: kyrtzidis@apple.com
|
||||
D: Bug fixes.
|
||||
|
@@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
|
||||
University of Illinois/NCSA
|
||||
Open Source License
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
|
||||
|
||||
All rights reserved.
|
||||
|
||||
@@ -55,7 +55,7 @@ SOFTWARE.
|
||||
|
||||
==============================================================================
|
||||
|
||||
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
|
||||
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
57
Makefile
57
Makefile
@@ -14,9 +14,12 @@ ifeq (,$(RC_INDIGO))
|
||||
else
|
||||
INSTALL_PREFIX="$(SDKROOT)"
|
||||
endif
|
||||
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
|
||||
|
||||
.PHONY: help installsrc clean installheaders install
|
||||
|
||||
help::
|
||||
echo Use make install DSTROOT=<destination>
|
||||
@echo "Use make install DSTROOT=<destination>"
|
||||
|
||||
installsrc:: $(SRCROOT)
|
||||
|
||||
@@ -27,42 +30,24 @@ installsrc:: $(SRCROOT)
|
||||
|
||||
clean::
|
||||
|
||||
installhdrs::
|
||||
# The installheaders target is used by clang's runtime/libcxx makefile.
|
||||
installheaders::
|
||||
mkdir -p $(HEADER_DIR)/c++/v1/ext
|
||||
rsync -r --exclude=".*" --exclude="support" $(SRCDIRS)/include/* \
|
||||
$(HEADER_DIR)/c++/v1/
|
||||
chown -R root:wheel $(HEADER_DIR)/c++
|
||||
chmod 755 $(HEADER_DIR)/c++/v1
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/*
|
||||
chmod 755 $(HEADER_DIR)/c++/v1/ext
|
||||
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
|
||||
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
|
||||
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
|
||||
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
|
||||
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
|
||||
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
|
||||
|
||||
install:: installhdrs $(DESTDIR)
|
||||
install::
|
||||
|
||||
cd lib && ./buildit
|
||||
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(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
|
||||
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
mkdir -p $(INSTALL_DIR)/usr/lib
|
||||
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
|
||||
$(SYMROOT)/usr/lib/libc++.1.dylib
|
||||
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib
|
||||
|
@@ -14,12 +14,16 @@
|
||||
#include <__config>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _C, bool _IsConst> class __bit_iterator;
|
||||
template <class _C> class __bit_const_reference;
|
||||
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
|
||||
template <class _Cp> class __bit_const_reference;
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_storage_type
|
||||
@@ -27,22 +31,22 @@ struct __has_storage_type
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _C, bool = __has_storage_type<_C>::value>
|
||||
template <class _Cp, bool = __has_storage_type<_Cp>::value>
|
||||
class __bit_reference
|
||||
{
|
||||
typedef typename _C::__storage_type __storage_type;
|
||||
typedef typename _C::__storage_pointer __storage_pointer;
|
||||
typedef typename _Cp::__storage_type __storage_type;
|
||||
typedef typename _Cp::__storage_pointer __storage_pointer;
|
||||
|
||||
__storage_pointer __seg_;
|
||||
__storage_type __mask_;
|
||||
|
||||
#if defined(__clang__)
|
||||
friend typename _C::__self;
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _C::__self;
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
friend class __bit_const_reference<_C>;
|
||||
friend class __bit_iterator<_C, false>;
|
||||
friend class __bit_const_reference<_Cp>;
|
||||
friend class __bit_iterator<_Cp, false>;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||
@@ -64,76 +68,77 @@ public:
|
||||
{return operator=(static_cast<bool>(__x));}
|
||||
|
||||
_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_)));}
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
|
||||
{return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||
: __seg_(__s), __mask_(__m) {}
|
||||
};
|
||||
|
||||
template <class _C>
|
||||
class __bit_reference<_C, false>
|
||||
template <class _Cp>
|
||||
class __bit_reference<_Cp, false>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _C, class _D>
|
||||
template <class _Cp, class _Dp>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
|
||||
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
__y = __t;
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
|
||||
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
__y = __t;
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
|
||||
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
|
||||
{
|
||||
bool __t = __x;
|
||||
__x = __y;
|
||||
__y = __t;
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
class __bit_const_reference
|
||||
{
|
||||
typedef typename _C::__storage_type __storage_type;
|
||||
typedef typename _C::__const_storage_pointer __storage_pointer;
|
||||
typedef typename _Cp::__storage_type __storage_type;
|
||||
typedef typename _Cp::__const_storage_pointer __storage_pointer;
|
||||
|
||||
__storage_pointer __seg_;
|
||||
__storage_type __mask_;
|
||||
|
||||
#if defined(__clang__)
|
||||
friend typename _C::__self;
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _C::__self;
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
friend class __bit_iterator<_C, true>;
|
||||
friend class __bit_iterator<_Cp, true>;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
|
||||
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
|
||||
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
|
||||
{return static_cast<bool>(*__seg_ & __mask_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
|
||||
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
|
||||
{return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
|
||||
: __seg_(__s), __mask_(__m) {}
|
||||
|
||||
@@ -142,11 +147,11 @@ private:
|
||||
|
||||
// find
|
||||
|
||||
template <class _C>
|
||||
__bit_iterator<_C, false>
|
||||
__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, _IsConst>
|
||||
__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
// do first partial word
|
||||
@@ -176,11 +181,11 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
__bit_iterator<_C, false>
|
||||
__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, _IsConst>
|
||||
__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
// do first partial word
|
||||
@@ -189,7 +194,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||
__storage_type __b = ~*__first.__seg_ & __m;
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
__n -= __dn;
|
||||
@@ -206,30 +211,30 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
if (__n > 0)
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__storage_type __b = ~(*__first.__seg_ & __m);
|
||||
__storage_type __b = ~*__first.__seg_ & __m;
|
||||
if (__b)
|
||||
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
|
||||
}
|
||||
return _It(__first.__seg_, static_cast<unsigned>(__n));
|
||||
}
|
||||
|
||||
template <class _C, class _Tp>
|
||||
template <class _Cp, bool _IsConst, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
||||
__bit_iterator<_Cp, _IsConst>
|
||||
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||
{
|
||||
if (static_cast<bool>(__value))
|
||||
return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||
return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||
if (static_cast<bool>(__value_))
|
||||
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
}
|
||||
|
||||
// count
|
||||
|
||||
template <class _C>
|
||||
typename __bit_iterator<_C, false>::difference_type
|
||||
__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
template <class _Cp, bool _IsConst>
|
||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
typedef typename _It::difference_type difference_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
@@ -256,11 +261,11 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
typename __bit_iterator<_C, false>::difference_type
|
||||
__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
template <class _Cp, bool _IsConst>
|
||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||
__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
typedef typename _It::difference_type difference_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
@@ -271,7 +276,7 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
|
||||
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
|
||||
__storage_type __dn = _VSTD::min(__clz_f, __n);
|
||||
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
|
||||
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||
__r = _VSTD::__pop_count(~*__first.__seg_ & __m);
|
||||
__n -= __dn;
|
||||
++__first.__seg_;
|
||||
}
|
||||
@@ -282,28 +287,28 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
|
||||
if (__n > 0)
|
||||
{
|
||||
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
|
||||
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
|
||||
__r += _VSTD::__pop_count(~*__first.__seg_ & __m);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _C, class _Tp>
|
||||
template <class _Cp, bool _IsConst, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __bit_iterator<_C, false>::difference_type
|
||||
count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
|
||||
typename __bit_iterator<_Cp, _IsConst>::difference_type
|
||||
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
|
||||
{
|
||||
if (static_cast<bool>(__value))
|
||||
return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||
return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
|
||||
if (static_cast<bool>(__value_))
|
||||
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
|
||||
}
|
||||
|
||||
// fill_n
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
void
|
||||
__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, false> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
// do first partial word
|
||||
@@ -329,11 +334,11 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
}
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
void
|
||||
__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _It;
|
||||
typedef __bit_iterator<_Cp, false> _It;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
// do first partial word
|
||||
@@ -359,14 +364,14 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
|
||||
}
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
|
||||
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
|
||||
{
|
||||
if (__n > 0)
|
||||
{
|
||||
if (__value)
|
||||
if (__value_)
|
||||
__fill_n_true(__first, __n);
|
||||
else
|
||||
__fill_n_false(__first, __n);
|
||||
@@ -375,22 +380,22 @@ fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __val
|
||||
|
||||
// fill
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
|
||||
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
|
||||
{
|
||||
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
|
||||
_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
|
||||
}
|
||||
|
||||
// copy
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
__bit_iterator<_C, false>
|
||||
__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||
__bit_iterator<_C, false> __result)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, false>
|
||||
__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||
__bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C, _IsConst> _In;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||
typedef typename _In::difference_type difference_type;
|
||||
typedef typename _In::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||
@@ -432,12 +437,12 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
__bit_iterator<_C, false>
|
||||
__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||
__bit_iterator<_C, false> __result)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, false>
|
||||
__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||
__bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C, _IsConst> _In;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||
typedef typename _In::difference_type difference_type;
|
||||
typedef typename _In::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||
@@ -510,10 +515,10 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
template <class _Cp, bool _IsConst>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
__bit_iterator<_Cp, false>
|
||||
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
if (__first.__ctz_ == __result.__ctz_)
|
||||
return __copy_aligned(__first, __last, __result);
|
||||
@@ -522,12 +527,12 @@ copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||
|
||||
// copy_backward
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
__bit_iterator<_C, false>
|
||||
__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||
__bit_iterator<_C, false> __result)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, false>
|
||||
__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||
__bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C, _IsConst> _In;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||
typedef typename _In::difference_type difference_type;
|
||||
typedef typename _In::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||
@@ -569,12 +574,12 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
__bit_iterator<_C, false>
|
||||
__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
|
||||
__bit_iterator<_C, false> __result)
|
||||
template <class _Cp, bool _IsConst>
|
||||
__bit_iterator<_Cp, false>
|
||||
__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
|
||||
__bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
typedef __bit_iterator<_C, _IsConst> _In;
|
||||
typedef __bit_iterator<_Cp, _IsConst> _In;
|
||||
typedef typename _In::difference_type difference_type;
|
||||
typedef typename _In::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _In::__bits_per_word;
|
||||
@@ -633,7 +638,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
||||
{
|
||||
__m = ~__storage_type(0) << (__bits_per_word - __n);
|
||||
__storage_type __b = *--__last.__seg_ & __m;
|
||||
unsigned __clz_r = __bits_per_word - __result.__ctz_;
|
||||
__clz_r = __bits_per_word - __result.__ctz_;
|
||||
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
|
||||
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
|
||||
*__result.__seg_ &= ~__m;
|
||||
@@ -655,10 +660,10 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
template <class _Cp, bool _IsConst>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
__bit_iterator<_Cp, false>
|
||||
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
if (__last.__ctz_ == __result.__ctz_)
|
||||
return __copy_backward_aligned(__first, __last, __result);
|
||||
@@ -667,20 +672,20 @@ copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst>
|
||||
|
||||
// move
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
template <class _Cp, bool _IsConst>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
__bit_iterator<_Cp, false>
|
||||
move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
return _VSTD::copy(__first, __last, __result);
|
||||
}
|
||||
|
||||
// move_backward
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
template <class _Cp, bool _IsConst>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator<_C, false>
|
||||
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
|
||||
__bit_iterator<_Cp, false>
|
||||
move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
|
||||
{
|
||||
return _VSTD::copy(__first, __last, __result);
|
||||
}
|
||||
@@ -850,34 +855,33 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
|
||||
|
||||
// rotate
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
struct __bit_array
|
||||
{
|
||||
typedef typename _C::difference_type difference_type;
|
||||
typedef typename _C::__storage_type __storage_type;
|
||||
typedef typename _C::iterator iterator;
|
||||
static const unsigned __bits_per_word = _C::__bits_per_word;
|
||||
static const unsigned _N = 4;
|
||||
typedef typename _Cp::difference_type difference_type;
|
||||
typedef typename _Cp::__storage_type __storage_type;
|
||||
typedef typename _Cp::iterator iterator;
|
||||
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
||||
static const unsigned _Np = 4;
|
||||
|
||||
difference_type __size_;
|
||||
__storage_type __word_[_N];
|
||||
__storage_type __word_[_Np];
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
|
||||
{return static_cast<difference_type>(_N * __bits_per_word);}
|
||||
{return static_cast<difference_type>(_Np * __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
|
||||
static_cast<unsigned>(__size_ % __bits_per_word));}
|
||||
};
|
||||
|
||||
template <class _C>
|
||||
__bit_iterator<_C, false>
|
||||
rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
|
||||
template <class _Cp>
|
||||
__bit_iterator<_Cp, false>
|
||||
rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
|
||||
{
|
||||
typedef __bit_iterator<_C, false> _I1;
|
||||
typedef __bit_iterator<_Cp, false> _I1;
|
||||
typedef typename _I1::difference_type difference_type;
|
||||
typedef typename _I1::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _I1::__bits_per_word;
|
||||
difference_type __d1 = __middle - __first;
|
||||
difference_type __d2 = __last - __middle;
|
||||
_I1 __r = __first + __d2;
|
||||
@@ -885,16 +889,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
||||
{
|
||||
if (__d1 <= __d2)
|
||||
{
|
||||
if (__d1 <= __bit_array<_C>::capacity())
|
||||
if (__d1 <= __bit_array<_Cp>::capacity())
|
||||
{
|
||||
__bit_array<_C> __b(__d1);
|
||||
__bit_array<_Cp> __b(__d1);
|
||||
_VSTD::copy(__first, __middle, __b.begin());
|
||||
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
||||
__bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
|
||||
__first = __middle;
|
||||
__middle = __mp;
|
||||
__d2 -= __d1;
|
||||
@@ -902,16 +906,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__d2 <= __bit_array<_C>::capacity())
|
||||
if (__d2 <= __bit_array<_Cp>::capacity())
|
||||
{
|
||||
__bit_array<_C> __b(__d2);
|
||||
__bit_array<_Cp> __b(__d2);
|
||||
_VSTD::copy(__middle, __last, __b.begin());
|
||||
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
__bit_iterator<_C, false> __mp = __first + __d2;
|
||||
__bit_iterator<_Cp, false> __mp = __first + __d2;
|
||||
_VSTD::swap_ranges(__first, __mp, __middle);
|
||||
__first = __mp;
|
||||
__d1 -= __d2;
|
||||
@@ -923,12 +927,12 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
|
||||
|
||||
// equal
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp, bool _IC1, bool _IC2>
|
||||
bool
|
||||
__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
||||
__bit_iterator<_C, true> __first2)
|
||||
__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
||||
__bit_iterator<_Cp, _IC2> __first2)
|
||||
{
|
||||
typedef __bit_iterator<_C, true> _It;
|
||||
typedef __bit_iterator<_Cp, _IC1> _It;
|
||||
typedef typename _It::difference_type difference_type;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
@@ -947,11 +951,15 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
||||
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
|
||||
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
|
||||
if (__first2.__ctz_ > __first1.__ctz_)
|
||||
{
|
||||
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
|
||||
return false;
|
||||
}
|
||||
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
|
||||
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
|
||||
__dn -= __ddn;
|
||||
@@ -1001,12 +1009,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp, bool _IC1, bool _IC2>
|
||||
bool
|
||||
__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
|
||||
__bit_iterator<_C, true> __first2)
|
||||
__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
|
||||
__bit_iterator<_Cp, _IC2> __first2)
|
||||
{
|
||||
typedef __bit_iterator<_C, true> _It;
|
||||
typedef __bit_iterator<_Cp, _IC1> _It;
|
||||
typedef typename _It::difference_type difference_type;
|
||||
typedef typename _It::__storage_type __storage_type;
|
||||
static const unsigned __bits_per_word = _It::__bits_per_word;
|
||||
@@ -1044,31 +1052,32 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _C, bool _IC1, bool _IC2>
|
||||
template <class _Cp, 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)
|
||||
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
|
||||
{
|
||||
if (__first1.__ctz_ == __first2.__ctz_)
|
||||
return __equal_aligned(__first1, __last1, __first2);
|
||||
return __equal_unaligned(__first1, __last1, __first2);
|
||||
}
|
||||
|
||||
template <class _C, bool _IsConst>
|
||||
template <class _Cp, bool _IsConst,
|
||||
typename _Cp::__storage_type>
|
||||
class __bit_iterator
|
||||
{
|
||||
public:
|
||||
typedef typename _C::difference_type difference_type;
|
||||
typedef typename _Cp::difference_type difference_type;
|
||||
typedef bool value_type;
|
||||
typedef __bit_iterator pointer;
|
||||
typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
|
||||
typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
|
||||
typedef random_access_iterator_tag iterator_category;
|
||||
|
||||
private:
|
||||
typedef typename _C::__storage_type __storage_type;
|
||||
typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
|
||||
typename _C::__storage_pointer>::type __storage_pointer;
|
||||
static const unsigned __bits_per_word = _C::__bits_per_word;
|
||||
typedef typename _Cp::__storage_type __storage_type;
|
||||
typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
|
||||
typename _Cp::__storage_pointer>::type __storage_pointer;
|
||||
static const unsigned __bits_per_word = _Cp::__bits_per_word;
|
||||
|
||||
__storage_pointer __seg_;
|
||||
unsigned __ctz_;
|
||||
@@ -1077,7 +1086,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
|
||||
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
|
||||
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
|
||||
@@ -1185,34 +1194,34 @@ private:
|
||||
: __seg_(__s), __ctz_(__ctz) {}
|
||||
|
||||
#if defined(__clang__)
|
||||
friend typename _C::__self;
|
||||
friend typename _Cp::__self;
|
||||
#else
|
||||
friend class _C::__self;
|
||||
friend class _Cp::__self;
|
||||
#endif
|
||||
friend class __bit_reference<_C>;
|
||||
friend class __bit_const_reference<_C>;
|
||||
friend class __bit_iterator<_C, true>;
|
||||
template <class _D> friend struct __bit_array;
|
||||
template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
||||
template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
|
||||
__bit_iterator<_D, _IC> __last,
|
||||
__bit_iterator<_D, false> __result);
|
||||
friend class __bit_reference<_Cp>;
|
||||
friend class __bit_const_reference<_Cp>;
|
||||
friend class __bit_iterator<_Cp, true>;
|
||||
template <class _Dp> friend struct __bit_array;
|
||||
template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
||||
template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
|
||||
__bit_iterator<_Dp, _IC> __last,
|
||||
__bit_iterator<_Dp, false> __result);
|
||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C2, false>);
|
||||
@@ -1222,22 +1231,26 @@ private:
|
||||
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C1, false>,
|
||||
__bit_iterator<__C2, false>);
|
||||
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
|
||||
__bit_iterator<_D, false>,
|
||||
__bit_iterator<_D, false>);
|
||||
template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
|
||||
__bit_iterator<_D, true>,
|
||||
__bit_iterator<_D, true>);
|
||||
template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
|
||||
__bit_iterator<_D, true>,
|
||||
__bit_iterator<_D, true>);
|
||||
template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
|
||||
__bit_iterator<_D, _IC1>,
|
||||
__bit_iterator<_D, _IC2>);
|
||||
template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
|
||||
typename _D::size_type);
|
||||
template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
|
||||
typename _D::size_type);
|
||||
template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
|
||||
__bit_iterator<_Dp, false>,
|
||||
__bit_iterator<_Dp, false>);
|
||||
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC2>);
|
||||
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC2>);
|
||||
template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC1>,
|
||||
__bit_iterator<_Dp, _IC2>);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
|
||||
typename _Dp::size_type);
|
||||
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
|
||||
typename _Dp::size_type);
|
||||
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
||||
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
||||
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
|
||||
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
193
include/__config
193
include/__config
@@ -11,9 +11,15 @@
|
||||
#ifndef _LIBCPP_CONFIG
|
||||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1001
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 1101
|
||||
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
|
||||
@@ -51,11 +57,23 @@
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
// Compiler intrinsics (GCC or MSVC)
|
||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|
||||
# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
|
||||
|| (defined(__GNUC__) && _GNUC_VER > 403)
|
||||
# define _LIBCP_HAS_IS_BASE_OF
|
||||
# endif
|
||||
#endif // _WIN32
|
||||
|
||||
#ifdef __sun__
|
||||
# include <sys/isa_defs.h>
|
||||
# ifdef _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# else
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# endif
|
||||
#endif // __sun__
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
@@ -69,17 +87,49 @@
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#ifndef _LIBCPP_VISIBILITY_TAG
|
||||
#define _LIBCPP_VISIBILITY_TAG 1
|
||||
#if _WIN32
|
||||
|
||||
// only really useful for a DLL
|
||||
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
|
||||
# ifdef cxx_EXPORTS
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE __declspec(dllexport)
|
||||
# else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE __declspec(dllimport)
|
||||
# endif
|
||||
#else
|
||||
# define _LIBCPP_HIDDEN
|
||||
# define _LIBCPP_VISIBLE
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_VISIBILITY_TAG
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
# if _MSC_VER
|
||||
# define _LIBCPP_INLINE_VISIBILITY __forceinline
|
||||
# else // MinGW GCC and Clang
|
||||
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXCEPTION_ABI
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
# if _MSC_VER
|
||||
# define _LIBCPP_ALWAYS_INLINE __forceinline
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
#ifndef _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_VISIBLE
|
||||
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
|
||||
#else // _LIBCPP_VISIBILITY_TAG
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_VISIBLE
|
||||
#endif // _LIBCPP_VISIBILITY_TAG
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_INLINE_VISIBILITY
|
||||
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
@@ -89,12 +139,24 @@
|
||||
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CANTTHROW
|
||||
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ALWAYS_INLINE
|
||||
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
#if __has_feature(cxx_alignas)
|
||||
# define _ALIGNAS_TYPE(x) alignas(x)
|
||||
# define _ALIGNAS(x) alignas(x)
|
||||
#else
|
||||
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#endif
|
||||
|
||||
#if !__has_feature(cxx_alias_templates)
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#endif
|
||||
@@ -116,14 +178,18 @@ typedef __char32_t char32_t;
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_strong_enums))
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_decltype))
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_attributes)
|
||||
# define _ATTRIBUTE(x) [[x]]
|
||||
# define _LIBCPP_NORETURN [[noreturn]]
|
||||
#else
|
||||
# define _ATTRIBUTE(x) __attribute__ ((x))
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
@@ -179,22 +245,18 @@ typedef __char32_t char32_t;
|
||||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#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 _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif
|
||||
|
||||
#if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
|
||||
#define _LIBCPP_HAS_QUICK_EXIT
|
||||
#define _LIBCPP_HAS_C11_FEATURES
|
||||
#endif
|
||||
|
||||
#if (__has_feature(cxx_noexcept))
|
||||
# define _NOEXCEPT noexcept
|
||||
# define _NOEXCEPT_(x) noexcept(x)
|
||||
@@ -207,11 +269,22 @@ namespace std {
|
||||
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
|
||||
#endif
|
||||
|
||||
// end defined(__clang__)
|
||||
// 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 _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define _ATTRIBUTE(x) __attribute__((x))
|
||||
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
|
||||
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
|
||||
|
||||
#define _LIBCPP_NORETURN __attribute__((noreturn))
|
||||
|
||||
#if !__EXCEPTIONS
|
||||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -241,15 +314,15 @@ namespace std {
|
||||
#define _LIBCPP_HAS_NO_TRAILING_RETURN
|
||||
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
|
||||
#if _GNUC_VER < 403
|
||||
#define _LIBCPP_HAS_NO_STATIC_ASSERT
|
||||
#endif
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#if _GNUC_VER < 404
|
||||
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
|
||||
#define _LIBCPP_HAS_NO_DECLTYPE
|
||||
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
|
||||
@@ -257,9 +330,9 @@ namespace std {
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
|
||||
#endif // _GNUC_VER < 404
|
||||
|
||||
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
|
||||
#if _GNUC_VER < 406
|
||||
#define _LIBCPP_HAS_NO_NULLPTR
|
||||
#endif
|
||||
|
||||
@@ -275,7 +348,29 @@ namespace _LIBCPP_NAMESPACE {
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
}
|
||||
|
||||
#endif // defined(__GNUC__)
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#define _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
#define __alignof__ __alignof
|
||||
#define _LIBCPP_NORETURN __declspec(noreturn)
|
||||
#define _ALIGNAS(x) __declspec(align(x))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#define _NOEXCEPT throw()
|
||||
#define _NOEXCEPT_(x)
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
|
||||
#define _LIBCPP_END_NAMESPACE_STD }
|
||||
#define _VSTD std
|
||||
|
||||
namespace std {
|
||||
}
|
||||
|
||||
#endif // __clang__ || __GNUC___ || _MSC_VER
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
@@ -298,22 +393,56 @@ template <unsigned> struct __static_assert_check {};
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#define constexpr const
|
||||
#define _LIBCPP_CONSTEXPR
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define _NOALIAS __attribute__((malloc))
|
||||
#else
|
||||
#define _NOALIAS
|
||||
#endif
|
||||
|
||||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__ || _WIN32
|
||||
#if __has_feature(cxx_explicit_conversions)
|
||||
# define _LIBCPP_EXPLICIT explicit
|
||||
#else
|
||||
# define _LIBCPP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum __lx
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
__lx __v_; \
|
||||
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
|
||||
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
|
||||
};
|
||||
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
|
||||
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
#if __FreeBSD__
|
||||
#define _DECLARE_C99_LDBL_MATH 1
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
|
||||
#endif
|
||||
|
||||
#if __APPLE__ || __FreeBSD__
|
||||
#if __APPLE__ || __FreeBSD__ || __sun__
|
||||
#define _LIBCPP_WCTYPE_IS_MASK
|
||||
#endif
|
||||
|
||||
|
@@ -83,8 +83,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__dereferenceable(__j);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__dereferenceable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
@@ -93,8 +93,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__decrementable(__j);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__decrementable(__j);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
@@ -103,8 +103,8 @@ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__addable(__j, __n);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__addable(__j, __n);
|
||||
}
|
||||
|
||||
template <class _Cont>
|
||||
@@ -113,8 +113,8 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
|
||||
{
|
||||
typedef typename _Cont::const_iterator iterator;
|
||||
const iterator* __j = static_cast<const iterator*>(__i);
|
||||
_Cont* _C = static_cast<_Cont*>(__c_);
|
||||
return _C->__subscriptable(__j, __n);
|
||||
_Cont* _Cp = static_cast<_Cont*>(__c_);
|
||||
return _Cp->__subscriptable(__j, __n);
|
||||
}
|
||||
|
||||
class _LIBCPP_VISIBLE __libcpp_db
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -16,7 +16,9 @@
|
||||
#include <typeinfo>
|
||||
#include <exception>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -41,13 +43,20 @@ template <class _Tp>
|
||||
struct __has_result_type
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::result_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
|
||||
{return __x < __y;}
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#include <__functional_base_03>
|
||||
@@ -60,11 +69,11 @@ template <class _Tp>
|
||||
struct __derives_from_unary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A, class _R>
|
||||
static unary_function<_A, _R>
|
||||
__test(const volatile unary_function<_A, _R>*);
|
||||
template <class _Ap, class _Rp>
|
||||
static unary_function<_Ap, _Rp>
|
||||
__test(const volatile unary_function<_Ap, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
@@ -74,11 +83,11 @@ template <class _Tp>
|
||||
struct __derives_from_binary_function
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
static __two __test(...);
|
||||
template <class _A1, class _A2, class _R>
|
||||
static binary_function<_A1, _A2, _R>
|
||||
__test(const volatile binary_function<_A1, _A2, _R>*);
|
||||
template <class _A1, class _A2, class _Rp>
|
||||
static binary_function<_A1, _A2, _Rp>
|
||||
__test(const volatile binary_function<_A1, _A2, _Rp>*);
|
||||
public:
|
||||
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
|
||||
typedef decltype(__test((_Tp*)0)) type;
|
||||
@@ -129,173 +138,173 @@ struct __weak_result_type
|
||||
|
||||
// 0 argument case
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R ()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp ()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (&)()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (&)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R>
|
||||
struct __weak_result_type<_R (*)()>
|
||||
template <class _Rp>
|
||||
struct __weak_result_type<_Rp (*)()>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// 1 argument case
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (&)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (&)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1>
|
||||
struct __weak_result_type<_R (*)(_A1)>
|
||||
: public unary_function<_A1, _R>
|
||||
template <class _Rp, class _A1>
|
||||
struct __weak_result_type<_Rp (*)(_A1)>
|
||||
: public unary_function<_A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)()>
|
||||
: public unary_function<_C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)()>
|
||||
: public unary_function<_Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const>
|
||||
: public unary_function<const _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const>
|
||||
: public unary_function<const _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() volatile>
|
||||
: public unary_function<volatile _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() volatile>
|
||||
: public unary_function<volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C>
|
||||
struct __weak_result_type<_R (_C::*)() const volatile>
|
||||
: public unary_function<const volatile _C*, _R>
|
||||
template <class _Rp, class _Cp>
|
||||
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
|
||||
: public unary_function<const volatile _Cp*, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 2 argument case
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _R>
|
||||
template <class _Rp, class _A1, class _A2>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2)>
|
||||
: public binary_function<_A1, _A2, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1)>
|
||||
: public binary_function<_C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
|
||||
: public binary_function<_Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const>
|
||||
: public binary_function<const _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
|
||||
: public binary_function<const _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) volatile>
|
||||
: public binary_function<volatile _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
|
||||
: public binary_function<volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1>
|
||||
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _C*, _A1, _R>
|
||||
template <class _Rp, class _Cp, class _A1>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
||||
: public binary_function<const volatile _Cp*, _A1, _Rp>
|
||||
{
|
||||
};
|
||||
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
template <class _R, class _C, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
|
||||
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
|
||||
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
{
|
||||
typedef _R result_type;
|
||||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
// __invoke
|
||||
|
||||
// bullets 1 and 2
|
||||
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
template <class _Fp, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _F, class _A0, class ..._Args>
|
||||
template <class _Fp, class _A0, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
|
||||
@@ -303,19 +312,19 @@ __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
|
||||
|
||||
// bullets 3 and 4
|
||||
|
||||
template <class _F, class _A0>
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
|
||||
{
|
||||
return _VSTD::forward<_A0>(__a0).*__f;
|
||||
}
|
||||
|
||||
template <class _F, class _A0>
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _A0&& __a0)
|
||||
__invoke(_Fp&& __f, _A0&& __a0)
|
||||
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
|
||||
{
|
||||
return (*_VSTD::forward<_A0>(__a0)).*__f;
|
||||
@@ -323,13 +332,13 @@ __invoke(_F&& __f, _A0&& __a0)
|
||||
|
||||
// bullet 5
|
||||
|
||||
template <class _F, class ..._Args>
|
||||
template <class _Fp, class ..._Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
__invoke(_F&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
__invoke(_Fp&& __f, _Args&& ...__args)
|
||||
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
|
||||
{
|
||||
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
@@ -409,13 +418,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
|
||||
#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;
|
||||
template <class _Tp> void ref(const _Tp&&) = delete;
|
||||
template <class _Tp> void cref(const _Tp&&) = 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;
|
||||
template <class _Tp> void ref(const _Tp&&);// = delete;
|
||||
template <class _Tp> void cref(const _Tp&&);// = delete;
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,11 @@
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -54,10 +58,31 @@ struct __hash_node
|
||||
value_type __value_;
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__is_power2(size_t __bc)
|
||||
{
|
||||
return __bc > 2 && !(__bc & (__bc - 1));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__constrain_hash(size_t __h, size_t __bc)
|
||||
{
|
||||
return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__next_pow2(size_t __n)
|
||||
{
|
||||
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
|
||||
template <class _ConstNodePtr> class __hash_const_iterator;
|
||||
template <class _HashIterator> class __hash_map_iterator;
|
||||
template <class _HashIterator> class __hash_map_const_iterator;
|
||||
template <class _ConstNodePtr> class _LIBCPP_VISIBLE __hash_const_iterator;
|
||||
template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_iterator;
|
||||
template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_const_iterator;
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
class _LIBCPP_VISIBLE unordered_map;
|
||||
|
||||
@@ -236,7 +261,7 @@ public:
|
||||
__hash_local_iterator& operator++()
|
||||
{
|
||||
__node_ = __node_->__next_;
|
||||
if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
|
||||
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
|
||||
__node_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
@@ -326,7 +351,7 @@ public:
|
||||
__hash_const_local_iterator& operator++()
|
||||
{
|
||||
__node_ = __node_->__next_;
|
||||
if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
|
||||
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
|
||||
__node_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
@@ -471,7 +496,6 @@ public:
|
||||
public:
|
||||
// Create __node
|
||||
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
|
||||
typedef typename __node::__first_node __first_node;
|
||||
typedef typename __alloc_traits::template
|
||||
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
|
||||
rebind_alloc<__node>
|
||||
@@ -482,6 +506,7 @@ 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 __hash_node_base<__node_pointer> __first_node;
|
||||
|
||||
private:
|
||||
|
||||
@@ -600,15 +625,15 @@ public:
|
||||
pair<iterator, bool> __insert_unique(const value_type& __x);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P>
|
||||
pair<iterator, bool> __insert_unique(_P&& __x);
|
||||
template <class _Pp>
|
||||
pair<iterator, bool> __insert_unique(_Pp&& __x);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _P>
|
||||
iterator __insert_multi(_P&& __x);
|
||||
template <class _P>
|
||||
iterator __insert_multi(const_iterator __p, _P&& __x);
|
||||
template <class _Pp>
|
||||
iterator __insert_multi(_Pp&& __x);
|
||||
template <class _Pp>
|
||||
iterator __insert_multi(const_iterator __p, _Pp&& __x);
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
iterator __insert_multi(const value_type& __x);
|
||||
iterator __insert_multi(const_iterator __p, const value_type& __x);
|
||||
@@ -633,15 +658,15 @@ public:
|
||||
template <class _Key>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket(const _Key& __k) const
|
||||
{return hash_function()(__k) % bucket_count();}
|
||||
{return __constrain_hash(hash_function()(__k), bucket_count());}
|
||||
|
||||
template <class _Key>
|
||||
iterator find(const _Key& __x);
|
||||
template <class _Key>
|
||||
const_iterator find(const _Key& __x) const;
|
||||
|
||||
typedef __hash_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __hash_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
|
||||
iterator erase(const_iterator __p);
|
||||
iterator erase(const_iterator __first, const_iterator __last);
|
||||
@@ -719,7 +744,7 @@ private:
|
||||
__node_traits::propagate_on_container_copy_assignment::value>());}
|
||||
void __copy_assign_alloc(const __hash_table& __u, true_type);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
|
||||
void __copy_assign_alloc(const __hash_table&, false_type) {}
|
||||
|
||||
void __move_assign(__hash_table& __u, false_type);
|
||||
void __move_assign(__hash_table& __u, true_type)
|
||||
@@ -748,37 +773,37 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
|
||||
template <class _A>
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y)
|
||||
__swap_alloc(_Ap& __x, _Ap& __y)
|
||||
_NOEXCEPT_(
|
||||
!allocator_traits<_A>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<_A>::value)
|
||||
!allocator_traits<_Ap>::propagate_on_container_swap::value ||
|
||||
__is_nothrow_swappable<_Ap>::value)
|
||||
{
|
||||
__swap_alloc(__x, __y,
|
||||
integral_constant<bool,
|
||||
allocator_traits<_A>::propagate_on_container_swap::value
|
||||
allocator_traits<_Ap>::propagate_on_container_swap::value
|
||||
>());
|
||||
}
|
||||
|
||||
template <class _A>
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_A>::value)
|
||||
__swap_alloc(_Ap& __x, _Ap& __y, true_type)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Ap>::value)
|
||||
{
|
||||
using _VSTD::swap;
|
||||
swap(__x, __y);
|
||||
}
|
||||
|
||||
template <class _A>
|
||||
template <class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static
|
||||
void
|
||||
__swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {}
|
||||
__swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
|
||||
|
||||
void __deallocate(__node_pointer __np) _NOEXCEPT;
|
||||
__node_pointer __detach() _NOEXCEPT;
|
||||
@@ -867,7 +892,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
|
||||
{
|
||||
if (size() > 0)
|
||||
{
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
@@ -891,7 +916,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
{
|
||||
__p1_.first().__next_ = __u.__p1_.first().__next_;
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
size() = __u.size();
|
||||
__u.size() = 0;
|
||||
@@ -988,7 +1013,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__p1_.first().__next_ = __u.__p1_.first().__next_;
|
||||
if (size() > 0)
|
||||
{
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
@@ -1186,12 +1211,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
size_t __chash;
|
||||
if (__bc != 0)
|
||||
{
|
||||
__chash = __nd->__hash_ % __bc;
|
||||
__chash = __constrain_hash(__nd->__hash_, __bc);
|
||||
__ndptr = __bucket_list_[__chash];
|
||||
if (__ndptr != nullptr)
|
||||
{
|
||||
for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
|
||||
__ndptr->__hash_ % __bc == __chash;
|
||||
__constrain_hash(__ndptr->__hash_, __bc) == __chash;
|
||||
__ndptr = __ndptr->__next_)
|
||||
{
|
||||
if (key_eq()(__ndptr->__value_, __nd->__value_))
|
||||
@@ -1202,10 +1227,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
{
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __nd->__hash_ % __bc;
|
||||
__chash = __constrain_hash(__nd->__hash_, __bc);
|
||||
}
|
||||
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
@@ -1217,7 +1242,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
// fix up __bucket_list_
|
||||
__bucket_list_[__chash] = __pn;
|
||||
if (__nd->__next_ != nullptr)
|
||||
__bucket_list_[__nd->__next_->__hash_ % __bc] = __nd;
|
||||
__bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1241,11 +1266,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
size_t __chash = __cp->__hash_ % __bc;
|
||||
size_t __chash = __constrain_hash(__cp->__hash_, __bc);
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
if (__pn == nullptr)
|
||||
{
|
||||
@@ -1255,12 +1280,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
// fix up __bucket_list_
|
||||
__bucket_list_[__chash] = __pn;
|
||||
if (__cp->__next_ != nullptr)
|
||||
__bucket_list_[__cp->__next_->__hash_ % __bc] = __cp;
|
||||
__bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (bool __found = false; __pn->__next_ != nullptr &&
|
||||
__pn->__next_->__hash_ % __bc == __chash;
|
||||
__constrain_hash(__pn->__next_->__hash_, __bc) == __chash;
|
||||
__pn = __pn->__next_)
|
||||
{
|
||||
// __found key_eq() action
|
||||
@@ -1281,7 +1306,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
__pn->__next_ = __cp;
|
||||
if (__cp->__next_ != nullptr)
|
||||
{
|
||||
size_t __nhash = __cp->__next_->__hash_ % __bc;
|
||||
size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc);
|
||||
if (__nhash != __chash)
|
||||
__bucket_list_[__nhash] = __cp;
|
||||
}
|
||||
@@ -1302,11 +1327,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
size_type __bc = bucket_count();
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
}
|
||||
size_t __chash = __cp->__hash_ % __bc;
|
||||
size_t __chash = __constrain_hash(__cp->__hash_, __bc);
|
||||
__node_pointer __pp = __bucket_list_[__chash];
|
||||
while (__pp->__next_ != __np)
|
||||
__pp = __pp->__next_;
|
||||
@@ -1329,12 +1354,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
size_t __chash;
|
||||
if (__bc != 0)
|
||||
{
|
||||
__chash = __hash % __bc;
|
||||
__chash = __constrain_hash(__hash, __bc);
|
||||
__nd = __bucket_list_[__chash];
|
||||
if (__nd != nullptr)
|
||||
{
|
||||
for (__nd = __nd->__next_; __nd != nullptr &&
|
||||
__nd->__hash_ % __bc == __chash;
|
||||
__constrain_hash(__nd->__hash_, __bc) == __chash;
|
||||
__nd = __nd->__next_)
|
||||
{
|
||||
if (key_eq()(__nd->__value_, __x))
|
||||
@@ -1346,10 +1371,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
__node_holder __h = __construct_node(__x, __hash);
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + 1,
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
|
||||
size_type(ceil(float(size() + 1) / max_load_factor()))));
|
||||
__bc = bucket_count();
|
||||
__chash = __hash % __bc;
|
||||
__chash = __constrain_hash(__hash, __bc);
|
||||
}
|
||||
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
@@ -1361,7 +1386,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
|
||||
// fix up __bucket_list_
|
||||
__bucket_list_[__chash] = __pn;
|
||||
if (__h->__next_ != nullptr)
|
||||
__bucket_list_[__h->__next_->__hash_ % __bc] = __h.get();
|
||||
__bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1418,11 +1443,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _P>
|
||||
template <class _Pp>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1434,23 +1459,23 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _P>
|
||||
template <class _Pp>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
|
||||
iterator __r = __node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _P>
|
||||
template <class _Pp>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
|
||||
_P&& __x)
|
||||
_Pp&& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
@@ -1485,16 +1510,20 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
|
||||
{
|
||||
__n = __next_prime(_VSTD::max<size_type>(__n, size() > 0));
|
||||
if (__n == 1)
|
||||
__n = 2;
|
||||
else if (__n & (__n - 1))
|
||||
__n = __next_prime(__n);
|
||||
size_type __bc = bucket_count();
|
||||
if (__n > __bc)
|
||||
__rehash(__n);
|
||||
else
|
||||
else if (__n < __bc)
|
||||
{
|
||||
__n = _VSTD::max<size_type>
|
||||
(
|
||||
__n,
|
||||
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
|
||||
__is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
|
||||
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
|
||||
);
|
||||
if (__n < __bc)
|
||||
__rehash(__n);
|
||||
@@ -1517,13 +1546,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
|
||||
__node_pointer __cp = __pp->__next_;
|
||||
if (__cp != nullptr)
|
||||
{
|
||||
size_type __chash = __cp->__hash_ % __nbc;
|
||||
size_type __chash = __constrain_hash(__cp->__hash_, __nbc);
|
||||
__bucket_list_[__chash] = __pp;
|
||||
size_type __phash = __chash;
|
||||
for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
|
||||
__cp = __pp->__next_)
|
||||
{
|
||||
__chash = __cp->__hash_ % __nbc;
|
||||
__chash = __constrain_hash(__cp->__hash_, __nbc);
|
||||
if (__chash == __phash)
|
||||
__pp = __cp;
|
||||
else
|
||||
@@ -1561,12 +1590,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
|
||||
size_type __bc = bucket_count();
|
||||
if (__bc != 0)
|
||||
{
|
||||
size_t __chash = __hash % __bc;
|
||||
size_t __chash = __constrain_hash(__hash, __bc);
|
||||
__node_pointer __nd = __bucket_list_[__chash];
|
||||
if (__nd != nullptr)
|
||||
{
|
||||
for (__nd = __nd->__next_; __nd != nullptr &&
|
||||
__nd->__hash_ % __bc == __chash;
|
||||
__constrain_hash(__nd->__hash_, __bc) == __chash;
|
||||
__nd = __nd->__next_)
|
||||
{
|
||||
if (key_eq()(__nd->__value_, __k))
|
||||
@@ -1586,12 +1615,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
size_type __bc = bucket_count();
|
||||
if (__bc != 0)
|
||||
{
|
||||
size_t __chash = __hash % __bc;
|
||||
size_t __chash = __constrain_hash(__hash, __bc);
|
||||
__node_const_pointer __nd = __bucket_list_[__chash];
|
||||
if (__nd != nullptr)
|
||||
{
|
||||
for (__nd = __nd->__next_; __nd != nullptr &&
|
||||
__nd->__hash_ % __bc == __chash;
|
||||
__constrain_hash(__nd->__hash_, __bc) == __chash;
|
||||
__nd = __nd->__next_)
|
||||
{
|
||||
if (key_eq()(__nd->__value_, __k))
|
||||
@@ -1612,7 +1641,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
@@ -1628,7 +1657,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
|
||||
size_t __hash)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
@@ -1643,7 +1672,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
@@ -1659,7 +1688,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
|
||||
size_t __hash)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
@@ -1730,7 +1759,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
// current node
|
||||
__node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
|
||||
size_type __bc = bucket_count();
|
||||
size_t __chash = __cn->__hash_ % __bc;
|
||||
size_t __chash = __constrain_hash(__cn->__hash_, __bc);
|
||||
// find previous node
|
||||
__node_pointer __pn = __bucket_list_[__chash];
|
||||
for (; __pn->__next_ != __cn; __pn = __pn->__next_)
|
||||
@@ -1738,15 +1767,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
// Fix up __bucket_list_
|
||||
// if __pn is not in same bucket (before begin is not in same bucket) &&
|
||||
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
|
||||
if (__pn == _VSTD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
|
||||
if (__pn == _VSTD::addressof(__p1_.first()) || __constrain_hash(__pn->__hash_, __bc) != __chash)
|
||||
{
|
||||
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
|
||||
if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash)
|
||||
__bucket_list_[__chash] = nullptr;
|
||||
}
|
||||
// if __cn->__next_ is not in same bucket (nullptr is in same bucket)
|
||||
if (__cn->__next_ != nullptr)
|
||||
{
|
||||
size_t __nhash = __cn->__next_->__hash_ % __bc;
|
||||
size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc);
|
||||
if (__nhash != __chash)
|
||||
__bucket_list_[__nhash] = __pn;
|
||||
}
|
||||
@@ -1754,7 +1783,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
return __node_holder(__cn, _D(__node_alloc(), true));
|
||||
return __node_holder(__cn, _Dp(__node_alloc(), true));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
@@ -1877,10 +1906,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
__p2_.swap(__u.__p2_);
|
||||
__p3_.swap(__u.__p3_);
|
||||
if (size() > 0)
|
||||
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
|
||||
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
|
||||
if (__u.size() > 0)
|
||||
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
|
||||
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] =
|
||||
static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first()));
|
||||
}
|
||||
|
||||
@@ -1894,7 +1923,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
|
||||
if (__np != nullptr)
|
||||
{
|
||||
for (__np = __np->__next_; __np != nullptr &&
|
||||
__np->__hash_ % __bc == __n;
|
||||
__constrain_hash(__np->__hash_, __bc) == __n;
|
||||
__np = __np->__next_, ++__r)
|
||||
;
|
||||
}
|
||||
|
@@ -21,25 +21,34 @@
|
||||
#include <locale.h>
|
||||
#if _WIN32
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
|
||||
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__)
|
||||
# include <xlocale.h>
|
||||
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class locale;
|
||||
class _LIBCPP_VISIBLE locale;
|
||||
|
||||
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
|
||||
template <class _Facet> const _Facet& use_facet(const locale&);
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
has_facet(const locale&) _NOEXCEPT;
|
||||
|
||||
template <class _Facet>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Facet&
|
||||
use_facet(const locale&);
|
||||
|
||||
class _LIBCPP_VISIBLE locale
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
class facet;
|
||||
class id;
|
||||
class _LIBCPP_VISIBLE facet;
|
||||
class _LIBCPP_VISIBLE id;
|
||||
|
||||
typedef int category;
|
||||
static const category // values assigned here are for exposition only
|
||||
@@ -117,7 +126,7 @@ class _LIBCPP_VISIBLE locale::id
|
||||
|
||||
static int32_t __next_id;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY id() {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
|
||||
private:
|
||||
void __init();
|
||||
void operator=(const id&); // = delete;
|
||||
@@ -238,15 +247,15 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
||||
const size_t __mask = size_t(0xF) << (__sr + 4);
|
||||
for(const char_type* __p = __lo; __p != __hi; ++__p)
|
||||
{
|
||||
__h = (__h << 4) + *__p;
|
||||
__h = (__h << 4) + static_cast<size_t>(*__p);
|
||||
size_t __g = __h & __mask;
|
||||
__h ^= __g | (__g >> __sr);
|
||||
}
|
||||
return static_cast<long>(__h);
|
||||
}
|
||||
|
||||
extern template class _LIBCPP_VISIBLE collate<char>;
|
||||
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<wchar_t>)
|
||||
|
||||
// template <class CharT> class collate_byname;
|
||||
|
||||
@@ -346,7 +355,19 @@ public:
|
||||
static const mask punct = _CTYPE_P;
|
||||
static const mask xdigit = _CTYPE_X;
|
||||
static const mask blank = _CTYPE_B;
|
||||
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
|
||||
#elif __sun__
|
||||
typedef unsigned int mask;
|
||||
static const mask space = _ISSPACE;
|
||||
static const mask print = _ISPRINT;
|
||||
static const mask cntrl = _ISCNTRL;
|
||||
static const mask upper = _ISUPPER;
|
||||
static const mask lower = _ISLOWER;
|
||||
static const mask alpha = _ISALPHA;
|
||||
static const mask digit = _ISDIGIT;
|
||||
static const mask punct = _ISPUNCT;
|
||||
static const mask xdigit = _ISXDIGIT;
|
||||
static const mask blank = _ISBLANK;
|
||||
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __sun__
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
@@ -483,14 +504,14 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool is(mask __m, char_type __c) const
|
||||
{
|
||||
return isascii(__c) ? __tab_[__c] & __m : false;
|
||||
return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
|
||||
{
|
||||
for (; __low != __high; ++__low, ++__vec)
|
||||
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
|
||||
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
|
||||
return __low;
|
||||
}
|
||||
|
||||
@@ -498,7 +519,7 @@ public:
|
||||
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
if (isascii(*__low) && (__tab_[*__low] & __m))
|
||||
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
|
||||
break;
|
||||
return __low;
|
||||
}
|
||||
@@ -507,7 +528,7 @@ public:
|
||||
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
|
||||
{
|
||||
for (; __low != __high; ++__low)
|
||||
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
|
||||
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
|
||||
break;
|
||||
return __low;
|
||||
}
|
||||
@@ -1114,14 +1135,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
||||
{
|
||||
}
|
||||
|
||||
extern template class codecvt_byname<char, char, mbstate_t>;
|
||||
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>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>)
|
||||
|
||||
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
|
||||
|
||||
template <size_t _N>
|
||||
template <size_t _Np>
|
||||
struct __narrow_to_utf8
|
||||
{
|
||||
template <class _OutputIterator, class _CharT>
|
||||
@@ -1211,7 +1232,7 @@ struct __narrow_to_utf8<32>
|
||||
}
|
||||
};
|
||||
|
||||
template <size_t _N>
|
||||
template <size_t _Np>
|
||||
struct __widen_from_utf8
|
||||
{
|
||||
template <class _OutputIterator>
|
||||
|
@@ -16,7 +16,9 @@
|
||||
#include <system_error>
|
||||
#include <pthread.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_SHARED_LOCK
|
||||
|
||||
@@ -36,7 +38,11 @@ class _LIBCPP_VISIBLE mutex
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
|
||||
#else
|
||||
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
|
||||
#endif
|
||||
~mutex();
|
||||
|
||||
private:
|
||||
@@ -45,8 +51,8 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
@@ -56,17 +62,19 @@ struct _LIBCPP_VISIBLE defer_lock_t {};
|
||||
struct _LIBCPP_VISIBLE try_to_lock_t {};
|
||||
struct _LIBCPP_VISIBLE adopt_lock_t {};
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
defer_lock_t defer_lock;
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
try_to_lock_t try_to_lock;
|
||||
extern const defer_lock_t defer_lock;
|
||||
extern const try_to_lock_t try_to_lock;
|
||||
extern const adopt_lock_t adopt_lock;
|
||||
|
||||
//constexpr
|
||||
extern const
|
||||
adopt_lock_t adopt_lock;
|
||||
#else
|
||||
|
||||
constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
|
||||
#endif
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_VISIBLE lock_guard
|
||||
@@ -104,12 +112,12 @@ private:
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock() : __m_(nullptr), __owns_(false) {}
|
||||
unique_lock() _NOEXCEPT : __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)
|
||||
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
|
||||
: __m_(&__m), __owns_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(mutex_type& __m, try_to_lock_t)
|
||||
@@ -139,11 +147,11 @@ private:
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u)
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
{__u.__m_ = nullptr; __u.__owns_ = false;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock& operator=(unique_lock&& __u)
|
||||
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
|
||||
{
|
||||
if (__owns_)
|
||||
__m_->unlock();
|
||||
@@ -188,13 +196,13 @@ public:
|
||||
void unlock();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(unique_lock& __u)
|
||||
void swap(unique_lock& __u) _NOEXCEPT
|
||||
{
|
||||
_VSTD::swap(__m_, __u.__m_);
|
||||
_VSTD::swap(__owns_, __u.__owns_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* release()
|
||||
mutex_type* release() _NOEXCEPT
|
||||
{
|
||||
mutex_type* __m = __m_;
|
||||
__m_ = nullptr;
|
||||
@@ -203,12 +211,12 @@ public:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool owns_lock() const {return __owns_;}
|
||||
bool owns_lock() const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
operator bool () const {return __owns_;}
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool () const _NOEXCEPT {return __owns_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
mutex_type* mutex() const {return __m_;}
|
||||
mutex_type* mutex() const _NOEXCEPT {return __m_;}
|
||||
};
|
||||
|
||||
template <class _Mutex>
|
||||
@@ -274,18 +282,19 @@ unique_lock<_Mutex>::unlock()
|
||||
template <class _Mutex>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
|
||||
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
|
||||
{__x.swap(__y);}
|
||||
|
||||
struct _LIBCPP_VISIBLE cv_status
|
||||
{
|
||||
enum _ {
|
||||
enum __lx {
|
||||
no_timeout,
|
||||
timeout
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
__lx __v_;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
@@ -295,7 +304,11 @@ class _LIBCPP_VISIBLE condition_variable
|
||||
pthread_cond_t __cv_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
|
||||
#else
|
||||
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
|
||||
#endif
|
||||
~condition_variable();
|
||||
|
||||
private:
|
||||
@@ -303,18 +316,13 @@ private:
|
||||
condition_variable& operator=(const condition_variable&); // = delete;
|
||||
|
||||
public:
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
void wait(unique_lock<mutex>& __lk);
|
||||
template <class _Predicate>
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
@@ -369,28 +377,13 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
|
||||
wait(__lk);
|
||||
}
|
||||
|
||||
template <class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<chrono::system_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
|
||||
__do_timed_wait(__lk,
|
||||
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
|
||||
return system_clock::now() < __t ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
cv_status
|
||||
condition_variable::wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
typename _Clock::time_point __c_now = _Clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
|
||||
wait_for(__lk, __t - _Clock::now());
|
||||
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
|
||||
}
|
||||
|
||||
@@ -414,9 +407,17 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (__d <= __d.zero())
|
||||
return cv_status::timeout;
|
||||
typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
|
||||
typedef time_point<system_clock, nanoseconds> __sys_tpi;
|
||||
__sys_tpf _Max = __sys_tpi::max();
|
||||
system_clock::time_point __s_now = system_clock::now();
|
||||
steady_clock::time_point __c_now = steady_clock::now();
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
if (_Max - __d > __s_now)
|
||||
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
|
||||
else
|
||||
__do_timed_wait(__lk, __sys_tpi::max());
|
||||
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
|
||||
cv_status::timeout;
|
||||
}
|
||||
|
@@ -6,7 +6,11 @@
|
||||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -91,7 +95,7 @@ public:
|
||||
void reserve(size_type __n);
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
void push_back(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
@@ -129,8 +133,10 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last) _NOEXCEPT
|
||||
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
|
||||
{__destruct_at_end(__new_last, false_type());}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
|
||||
|
||||
void swap(__split_buffer& __x)
|
||||
@@ -148,7 +154,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
|
||||
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -167,7 +173,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
|
||||
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -283,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ < __new_begin)
|
||||
while (__begin_ != __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __begin_++);
|
||||
}
|
||||
|
||||
@@ -300,7 +306,7 @@ _LIBCPP_INLINE_VISIBILITY inline
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last < __end_)
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), --__end_);
|
||||
}
|
||||
|
||||
@@ -388,8 +394,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
|
||||
__first_ = __alloc_traits::allocate(__alloc(), __cap);
|
||||
__begin_ = __end_ = __first_;
|
||||
__end_cap() = __first_ + __cap;
|
||||
typedef move_iterator<iterator> _I;
|
||||
__construct_at_end(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
@@ -517,7 +523,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
@@ -550,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
@@ -581,7 +587,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
@@ -614,7 +620,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
}
|
||||
else
|
||||
{
|
||||
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
|
||||
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
|
||||
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
|
||||
__t.__construct_at_end(move_iterator<pointer>(__begin_),
|
||||
move_iterator<pointer>(__end_));
|
||||
|
@@ -15,24 +15,26 @@
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
|
||||
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
|
||||
|
||||
template <size_t _N>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _N>
|
||||
template <size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
|
||||
{
|
||||
public:
|
||||
typedef const void* const_pointer;
|
||||
typedef void value_type;
|
||||
};
|
||||
|
||||
template <class _Tp, size_t _N>
|
||||
template <class _Tp, size_t _Np>
|
||||
class _LIBCPP_HIDDEN __sso_allocator
|
||||
{
|
||||
typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
|
||||
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
|
||||
bool __allocated_;
|
||||
public:
|
||||
typedef size_t size_type;
|
||||
@@ -41,14 +43,14 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
|
||||
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
|
||||
: __allocated_(false) {}
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _N>::const_pointer = 0)
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||
{
|
||||
if (!__allocated_ && __n <= _N)
|
||||
if (!__allocated_ && __n <= _Np)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
|
@@ -17,11 +17,15 @@
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const unsigned __limit = 8;
|
||||
static const int __limit = 8;
|
||||
|
||||
// __stdinbuf
|
||||
|
||||
@@ -100,7 +104,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
int __nread = _VSTD::max(1, __encoding_);
|
||||
for (int __i = 0; __i < __nread; ++__i)
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__i] = static_cast<char>(__c);
|
||||
@@ -127,7 +131,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
|
||||
if (__nread == sizeof(__extbuf))
|
||||
return traits_type::eof();
|
||||
{
|
||||
char __c = getc(__file_);
|
||||
int __c = getc(__file_);
|
||||
if (__c == EOF)
|
||||
return traits_type::eof();
|
||||
__extbuf[__nread] = static_cast<char>(__c);
|
||||
@@ -264,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
this->setp((char_type*)__e, this->pptr());
|
||||
this->pbump(this->epptr() - this->pbase());
|
||||
this->pbump(static_cast<int>(this->epptr() - this->pbase()));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -17,7 +17,9 @@
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -612,8 +614,8 @@ public:
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
};
|
||||
|
||||
template <class _TreeIterator> class __map_iterator;
|
||||
template <class _TreeIterator> class __map_const_iterator;
|
||||
template <class _TreeIterator> class _LIBCPP_VISIBLE __map_iterator;
|
||||
template <class _TreeIterator> class _LIBCPP_VISIBLE __map_const_iterator;
|
||||
|
||||
template <class _Tp, class _NodePtr, class _DiffType>
|
||||
class _LIBCPP_VISIBLE __tree_iterator
|
||||
@@ -930,14 +932,14 @@ public:
|
||||
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _V>
|
||||
pair<iterator, bool> __insert_unique(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_unique(const_iterator __p, _V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(_V&& __v);
|
||||
template <class _V>
|
||||
iterator __insert_multi(const_iterator __p, _V&& __v);
|
||||
template <class _Vp>
|
||||
pair<iterator, bool> __insert_unique(_Vp&& __v);
|
||||
template <class _Vp>
|
||||
iterator __insert_unique(const_iterator __p, _Vp&& __v);
|
||||
template <class _Vp>
|
||||
iterator __insert_multi(_Vp&& __v);
|
||||
template <class _Vp>
|
||||
iterator __insert_multi(const_iterator __p, _Vp&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
pair<iterator, bool> __insert_unique(const value_type& __v);
|
||||
@@ -1019,8 +1021,8 @@ public:
|
||||
pair<const_iterator, const_iterator>
|
||||
__equal_range_multi(const _Key& __k) const;
|
||||
|
||||
typedef __tree_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __tree_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
|
||||
__node_holder remove(const_iterator __p) _NOEXCEPT;
|
||||
private:
|
||||
@@ -1709,7 +1711,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return __h;
|
||||
@@ -1779,11 +1781,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _V>
|
||||
template <class _Vp>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||
pair<iterator, bool> __r = __node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1791,11 +1793,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _V>
|
||||
template <class _Vp>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||
iterator __r = __node_insert_unique(__p, __h.get());
|
||||
if (__r.__ptr_ == __h.get())
|
||||
__h.release();
|
||||
@@ -1803,11 +1805,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _V>
|
||||
template <class _Vp>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1815,11 +1817,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _V>
|
||||
template <class _Vp>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
|
||||
__node_base_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
|
||||
__insert_node_at(__parent, __child, __h.get());
|
||||
@@ -1833,7 +1835,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
__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_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return _VSTD::move(__h);
|
||||
@@ -2051,7 +2053,7 @@ template <class _Key>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::size_type
|
||||
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> _P;
|
||||
typedef pair<const_iterator, const_iterator> _Pp;
|
||||
__node_const_pointer __result = __end_node();
|
||||
__node_const_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@@ -2158,7 +2160,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
||||
{
|
||||
typedef pair<iterator, iterator> _P;
|
||||
typedef pair<iterator, iterator> _Pp;
|
||||
__node_pointer __result = __end_node();
|
||||
__node_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@@ -2171,13 +2173,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
|
||||
else if (value_comp()(__rt->__value_, __k))
|
||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||
else
|
||||
return _P(iterator(__rt),
|
||||
return _Pp(iterator(__rt),
|
||||
iterator(
|
||||
__rt->__right_ != nullptr ?
|
||||
static_cast<__node_pointer>(__tree_min(__rt->__right_))
|
||||
: __result));
|
||||
}
|
||||
return _P(iterator(__result), iterator(__result));
|
||||
return _Pp(iterator(__result), iterator(__result));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -2186,7 +2188,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> _P;
|
||||
typedef pair<const_iterator, const_iterator> _Pp;
|
||||
__node_const_pointer __result = __end_node();
|
||||
__node_const_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@@ -2199,13 +2201,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
|
||||
else if (value_comp()(__rt->__value_, __k))
|
||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||
else
|
||||
return _P(const_iterator(__rt),
|
||||
return _Pp(const_iterator(__rt),
|
||||
const_iterator(
|
||||
__rt->__right_ != nullptr ?
|
||||
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
|
||||
: __result));
|
||||
}
|
||||
return _P(const_iterator(__result), const_iterator(__result));
|
||||
return _Pp(const_iterator(__result), const_iterator(__result));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -2214,7 +2216,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
||||
{
|
||||
typedef pair<iterator, iterator> _P;
|
||||
typedef pair<iterator, iterator> _Pp;
|
||||
__node_pointer __result = __end_node();
|
||||
__node_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@@ -2227,10 +2229,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
|
||||
else if (value_comp()(__rt->__value_, __k))
|
||||
__rt = static_cast<__node_pointer>(__rt->__right_);
|
||||
else
|
||||
return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
||||
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
|
||||
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
|
||||
}
|
||||
return _P(iterator(__result), iterator(__result));
|
||||
return _Pp(iterator(__result), iterator(__result));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -2239,7 +2241,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
|
||||
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
||||
{
|
||||
typedef pair<const_iterator, const_iterator> _P;
|
||||
typedef pair<const_iterator, const_iterator> _Pp;
|
||||
__node_const_pointer __result = __end_node();
|
||||
__node_const_pointer __rt = __root();
|
||||
while (__rt != nullptr)
|
||||
@@ -2252,10 +2254,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
|
||||
else if (value_comp()(__rt->__value_, __k))
|
||||
__rt = static_cast<__node_const_pointer>(__rt->__right_);
|
||||
else
|
||||
return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
||||
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
|
||||
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
|
||||
}
|
||||
return _P(const_iterator(__result), const_iterator(__result));
|
||||
return _Pp(const_iterator(__result), const_iterator(__result));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
@@ -2273,7 +2275,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
|
||||
--size();
|
||||
__tree_remove(__end_node()->__left_,
|
||||
static_cast<__node_base_pointer>(__np));
|
||||
return __node_holder(__np, _D(__node_alloc()));
|
||||
return __node_holder(__np, _Dp(__node_alloc()));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
|
@@ -15,7 +15,9 @@
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
@@ -63,7 +65,7 @@ public:
|
||||
};
|
||||
|
||||
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
|
||||
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
|
||||
template <class _T1, class _T2> struct _LIBCPP_VISIBLE pair;
|
||||
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
|
||||
|
||||
template <class _Tp> struct __tuple_like : false_type {};
|
||||
@@ -77,38 +79,47 @@ template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type
|
||||
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
get(pair<_T1, _T2>&&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp&
|
||||
get(array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp&&
|
||||
get(array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
|
||||
@@ -214,7 +225,7 @@ 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...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
is_convertible<_Tp0, _Up0>::value &&
|
||||
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
@@ -233,6 +244,33 @@ struct __tuple_convertible<_Tp, _Up, true, true>
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_constructible
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
struct __tuple_constructible_imp : public false_type {};
|
||||
|
||||
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
|
||||
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
|
||||
: public integral_constant<bool,
|
||||
is_constructible<_Up0, _Tp0>::value &&
|
||||
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
|
||||
|
||||
template <>
|
||||
struct __tuple_constructible_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_constructible
|
||||
: public false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __tuple_constructible<_Tp, _Up, true, true>
|
||||
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
|
||||
tuple_size<_Up>::value,
|
||||
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
|
||||
{};
|
||||
|
||||
// __tuple_assignable
|
||||
|
||||
template <bool, class _Tp, class _Up>
|
||||
|
@@ -13,7 +13,9 @@
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
19
include/__undef_min_max
Normal file
19
include/__undef_min_max
Normal file
@@ -0,0 +1,19 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifdef min
|
||||
#warning: macro min is incompatible with C++. #undefing min
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#warning: macro max is incompatible with C++. #undefing max
|
||||
#undef max
|
||||
#endif
|
@@ -593,9 +593,13 @@ template <class BidirectionalIterator, class Compare>
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <iterator>
|
||||
#include <cstdlib>
|
||||
#include <cstddef>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -693,14 +697,48 @@ struct __debug_less
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned long __ctz(unsigned long __x) {return __builtin_ctzl (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned long long __ctz(unsigned long long __x) {return __builtin_ctzll(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned
|
||||
__ctz(unsigned __x)
|
||||
{
|
||||
return static_cast<unsigned>(__builtin_ctz(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long
|
||||
__ctz(unsigned long __x)
|
||||
{
|
||||
return static_cast<unsigned long>(__builtin_ctzl(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long long
|
||||
__ctz(unsigned long long __x)
|
||||
{
|
||||
return static_cast<unsigned long long>(__builtin_ctzll(__x));
|
||||
}
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned __clz(unsigned __x) {return __builtin_clz (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned long __clz(unsigned long __x) {return __builtin_clzl (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY unsigned long long __clz(unsigned long long __x) {return __builtin_clzll(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned
|
||||
__clz(unsigned __x)
|
||||
{
|
||||
return static_cast<unsigned>(__builtin_clz(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long
|
||||
__clz(unsigned long __x)
|
||||
{
|
||||
return static_cast<unsigned long>(__builtin_clzl (__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long long
|
||||
__clz(unsigned long long __x)
|
||||
{
|
||||
return static_cast<unsigned long long>(__builtin_clzll(__x));
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
|
||||
@@ -762,10 +800,10 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
|
||||
template <class _InputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_InputIterator
|
||||
find(_InputIterator __first, _InputIterator __last, const _Tp& __value)
|
||||
find(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
if (*__first == __value)
|
||||
if (*__first == __value_)
|
||||
break;
|
||||
return __first;
|
||||
}
|
||||
@@ -1002,11 +1040,11 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
|
||||
template <class _InputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename iterator_traits<_InputIterator>::difference_type
|
||||
count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
|
||||
count(_InputIterator __first, _InputIterator __last, const _Tp& __value_)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::difference_type __r(0);
|
||||
for (; __first != __last; ++__first)
|
||||
if (*__first == __value)
|
||||
if (*__first == __value_)
|
||||
++__r;
|
||||
return __r;
|
||||
}
|
||||
@@ -1310,22 +1348,22 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
|
||||
template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp>
|
||||
_ForwardIterator
|
||||
__search_n(_ForwardIterator __first, _ForwardIterator __last,
|
||||
_Size __count, const _Tp& __value, _BinaryPredicate __pred, forward_iterator_tag)
|
||||
_Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag)
|
||||
{
|
||||
if (__count <= 0)
|
||||
return __first;
|
||||
while (true)
|
||||
{
|
||||
// Find first element in sequence that matchs __value, with a mininum of loop checks
|
||||
// Find first element in sequence that matchs __value_, with a mininum of loop checks
|
||||
while (true)
|
||||
{
|
||||
if (__first == __last) // return __last if no element matches __value
|
||||
if (__first == __last) // return __last if no element matches __value_
|
||||
return __last;
|
||||
if (__pred(*__first, __value))
|
||||
if (__pred(*__first, __value_))
|
||||
break;
|
||||
++__first;
|
||||
}
|
||||
// *__first matches __value, now match elements after here
|
||||
// *__first matches __value_, now match elements after here
|
||||
_ForwardIterator __m = __first;
|
||||
_Size __c(0);
|
||||
while (true)
|
||||
@@ -1334,7 +1372,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last,
|
||||
return __first;
|
||||
if (++__m == __last) // Otherwise if source exhaused, pattern not found
|
||||
return __last;
|
||||
if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
|
||||
if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first
|
||||
{
|
||||
__first = __m;
|
||||
++__first;
|
||||
@@ -1347,7 +1385,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last,
|
||||
template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp>
|
||||
_RandomAccessIterator
|
||||
__search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
_Size __count, const _Tp& __value, _BinaryPredicate __pred, random_access_iterator_tag)
|
||||
_Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag)
|
||||
{
|
||||
if (__count <= 0)
|
||||
return __first;
|
||||
@@ -1357,16 +1395,16 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
const _RandomAccessIterator __s = __last - (__count - 1); // Start of pattern match can't go beyond here
|
||||
while (true)
|
||||
{
|
||||
// Find first element in sequence that matchs __value, with a mininum of loop checks
|
||||
// Find first element in sequence that matchs __value_, with a mininum of loop checks
|
||||
while (true)
|
||||
{
|
||||
if (__first == __s) // return __last if no element matches __value
|
||||
if (__first == __s) // return __last if no element matches __value_
|
||||
return __last;
|
||||
if (__pred(*__first, __value))
|
||||
if (__pred(*__first, __value_))
|
||||
break;
|
||||
++__first;
|
||||
}
|
||||
// *__first matches __value, now match elements after here
|
||||
// *__first matches __value_, now match elements after here
|
||||
_RandomAccessIterator __m = __first;
|
||||
_Size __c(0);
|
||||
while (true)
|
||||
@@ -1374,7 +1412,7 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
|
||||
return __first;
|
||||
++__m; // no need to check range on __m because __s guarantees we have enough source
|
||||
if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
|
||||
if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first
|
||||
{
|
||||
__first = __m;
|
||||
++__first;
|
||||
@@ -1388,19 +1426,19 @@ template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
search_n(_ForwardIterator __first, _ForwardIterator __last,
|
||||
_Size __count, const _Tp& __value, _BinaryPredicate __pred)
|
||||
_Size __count, const _Tp& __value_, _BinaryPredicate __pred)
|
||||
{
|
||||
return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
|
||||
(__first, __last, __count, __value, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
(__first, __last, __count, __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value)
|
||||
search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::value_type __v;
|
||||
return _VSTD::search_n(__first, __last, __count, __value, __equal_to<__v, _Tp>());
|
||||
return _VSTD::search_n(__first, __last, __count, __value_, __equal_to<__v, _Tp>());
|
||||
}
|
||||
|
||||
// copy
|
||||
@@ -1742,29 +1780,29 @@ replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator _
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, false_type)
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, false_type)
|
||||
{
|
||||
for (; __n > 0; ++__first, --__n)
|
||||
*__first = __value;
|
||||
*__first = __value_;
|
||||
return __first;
|
||||
}
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, true_type)
|
||||
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, true_type)
|
||||
{
|
||||
if (__n > 0)
|
||||
_VSTD::memset(__first, (unsigned char)__value, (size_t)(__n));
|
||||
_VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n));
|
||||
return __first + __n;
|
||||
}
|
||||
|
||||
template <class _OutputIterator, class _Size, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::__fill_n(__first, __n, __value, integral_constant<bool,
|
||||
return _VSTD::__fill_n(__first, __n, __value_, integral_constant<bool,
|
||||
is_pointer<_OutputIterator>::value &&
|
||||
is_trivially_copy_assignable<_Tp>::value &&
|
||||
sizeof(_Tp) == 1>());
|
||||
@@ -1775,26 +1813,26 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
|
||||
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
*__first = __value;
|
||||
*__first = __value_;
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
|
||||
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag)
|
||||
{
|
||||
_VSTD::fill_n(__first, __last - __first, __value);
|
||||
_VSTD::fill_n(__first, __last - __first, __value_);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
_VSTD::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
_VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category());
|
||||
}
|
||||
|
||||
// generate
|
||||
@@ -1824,15 +1862,15 @@ generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
_ForwardIterator
|
||||
remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
__first = _VSTD::find(__first, __last, __value);
|
||||
__first = _VSTD::find(__first, __last, __value_);
|
||||
if (__first != __last)
|
||||
{
|
||||
_ForwardIterator __i = __first;
|
||||
while (++__i != __last)
|
||||
{
|
||||
if (!(*__i == __value))
|
||||
if (!(*__i == __value_))
|
||||
{
|
||||
*__first = _VSTD::move(*__i);
|
||||
++__first;
|
||||
@@ -1870,11 +1908,11 @@ remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_OutputIterator
|
||||
remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value)
|
||||
remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
{
|
||||
if (!(*__first == __value))
|
||||
if (!(*__first == __value_))
|
||||
{
|
||||
*__result = *__first;
|
||||
++__result;
|
||||
@@ -2065,12 +2103,31 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_ForwardIterator
|
||||
__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, false_type)
|
||||
__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
|
||||
value_type __tmp = _VSTD::move(*__first);
|
||||
_ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
|
||||
*__lm1 = _VSTD::move(__tmp);
|
||||
return __lm1;
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
_BidirectionalIterator
|
||||
__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
|
||||
{
|
||||
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
|
||||
_BidirectionalIterator __lm1 = _VSTD::prev(__last);
|
||||
value_type __tmp = _VSTD::move(*__lm1);
|
||||
_BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
|
||||
*__first = _VSTD::move(__tmp);
|
||||
return __fp1;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
_ForwardIterator
|
||||
__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
|
||||
{
|
||||
if (__first == __middle)
|
||||
return __last;
|
||||
if (__middle == __last)
|
||||
return __first;
|
||||
_ForwardIterator __i = __middle;
|
||||
while (true)
|
||||
{
|
||||
@@ -2118,15 +2175,11 @@ __gcd(_Integral __x, _Integral __y)
|
||||
|
||||
template<typename _RandomAccessIterator>
|
||||
_RandomAccessIterator
|
||||
__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, true_type)
|
||||
__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
|
||||
|
||||
if (__first == __middle)
|
||||
return __last;
|
||||
if (__middle == __last)
|
||||
return __first;
|
||||
const difference_type __m1 = __middle - __first;
|
||||
const difference_type __m2 = __last - __middle;
|
||||
if (__m1 == __m2)
|
||||
@@ -2134,15 +2187,15 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
|
||||
_VSTD::swap_ranges(__first, __middle, __middle);
|
||||
return __middle;
|
||||
}
|
||||
const difference_type __g = __gcd(__m1, __m2);
|
||||
const difference_type __g = _VSTD::__gcd(__m1, __m2);
|
||||
for (_RandomAccessIterator __p = __first + __g; __p != __first;)
|
||||
{
|
||||
value_type __t(*--__p);
|
||||
value_type __t(_VSTD::move(*--__p));
|
||||
_RandomAccessIterator __p1 = __p;
|
||||
_RandomAccessIterator __p2 = __p1 + __m1;
|
||||
do
|
||||
{
|
||||
*__p1 = *__p2;
|
||||
*__p1 = _VSTD::move(*__p2);
|
||||
__p1 = __p2;
|
||||
const difference_type __d = __last - __p2;
|
||||
if (__m1 < __d)
|
||||
@@ -2150,30 +2203,72 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
|
||||
else
|
||||
__p2 = __first + (__m1 - __d);
|
||||
} while (__p2 != __p);
|
||||
*__p1 = __t;
|
||||
*__p1 = _VSTD::move(__t);
|
||||
}
|
||||
return __first + __m2;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
|
||||
_VSTD::forward_iterator_tag)
|
||||
{
|
||||
typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type;
|
||||
if (_VSTD::is_trivially_move_assignable<value_type>::value)
|
||||
{
|
||||
if (_VSTD::next(__first) == __middle)
|
||||
return _VSTD::__rotate_left(__first, __last);
|
||||
}
|
||||
return _VSTD::__rotate_forward(__first, __middle, __last);
|
||||
}
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_BidirectionalIterator
|
||||
__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
|
||||
_VSTD::bidirectional_iterator_tag)
|
||||
{
|
||||
typedef typename _VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type;
|
||||
if (_VSTD::is_trivially_move_assignable<value_type>::value)
|
||||
{
|
||||
if (_VSTD::next(__first) == __middle)
|
||||
return _VSTD::__rotate_left(__first, __last);
|
||||
if (_VSTD::next(__middle) == __last)
|
||||
return _VSTD::__rotate_right(__first, __last);
|
||||
}
|
||||
return _VSTD::__rotate_forward(__first, __middle, __last);
|
||||
}
|
||||
|
||||
template <class _RandomAccessIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_RandomAccessIterator
|
||||
__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
|
||||
_VSTD::random_access_iterator_tag)
|
||||
{
|
||||
typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type;
|
||||
if (_VSTD::is_trivially_move_assignable<value_type>::value)
|
||||
{
|
||||
if (_VSTD::next(__first) == __middle)
|
||||
return _VSTD::__rotate_left(__first, __last);
|
||||
if (_VSTD::next(__middle) == __last)
|
||||
return _VSTD::__rotate_right(__first, __last);
|
||||
return _VSTD::__rotate_gcd(__first, __middle, __last);
|
||||
}
|
||||
return _VSTD::__rotate_forward(__first, __middle, __last);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
|
||||
{
|
||||
if (__first == __middle)
|
||||
return __last;
|
||||
if (__middle == __last)
|
||||
return __first;
|
||||
return _VSTD::__rotate(__first, __middle, __last,
|
||||
integral_constant
|
||||
<
|
||||
bool,
|
||||
is_convertible
|
||||
<
|
||||
typename iterator_traits<_ForwardIterator>::iterator_category,
|
||||
random_access_iterator_tag
|
||||
>::value &&
|
||||
is_trivially_copy_assignable
|
||||
<
|
||||
typename iterator_traits<_ForwardIterator>::value_type
|
||||
>::value
|
||||
>());
|
||||
typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category());
|
||||
}
|
||||
|
||||
// rotate_copy
|
||||
@@ -2326,10 +2421,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
|
||||
if (++__first != __last)
|
||||
{
|
||||
if (__comp(*__first, *__result.first))
|
||||
{
|
||||
__result.second = __result.first;
|
||||
__result.first = __first;
|
||||
}
|
||||
else
|
||||
__result.second = __first;
|
||||
while (++__first != __last)
|
||||
@@ -2421,29 +2513,29 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
|
||||
|
||||
// __independent_bits_engine
|
||||
|
||||
template <unsigned long long _X, size_t _R>
|
||||
template <unsigned long long _Xp, size_t _Rp>
|
||||
struct __log2_imp
|
||||
{
|
||||
static const size_t value = _X & ((unsigned long long)(1) << _R) ? _R
|
||||
: __log2_imp<_X, _R - 1>::value;
|
||||
static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp
|
||||
: __log2_imp<_Xp, _Rp - 1>::value;
|
||||
};
|
||||
|
||||
template <unsigned long long _X>
|
||||
struct __log2_imp<_X, 0>
|
||||
template <unsigned long long _Xp>
|
||||
struct __log2_imp<_Xp, 0>
|
||||
{
|
||||
static const size_t value = 0;
|
||||
};
|
||||
|
||||
template <size_t _R>
|
||||
struct __log2_imp<0, _R>
|
||||
template <size_t _Rp>
|
||||
struct __log2_imp<0, _Rp>
|
||||
{
|
||||
static const size_t value = _R + 1;
|
||||
static const size_t value = _Rp + 1;
|
||||
};
|
||||
|
||||
template <class _UI, _UI _X>
|
||||
template <class _UI, _UI _Xp>
|
||||
struct __log2
|
||||
{
|
||||
static const size_t value = __log2_imp<_X,
|
||||
static const size_t value = __log2_imp<_Xp,
|
||||
sizeof(_UI) * __CHAR_BIT__ - 1>::value;
|
||||
};
|
||||
|
||||
@@ -2473,18 +2565,23 @@ private:
|
||||
_Engine_result_type __mask0_;
|
||||
_Engine_result_type __mask1_;
|
||||
|
||||
static const _Working_result_type _R = _Engine::_Max - _Engine::_Min
|
||||
+ _Working_result_type(1);
|
||||
static const size_t __m = __log2<_Working_result_type, _R>::value;
|
||||
static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
|
||||
static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
|
||||
+ _Working_result_type(1);
|
||||
#else
|
||||
static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min()
|
||||
+ _Working_result_type(1);
|
||||
#endif
|
||||
static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
|
||||
static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
|
||||
static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
|
||||
|
||||
public:
|
||||
// constructors and seeding functions
|
||||
__independent_bits_engine(_Engine& __e, size_t __w);
|
||||
|
||||
// generating functions
|
||||
result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
|
||||
result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
|
||||
|
||||
private:
|
||||
result_type __eval(false_type);
|
||||
@@ -2499,24 +2596,24 @@ __independent_bits_engine<_Engine, _UIntType>
|
||||
{
|
||||
__n_ = __w_ / __m + (__w_ % __m != 0);
|
||||
__w0_ = __w_ / __n_;
|
||||
if (_R == 0)
|
||||
__y0_ = _R;
|
||||
if (_Rp == 0)
|
||||
__y0_ = _Rp;
|
||||
else if (__w0_ < _WDt)
|
||||
__y0_ = (_R >> __w0_) << __w0_;
|
||||
__y0_ = (_Rp >> __w0_) << __w0_;
|
||||
else
|
||||
__y0_ = 0;
|
||||
if (_R - __y0_ > __y0_ / __n_)
|
||||
if (_Rp - __y0_ > __y0_ / __n_)
|
||||
{
|
||||
++__n_;
|
||||
__w0_ = __w_ / __n_;
|
||||
if (__w0_ < _WDt)
|
||||
__y0_ = (_R >> __w0_) << __w0_;
|
||||
__y0_ = (_Rp >> __w0_) << __w0_;
|
||||
else
|
||||
__y0_ = 0;
|
||||
}
|
||||
__n0_ = __n_ - __w_ % __n_;
|
||||
if (__w0_ < _WDt - 1)
|
||||
__y1_ = (_R >> (__w0_ + 1)) << (__w0_ + 1);
|
||||
__y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
|
||||
else
|
||||
__y1_ = 0;
|
||||
__mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
|
||||
@@ -2538,7 +2635,7 @@ template<class _Engine, class _UIntType>
|
||||
_UIntType
|
||||
__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
||||
{
|
||||
result_type _S = 0;
|
||||
result_type _Sp = 0;
|
||||
for (size_t __k = 0; __k < __n0_; ++__k)
|
||||
{
|
||||
_Engine_result_type __u;
|
||||
@@ -2546,11 +2643,11 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
||||
{
|
||||
__u = __e_() - _Engine::min();
|
||||
} while (__u >= __y0_);
|
||||
if (__w0_ < _EDt)
|
||||
_S <<= __w0_;
|
||||
if (__w0_ < _WDt)
|
||||
_Sp <<= __w0_;
|
||||
else
|
||||
_S = 0;
|
||||
_S += __u & __mask0_;
|
||||
_Sp = 0;
|
||||
_Sp += __u & __mask0_;
|
||||
}
|
||||
for (size_t __k = __n0_; __k < __n_; ++__k)
|
||||
{
|
||||
@@ -2559,13 +2656,13 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
||||
{
|
||||
__u = __e_() - _Engine::min();
|
||||
} while (__u >= __y1_);
|
||||
if (__w0_ < _EDt - 1)
|
||||
_S <<= __w0_ + 1;
|
||||
if (__w0_ < _WDt - 1)
|
||||
_Sp <<= __w0_ + 1;
|
||||
else
|
||||
_S = 0;
|
||||
_S += __u & __mask1_;
|
||||
_Sp = 0;
|
||||
_Sp += __u & __mask1_;
|
||||
}
|
||||
return _S;
|
||||
return _Sp;
|
||||
}
|
||||
|
||||
// uniform_int_distribution
|
||||
@@ -2638,22 +2735,22 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
|
||||
{
|
||||
typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t),
|
||||
uint32_t, uint64_t>::type _UIntType;
|
||||
const _UIntType _R = __p.b() - __p.a() + _UIntType(1);
|
||||
if (_R == 1)
|
||||
const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1);
|
||||
if (_Rp == 1)
|
||||
return __p.a();
|
||||
const size_t _Dt = numeric_limits<_UIntType>::digits;
|
||||
typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
|
||||
if (_R == 0)
|
||||
if (_Rp == 0)
|
||||
return static_cast<result_type>(_Eng(__g, _Dt)());
|
||||
size_t __w = _Dt - __clz(_R) - 1;
|
||||
if ((_R & (_UIntType(~0) >> (_Dt - __w))) != 0)
|
||||
size_t __w = _Dt - __clz(_Rp) - 1;
|
||||
if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0)
|
||||
++__w;
|
||||
_Eng __e(__g, __w);
|
||||
_UIntType __u;
|
||||
do
|
||||
{
|
||||
__u = __e();
|
||||
} while (__u >= _R);
|
||||
} while (__u >= _Rp);
|
||||
return static_cast<result_type>(__u + __p.a());
|
||||
}
|
||||
|
||||
@@ -2677,8 +2774,8 @@ public:
|
||||
|
||||
result_type operator()();
|
||||
|
||||
static const/*expr*/ result_type min() {return _Min;}
|
||||
static const/*expr*/ result_type max() {return _Max;}
|
||||
static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
|
||||
static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
|
||||
|
||||
friend __rs_default __rs_get();
|
||||
};
|
||||
@@ -2690,16 +2787,16 @@ void
|
||||
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _D;
|
||||
typedef typename _D::param_type _P;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _Dp;
|
||||
typedef typename _Dp::param_type _Pp;
|
||||
difference_type __d = __last - __first;
|
||||
if (__d > 1)
|
||||
{
|
||||
_D __uid;
|
||||
_Dp __uid;
|
||||
__rs_default __g = __rs_get();
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
difference_type __i = __uid(__g, _Pp(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
@@ -2736,15 +2833,15 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
#endif
|
||||
{
|
||||
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _D;
|
||||
typedef typename _D::param_type _P;
|
||||
typedef uniform_int_distribution<ptrdiff_t> _Dp;
|
||||
typedef typename _Dp::param_type _Pp;
|
||||
difference_type __d = __last - __first;
|
||||
if (__d > 1)
|
||||
{
|
||||
_D __uid;
|
||||
_Dp __uid;
|
||||
for (--__last, --__d; __first < __last; ++__first, --__d)
|
||||
{
|
||||
difference_type __i = __uid(__g, _P(0, __d));
|
||||
difference_type __i = __uid(__g, _Pp(0, __d));
|
||||
if (__i != difference_type(0))
|
||||
swap(*__first, *(__first + __i));
|
||||
}
|
||||
@@ -3681,45 +3778,52 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
|
||||
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
|
||||
}
|
||||
|
||||
extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
|
||||
extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
|
||||
extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
|
||||
extern template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
|
||||
extern template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
|
||||
extern template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
|
||||
extern template void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
|
||||
extern template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
|
||||
extern template void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
|
||||
extern template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
|
||||
extern template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
|
||||
extern template void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
|
||||
extern template void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
|
||||
extern template void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
|
||||
extern template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4231)
|
||||
#endif // _MSC_VER
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<int>&, int*>(int*, int*, __less<int>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long>&, long*>(long*, long*, __less<long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<float>&, float*>(float*, float*, __less<float>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<double>&, double*>(double*, double*, __less<double>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
|
||||
|
||||
extern template bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&);
|
||||
extern template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
|
||||
|
||||
extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
|
||||
_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif // _MSC_VER
|
||||
|
||||
// lower_bound
|
||||
|
||||
template <class _Compare, class _ForwardIterator, class _Tp>
|
||||
_ForwardIterator
|
||||
__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
|
||||
difference_type __len = _VSTD::distance(__first, __last);
|
||||
@@ -3728,7 +3832,7 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
difference_type __l2 = __len / 2;
|
||||
_ForwardIterator __m = __first;
|
||||
_VSTD::advance(__m, __l2);
|
||||
if (__comp(*__m, __value))
|
||||
if (__comp(*__m, __value_))
|
||||
{
|
||||
__first = ++__m;
|
||||
__len -= __l2 + 1;
|
||||
@@ -3742,24 +3846,24 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value_, __c);
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
|
||||
return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp);
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::lower_bound(__first, __last, __value,
|
||||
return _VSTD::lower_bound(__first, __last, __value_,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
|
||||
}
|
||||
|
||||
@@ -3767,7 +3871,7 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
|
||||
|
||||
template <class _Compare, class _ForwardIterator, class _Tp>
|
||||
_ForwardIterator
|
||||
__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
|
||||
difference_type __len = _VSTD::distance(__first, __last);
|
||||
@@ -3776,7 +3880,7 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
difference_type __l2 = __len / 2;
|
||||
_ForwardIterator __m = __first;
|
||||
_VSTD::advance(__m, __l2);
|
||||
if (__comp(__value, *__m))
|
||||
if (__comp(__value_, *__m))
|
||||
__len = __l2;
|
||||
else
|
||||
{
|
||||
@@ -3790,24 +3894,24 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value_, __c);
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
|
||||
return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp);
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator
|
||||
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::upper_bound(__first, __last, __value,
|
||||
return _VSTD::upper_bound(__first, __last, __value_,
|
||||
__less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>());
|
||||
}
|
||||
|
||||
@@ -3815,7 +3919,7 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
|
||||
|
||||
template <class _Compare, class _ForwardIterator, class _Tp>
|
||||
pair<_ForwardIterator, _ForwardIterator>
|
||||
__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
|
||||
difference_type __len = _VSTD::distance(__first, __last);
|
||||
@@ -3824,12 +3928,12 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
difference_type __l2 = __len / 2;
|
||||
_ForwardIterator __m = __first;
|
||||
_VSTD::advance(__m, __l2);
|
||||
if (__comp(*__m, __value))
|
||||
if (__comp(*__m, __value_))
|
||||
{
|
||||
__first = ++__m;
|
||||
__len -= __l2 + 1;
|
||||
}
|
||||
else if (__comp(__value, *__m))
|
||||
else if (__comp(__value_, *__m))
|
||||
{
|
||||
__last = __m;
|
||||
__len = __l2;
|
||||
@@ -3839,8 +3943,8 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
_ForwardIterator __mp1 = __m;
|
||||
return pair<_ForwardIterator, _ForwardIterator>
|
||||
(
|
||||
__lower_bound<_Compare>(__first, __m, __value, __comp),
|
||||
__upper_bound<_Compare>(++__mp1, __last, __value, __comp)
|
||||
__lower_bound<_Compare>(__first, __m, __value_, __comp),
|
||||
__upper_bound<_Compare>(++__mp1, __last, __value_, __comp)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -3850,24 +3954,24 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
pair<_ForwardIterator, _ForwardIterator>
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value, __c);
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
|
||||
return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
pair<_ForwardIterator, _ForwardIterator>
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::equal_range(__first, __last, __value,
|
||||
return _VSTD::equal_range(__first, __last, __value_,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
|
||||
}
|
||||
|
||||
@@ -3876,33 +3980,33 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
|
||||
template <class _Compare, class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
__first = __lower_bound<_Compare>(__first, __last, __value, __comp);
|
||||
return __first != __last && !__comp(__value, *__first);
|
||||
__first = __lower_bound<_Compare>(__first, __last, __value_, __comp);
|
||||
return __first != __last && !__comp(__value_, *__first);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
|
||||
__debug_less<_Compare> __c(__comp);
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value, __c);
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
|
||||
#else // _LIBCPP_DEBUG2
|
||||
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
|
||||
return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
|
||||
#endif // _LIBCPP_DEBUG2
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
|
||||
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_)
|
||||
{
|
||||
return _VSTD::binary_search(__first, __last, __value,
|
||||
return _VSTD::binary_search(__first, __last, __value_,
|
||||
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
|
||||
}
|
||||
|
||||
@@ -4709,6 +4813,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
|
||||
while (true)
|
||||
{
|
||||
__restart:
|
||||
if (__nth == __last)
|
||||
return;
|
||||
difference_type __len = __last - __first;
|
||||
switch (__len)
|
||||
{
|
||||
|
@@ -55,7 +55,7 @@ struct array
|
||||
// capacity:
|
||||
constexpr size_type size() const noexcept;
|
||||
constexpr size_type max_size() const noexcept;
|
||||
bool empty() const noexcept;
|
||||
constexpr bool empty() const noexcept;
|
||||
|
||||
// element access:
|
||||
reference operator[](size_type n);
|
||||
@@ -111,7 +111,9 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -171,11 +173,11 @@ struct _LIBCPP_VISIBLE array
|
||||
|
||||
// capacity:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
|
||||
|
724
include/atomic
724
include/atomic
File diff suppressed because it is too large
Load Diff
@@ -113,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <__bit_reference>
|
||||
@@ -127,6 +129,8 @@ template <size_t N> struct hash<std::bitset<N>>;
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
@@ -144,9 +148,9 @@ class __bitset
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -155,7 +159,7 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
__storage_type __first_[_N_words];
|
||||
|
||||
@@ -164,12 +168,12 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
|
||||
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 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) _NOEXCEPT
|
||||
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
@@ -190,8 +194,10 @@ protected:
|
||||
bool any() const _NOEXCEPT;
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
private:
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
||||
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||
unsigned long to_ulong(false_type) const;
|
||||
unsigned long to_ulong(true_type) const;
|
||||
unsigned long long to_ullong(false_type) const;
|
||||
@@ -202,14 +208,22 @@ private:
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
: __first_{0}
|
||||
#endif
|
||||
{
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
void
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
|
||||
{
|
||||
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||
@@ -222,17 +236,25 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
|
||||
{
|
||||
__first_[0] = __v;
|
||||
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
: __first_{__v}
|
||||
#endif
|
||||
{
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
||||
#endif
|
||||
}
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
@@ -402,9 +424,9 @@ class __bitset<1, _Size>
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -413,7 +435,7 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
__storage_type __first_;
|
||||
|
||||
@@ -422,12 +444,12 @@ protected:
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
|
||||
|
||||
_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 _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 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) _NOEXCEPT
|
||||
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
|
||||
@@ -451,6 +473,7 @@ protected:
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||
: __first_(0)
|
||||
{
|
||||
@@ -458,6 +481,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
|
||||
|
||||
template <size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
: __first_(static_cast<__storage_type>(__v))
|
||||
{
|
||||
@@ -545,9 +569,9 @@ class __bitset<0, 0>
|
||||
public:
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef size_t size_type;
|
||||
typedef size_type __storage_type;
|
||||
protected:
|
||||
typedef __bitset __self;
|
||||
typedef size_type __storage_type;
|
||||
typedef __storage_type* __storage_pointer;
|
||||
typedef const __storage_type* __const_storage_pointer;
|
||||
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
|
||||
@@ -556,23 +580,23 @@ protected:
|
||||
friend class __bit_const_reference<__bitset>;
|
||||
friend class __bit_iterator<__bitset, false>;
|
||||
friend class __bit_iterator<__bitset, true>;
|
||||
friend class __bit_array<__bitset>;
|
||||
friend struct __bit_array<__bitset>;
|
||||
|
||||
typedef __bit_reference<__bitset> reference;
|
||||
typedef __bit_const_reference<__bitset> const_reference;
|
||||
typedef __bit_iterator<__bitset, false> iterator;
|
||||
typedef __bit_iterator<__bitset, true> const_iterator;
|
||||
|
||||
__bitset() _NOEXCEPT;
|
||||
explicit __bitset(unsigned long long) _NOEXCEPT;
|
||||
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||
{return reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
{return const_reference(0, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
||||
{return iterator(0, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
||||
{return const_iterator(0, 0);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||
@@ -591,16 +615,18 @@ protected:
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<0, 0>::__bitset() _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
|
||||
{
|
||||
}
|
||||
|
||||
template <size_t _Size> class bitset;
|
||||
template <size_t _Size> class _LIBCPP_VISIBLE bitset;
|
||||
template <size_t _Size> struct hash<bitset<_Size> >;
|
||||
|
||||
template <size_t _Size>
|
||||
@@ -615,8 +641,9 @@ public:
|
||||
typedef typename base::const_reference const_reference;
|
||||
|
||||
// 23.3.5.1 constructors:
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
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,
|
||||
@@ -643,7 +670,8 @@ public:
|
||||
bitset& flip(size_t __pos);
|
||||
|
||||
// element access:
|
||||
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
|
||||
unsigned long to_ulong() const;
|
||||
unsigned long long to_ullong() const;
|
||||
@@ -659,7 +687,7 @@ public:
|
||||
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
|
||||
char __one = '1') const;
|
||||
size_t count() const _NOEXCEPT;
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR 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;
|
||||
@@ -691,11 +719,11 @@ bitset<_Size>::bitset(const _CharT* __str,
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _VSTD::min(__rlen, _Size);
|
||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
for (; __i < _Mp; ++__i)
|
||||
{
|
||||
_CharT __c = __str[_M - 1 - __i];
|
||||
_CharT __c = __str[_Mp - 1 - __i];
|
||||
if (__c == __zero)
|
||||
(*this)[__i] = false;
|
||||
else
|
||||
@@ -725,11 +753,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
|
||||
#else
|
||||
assert(!"bitset string ctor has invalid argument");
|
||||
#endif
|
||||
size_t _M = _VSTD::min(__rlen, _Size);
|
||||
size_t _Mp = _VSTD::min(__rlen, _Size);
|
||||
size_t __i = 0;
|
||||
for (; __i < _M; ++__i)
|
||||
for (; __i < _Mp; ++__i)
|
||||
{
|
||||
_CharT __c = __str[__pos + _M - 1 - __i];
|
||||
_CharT __c = __str[__pos + _Mp - 1 - __i];
|
||||
if (_Traits::eq(__c, __zero))
|
||||
(*this)[__i] = false;
|
||||
else
|
||||
|
@@ -20,4 +20,6 @@ Macros:
|
||||
#include <__config>
|
||||
#include <assert.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
@@ -20,7 +20,9 @@
|
||||
|
||||
#include <complex>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// hh 080623 Created
|
||||
|
||||
|
@@ -37,8 +37,13 @@ int toupper(int c);
|
||||
|
||||
#include <__config>
|
||||
#include <ctype.h>
|
||||
#if defined(_MSC_VER)
|
||||
#include "support/win32/support.h"
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -26,7 +26,9 @@ Macros:
|
||||
#include <__config>
|
||||
#include <errno.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
|
||||
|
||||
|
@@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
|
||||
#include <__config>
|
||||
#include <fenv.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -63,7 +63,9 @@ Macros:
|
||||
#include <__config>
|
||||
#include <float.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef FLT_EVAL_METHOD
|
||||
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
||||
|
135
include/chrono
135
include/chrono
@@ -20,6 +20,7 @@ namespace chrono
|
||||
{
|
||||
|
||||
template <class ToDuration, class Rep, class Period>
|
||||
constexpr
|
||||
ToDuration
|
||||
duration_cast(const duration<Rep, Period>& fd);
|
||||
|
||||
@@ -29,9 +30,9 @@ template <class Rep>
|
||||
struct duration_values
|
||||
{
|
||||
public:
|
||||
static Rep zero();
|
||||
static Rep max();
|
||||
static Rep min();
|
||||
static constexpr Rep zero();
|
||||
static constexpr Rep max();
|
||||
static constexpr Rep min();
|
||||
};
|
||||
|
||||
// duration
|
||||
@@ -46,9 +47,9 @@ public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
|
||||
duration() = default;
|
||||
constexpr duration() = default;
|
||||
template <class Rep2>
|
||||
explicit duration(const Rep2& r,
|
||||
constexpr explicit duration(const Rep2& r,
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<Rep2, rep>::value &&
|
||||
@@ -58,7 +59,7 @@ public:
|
||||
|
||||
// conversions
|
||||
template <class Rep2, class Period2>
|
||||
duration(const duration<Rep2, Period2>& d,
|
||||
constexpr duration(const duration<Rep2, Period2>& d,
|
||||
typename enable_if
|
||||
<
|
||||
treat_as_floating_point<rep>::value ||
|
||||
@@ -67,12 +68,12 @@ public:
|
||||
|
||||
// observer
|
||||
|
||||
rep count() const;
|
||||
constexpr rep count() const;
|
||||
|
||||
// arithmetic
|
||||
|
||||
duration operator+() const;
|
||||
duration operator-() const;
|
||||
constexpr duration operator+() const;
|
||||
constexpr duration operator-() const;
|
||||
duration& operator++();
|
||||
duration operator++(int);
|
||||
duration& operator--();
|
||||
@@ -86,9 +87,9 @@ public:
|
||||
|
||||
// special values
|
||||
|
||||
static duration zero();
|
||||
static duration min();
|
||||
static duration max();
|
||||
static constexpr duration zero();
|
||||
static constexpr duration min();
|
||||
static constexpr duration max();
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
@@ -145,36 +146,48 @@ namespace chrono {
|
||||
|
||||
// duration arithmetic
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
|
||||
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator*(const Rep1& s, const duration<Rep2, Period>& d);
|
||||
template <class Rep1, class Period, class Rep2>
|
||||
constexpr
|
||||
duration<typename common_type<Rep1, Rep2>::type, Period>
|
||||
operator/(const duration<Rep1, Period>& d, const Rep2& s);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
typename common_type<Rep1, Rep2>::type
|
||||
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration comparisons
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
template <class Rep1, class Period1, class Rep2, class Period2>
|
||||
constexpr
|
||||
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
|
||||
|
||||
// duration_cast
|
||||
@@ -255,7 +268,11 @@ typedef steady_clock high_resolution_clock;
|
||||
#include <ratio>
|
||||
#include <limits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -302,7 +319,7 @@ struct __duration_cast;
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
|
||||
@@ -312,7 +329,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -324,7 +341,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -336,7 +353,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
|
||||
template <class _FromDuration, class _ToDuration, class _Period>
|
||||
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
_ToDuration operator()(const _FromDuration& __fd) const
|
||||
{
|
||||
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
|
||||
@@ -348,6 +365,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
|
||||
|
||||
template <class _ToDuration, class _Rep, class _Period>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
__is_duration<_ToDuration>::value,
|
||||
@@ -365,9 +383,9 @@ template <class _Rep>
|
||||
struct _LIBCPP_VISIBLE duration_values
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
|
||||
};
|
||||
|
||||
// duration
|
||||
@@ -385,9 +403,9 @@ private:
|
||||
rep __rep_;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
|
||||
template <class _Rep2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
explicit duration(const _Rep2& __r,
|
||||
typename enable_if
|
||||
<
|
||||
@@ -399,7 +417,7 @@ public:
|
||||
|
||||
// conversions
|
||||
template <class _Rep2, class _Period2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
duration(const duration<_Rep2, _Period2>& __d,
|
||||
typename enable_if
|
||||
<
|
||||
@@ -411,12 +429,12 @@ public:
|
||||
|
||||
// observer
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
|
||||
@@ -432,9 +450,9 @@ public:
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
|
||||
};
|
||||
|
||||
typedef duration<long long, nano> nanoseconds;
|
||||
@@ -449,7 +467,7 @@ typedef duration< long, ratio<3600> > hours;
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_eq
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
@@ -460,13 +478,14 @@ struct __duration_eq
|
||||
template <class _LhsDuration>
|
||||
struct __duration_eq<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() == __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -477,6 +496,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -488,7 +508,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
template <class _LhsDuration, class _RhsDuration>
|
||||
struct __duration_lt
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
|
||||
{
|
||||
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
|
||||
@@ -499,13 +519,14 @@ struct __duration_lt
|
||||
template <class _LhsDuration>
|
||||
struct __duration_lt<_LhsDuration, _LhsDuration>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
|
||||
{return __lhs.count() < __rhs.count();}
|
||||
};
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -516,6 +537,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -526,6 +548,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -536,6 +559,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
bool
|
||||
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -546,30 +570,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r += __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
|
||||
}
|
||||
|
||||
// Duration -
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r -= __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
|
||||
}
|
||||
|
||||
// Duration *
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
@@ -578,13 +603,13 @@ typename enable_if
|
||||
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r *= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
|
||||
@@ -623,17 +648,18 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r /= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<_Rep1, _Rep2>::type
|
||||
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
@@ -645,23 +671,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
|
||||
|
||||
template <class _Rep1, class _Period, class _Rep2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
|
||||
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
|
||||
{
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
duration<_Cr, _Period> __r = __d;
|
||||
__r %= static_cast<_Cr>(__s);
|
||||
return __r;
|
||||
typedef duration<_Cr, _Period> _Cd;
|
||||
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
|
||||
}
|
||||
|
||||
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
|
||||
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
|
||||
{
|
||||
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
|
||||
__r %= __rhs;
|
||||
return __r;
|
||||
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
|
||||
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
|
||||
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////
|
||||
@@ -701,13 +728,13 @@ public:
|
||||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
|
||||
|
||||
// special values
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
|
||||
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
|
||||
};
|
||||
|
||||
} // chrono
|
||||
|
@@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
|
||||
#include <cstdint>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -18,6 +18,8 @@
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CISO646
|
||||
|
@@ -41,6 +41,8 @@ Macros:
|
||||
#include <__config>
|
||||
#include <limits.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CLIMITS
|
||||
|
@@ -38,7 +38,9 @@ lconv* localeconv();
|
||||
#include <__config>
|
||||
#include <locale.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
495
include/cmath
495
include/cmath
File diff suppressed because it is too large
Load Diff
@@ -55,7 +55,9 @@ class codecvt_utf8_utf16
|
||||
#include <__config>
|
||||
#include <__locale>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -249,7 +249,9 @@ template<class T, class charT, class traits>
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -280,7 +282,8 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
|
||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||
@@ -327,18 +330,19 @@ class _LIBCPP_VISIBLE complex<float>
|
||||
public:
|
||||
typedef float value_type;
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
|
||||
: __re_(__re), __im_(__im) {}
|
||||
explicit /*constexpr*/ complex(const complex<double>& __c);
|
||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
|
||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||
@@ -382,18 +386,19 @@ class _LIBCPP_VISIBLE complex<double>
|
||||
public:
|
||||
typedef double value_type;
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
|
||||
: __re_(__re), __im_(__im) {}
|
||||
/*constexpr*/ complex(const complex<float>& __c);
|
||||
explicit /*constexpr*/ complex(const complex<long double>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
|
||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||
@@ -437,18 +442,19 @@ class _LIBCPP_VISIBLE complex<long double>
|
||||
public:
|
||||
typedef long double value_type;
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
|
||||
: __re_(__re), __im_(__im) {}
|
||||
/*constexpr*/ complex(const complex<float>& __c);
|
||||
/*constexpr*/ complex(const complex<double>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
|
||||
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
|
||||
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
|
||||
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
|
||||
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
|
||||
{__re_ = __re; __im_ = value_type(); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
|
||||
@@ -484,33 +490,33 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<float>::complex(const complex<double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<float>::complex(const complex<long double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<double>::complex(const complex<float>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<double>::complex(const complex<long double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<long double>::complex(const complex<float>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
//constexpr
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR
|
||||
complex<long double>::complex(const complex<double>& __c)
|
||||
: __re_(__c.real()), __im_(__c.imag()) {}
|
||||
|
||||
@@ -1243,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
|
||||
if (isnan(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
if (isinf(__x.imag()))
|
||||
{
|
||||
if (__x.real() > 0)
|
||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
else
|
||||
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
|
||||
}
|
||||
if (__x.real() < 0)
|
||||
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
@@ -1345,7 +1353,11 @@ tanh(const complex<_Tp>& __x)
|
||||
_Tp __2r(_Tp(2) * __x.real());
|
||||
_Tp __2i(_Tp(2) * __x.imag());
|
||||
_Tp __d(cosh(__2r) + cos(__2i));
|
||||
return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
|
||||
_Tp __2rsh(sinh(__2r));
|
||||
if (isinf(__2rsh) && isinf(__d))
|
||||
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
||||
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
||||
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
|
||||
}
|
||||
|
||||
// asin
|
||||
|
@@ -28,6 +28,8 @@
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_COMPLEX_H
|
||||
|
@@ -28,8 +28,8 @@ public:
|
||||
condition_variable(const condition_variable&) = delete;
|
||||
condition_variable& operator=(const condition_variable&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
void wait(unique_lock<mutex>& lock);
|
||||
template <class Predicate>
|
||||
@@ -72,8 +72,8 @@ public:
|
||||
condition_variable_any(const condition_variable_any&) = delete;
|
||||
condition_variable_any& operator=(const condition_variable_any&) = delete;
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() noexcept;
|
||||
void notify_all() noexcept;
|
||||
|
||||
template <class Lock>
|
||||
void wait(Lock& lock);
|
||||
@@ -111,7 +111,9 @@ public:
|
||||
#include <__mutex_base>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -122,8 +124,8 @@ class _LIBCPP_VISIBLE condition_variable_any
|
||||
public:
|
||||
condition_variable_any();
|
||||
|
||||
void notify_one();
|
||||
void notify_all();
|
||||
void notify_one() _NOEXCEPT;
|
||||
void notify_all() _NOEXCEPT;
|
||||
|
||||
template <class _Lock>
|
||||
void wait(_Lock& __lock);
|
||||
@@ -159,17 +161,17 @@ condition_variable_any::condition_variable_any()
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_one()
|
||||
condition_variable_any::notify_one() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_one();
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
condition_variable_any::notify_all()
|
||||
condition_variable_any::notify_all() _NOEXCEPT
|
||||
{
|
||||
{lock_guard<mutex> _(*__mut_);}
|
||||
{lock_guard<mutex> __lx(*__mut_);}
|
||||
__cv_.notify_all();
|
||||
}
|
||||
|
||||
@@ -186,8 +188,8 @@ condition_variable_any::wait(_Lock& __lock)
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
__cv_.wait(__lk);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
@@ -208,8 +210,8 @@ condition_variable_any::wait_until(_Lock& __lock,
|
||||
shared_ptr<mutex> __mut = __mut_;
|
||||
unique_lock<mutex> __lk(*__mut);
|
||||
__lock.unlock();
|
||||
unique_ptr<_Lock, __lock_external> __(&__lock);
|
||||
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
|
||||
unique_ptr<_Lock, __lock_external> __lxx(&__lock);
|
||||
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
|
||||
return __cv_.wait_until(__lk, __t);
|
||||
} // __mut_.unlock(), __lock.lock()
|
||||
|
||||
|
@@ -34,7 +34,9 @@ void longjmp(jmp_buf env, int val);
|
||||
#include <__config>
|
||||
#include <setjmp.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifndef setjmp
|
||||
#define setjmp(env) setjmp(env)
|
||||
|
@@ -43,7 +43,9 @@ int raise(int sig);
|
||||
#include <__config>
|
||||
#include <signal.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -35,7 +35,9 @@ Types:
|
||||
#include <__config>
|
||||
#include <stdarg.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -22,7 +22,9 @@ Macros:
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#undef __bool_true_false_are_defined
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
@@ -43,7 +43,9 @@ Types:
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -56,31 +58,32 @@ typedef long double max_align_t;
|
||||
|
||||
struct _LIBCPP_VISIBLE nullptr_t
|
||||
{
|
||||
void* _;
|
||||
void* __lx;
|
||||
|
||||
struct __nat {int __for_bool_;};
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
|
||||
operator _Tp* () const {return 0;}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator _Tp _Up::* () const {return 0;}
|
||||
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
|
||||
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
|
||||
};
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
|
||||
|
||||
#define nullptr _VSTD::__get_nullptr_t()
|
||||
|
||||
|
@@ -144,7 +144,9 @@ Types:
|
||||
#include <__config>
|
||||
#include <stdint.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -99,7 +99,21 @@ void perror(const char* s);
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef getc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
|
||||
#undef getc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
|
||||
#endif // getc
|
||||
|
||||
#ifdef putc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
|
||||
#undef putc
|
||||
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
|
||||
#endif // putc
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -124,13 +138,15 @@ using ::scanf;
|
||||
using ::snprintf;
|
||||
using ::sprintf;
|
||||
using ::sscanf;
|
||||
#ifndef _MSC_VER
|
||||
using ::vfprintf;
|
||||
using ::vfscanf;
|
||||
using ::vprintf;
|
||||
using ::vscanf;
|
||||
using ::vsscanf;
|
||||
#endif // _MSC_VER
|
||||
using ::vprintf;
|
||||
using ::vsnprintf;
|
||||
using ::vsprintf;
|
||||
using ::vsscanf;
|
||||
using ::fgetc;
|
||||
using ::fgets;
|
||||
using ::fputc;
|
||||
|
@@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
|
||||
int wctomb(char* s, wchar_t wchar);
|
||||
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
|
||||
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
int at_quick_exit(void (*func)(void)) // C++11
|
||||
void quick_exit(int status); // C++11
|
||||
void *aligned_alloc(size_t alignment, size_t size); // C11
|
||||
|
||||
} // std
|
||||
|
||||
@@ -81,8 +84,13 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
|
||||
|
||||
#include <__config>
|
||||
#include <stdlib.h>
|
||||
#ifdef _MSC_VER
|
||||
#include "support/win32/locale_win32.h"
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -126,12 +134,22 @@ using ::mbtowc;
|
||||
using ::wctomb;
|
||||
using ::mbstowcs;
|
||||
using ::wcstombs;
|
||||
#ifdef _LIBCPP_HAS_QUICK_EXIT
|
||||
using ::at_quick_exit;
|
||||
using ::quick_exit;
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_C11_FEATURES
|
||||
using ::aligned_alloc;
|
||||
#endif
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
|
||||
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
|
||||
#if !defined(_MSC_VER) && !defined(__sun__)
|
||||
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
|
||||
#endif // _MSC_VER
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@@ -60,7 +60,9 @@ size_t strlen(const char* s);
|
||||
#include <__config>
|
||||
#include <string.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -91,7 +93,8 @@ using ::strspn;
|
||||
|
||||
using ::strstr;
|
||||
|
||||
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
|
||||
#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__)
|
||||
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);}
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <ccomplex>
|
||||
#include <cmath>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CTGMATH
|
||||
|
@@ -47,7 +47,9 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
|
||||
#include <__config>
|
||||
#include <time.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -110,7 +110,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
|
||||
#include <support/win32/support.h> // pull in *swprintf defines
|
||||
#endif // _WIN32
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -122,13 +124,15 @@ using ::FILE;
|
||||
using ::fwprintf;
|
||||
using ::fwscanf;
|
||||
using ::swprintf;
|
||||
using ::swscanf;
|
||||
using ::vfwprintf;
|
||||
using ::vfwscanf;
|
||||
using ::vswprintf;
|
||||
using ::vswscanf;
|
||||
using ::vwprintf;
|
||||
#ifndef _MSC_VER
|
||||
using ::swscanf;
|
||||
using ::vfwscanf;
|
||||
using ::vswscanf;
|
||||
using ::vwscanf;
|
||||
#endif // _MSC_VER
|
||||
using ::wprintf;
|
||||
using ::wscanf;
|
||||
using ::fgetwc;
|
||||
@@ -142,8 +146,10 @@ using ::putwc;
|
||||
using ::putwchar;
|
||||
using ::ungetwc;
|
||||
using ::wcstod;
|
||||
#ifndef _MSC_VER
|
||||
using ::wcstof;
|
||||
using ::wcstold;
|
||||
#endif // _MSC_VER
|
||||
using ::wcstol;
|
||||
using ::wcstoll;
|
||||
using ::wcstoul;
|
||||
|
@@ -54,7 +54,9 @@ wctrans_t wctrans(const char* property);
|
||||
#include <cctype>
|
||||
#include <wctype.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -150,7 +150,9 @@ template <class T, class Allocator>
|
||||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <__split_buffer>
|
||||
@@ -160,6 +162,8 @@ template <class T, class Allocator>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Allocator> class __deque_base;
|
||||
@@ -276,10 +280,10 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
|
||||
|
||||
template <class _P, class _R, class _MP>
|
||||
template <class _Pp, class _Rp, class _MP>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
|
||||
typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
|
||||
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
|
||||
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
|
||||
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
|
||||
@@ -405,9 +409,9 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
|
||||
: __m_iter_(__m), __ptr_(__p) {}
|
||||
|
||||
template <class _Tp, class _A> friend class __deque_base;
|
||||
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
|
||||
template <class _V, class _P, class _R, class _MP, class _D, _D>
|
||||
template <class _Tp, class _Ap> friend class __deque_base;
|
||||
template <class _Tp, class _Ap> friend class _LIBCPP_VISIBLE deque;
|
||||
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
|
||||
friend class _LIBCPP_VISIBLE __deque_iterator;
|
||||
|
||||
template <class _RAIter,
|
||||
@@ -984,7 +988,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
|
||||
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -1003,7 +1007,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
|
||||
static void __swap_alloc(allocator_type&, allocator_type&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
};
|
||||
@@ -1399,7 +1403,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const deque& __c, false_type)
|
||||
void __copy_assign_alloc(const deque&, false_type)
|
||||
{}
|
||||
|
||||
void __move_assign(deque& __c, true_type)
|
||||
@@ -1506,8 +1510,8 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
|
||||
{
|
||||
if (__a != __c.__alloc())
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
assign(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1529,8 +1533,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
|
||||
{
|
||||
if (__base::__alloc() != __c.__alloc())
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
assign(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
else
|
||||
__move_assign(__c, true_type());
|
||||
@@ -1962,6 +1966,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
}
|
||||
else
|
||||
{
|
||||
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
@@ -1969,7 +1974,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = value_type(_VSTD::forward<_Args>(__args)...);
|
||||
*__b = _VSTD::move(__tmp);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1985,13 +1990,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
}
|
||||
else
|
||||
{
|
||||
value_type __tmp(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = value_type(_VSTD::forward<_Args>(__args)...);
|
||||
*--__e = _VSTD::move(__tmp);
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
|
@@ -80,7 +80,9 @@ template <class E> void rethrow_if_nested(const E& e);
|
||||
#include <cstddef>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
@@ -105,19 +107,19 @@ public:
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
|
||||
_LIBCPP_NORETURN _LIBCPP_VISIBLE void unexpected();
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
|
||||
|
||||
class exception_ptr;
|
||||
class _LIBCPP_VISIBLE exception_ptr;
|
||||
|
||||
exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
|
||||
_LIBCPP_NORETURN void rethrow_exception(exception_ptr);
|
||||
|
||||
class _LIBCPP_VISIBLE exception_ptr
|
||||
{
|
||||
@@ -130,7 +132,7 @@ public:
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
@@ -141,12 +143,12 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
friend exception_ptr current_exception() _NOEXCEPT;
|
||||
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
|
||||
_LIBCPP_NORETURN friend void rethrow_exception(exception_ptr);
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
exception_ptr
|
||||
make_exception_ptr(_E __e) _NOEXCEPT
|
||||
make_exception_ptr(_Ep __e) _NOEXCEPT
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
@@ -172,7 +174,7 @@ public:
|
||||
virtual ~nested_exception() _NOEXCEPT;
|
||||
|
||||
// access functions
|
||||
_ATTRIBUTE(noreturn) void rethrow_nested() const;
|
||||
_LIBCPP_NORETURN void rethrow_nested() const;
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
|
||||
};
|
||||
|
||||
@@ -185,7 +187,7 @@ struct __nested
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
@@ -204,7 +206,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_ATTRIBUTE(noreturn)
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
@@ -222,11 +224,11 @@ throw_with_nested (_Tp& __t, typename enable_if<
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
is_polymorphic<_E>::value
|
||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
|
||||
@@ -234,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
__nep->rethrow_nested();
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _E& __e, typename enable_if<
|
||||
!is_polymorphic<_E>::value
|
||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||
!is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
{
|
||||
}
|
||||
|
@@ -43,4 +43,4 @@ template <> struct _LIBCPP_VISIBLE hash<char *>
|
||||
};
|
||||
}
|
||||
|
||||
#endif _LIBCPP_EXT_HASH
|
||||
#endif // _LIBCPP_EXT_HASH
|
||||
|
@@ -215,7 +215,11 @@ namespace __gnu_cxx {
|
||||
|
||||
using namespace std;
|
||||
|
||||
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
|
||||
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Hash)
|
||||
#endif
|
||||
>
|
||||
class __hash_map_hasher
|
||||
: private _Hash
|
||||
{
|
||||
@@ -247,7 +251,11 @@ public:
|
||||
{return __hash_(__x);}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
|
||||
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Pred)
|
||||
#endif
|
||||
>
|
||||
class __hash_map_equal
|
||||
: private _Pred
|
||||
{
|
||||
@@ -499,8 +507,8 @@ private:
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
@@ -671,7 +679,7 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
|
||||
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_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
@@ -776,8 +784,8 @@ private:
|
||||
typedef typename __table::__node_traits __node_traits;
|
||||
typedef typename __table::__node_allocator __node_allocator;
|
||||
typedef typename __table::__node __node;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __hash_map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
typedef allocator_traits<allocator_type> __alloc_traits;
|
||||
public:
|
||||
typedef typename __alloc_traits::pointer pointer;
|
||||
|
@@ -174,7 +174,11 @@ template <class T, class Allocator>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -208,8 +212,8 @@ struct __forward_list_node
|
||||
value_type __value_;
|
||||
};
|
||||
|
||||
template<class _Tp, class _Alloc> class forward_list;
|
||||
template<class _NodeConstPtr> class __forward_list_const_iterator;
|
||||
template<class _Tp, class _Alloc> class _LIBCPP_VISIBLE forward_list;
|
||||
template<class _NodeConstPtr> class _LIBCPP_VISIBLE __forward_list_const_iterator;
|
||||
|
||||
template <class _NodePtr>
|
||||
class _LIBCPP_VISIBLE __forward_list_iterator
|
||||
@@ -221,8 +225,8 @@ class _LIBCPP_VISIBLE __forward_list_iterator
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
|
||||
|
||||
template<class, class> friend class forward_list;
|
||||
template<class> friend class __forward_list_const_iterator;
|
||||
template<class, class> friend class _LIBCPP_VISIBLE forward_list;
|
||||
template<class> friend class _LIBCPP_VISIBLE __forward_list_const_iterator;
|
||||
|
||||
public:
|
||||
typedef forward_iterator_tag iterator_category;
|
||||
@@ -768,8 +772,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
|
||||
if (__n > 0)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
|
||||
__p = __p->__next_)
|
||||
{
|
||||
@@ -844,8 +848,8 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
||||
{
|
||||
if (base::__alloc() != __x.__alloc())
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -902,8 +906,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
|
||||
__move_assign(__x, true_type());
|
||||
else
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
assign(_I(__x.begin()), _I(__x.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
assign(_Ip(__x.begin()), _Ip(__x.end()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -991,8 +995,8 @@ void
|
||||
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
@@ -1006,8 +1010,8 @@ void
|
||||
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
@@ -1020,8 +1024,8 @@ void
|
||||
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__h->__next_ = base::__before_begin()->__next_;
|
||||
base::__before_begin()->__next_ = __h.release();
|
||||
@@ -1048,8 +1052,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h->__next_ = __r->__next_;
|
||||
@@ -1065,8 +1069,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||
{
|
||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
|
||||
__h->__next_ = __r->__next_;
|
||||
__r->__next_ = __h.release();
|
||||
@@ -1081,8 +1085,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
|
||||
{
|
||||
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__h->__next_ = __r->__next_;
|
||||
__r->__next_ = __h.release();
|
||||
@@ -1098,8 +1102,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
|
||||
if (__n > 0)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
|
||||
__node_pointer __first = __h.release();
|
||||
__node_pointer __last = __first;
|
||||
@@ -1148,8 +1152,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
|
||||
if (__f != __l)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
|
||||
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
|
||||
__node_pointer __first = __h.release();
|
||||
__node_pointer __last = __first;
|
||||
@@ -1240,8 +1244,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
|
||||
if (__n > 0)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||
__ptr = __ptr->__next_)
|
||||
{
|
||||
@@ -1272,8 +1276,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
|
||||
if (__n > 0)
|
||||
{
|
||||
__node_allocator& __a = base::__alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
|
||||
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
|
||||
__ptr = __ptr->__next_)
|
||||
{
|
||||
@@ -1565,12 +1569,12 @@ template <class _Tp, class _Alloc>
|
||||
bool operator==(const forward_list<_Tp, _Alloc>& __x,
|
||||
const forward_list<_Tp, _Alloc>& __y)
|
||||
{
|
||||
typedef forward_list<_Tp, _Alloc> _C;
|
||||
typedef typename _C::const_iterator _I;
|
||||
_I __ix = __x.begin();
|
||||
_I __ex = __x.end();
|
||||
_I __iy = __y.begin();
|
||||
_I __ey = __y.end();
|
||||
typedef forward_list<_Tp, _Alloc> _Cp;
|
||||
typedef typename _Cp::const_iterator _Ip;
|
||||
_Ip __ix = __x.begin();
|
||||
_Ip __ex = __x.end();
|
||||
_Ip __iy = __y.begin();
|
||||
_Ip __ey = __y.end();
|
||||
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
|
||||
if (!(*__ix == *__iy))
|
||||
return false;
|
||||
|
@@ -171,7 +171,11 @@ typedef basic_fstream<wchar_t> wfstream;
|
||||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -230,6 +234,7 @@ private:
|
||||
FILE* __file_;
|
||||
const codecvt<char_type, char, state_type>* __cv_;
|
||||
state_type __st_;
|
||||
state_type __st_last_;
|
||||
ios_base::openmode __om_;
|
||||
ios_base::openmode __cm_;
|
||||
bool __owns_eb_;
|
||||
@@ -249,14 +254,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
||||
__intbuf_(0),
|
||||
__ibs_(0),
|
||||
__file_(0),
|
||||
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
|
||||
__cv_(nullptr),
|
||||
__st_(),
|
||||
__st_last_(),
|
||||
__om_(0),
|
||||
__cm_(0),
|
||||
__owns_eb_(false),
|
||||
__owns_ib_(false),
|
||||
__always_noconv_(__cv_->always_noconv())
|
||||
__always_noconv_(false)
|
||||
{
|
||||
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
|
||||
{
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
}
|
||||
setbuf(0, 4096);
|
||||
}
|
||||
|
||||
@@ -284,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
__file_ = __rhs.__file_;
|
||||
__cv_ = __rhs.__cv_;
|
||||
__st_ = __rhs.__st_;
|
||||
__st_last_ = __rhs.__st_last_;
|
||||
__om_ = __rhs.__om_;
|
||||
__cm_ = __rhs.__cm_;
|
||||
__owns_eb_ = __rhs.__owns_eb_;
|
||||
@@ -316,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
__rhs.__ibs_ = 0;
|
||||
__rhs.__file_ = 0;
|
||||
__rhs.__st_ = state_type();
|
||||
__rhs.__st_last_ = state_type();
|
||||
__rhs.__om_ = 0;
|
||||
__rhs.__cm_ = 0;
|
||||
__rhs.__owns_eb_ = false;
|
||||
@@ -331,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
||||
{
|
||||
close();
|
||||
swap(__rhs);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -393,6 +407,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
||||
_VSTD::swap(__file_, __rhs.__file_);
|
||||
_VSTD::swap(__cv_, __rhs.__cv_);
|
||||
_VSTD::swap(__st_, __rhs.__st_);
|
||||
_VSTD::swap(__st_last_, __rhs.__st_last_);
|
||||
_VSTD::swap(__om_, __rhs.__om_);
|
||||
_VSTD::swap(__cm_, __rhs.__cm_);
|
||||
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
|
||||
@@ -545,7 +560,7 @@ basic_filebuf<_CharT, _Traits>::close()
|
||||
{
|
||||
__rt = this;
|
||||
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
||||
if ((__cm_ & ios_base::out) && sync())
|
||||
if (sync())
|
||||
__rt = 0;
|
||||
if (fclose(__h.release()) == 0)
|
||||
__file_ = 0;
|
||||
@@ -587,18 +602,22 @@ 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 = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
|
||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
||||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
state_type __svs = __st_;
|
||||
__st_last_ = __st_;
|
||||
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
||||
if (__nr != 0)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
__extbufend_ = __extbufnext_ + __nr;
|
||||
char_type* __inext;
|
||||
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
|
||||
this->eback() + __unget_sz,
|
||||
this->egptr(), __inext);
|
||||
this->eback() + __ibs_, __inext);
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||
@@ -672,6 +691,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
||||
codecvt_base::result __r;
|
||||
do
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
const char_type* __e;
|
||||
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
|
||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||
@@ -761,6 +784,10 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
ios_base::openmode)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
int __width = __cv_->encoding();
|
||||
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
||||
return pos_type(off_type(-1));
|
||||
@@ -795,6 +822,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
||||
return pos_type(off_type(-1));
|
||||
if (fseeko(__file_, __sp, SEEK_SET))
|
||||
return pos_type(off_type(-1));
|
||||
__st_ = __sp.state();
|
||||
return __sp;
|
||||
}
|
||||
|
||||
@@ -804,6 +832,10 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
{
|
||||
if (__file_ == 0)
|
||||
return 0;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (!__cv_)
|
||||
throw bad_cast();
|
||||
#endif
|
||||
if (__cm_ & ios_base::out)
|
||||
{
|
||||
if (this->pptr() != this->pbase())
|
||||
@@ -826,6 +858,8 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
else if (__cm_ & ios_base::in)
|
||||
{
|
||||
off_type __c;
|
||||
state_type __state = __st_last_;
|
||||
bool __update_st = false;
|
||||
if (__always_noconv_)
|
||||
__c = this->egptr() - this->gptr();
|
||||
else
|
||||
@@ -838,32 +872,19 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
{
|
||||
if (this->gptr() != this->egptr())
|
||||
{
|
||||
reverse(this->gptr(), this->egptr());
|
||||
codecvt_base::result __r;
|
||||
const char_type* __e = this->gptr();
|
||||
char* __extbe;
|
||||
do
|
||||
{
|
||||
__r = __cv_->out(__st_, __e, this->egptr(), __e,
|
||||
__extbuf_, __extbuf_ + __ebs_, __extbe);
|
||||
switch (__r)
|
||||
{
|
||||
case codecvt_base::noconv:
|
||||
__c += this->egptr() - this->gptr();
|
||||
break;
|
||||
case codecvt_base::ok:
|
||||
case codecvt_base::partial:
|
||||
__c += __extbe - __extbuf_;
|
||||
break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
} while (__r == codecvt_base::partial);
|
||||
const int __off = __cv_->length(__state, __extbuf_,
|
||||
__extbufnext_,
|
||||
this->gptr() - this->eback());
|
||||
__c += __extbufnext_ - __extbuf_ - __off;
|
||||
__update_st = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fseeko(__file_, -__c, SEEK_CUR))
|
||||
return -1;
|
||||
if (__update_st)
|
||||
__st_ = __state;
|
||||
__extbufnext_ = __extbufend_ = __extbuf_;
|
||||
this->setg(0, 0, 0);
|
||||
__cm_ = 0;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
1036
include/future
1036
include/future
File diff suppressed because it is too large
Load Diff
@@ -46,52 +46,54 @@ template<class E> const E* end(initializer_list<E> il) noexcept;
|
||||
#include <__config>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
class _LIBCPP_VISIBLE initializer_list
|
||||
{
|
||||
const _E* __begin_;
|
||||
const _Ep* __begin_;
|
||||
size_t __size_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
initializer_list(const _E* __b, size_t __s) _NOEXCEPT
|
||||
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
|
||||
: __begin_(__b),
|
||||
__size_(__s)
|
||||
{}
|
||||
public:
|
||||
typedef _E value_type;
|
||||
typedef const _E& reference;
|
||||
typedef const _E& const_reference;
|
||||
typedef _Ep value_type;
|
||||
typedef const _Ep& reference;
|
||||
typedef const _Ep& const_reference;
|
||||
typedef size_t size_type;
|
||||
|
||||
typedef const _E* iterator;
|
||||
typedef const _E* const_iterator;
|
||||
typedef const _Ep* iterator;
|
||||
typedef const _Ep* const_iterator;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
|
||||
|
||||
_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_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
|
||||
};
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
begin(initializer_list<_E> __il) _NOEXCEPT
|
||||
const _Ep*
|
||||
begin(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.begin();
|
||||
}
|
||||
|
||||
template<class _E>
|
||||
template<class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const _E*
|
||||
end(initializer_list<_E> __il) _NOEXCEPT
|
||||
const _Ep*
|
||||
end(initializer_list<_Ep> __il) _NOEXCEPT
|
||||
{
|
||||
return __il.end();
|
||||
}
|
||||
|
@@ -33,7 +33,9 @@ template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
|
||||
#include <__config>
|
||||
#include <istream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -275,10 +277,10 @@ public:
|
||||
__iom_t7(_MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
|
||||
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
@@ -292,11 +294,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef money_get<_CharT, _I> _F;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef money_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __mf = use_facet<_F>(__is.getloc());
|
||||
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
const _Fp& __mf = use_facet<_Fp>(__is.getloc());
|
||||
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
|
||||
__is.setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -335,10 +337,10 @@ public:
|
||||
__iom_t8(const _MoneyT& __mon, bool __intl)
|
||||
: __mon_(__mon), __intl_(__intl) {}
|
||||
|
||||
template <class _CharT, class _Traits, class _M>
|
||||
template <class _CharT, class _Traits, class _Mp>
|
||||
friend
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _MoneyT>
|
||||
@@ -352,10 +354,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef money_put<_CharT, _O> _F;
|
||||
const _F& __mf = use_facet<_F>(__os.getloc());
|
||||
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef money_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __mf = use_facet<_Fp>(__os.getloc());
|
||||
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -394,10 +396,10 @@ public:
|
||||
__iom_t9(tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_istream<_C, _Traits>&
|
||||
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
|
||||
basic_istream<_Cp, _Traits>&
|
||||
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -411,11 +413,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
|
||||
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef time_get<_CharT, _I> _F;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef time_get<_CharT, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
const _F& __tf = use_facet<_F>(__is.getloc());
|
||||
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
|
||||
const _Fp& __tf = use_facet<_Fp>(__is.getloc());
|
||||
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
|
||||
__is.setstate(__err);
|
||||
}
|
||||
@@ -455,10 +457,10 @@ public:
|
||||
__iom_t10(const tm* __tm, const _CharT* __fmt)
|
||||
: __tm_(__tm), __fmt_(__fmt) {}
|
||||
|
||||
template <class _C, class _Traits>
|
||||
template <class _Cp, class _Traits>
|
||||
friend
|
||||
basic_ostream<_C, _Traits>&
|
||||
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
|
||||
basic_ostream<_Cp, _Traits>&
|
||||
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -472,10 +474,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
typedef time_put<_CharT, _O> _F;
|
||||
const _F& __tf = use_facet<_F>(__os.getloc());
|
||||
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
typedef time_put<_CharT, _Op> _Fp;
|
||||
const _Fp& __tf = use_facet<_Fp>(__os.getloc());
|
||||
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
|
||||
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
|
||||
__os.setstate(ios_base::badbit);
|
||||
}
|
||||
|
99
include/ios
99
include/ios
@@ -29,43 +29,43 @@ public:
|
||||
class failure;
|
||||
|
||||
typedef T1 fmtflags;
|
||||
static const fmtflags boolalpha;
|
||||
static const fmtflags dec;
|
||||
static const fmtflags fixed;
|
||||
static const fmtflags hex;
|
||||
static const fmtflags internal;
|
||||
static const fmtflags left;
|
||||
static const fmtflags oct;
|
||||
static const fmtflags right;
|
||||
static const fmtflags scientific;
|
||||
static const fmtflags showbase;
|
||||
static const fmtflags showpoint;
|
||||
static const fmtflags showpos;
|
||||
static const fmtflags skipws;
|
||||
static const fmtflags unitbuf;
|
||||
static const fmtflags uppercase;
|
||||
static const fmtflags adjustfield;
|
||||
static const fmtflags basefield;
|
||||
static const fmtflags floatfield;
|
||||
static constexpr fmtflags boolalpha;
|
||||
static constexpr fmtflags dec;
|
||||
static constexpr fmtflags fixed;
|
||||
static constexpr fmtflags hex;
|
||||
static constexpr fmtflags internal;
|
||||
static constexpr fmtflags left;
|
||||
static constexpr fmtflags oct;
|
||||
static constexpr fmtflags right;
|
||||
static constexpr fmtflags scientific;
|
||||
static constexpr fmtflags showbase;
|
||||
static constexpr fmtflags showpoint;
|
||||
static constexpr fmtflags showpos;
|
||||
static constexpr fmtflags skipws;
|
||||
static constexpr fmtflags unitbuf;
|
||||
static constexpr fmtflags uppercase;
|
||||
static constexpr fmtflags adjustfield;
|
||||
static constexpr fmtflags basefield;
|
||||
static constexpr fmtflags floatfield;
|
||||
|
||||
typedef T2 iostate;
|
||||
static const iostate badbit;
|
||||
static const iostate eofbit;
|
||||
static const iostate failbit;
|
||||
static const iostate goodbit;
|
||||
static constexpr iostate badbit;
|
||||
static constexpr iostate eofbit;
|
||||
static constexpr iostate failbit;
|
||||
static constexpr iostate goodbit;
|
||||
|
||||
typedef T3 openmode;
|
||||
static const openmode app;
|
||||
static const openmode ate;
|
||||
static const openmode binary;
|
||||
static const openmode in;
|
||||
static const openmode out;
|
||||
static const openmode trunc;
|
||||
static constexpr openmode app;
|
||||
static constexpr openmode ate;
|
||||
static constexpr openmode binary;
|
||||
static constexpr openmode in;
|
||||
static constexpr openmode out;
|
||||
static constexpr openmode trunc;
|
||||
|
||||
typedef T4 seekdir;
|
||||
static const seekdir beg;
|
||||
static const seekdir cur;
|
||||
static const seekdir end;
|
||||
static constexpr seekdir beg;
|
||||
static constexpr seekdir cur;
|
||||
static constexpr seekdir end;
|
||||
|
||||
class Init;
|
||||
|
||||
@@ -160,7 +160,7 @@ protected:
|
||||
basic_ios();
|
||||
void init(basic_streambuf<charT,traits>* sb);
|
||||
void move(basic_ios& rhs);
|
||||
void swap(basic_ios& rhs);
|
||||
void swap(basic_ios& rhs) noexcept;
|
||||
void set_rdbuf(basic_streambuf<charT, traits>* sb);
|
||||
};
|
||||
|
||||
@@ -216,7 +216,9 @@ storage-class-specifier const error_category& iostream_category;
|
||||
#include <__locale>
|
||||
#include <system_error>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -225,7 +227,7 @@ typedef ptrdiff_t streamsize;
|
||||
class _LIBCPP_VISIBLE ios_base
|
||||
{
|
||||
public:
|
||||
class failure;
|
||||
class _LIBCPP_VISIBLE failure;
|
||||
|
||||
typedef unsigned int fmtflags;
|
||||
static const fmtflags boolalpha = 0x0001;
|
||||
@@ -269,7 +271,7 @@ public:
|
||||
typedef _VSTD::streamoff streamoff;
|
||||
typedef _VSTD::streampos streampos;
|
||||
|
||||
class Init;
|
||||
class _LIBCPP_VISIBLE Init;
|
||||
|
||||
// 27.5.2.2 fmtflags state:
|
||||
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
|
||||
@@ -340,7 +342,7 @@ protected:
|
||||
void __call_callbacks(event);
|
||||
void copyfmt(const ios_base&);
|
||||
void move(ios_base&);
|
||||
void swap(ios_base&);
|
||||
void swap(ios_base&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void set_rdbuf(void* __sb)
|
||||
@@ -371,21 +373,19 @@ private:
|
||||
};
|
||||
|
||||
//enum class io_errc
|
||||
struct _LIBCPP_VISIBLE io_errc
|
||||
_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
|
||||
{
|
||||
enum _ {
|
||||
stream = 1
|
||||
};
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
|
||||
};
|
||||
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
|
||||
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::__lx> : public true_type { };
|
||||
#endif
|
||||
|
||||
_LIBCPP_VISIBLE
|
||||
const error_category& iostream_category();
|
||||
@@ -572,7 +572,8 @@ public:
|
||||
typedef typename traits_type::pos_type pos_type;
|
||||
typedef typename traits_type::off_type off_type;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE // explicit
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return !fail();}
|
||||
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
|
||||
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
|
||||
@@ -631,12 +632,12 @@ protected:
|
||||
void move(basic_ios&& __rhs) {move(__rhs);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ios& __rhs);
|
||||
void swap(basic_ios& __rhs) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
|
||||
private:
|
||||
basic_ostream<char_type, traits_type>* __tie_;
|
||||
char_type __fill_;
|
||||
mutable int_type __fill_;
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -658,7 +659,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
ios_base::init(__sb);
|
||||
__tie_ = 0;
|
||||
__fill_ = widen(' ');
|
||||
__fill_ = traits_type::eof();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@@ -730,6 +731,8 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
_CharT
|
||||
basic_ios<_CharT, _Traits>::fill() const
|
||||
{
|
||||
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
|
||||
__fill_ = widen(' ');
|
||||
return __fill_;
|
||||
}
|
||||
|
||||
@@ -773,7 +776,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
|
||||
template <class _CharT, class _Traits>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
|
||||
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
|
||||
{
|
||||
ios_base::swap(__rhs);
|
||||
_VSTD::swap(__tie_, __rhs.__tie_);
|
||||
|
@@ -89,11 +89,13 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
|
||||
#include <__config>
|
||||
#include <wchar.h> // for mbstate_t
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
class ios_base;
|
||||
class _LIBCPP_VISIBLE ios_base;
|
||||
|
||||
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
|
||||
template<class _Tp> class _LIBCPP_VISIBLE allocator;
|
||||
|
@@ -40,7 +40,9 @@ extern wostream wclog;
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
110
include/istream
110
include/istream
@@ -155,7 +155,11 @@ template <class charT, class traits, class T>
|
||||
#include <__config>
|
||||
#include <ostream>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -190,7 +194,7 @@ protected:
|
||||
public:
|
||||
|
||||
// 27.7.1.1.3 Prefix/suffix:
|
||||
class sentry;
|
||||
class _LIBCPP_VISIBLE sentry;
|
||||
|
||||
// 27.7.1.2 Formatted input:
|
||||
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
|
||||
@@ -252,7 +256,7 @@ public:
|
||||
// ~sentry() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return __ok_;}
|
||||
};
|
||||
|
||||
@@ -267,10 +271,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
|
||||
__is.tie()->flush();
|
||||
if (!__noskipws && (__is.flags() & ios_base::skipws))
|
||||
{
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
|
||||
_I __i(__is);
|
||||
_I __eof;
|
||||
_Ip __i(__is);
|
||||
_Ip __eof;
|
||||
for (; __i != __eof; ++__i)
|
||||
if (!__ct.is(__ct.space, *__i))
|
||||
break;
|
||||
@@ -338,10 +342,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -365,10 +369,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -392,10 +396,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -419,10 +423,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -446,10 +450,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -473,10 +477,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -500,10 +504,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -527,10 +531,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -554,10 +558,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -581,10 +585,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -608,10 +612,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
|
||||
this->setstate(__err);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
@@ -635,11 +639,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
long __temp;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||
if (__temp < numeric_limits<short>::min())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
@@ -675,11 +679,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef istreambuf_iterator<char_type, traits_type> _I;
|
||||
typedef num_get<char_type, _I> _F;
|
||||
typedef istreambuf_iterator<char_type, traits_type> _Ip;
|
||||
typedef num_get<char_type, _Ip> _Fp;
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
long __temp;
|
||||
use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
|
||||
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
|
||||
if (__temp < numeric_limits<int>::min())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
@@ -1141,7 +1145,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
|
||||
}
|
||||
++__gc_;
|
||||
char_type __ch = traits_type::to_char_type(__i);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1157,7 +1161,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
|
||||
}
|
||||
++__gc_;
|
||||
char_type __ch = traits_type::to_char_type(__i);
|
||||
if (traits_type::eq(__ch, __dlm))
|
||||
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1185,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek()
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
__r = this->rdbuf()->sgetc();
|
||||
if (traits_type::eq_int_type(__r, traits_type::eof()))
|
||||
this->setstate(ios_base::eofbit);
|
||||
}
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@@ -1208,7 +1216,6 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
ios_base::iostate __err = ios_base::goodbit;
|
||||
for (; __gc_ < __n; ++__gc_)
|
||||
{
|
||||
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
|
||||
@@ -1260,6 +1267,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
@@ -1287,6 +1295,7 @@ basic_istream<_CharT, _Traits>::unget()
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
{
|
||||
@@ -1365,6 +1374,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
this->clear(this->rdstate() & ~ios_base::eofbit);
|
||||
sentry __sen(*this, true);
|
||||
if (__sen)
|
||||
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
|
||||
@@ -1700,9 +1710,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
|
||||
return __is;
|
||||
}
|
||||
|
||||
extern template class basic_istream<char>;
|
||||
extern template class basic_istream<wchar_t>;
|
||||
extern template class basic_iostream<char>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
186
include/iterator
186
include/iterator
@@ -263,10 +263,10 @@ public:
|
||||
typedef basic_streambuf<charT,traits> streambuf_type;
|
||||
typedef basic_istream<charT,traits> istream_type;
|
||||
|
||||
istreambuf_iterator() throw();
|
||||
istreambuf_iterator(istream_type& s) throw();
|
||||
istreambuf_iterator(streambuf_type* s) throw();
|
||||
istreambuf_iterator(a-private-type) throw();
|
||||
istreambuf_iterator() noexcept;
|
||||
istreambuf_iterator(istream_type& s) noexcept;
|
||||
istreambuf_iterator(streambuf_type* s) noexcept;
|
||||
istreambuf_iterator(a-private-type) noexcept;
|
||||
|
||||
charT operator*() const;
|
||||
pointer operator->() const;
|
||||
@@ -293,13 +293,13 @@ public:
|
||||
typedef basic_streambuf<charT,traits> streambuf_type;
|
||||
typedef basic_ostream<charT,traits> ostream_type;
|
||||
|
||||
ostreambuf_iterator(ostream_type& s) throw();
|
||||
ostreambuf_iterator(streambuf_type* s) throw();
|
||||
ostreambuf_iterator(ostream_type& s) noexcept;
|
||||
ostreambuf_iterator(streambuf_type* s) noexcept;
|
||||
ostreambuf_iterator& operator=(charT c);
|
||||
ostreambuf_iterator& operator*();
|
||||
ostreambuf_iterator& operator++();
|
||||
ostreambuf_iterator& operator++(int);
|
||||
bool failed() const throw();
|
||||
bool failed() const noexcept;
|
||||
};
|
||||
|
||||
template <class C> auto begin(C& c) -> decltype(c.begin());
|
||||
@@ -321,7 +321,9 @@ template <class T, size_t N> T* end(T (&array)[N]);
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -335,7 +337,7 @@ template <class _Tp>
|
||||
struct __has_iterator_category
|
||||
{
|
||||
private:
|
||||
struct __two {char _; char __;};
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::iterator_category* = 0);
|
||||
public:
|
||||
@@ -624,11 +626,11 @@ public:
|
||||
typedef _Container container_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{container->push_back(__value); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
|
||||
{container->push_back(__value_); return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{container->push_back(_VSTD::move(__value)); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
|
||||
{container->push_back(_VSTD::move(__value_)); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
|
||||
@@ -657,11 +659,11 @@ public:
|
||||
typedef _Container container_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{container->push_front(__value); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
|
||||
{container->push_front(__value_); return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{container->push_front(_VSTD::move(__value)); return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
|
||||
{container->push_front(_VSTD::move(__value_)); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
|
||||
@@ -692,11 +694,11 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
|
||||
: container(&__x), iter(__i) {}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
|
||||
{iter = container->insert(iter, __value); ++iter; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
|
||||
{iter = container->insert(iter, __value_); ++iter; return *this;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
|
||||
{iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
|
||||
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
|
||||
@@ -767,9 +769,9 @@ public:
|
||||
: __out_stream_(&__s), __delim_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
|
||||
: __out_stream_(&__s), __delim_(__delimiter) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value)
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
|
||||
{
|
||||
*__out_stream_ << __value;
|
||||
*__out_stream_ << __value_;
|
||||
if (__delim_)
|
||||
*__out_stream_ << __delim_;
|
||||
return *this;
|
||||
@@ -813,15 +815,16 @@ private:
|
||||
__sbuf_ = 0;
|
||||
}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw()
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
|
||||
: __sbuf_(__s.rdbuf()) {__test_for_eof();}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw()
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
|
||||
: __sbuf_(__s) {__test_for_eof();}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT
|
||||
: __sbuf_(__p.__sbuf_) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type operator*() const
|
||||
{return static_cast<char_type>(__sbuf_->sgetc());}
|
||||
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
|
||||
{
|
||||
@@ -864,9 +867,9 @@ public:
|
||||
private:
|
||||
streambuf_type* __sbuf_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw()
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
|
||||
: __sbuf_(__s.rdbuf()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw()
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
|
||||
: __sbuf_(__s) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
|
||||
{
|
||||
@@ -877,7 +880,15 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
|
||||
|
||||
template <class _Ch, class _Tr>
|
||||
friend
|
||||
_LIBCPP_HIDDEN
|
||||
ostreambuf_iterator<_Ch, _Tr>
|
||||
__pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
|
||||
const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
|
||||
ios_base& __iob, _Ch __fl);
|
||||
};
|
||||
|
||||
template <class _Iter>
|
||||
@@ -1006,43 +1017,52 @@ make_move_iterator(const _Iter& __i)
|
||||
template <class _Iter> class __wrap_iter;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
|
||||
|
||||
template <class _Iter>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__wrap_iter<_Iter>
|
||||
operator+(typename __wrap_iter<_Iter>::difference_type, __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);
|
||||
template <class _I, class _O> _O move(_I, _I, _O);
|
||||
template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@@ -1210,9 +1230,9 @@ private:
|
||||
__wrap_iter<_Iter1>
|
||||
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
|
||||
|
||||
template <class _I, class _O> friend _O copy(_I, _I, _O);
|
||||
template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
|
||||
template <class _I, class _O> friend _O move(_I, _I, _O);
|
||||
template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
|
||||
|
||||
template <class _Tp>
|
||||
@@ -1281,6 +1301,38 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
|
||||
{
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
|
||||
{
|
||||
return __y < __x;
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
|
||||
{
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <class _Iter1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
|
||||
{
|
||||
return !(__y < __x);
|
||||
}
|
||||
|
||||
template <class _Iter1, class _Iter2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
@@ -1310,34 +1362,42 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
|
||||
template <class _Container, class _Iter> class __debug_iter;
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter1, class _Iter2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __debug_iter<_Container, _Iter1>::difference_type
|
||||
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
|
||||
|
||||
template <class _Container, class _Iter>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__debug_iter<_Container, _Iter>
|
||||
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
|
||||
|
||||
@@ -1713,88 +1773,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
begin(_C& __c) -> decltype(__c.begin())
|
||||
begin(_Cp& __c) -> decltype(__c.begin())
|
||||
{
|
||||
return __c.begin();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
begin(const _C& __c) -> decltype(__c.begin())
|
||||
begin(const _Cp& __c) -> decltype(__c.begin())
|
||||
{
|
||||
return __c.begin();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
end(_C& __c) -> decltype(__c.end())
|
||||
end(_Cp& __c) -> decltype(__c.end())
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
auto
|
||||
end(const _C& __c) -> decltype(__c.end())
|
||||
end(const _Cp& __c) -> decltype(__c.end())
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::iterator
|
||||
begin(_C& __c)
|
||||
typename _Cp::iterator
|
||||
begin(_Cp& __c)
|
||||
{
|
||||
return __c.begin();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::const_iterator
|
||||
begin(const _C& __c)
|
||||
typename _Cp::const_iterator
|
||||
begin(const _Cp& __c)
|
||||
{
|
||||
return __c.begin();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::iterator
|
||||
end(_C& __c)
|
||||
typename _Cp::iterator
|
||||
end(_Cp& __c)
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
template <class _C>
|
||||
template <class _Cp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename _C::const_iterator
|
||||
end(const _C& __c)
|
||||
typename _Cp::const_iterator
|
||||
end(const _Cp& __c)
|
||||
{
|
||||
return __c.end();
|
||||
}
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
|
||||
|
||||
template <class _T, size_t _N>
|
||||
template <class _Tp, size_t _Np>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_T*
|
||||
begin(_T (&__array)[_N])
|
||||
_Tp*
|
||||
begin(_Tp (&__array)[_Np])
|
||||
{
|
||||
return __array;
|
||||
}
|
||||
|
||||
template <class _T, size_t _N>
|
||||
template <class _Tp, size_t _Np>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_T*
|
||||
end(_T (&__array)[_N])
|
||||
_Tp*
|
||||
end(_Tp (&__array)[_Np])
|
||||
{
|
||||
return __array + _N;
|
||||
return __array + _Np;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
916
include/limits
916
include/limits
File diff suppressed because it is too large
Load Diff
68
include/list
68
include/list
@@ -176,7 +176,11 @@ template <class T, class Alloc>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -209,9 +213,9 @@ struct __list_node
|
||||
_Tp __value_;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc> class list;
|
||||
template <class _Tp, class _Alloc> class _LIBCPP_VISIBLE list;
|
||||
template <class _Tp, class _Alloc> class __list_imp;
|
||||
template <class _Tp, class _VoidPtr> class __list_const_iterator;
|
||||
template <class _Tp, class _VoidPtr> class _LIBCPP_VISIBLE __list_const_iterator;
|
||||
|
||||
template <class _Tp, class _VoidPtr>
|
||||
class _LIBCPP_VISIBLE __list_iterator
|
||||
@@ -1191,8 +1195,8 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
|
||||
splice(end(), __c);
|
||||
else
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
assign(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1215,8 +1219,8 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
|
||||
{
|
||||
if (base::__node_alloc() != __c.__node_alloc())
|
||||
{
|
||||
typedef move_iterator<iterator> _I;
|
||||
assign(_I(__c.begin()), _I(__c.end()));
|
||||
typedef move_iterator<iterator> _Ip;
|
||||
assign(_Ip(__c.begin()), _Ip(__c.end()));
|
||||
}
|
||||
else
|
||||
__move_assign(__c, true_type());
|
||||
@@ -1282,8 +1286,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
||||
" referring to this list");
|
||||
#endif
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
@@ -1307,8 +1311,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
{
|
||||
size_type __ds = 0;
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
@@ -1375,8 +1379,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
{
|
||||
size_type __ds = 0;
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
++__ds;
|
||||
@@ -1430,8 +1434,8 @@ void
|
||||
list<_Tp, _Alloc>::push_front(const value_type& __x)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1443,8 +1447,8 @@ void
|
||||
list<_Tp, _Alloc>::push_back(const value_type& __x)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1458,8 +1462,8 @@ void
|
||||
list<_Tp, _Alloc>::push_front(value_type&& __x)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1471,8 +1475,8 @@ void
|
||||
list<_Tp, _Alloc>::push_back(value_type&& __x)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1487,8 +1491,8 @@ void
|
||||
list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1501,8 +1505,8 @@ void
|
||||
list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
|
||||
++base::__sz();
|
||||
@@ -1515,8 +1519,8 @@ typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
@@ -1540,8 +1544,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
" referring to this list");
|
||||
#endif
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
|
||||
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
|
||||
@@ -1704,8 +1708,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__n -= base::__sz();
|
||||
size_type __ds = 0;
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||
++__ds;
|
||||
@@ -1763,8 +1767,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
__n -= base::__sz();
|
||||
size_type __ds = 0;
|
||||
__node_allocator& __na = base::__node_alloc();
|
||||
typedef __allocator_destructor<__node_allocator> _D;
|
||||
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
|
||||
typedef __allocator_destructor<__node_allocator> _Dp;
|
||||
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
|
||||
__hold->__prev_ = 0;
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
|
264
include/locale
264
include/locale
@@ -192,7 +192,11 @@ template <class charT> class messages_byname;
|
||||
#include <nl_types.h>
|
||||
#endif // !_WIN32
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -207,7 +211,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
|
||||
#ifndef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
#endif
|
||||
|
||||
// OSX has nice foo_l() functions that let you turn off use of the global
|
||||
// locale. Linux, not so much. The following functions avoid the locale when
|
||||
@@ -429,7 +435,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
bool __case_sensitive = true)
|
||||
{
|
||||
typedef typename iterator_traits<_InputIterator>::value_type _CharT;
|
||||
size_t __nkw = _VSTD::distance(__kb, __ke);
|
||||
size_t __nkw = static_cast<size_t>(_VSTD::distance(__kb, __ke));
|
||||
const unsigned char __doesnt_match = '\0';
|
||||
const unsigned char __might_match = '\1';
|
||||
const unsigned char __does_match = '\2';
|
||||
@@ -594,7 +600,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
|
||||
__dc = 0;
|
||||
return 0;
|
||||
}
|
||||
if (__ct == __thousands_sep && __grouping.size() != 0)
|
||||
if (__grouping.size() != 0 && __ct == __thousands_sep)
|
||||
{
|
||||
if (__g_end-__g < __num_get_buf_sz)
|
||||
{
|
||||
@@ -661,6 +667,15 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
|
||||
if (__f >= 32)
|
||||
return -1;
|
||||
char __x = __src[__f];
|
||||
if (__x == '-' || __x == '+')
|
||||
{
|
||||
if (__a_end == __a || (__a_end[-1] & 0xDF) == __exp)
|
||||
{
|
||||
*__a_end++ = __x;
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (__a_end-__a < __num_get_buf_sz - 1)
|
||||
*__a_end++ = __x;
|
||||
if (__x == 'x' || __x == 'X')
|
||||
@@ -677,8 +692,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern template class __num_get<char>;
|
||||
extern template class __num_get<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct __num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct __num_get<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_VISIBLE num_get
|
||||
@@ -1271,7 +1286,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
int __base = 16;
|
||||
// Stage 2
|
||||
char_type __atoms[26];
|
||||
char_type __thousands_sep;
|
||||
char_type __thousands_sep = 0;
|
||||
string __grouping;
|
||||
use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
|
||||
__num_get_base::__src + 26, __atoms);
|
||||
@@ -1299,8 +1314,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
extern template class num_get<char>;
|
||||
extern template class num_get<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class num_get<wchar_t>)
|
||||
|
||||
struct __num_put_base
|
||||
{
|
||||
@@ -1449,8 +1464,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
__op = __ob + (__np - __nb);
|
||||
}
|
||||
|
||||
extern template class __num_put<char>;
|
||||
extern template class __num_put<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct __num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct __num_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_VISIBLE num_put
|
||||
@@ -1572,6 +1587,52 @@ __pad_and_output(_OutputIterator __s,
|
||||
return __s;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_HIDDEN
|
||||
ostreambuf_iterator<_CharT, _Traits>
|
||||
__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
|
||||
const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
|
||||
ios_base& __iob, _CharT __fl)
|
||||
{
|
||||
if (__s.__sbuf_ == nullptr)
|
||||
return __s;
|
||||
streamsize __sz = __oe - __ob;
|
||||
streamsize __ns = __iob.width();
|
||||
if (__ns > __sz)
|
||||
__ns -= __sz;
|
||||
else
|
||||
__ns = 0;
|
||||
streamsize __np = __op - __ob;
|
||||
if (__np > 0)
|
||||
{
|
||||
if (__s.__sbuf_->sputn(__ob, __np) != __np)
|
||||
{
|
||||
__s.__sbuf_ = nullptr;
|
||||
return __s;
|
||||
}
|
||||
}
|
||||
if (__ns > 0)
|
||||
{
|
||||
basic_string<_CharT, _Traits> __sp(__ns, __fl);
|
||||
if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns)
|
||||
{
|
||||
__s.__sbuf_ = nullptr;
|
||||
return __s;
|
||||
}
|
||||
}
|
||||
__np = __oe - __op;
|
||||
if (__np > 0)
|
||||
{
|
||||
if (__s.__sbuf_->sputn(__op, __np) != __np)
|
||||
{
|
||||
__s.__sbuf_ = nullptr;
|
||||
return __s;
|
||||
}
|
||||
}
|
||||
__iob.width(0);
|
||||
return __s;
|
||||
}
|
||||
|
||||
template <class _CharT, class _OutputIterator>
|
||||
_OutputIterator
|
||||
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
@@ -1762,7 +1823,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
unique_ptr<char_type, void(*)(void*)> __obh(0, free);
|
||||
if (__nb != __nar)
|
||||
{
|
||||
__ob = (char_type*)malloc((2*__nc)*sizeof(char_type));
|
||||
__ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
|
||||
if (__ob == 0)
|
||||
__throw_bad_alloc();
|
||||
__obh.reset(__ob);
|
||||
@@ -1831,7 +1892,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
unique_ptr<char_type, void(*)(void*)> __obh(0, free);
|
||||
if (__nb != __nar)
|
||||
{
|
||||
__ob = (char_type*)malloc((2*__nc)*sizeof(char_type));
|
||||
__ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
|
||||
if (__ob == 0)
|
||||
__throw_bad_alloc();
|
||||
__obh.reset(__ob);
|
||||
@@ -1877,8 +1938,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
|
||||
}
|
||||
|
||||
extern template class num_put<char>;
|
||||
extern template class num_put<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class num_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator>
|
||||
_LIBCPP_HIDDEN
|
||||
@@ -2098,7 +2159,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
|
||||
{
|
||||
// Note: ignoring case comes from the POSIX strptime spec
|
||||
const string_type* __wk = this->__weeks();
|
||||
int __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
|
||||
if (__i < 14)
|
||||
__w = __i % 7;
|
||||
}
|
||||
@@ -2112,7 +2173,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
|
||||
{
|
||||
// Note: ignoring case comes from the POSIX strptime spec
|
||||
const string_type* __month = this->__months();
|
||||
int __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
|
||||
if (__i < 24)
|
||||
__m = __i % 12;
|
||||
}
|
||||
@@ -2284,7 +2345,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
|
||||
__err |= ios_base::failbit;
|
||||
return;
|
||||
}
|
||||
int __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
|
||||
if (__i == 0 && __h == 12)
|
||||
__h = 0;
|
||||
else if (__i == 1 && __h < 12)
|
||||
@@ -2393,7 +2454,6 @@ time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
|
||||
ios_base::iostate& __err,
|
||||
tm* __tm) const
|
||||
{
|
||||
const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
|
||||
const string_type& __fmt = this->__x();
|
||||
return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
|
||||
}
|
||||
@@ -2456,8 +2516,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
case 'c':
|
||||
{
|
||||
const string_type& __fmt = this->__c();
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
|
||||
const string_type& __fm = this->__c();
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
@@ -2466,14 +2526,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
case 'D':
|
||||
{
|
||||
const char_type __fmt[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[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]));
|
||||
const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
|
||||
}
|
||||
break;
|
||||
case 'H':
|
||||
@@ -2500,14 +2560,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
case 'r':
|
||||
{
|
||||
const char_type __fmt[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
|
||||
}
|
||||
break;
|
||||
case 'R':
|
||||
{
|
||||
const char_type __fmt[] = {'%', 'H', ':', '%', 'M'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
|
||||
}
|
||||
break;
|
||||
case 'S':
|
||||
@@ -2515,8 +2575,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
break;
|
||||
case 'T':
|
||||
{
|
||||
const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
|
||||
const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
|
||||
}
|
||||
break;
|
||||
case 'w':
|
||||
@@ -2526,8 +2586,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return do_get_date(__b, __e, __iob, __err, __tm);
|
||||
case 'X':
|
||||
{
|
||||
const string_type& __fmt = this->__X();
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
|
||||
const string_type& __fm = this->__X();
|
||||
__b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
@@ -2545,8 +2605,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
extern template class time_get<char>;
|
||||
extern template class time_get<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_get<wchar_t>)
|
||||
|
||||
class __time_get
|
||||
{
|
||||
@@ -2628,8 +2688,8 @@ private:
|
||||
virtual const string_type& __X() const {return this->__X_;}
|
||||
};
|
||||
|
||||
extern template class time_get_byname<char>;
|
||||
extern template class time_get_byname<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_get_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_get_byname<wchar_t>)
|
||||
|
||||
class __time_put
|
||||
{
|
||||
@@ -2730,7 +2790,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
|
||||
|
||||
template <class _CharT, class _OutputIterator>
|
||||
_OutputIterator
|
||||
time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
|
||||
char_type, const tm* __tm,
|
||||
char __fmt, char __mod) const
|
||||
{
|
||||
@@ -2741,8 +2801,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
return _VSTD::copy(__nb, __ne, __s);
|
||||
}
|
||||
|
||||
extern template class time_put<char>;
|
||||
extern template class time_put<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_VISIBLE time_put_byname
|
||||
@@ -2762,8 +2822,8 @@ protected:
|
||||
~time_put_byname() {}
|
||||
};
|
||||
|
||||
extern template class time_put_byname<char>;
|
||||
extern template class time_put_byname<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_put_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class time_put_byname<wchar_t>)
|
||||
|
||||
// money_base
|
||||
|
||||
@@ -2816,19 +2876,23 @@ protected:
|
||||
virtual string_type do_negative_sign() const {return string_type(1, '-');}
|
||||
virtual int do_frac_digits() const {return 0;}
|
||||
virtual pattern do_pos_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
{pattern __p = {{symbol, sign, none, value}}; return __p;}
|
||||
virtual pattern do_neg_format() const
|
||||
{pattern __p = {symbol, sign, none, value}; return __p;}
|
||||
{pattern __p = {{symbol, sign, none, value}}; return __p;}
|
||||
};
|
||||
|
||||
template <class _CharT, bool _International>
|
||||
locale::id
|
||||
moneypunct<_CharT, _International>::id;
|
||||
|
||||
extern template class moneypunct<char, false>;
|
||||
extern template class moneypunct<char, true>;
|
||||
extern template class moneypunct<wchar_t, false>;
|
||||
extern template class moneypunct<wchar_t, true>;
|
||||
template <class _CharT, bool _International>
|
||||
const bool
|
||||
moneypunct<_CharT, _International>::intl;
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct<wchar_t, true>)
|
||||
|
||||
// moneypunct_byname
|
||||
|
||||
@@ -2882,10 +2946,10 @@ template<> void moneypunct_byname<char, true>::init(const char*);
|
||||
template<> void moneypunct_byname<wchar_t, false>::init(const char*);
|
||||
template<> void moneypunct_byname<wchar_t, true>::init(const char*);
|
||||
|
||||
extern template class moneypunct_byname<char, false>;
|
||||
extern template class moneypunct_byname<char, true>;
|
||||
extern template class moneypunct_byname<wchar_t, false>;
|
||||
extern template class moneypunct_byname<wchar_t, true>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class moneypunct_byname<wchar_t, true>)
|
||||
|
||||
// money_get
|
||||
|
||||
@@ -2941,8 +3005,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
|
||||
}
|
||||
}
|
||||
|
||||
extern template class __money_get<char>;
|
||||
extern template class __money_get<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class __money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class __money_get<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_VISIBLE money_get
|
||||
@@ -3007,10 +3071,10 @@ void
|
||||
__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
|
||||
{
|
||||
bool __owns = __b.get_deleter() != __do_nothing;
|
||||
size_t __cur_cap = (__e-__b.get()) * sizeof(_Tp);
|
||||
size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
|
||||
size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
|
||||
2 * __cur_cap : numeric_limits<size_t>::max();
|
||||
size_t __n_off = __n - __b.get();
|
||||
size_t __n_off = static_cast<size_t>(__n - __b.get());
|
||||
_Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
|
||||
if (__t == 0)
|
||||
__throw_bad_alloc();
|
||||
@@ -3046,6 +3110,9 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
||||
string_type __sym;
|
||||
string_type __psn;
|
||||
string_type __nsn;
|
||||
// Capture the spaces read into money_base::{space,none} so they
|
||||
// can be compared to initial spaces in __sym.
|
||||
string_type __spaces;
|
||||
int __fd;
|
||||
__money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
|
||||
__sym, __psn, __nsn, __fd);
|
||||
@@ -3059,7 +3126,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
||||
if (__p != 3)
|
||||
{
|
||||
if (__ct.is(ctype_base::space, *__b))
|
||||
++__b;
|
||||
__spaces.push_back(*__b++);
|
||||
else
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
@@ -3071,7 +3138,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
||||
if (__p != 3)
|
||||
{
|
||||
while (__b != __e && __ct.is(ctype_base::space, *__b))
|
||||
++__b;
|
||||
__spaces.push_back(*__b++);
|
||||
}
|
||||
break;
|
||||
case money_base::sign:
|
||||
@@ -3129,10 +3196,31 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
|
||||
bool __sb = __flags & ios_base::showbase;
|
||||
if (__sb || __more_needed)
|
||||
{
|
||||
ios_base::iostate __et = ios_base::goodbit;
|
||||
string_type* __k = __scan_keyword(__b, __e, &__sym, &__sym+1,
|
||||
__ct, __et);
|
||||
if (__sb && __k != &__sym)
|
||||
typename string_type::const_iterator __sym_space_end = __sym.begin();
|
||||
if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
|
||||
__pat.field[__p - 1] == money_base::space)) {
|
||||
// Match spaces we've already read against spaces at
|
||||
// the beginning of __sym.
|
||||
while (__sym_space_end != __sym.end() &&
|
||||
__ct.is(ctype_base::space, *__sym_space_end))
|
||||
++__sym_space_end;
|
||||
const size_t __num_spaces = __sym_space_end - __sym.begin();
|
||||
if (__num_spaces > __spaces.size() ||
|
||||
!equal(__spaces.end() - __num_spaces, __spaces.end(),
|
||||
__sym.begin())) {
|
||||
// No match. Put __sym_space_end back at the
|
||||
// beginning of __sym, which will prevent a
|
||||
// match in the next loop.
|
||||
__sym_space_end = __sym.begin();
|
||||
}
|
||||
}
|
||||
typename string_type::const_iterator __sym_curr_char = __sym_space_end;
|
||||
while (__sym_curr_char != __sym.end() && __b != __e &&
|
||||
*__b == *__sym_curr_char) {
|
||||
++__b;
|
||||
++__sym_curr_char;
|
||||
}
|
||||
if (__sb && __sym_curr_char != __sym.end())
|
||||
{
|
||||
__err |= ios_base::failbit;
|
||||
return false;
|
||||
@@ -3228,7 +3316,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
ios_base::iostate& __err,
|
||||
long double& __v) const
|
||||
{
|
||||
const unsigned __bz = 100;
|
||||
const int __bz = 100;
|
||||
char_type __wbuf[__bz];
|
||||
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
|
||||
char_type* __wn;
|
||||
@@ -3247,7 +3335,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
unique_ptr<char, void(*)(void*)> __h(0, free);
|
||||
if (__wn - __wb.get() > __bz-2)
|
||||
{
|
||||
__h.reset((char*)malloc(__wn - __wb.get() + 2));
|
||||
__h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
|
||||
if (__h.get() == 0)
|
||||
__throw_bad_alloc();
|
||||
__nc = __h.get();
|
||||
@@ -3272,7 +3360,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
ios_base::iostate& __err,
|
||||
string_type& __v) const
|
||||
{
|
||||
const unsigned __bz = 100;
|
||||
const int __bz = 100;
|
||||
char_type __wbuf[__bz];
|
||||
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
|
||||
char_type* __wn;
|
||||
@@ -3298,8 +3386,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
extern template class money_get<char>;
|
||||
extern template class money_get<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class money_get<wchar_t>)
|
||||
|
||||
// money_put
|
||||
|
||||
@@ -3473,8 +3561,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
__mi = __mb;
|
||||
}
|
||||
|
||||
extern template class __money_put<char>;
|
||||
extern template class __money_put<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class __money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class __money_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_VISIBLE money_put
|
||||
@@ -3532,14 +3620,14 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
char* __bb = __buf;
|
||||
char_type __digits[__bs];
|
||||
char_type* __db = __digits;
|
||||
size_t __n = snprintf(__bb, __bs, "%.0Lf", __units);
|
||||
size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
|
||||
unique_ptr<char, void(*)(void*)> __hn(0, free);
|
||||
unique_ptr<char_type, void(*)(void*)> __hd(0, free);
|
||||
// secure memory for digit storage
|
||||
if (__n > __bs-1)
|
||||
{
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
__n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
|
||||
__n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
|
||||
#else
|
||||
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
|
||||
#endif
|
||||
@@ -3547,7 +3635,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
__throw_bad_alloc();
|
||||
__hn.reset(__bb);
|
||||
__hd.reset((char_type*)malloc(__n * sizeof(char_type)));
|
||||
if (__hd == 0)
|
||||
if (__hd == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__db = __hd.get();
|
||||
}
|
||||
@@ -3569,8 +3657,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
char_type* __mb = __mbuf;
|
||||
unique_ptr<char_type, void(*)(void*)> __hw(0, free);
|
||||
size_t __exn = static_cast<int>(__n) > __fd ?
|
||||
(__n - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1
|
||||
: __sn.size() + __sym.size() + __fd + 2;
|
||||
(__n - static_cast<size_t>(__fd)) * 2 + __sn.size() +
|
||||
__sym.size() + static_cast<size_t>(__fd) + 1
|
||||
: __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
|
||||
if (__exn > __bs)
|
||||
{
|
||||
__hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
|
||||
@@ -3609,9 +3698,10 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
char_type __mbuf[100];
|
||||
char_type* __mb = __mbuf;
|
||||
unique_ptr<char_type, void(*)(void*)> __h(0, free);
|
||||
size_t __exn = __digits.size() > __fd ?
|
||||
(__digits.size() - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1
|
||||
: __sn.size() + __sym.size() + __fd + 2;
|
||||
size_t __exn = static_cast<int>(__digits.size()) > __fd ?
|
||||
(__digits.size() - static_cast<size_t>(__fd)) * 2 +
|
||||
__sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
|
||||
: __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
|
||||
if (__exn > 100)
|
||||
{
|
||||
__h.reset((char_type*)malloc(__exn * sizeof(char_type)));
|
||||
@@ -3628,8 +3718,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
|
||||
}
|
||||
|
||||
extern template class money_put<char>;
|
||||
extern template class money_put<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class money_put<wchar_t>)
|
||||
|
||||
// messages
|
||||
|
||||
@@ -3738,8 +3828,8 @@ messages<_CharT>::do_close(catalog __c) const
|
||||
#endif // !_WIN32
|
||||
}
|
||||
|
||||
extern template class messages<char>;
|
||||
extern template class messages<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class messages<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class messages<wchar_t>)
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_VISIBLE messages_byname
|
||||
@@ -3762,8 +3852,8 @@ protected:
|
||||
~messages_byname() {}
|
||||
};
|
||||
|
||||
extern template class messages_byname<char>;
|
||||
extern template class messages_byname<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class messages_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class messages_byname<wchar_t>)
|
||||
|
||||
template<class _Codecvt, class _Elem = wchar_t,
|
||||
class _Wide_alloc = allocator<_Elem>,
|
||||
@@ -3879,7 +3969,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
if (__cvtptr_ != nullptr)
|
||||
{
|
||||
wide_string __ws(2*(__frm_end - __frm), _Elem());
|
||||
__ws.resize(__ws.capacity());
|
||||
if (__frm != __frm_end)
|
||||
__ws.resize(__ws.capacity());
|
||||
codecvt_base::result __r = codecvt_base::ok;
|
||||
state_type __st = __cvtstate_;
|
||||
if (__frm != __frm_end)
|
||||
@@ -3939,7 +4030,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
if (__cvtptr_ != nullptr)
|
||||
{
|
||||
byte_string __bs(2*(__frm_end - __frm), char());
|
||||
__bs.resize(__bs.capacity());
|
||||
if (__frm != __frm_end)
|
||||
__bs.resize(__bs.capacity());
|
||||
codecvt_base::result __r = codecvt_base::ok;
|
||||
state_type __st = __cvtstate_;
|
||||
if (__frm != __frm_end)
|
||||
@@ -4001,9 +4093,9 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
|
||||
}
|
||||
else if (__r == codecvt_base::partial)
|
||||
{
|
||||
ptrdiff_t __s = __to_nxt - &__bs[0];
|
||||
__bs.resize(2 * __s);
|
||||
__to = &__bs[0] + __s;
|
||||
ptrdiff_t __sp = __to_nxt - &__bs[0];
|
||||
__bs.resize(2 * __sp);
|
||||
__to = &__bs[0] + __sp;
|
||||
__to_end = &__bs[0] + __bs.size();
|
||||
}
|
||||
} while (__r == codecvt_base::partial);
|
||||
|
323
include/map
323
include/map
@@ -375,15 +375,21 @@ swap(multimap<Key, T, Compare, Allocator>& x,
|
||||
#include <functional>
|
||||
#include <initializer_list>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value>
|
||||
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Compare)
|
||||
#endif
|
||||
>
|
||||
class __map_value_compare
|
||||
: private _Compare
|
||||
{
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
|
||||
typedef pair<const _Key, _Tp> _CP;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -400,25 +406,25 @@ public:
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _P& __y) const
|
||||
bool operator()(const _CP& __x, const _Pp& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _Key& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _CP& __y) const
|
||||
bool operator()(const _Pp& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _P& __y) const
|
||||
bool operator()(const _Pp& __x, const _Pp& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _Key& __y) const
|
||||
bool operator()(const _Pp& __x, const _Key& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _P& __y) const
|
||||
bool operator()(const _Key& __x, const _Pp& __y) const
|
||||
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Key& __y) const
|
||||
@@ -430,7 +436,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
|
||||
{
|
||||
_Compare comp;
|
||||
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
|
||||
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
|
||||
typedef pair<const _Key, _Tp> _CP;
|
||||
|
||||
public:
|
||||
@@ -449,25 +455,25 @@ public:
|
||||
bool operator()(const _CP& __x, const _CP& __y) const
|
||||
{return comp(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _P& __y) const
|
||||
bool operator()(const _CP& __x, const _Pp& __y) const
|
||||
{return comp(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _CP& __x, const _Key& __y) const
|
||||
{return comp(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _CP& __y) const
|
||||
bool operator()(const _Pp& __x, const _CP& __y) const
|
||||
{return comp(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _P& __y) const
|
||||
bool operator()(const _Pp& __x, const _Pp& __y) const
|
||||
{return comp(__x.first, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _P& __x, const _Key& __y) const
|
||||
bool operator()(const _Pp& __x, const _Key& __y) const
|
||||
{return comp(__x.first, __y);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _CP& __y) const
|
||||
{return comp(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _P& __y) const
|
||||
bool operator()(const _Key& __x, const _Pp& __y) const
|
||||
{return comp(__x, __y.first);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Key& __y) const
|
||||
@@ -874,59 +880,29 @@ public:
|
||||
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool>
|
||||
emplace() {return __tree_.__emplace_unique();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool>
|
||||
emplace(_A0&& __a0)
|
||||
{return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
template <class ..._Args>
|
||||
pair<iterator, bool>
|
||||
emplace(_A0&& __a0, _Args&& ...__args);
|
||||
emplace(_Args&& ...__args);
|
||||
|
||||
template <class ..._Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace_hint(const_iterator __p)
|
||||
{return __tree_.__emplace_hint_unique(__p.__i_);}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
template <class _Pp,
|
||||
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0)
|
||||
{return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
|
||||
pair<iterator, bool> insert(_Pp&& __p)
|
||||
{return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
template <class _Pp,
|
||||
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> insert(_P&& __p)
|
||||
{return __tree_.__insert_unique(_VSTD::forward<_P>(__p));}
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, _P&& __p)
|
||||
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));}
|
||||
iterator insert(const_iterator __pos, _Pp&& __p)
|
||||
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -1004,18 +980,28 @@ private:
|
||||
typedef typename __base::__node_const_pointer __node_const_pointer;
|
||||
typedef typename __base::__node_base_pointer __node_base_pointer;
|
||||
typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
|
||||
typedef __map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node();
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _A0>::value,
|
||||
__node_holder
|
||||
>::type
|
||||
__construct_node(_A0&& __a0);
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<key_type, _A0>::value,
|
||||
__node_holder
|
||||
>::type
|
||||
__construct_node(_A0&& __a0);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
|
||||
template <class _A0, class _A1, class ..._Args>
|
||||
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node(const key_type& __k);
|
||||
@@ -1200,7 +1186,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
@@ -1209,32 +1195,53 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0,
|
||||
class>
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<pair<const _Key, _Tp>, _A0>::value,
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
>::type
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<_Key, _A0>::value,
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
>::type
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class>
|
||||
template <class _A0, class _A1, class ..._Args>
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1248,7 +1255,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
@@ -1323,14 +1330,11 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
template <class ..._Args>
|
||||
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
|
||||
map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
|
||||
if (__r.second)
|
||||
__h.release();
|
||||
@@ -1338,15 +1342,12 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
template <class ..._Args>
|
||||
typename map<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
|
||||
_A0&& __a0, _Args&& ...__args)
|
||||
_Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
|
||||
if (__r.__i_.__ptr_ == __h.get())
|
||||
__h.release();
|
||||
@@ -1623,57 +1624,29 @@ public:
|
||||
{return value_compare(__tree_.value_comp().key_comp());}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace() {return __tree_.__emplace_multi();}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace(_A0&& __a0)
|
||||
{return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
template <class ..._Args>
|
||||
iterator
|
||||
emplace(_A0&& __a0, _Args&& ...__args);
|
||||
emplace(_Args&& ...__args);
|
||||
|
||||
template <class ..._Args>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p)
|
||||
{return __tree_.__emplace_hint_multi(__p.__i_);}
|
||||
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
template <class _Pp,
|
||||
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0)
|
||||
{return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
|
||||
iterator insert(_Pp&& __p)
|
||||
{return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
iterator
|
||||
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
template <class _Pp,
|
||||
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(_P&& __p)
|
||||
{return __tree_.__insert_multi(_VSTD::forward<_P>(__p));}
|
||||
|
||||
template <class _P,
|
||||
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __pos, _P&& __p)
|
||||
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));}
|
||||
iterator insert(const_iterator __pos, _Pp&& __p)
|
||||
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
@@ -1746,18 +1719,28 @@ private:
|
||||
typedef typename __base::__node_allocator __node_allocator;
|
||||
typedef typename __base::__node_pointer __node_pointer;
|
||||
typedef typename __base::__node_const_pointer __node_const_pointer;
|
||||
typedef __map_node_destructor<__node_allocator> _D;
|
||||
typedef unique_ptr<__node, _D> __node_holder;
|
||||
typedef __map_node_destructor<__node_allocator> _Dp;
|
||||
typedef unique_ptr<__node, _Dp> __node_holder;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__node_holder __construct_node();
|
||||
template <class _A0,
|
||||
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0);
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<value_type, _A0>::value,
|
||||
__node_holder
|
||||
>::type
|
||||
__construct_node(_A0&& __a0);
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<key_type, _A0>::value,
|
||||
__node_holder
|
||||
>::type
|
||||
__construct_node(_A0&& __a0);
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _A0, class ..._Args,
|
||||
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
|
||||
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
|
||||
template <class _A0, class _A1, class ..._Args>
|
||||
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
};
|
||||
@@ -1782,7 +1765,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
@@ -1791,34 +1774,53 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0,
|
||||
class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
|
||||
>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<pair<const _Key, _Tp>, _A0>::value,
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
>::type
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0>
|
||||
typename enable_if
|
||||
<
|
||||
is_constructible<_Key, _A0>::value,
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
>::type
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
|
||||
>
|
||||
template <class _A0, class _A1, class ..._Args>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
|
||||
{
|
||||
__node_allocator& __na = __tree_.__node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
|
||||
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return __h;
|
||||
}
|
||||
@@ -1829,30 +1831,23 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
template <class ..._Args>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
template <class _A0, class ..._Args,
|
||||
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
|
||||
>
|
||||
template <class ..._Args>
|
||||
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
|
||||
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
|
||||
_A0&& __a0,
|
||||
_Args&& ...__args)
|
||||
{
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
|
1696
include/memory
1696
include/memory
File diff suppressed because it is too large
Load Diff
@@ -20,7 +20,7 @@ namespace std
|
||||
class mutex
|
||||
{
|
||||
public:
|
||||
mutex();
|
||||
constexpr mutex() noexcept;
|
||||
~mutex();
|
||||
|
||||
mutex(const mutex&) = delete;
|
||||
@@ -44,7 +44,7 @@ public:
|
||||
recursive_mutex& operator=(const recursive_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() noexcept;
|
||||
void unlock();
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() noexcept;
|
||||
template <class Rep, class Period>
|
||||
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
template <class Clock, class Duration>
|
||||
@@ -114,9 +114,9 @@ class unique_lock
|
||||
{
|
||||
public:
|
||||
typedef Mutex mutex_type;
|
||||
unique_lock();
|
||||
unique_lock() noexcept;
|
||||
explicit unique_lock(mutex_type& m);
|
||||
unique_lock(mutex_type& m, defer_lock_t);
|
||||
unique_lock(mutex_type& m, defer_lock_t) noexcept;
|
||||
unique_lock(mutex_type& m, try_to_lock_t);
|
||||
unique_lock(mutex_type& m, adopt_lock_t);
|
||||
template <class Clock, class Duration>
|
||||
@@ -128,8 +128,8 @@ public:
|
||||
unique_lock(unique_lock const&) = delete;
|
||||
unique_lock& operator=(unique_lock const&) = delete;
|
||||
|
||||
unique_lock(unique_lock&& u);
|
||||
unique_lock& operator=(unique_lock&& u);
|
||||
unique_lock(unique_lock&& u) noexcept;
|
||||
unique_lock& operator=(unique_lock&& u) noexcept;
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
@@ -141,16 +141,16 @@ public:
|
||||
|
||||
void unlock();
|
||||
|
||||
void swap(unique_lock& u);
|
||||
mutex_type* release();
|
||||
void swap(unique_lock& u) noexcept;
|
||||
mutex_type* release() noexcept;
|
||||
|
||||
bool owns_lock() const;
|
||||
explicit operator bool () const;
|
||||
mutex_type* mutex() const;
|
||||
bool owns_lock() const noexcept;
|
||||
explicit operator bool () const noexcept;
|
||||
mutex_type* mutex() const noexcept;
|
||||
};
|
||||
|
||||
template <class Mutex>
|
||||
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
|
||||
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
|
||||
|
||||
template <class L1, class L2, class... L3>
|
||||
int try_lock(L1&, L2&, L3&...);
|
||||
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
|
||||
|
||||
struct once_flag
|
||||
{
|
||||
constexpr once_flag();
|
||||
constexpr once_flag() noexcept;
|
||||
|
||||
once_flag(const once_flag&) = delete;
|
||||
once_flag& operator=(const once_flag&) = delete;
|
||||
@@ -179,7 +179,11 @@ template<class Callable, class ...Args>
|
||||
#include <tuple>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -197,8 +201,8 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
void unlock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
void unlock() _NOEXCEPT;
|
||||
|
||||
typedef pthread_mutex_t* native_handle_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -220,14 +224,14 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __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();
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
@@ -263,14 +267,14 @@ private:
|
||||
|
||||
public:
|
||||
void lock();
|
||||
bool try_lock();
|
||||
bool try_lock() _NOEXCEPT;
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool try_lock_for(const chrono::duration<_Rep, _Period>& __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();
|
||||
void unlock() _NOEXCEPT;
|
||||
};
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
@@ -421,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct once_flag;
|
||||
struct _LIBCPP_VISIBLE once_flag;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable, class... _Args>
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable&&, _Args&&...);
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template<class _Callable>
|
||||
void call_once(once_flag&, _Callable);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void call_once(once_flag&, _Callable);
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
struct _LIBCPP_VISIBLE once_flag
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
// constexpr
|
||||
once_flag() {}
|
||||
_LIBCPP_CONSTEXPR
|
||||
once_flag() _NOEXCEPT : __state_(0) {}
|
||||
|
||||
private:
|
||||
once_flag(const once_flag&); // = delete;
|
||||
@@ -460,23 +466,23 @@ private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()()
|
||||
{
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
|
||||
__execute(_Index());
|
||||
}
|
||||
|
||||
@@ -491,17 +497,17 @@ private:
|
||||
|
||||
#else
|
||||
|
||||
template <class _F>
|
||||
template <class _Fp>
|
||||
class __call_once_param
|
||||
{
|
||||
_F __f_;
|
||||
_Fp __f_;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __call_once_param(const _F& __f) : __f_(__f) {}
|
||||
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -513,11 +519,11 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
template <class _F>
|
||||
template <class _Fp>
|
||||
void
|
||||
__call_once_proxy(void* __vp)
|
||||
{
|
||||
__call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
|
||||
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
|
||||
(*__p)();
|
||||
}
|
||||
|
||||
@@ -530,12 +536,12 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
|
||||
{
|
||||
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
|
||||
if (__flag.__state_ != ~0ul)
|
||||
{
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
|
||||
__call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
|
||||
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
|
||||
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -56,7 +56,9 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
@@ -94,7 +96,7 @@ _LIBCPP_VISIBLE void* operator new(std::size_t __sz)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
@@ -103,7 +105,7 @@ _LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
|
||||
throw(std::bad_alloc)
|
||||
#endif
|
||||
;
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
|
||||
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
|
||||
|
||||
|
@@ -60,7 +60,9 @@ template <class ForwardIterator, class T>
|
||||
#include <__config>
|
||||
#include <iterator>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -184,10 +186,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
{
|
||||
for (; __first != __last; ++__first, ++__value)
|
||||
*__first = __value;
|
||||
for (; __first != __last; ++__first, ++__value_)
|
||||
*__first = __value_;
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
132
include/ostream
132
include/ostream
@@ -133,7 +133,9 @@ template <class charT, class traits, class T>
|
||||
#include <iterator>
|
||||
#include <bitset>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -167,7 +169,7 @@ protected:
|
||||
public:
|
||||
|
||||
// 27.7.2.4 Prefix/suffix:
|
||||
class sentry;
|
||||
class _LIBCPP_VISIBLE sentry;
|
||||
|
||||
// 27.7.2.6 Formatted output:
|
||||
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
|
||||
@@ -218,7 +220,7 @@ public:
|
||||
~sentry();
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
// explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const {return __ok_;}
|
||||
};
|
||||
|
||||
@@ -340,11 +342,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_I __i(__sb);
|
||||
_I __eof;
|
||||
_O __o(*this);
|
||||
typedef istreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
_Ip __i(__sb);
|
||||
_Ip __eof;
|
||||
_Op __o(*this);
|
||||
size_t __c = 0;
|
||||
for (; __i != __eof; ++__i, ++__o, ++__c)
|
||||
{
|
||||
@@ -386,8 +388,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -413,8 +415,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
|
||||
if (__s)
|
||||
{
|
||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(),
|
||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||
static_cast<long>(static_cast<unsigned short>(__n)) :
|
||||
@@ -442,8 +444,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -469,8 +471,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
|
||||
if (__s)
|
||||
{
|
||||
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(),
|
||||
__flags == ios_base::oct || __flags == ios_base::hex ?
|
||||
static_cast<long>(static_cast<unsigned int>(__n)) :
|
||||
@@ -498,8 +500,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -524,8 +526,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -550,8 +552,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -576,8 +578,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -602,8 +604,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -628,8 +630,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -654,8 +656,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -680,8 +682,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -706,8 +708,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
|
||||
const _F& __f = use_facet<_F>(this->getloc());
|
||||
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
|
||||
const _Fp& __f = use_facet<_Fp>(this->getloc());
|
||||
if (__f.put(*this, *this, this->fill(), __n).failed())
|
||||
this->setstate(ios_base::badbit | ios_base::failbit);
|
||||
}
|
||||
@@ -732,8 +734,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -765,8 +767,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
|
||||
if (__s)
|
||||
{
|
||||
_CharT __c = __os.widen(__cn);
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -797,8 +799,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
&__c + 1 :
|
||||
@@ -829,8 +831,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(char*)&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(char*)&__c + 1 :
|
||||
@@ -861,8 +863,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
if (__pad_and_output(_I(__os),
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(char*)&__c,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(char*)&__c + 1 :
|
||||
@@ -893,9 +895,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = _Traits::length(__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str + __len :
|
||||
@@ -926,7 +928,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = char_traits<char>::length(__strn);
|
||||
const int __bs = 100;
|
||||
_CharT __wbb[__bs];
|
||||
@@ -941,7 +943,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
|
||||
}
|
||||
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
|
||||
*__p = __os.widen(*__strn);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__wb,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__wb + __len :
|
||||
@@ -972,9 +974,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length(__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str + __len :
|
||||
@@ -1005,9 +1007,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length((const char*)__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(const char*)__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(const char*)__str + __len :
|
||||
@@ -1038,9 +1040,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
|
||||
typename basic_ostream<char, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<char, _Traits> _I;
|
||||
typedef ostreambuf_iterator<char, _Traits> _Ip;
|
||||
size_t __len = _Traits::length((const char*)__str);
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
(const char*)__str,
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
(const char*)__str + __len :
|
||||
@@ -1071,8 +1073,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
|
||||
sentry __s(*this);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_O __o(*this);
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
_Op __o(*this);
|
||||
*__o = __c;
|
||||
if (__o.failed())
|
||||
this->setstate(ios_base::badbit);
|
||||
@@ -1098,8 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
|
||||
sentry __sen(*this);
|
||||
if (__sen && __n)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _O;
|
||||
_O __o(*this);
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Op;
|
||||
_Op __o(*this);
|
||||
for (; __n; --__n, ++__o, ++__s)
|
||||
{
|
||||
*__o = *__s;
|
||||
@@ -1216,12 +1218,12 @@ typename enable_if
|
||||
<
|
||||
!is_lvalue_reference<_Stream>::value &&
|
||||
is_base_of<ios_base, _Stream>::value,
|
||||
_Stream&
|
||||
_Stream&&
|
||||
>::type
|
||||
operator<<(_Stream&& __os, const _Tp& __x)
|
||||
{
|
||||
__os << __x;
|
||||
return __os;
|
||||
return _VSTD::move(__os);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1238,9 +1240,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
|
||||
if (__s)
|
||||
{
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _I;
|
||||
typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
|
||||
size_t __len = __str.size();
|
||||
if (__pad_and_output(_I(__os),
|
||||
if (__pad_and_output(_Ip(__os),
|
||||
__str.data(),
|
||||
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
|
||||
__str.data() + __len :
|
||||
@@ -1268,10 +1270,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
|
||||
return __os << __ec.category().name() << ':' << __ec.value();
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Y>
|
||||
template<class _CharT, class _Traits, class _Yp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
|
||||
{
|
||||
return __os << __p.get();
|
||||
}
|
||||
@@ -1285,8 +1287,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
|
||||
}
|
||||
|
||||
extern template class basic_ostream<char>;
|
||||
extern template class basic_ostream<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@@ -171,17 +171,21 @@ template <class T, class Container, class Compare>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Container> class queue;
|
||||
template <class _Tp, class _Container> class _LIBCPP_VISIBLE queue;
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
|
||||
|
||||
|
1005
include/random
1005
include/random
File diff suppressed because it is too large
Load Diff
@@ -70,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
|
||||
#include <climits>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -88,6 +92,12 @@ struct __static_gcd<_Xp, 0>
|
||||
static const intmax_t value = _Xp;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct __static_gcd<0, 0>
|
||||
{
|
||||
static const intmax_t value = 1;
|
||||
};
|
||||
|
||||
// __static_lcm
|
||||
|
||||
template <intmax_t _Xp, intmax_t _Yp>
|
||||
@@ -404,27 +414,27 @@ struct __ratio_less1
|
||||
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
|
||||
{
|
||||
static const bool value = !_Odd;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
|
||||
{
|
||||
static const bool value = _Odd;
|
||||
};
|
||||
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
|
||||
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
|
||||
intmax_t _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
|
||||
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
|
||||
{
|
||||
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
|
||||
ratio<_R2::den, _M2>, !_Odd>::value;
|
||||
|
168
include/regex
168
include/regex
@@ -147,7 +147,7 @@ public:
|
||||
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
|
||||
basic_regex(const charT* p, size_t len, flag_type f);
|
||||
basic_regex(const basic_regex&);
|
||||
basic_regex(basic_regex&&);
|
||||
basic_regex(basic_regex&&) noexcept;
|
||||
template <class ST, class SA>
|
||||
explicit basic_regex(const basic_string<charT, ST, SA>& p,
|
||||
flag_type f = regex_constants::ECMAScript);
|
||||
@@ -159,7 +159,7 @@ public:
|
||||
~basic_regex();
|
||||
|
||||
basic_regex& operator=(const basic_regex&);
|
||||
basic_regex& operator=(basic_regex&&);
|
||||
basic_regex& operator=(basic_regex&&) noexcept;
|
||||
basic_regex& operator=(const charT* ptr);
|
||||
basic_regex& operator=(initializer_list<charT> il);
|
||||
template <class ST, class SA>
|
||||
@@ -167,7 +167,7 @@ public:
|
||||
|
||||
// assign:
|
||||
basic_regex& assign(const basic_regex& that);
|
||||
basic_regex& assign(basic_regex&& that);
|
||||
basic_regex& assign(basic_regex&& that) noexcept;
|
||||
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
|
||||
basic_regex& assign(const charT* p, size_t len, flag_type f);
|
||||
template <class string_traits, class A>
|
||||
@@ -449,7 +449,7 @@ public:
|
||||
// construct/copy/destroy:
|
||||
explicit match_results(const Allocator& a = Allocator());
|
||||
match_results(const match_results& m);
|
||||
match_results(match_results&& m);
|
||||
match_results(match_results&& m) noexcept;
|
||||
match_results& operator=(const match_results& m);
|
||||
match_results& operator=(match_results&& m);
|
||||
~match_results();
|
||||
@@ -732,7 +732,11 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -756,7 +760,7 @@ enum syntax_option_type
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
syntax_option_type
|
||||
operator~(syntax_option_type __x)
|
||||
{
|
||||
@@ -764,7 +768,7 @@ operator~(syntax_option_type __x)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
syntax_option_type
|
||||
operator&(syntax_option_type __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -772,7 +776,7 @@ operator&(syntax_option_type __x, syntax_option_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
syntax_option_type
|
||||
operator|(syntax_option_type __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -780,7 +784,7 @@ operator|(syntax_option_type __x, syntax_option_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
syntax_option_type
|
||||
operator^(syntax_option_type __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -788,7 +792,6 @@ operator^(syntax_option_type __x, syntax_option_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
syntax_option_type&
|
||||
operator&=(syntax_option_type& __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -797,7 +800,6 @@ operator&=(syntax_option_type& __x, syntax_option_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
syntax_option_type&
|
||||
operator|=(syntax_option_type& __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -806,7 +808,6 @@ operator|=(syntax_option_type& __x, syntax_option_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
syntax_option_type&
|
||||
operator^=(syntax_option_type& __x, syntax_option_type __y)
|
||||
{
|
||||
@@ -835,7 +836,7 @@ enum match_flag_type
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
match_flag_type
|
||||
operator~(match_flag_type __x)
|
||||
{
|
||||
@@ -843,7 +844,7 @@ operator~(match_flag_type __x)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
match_flag_type
|
||||
operator&(match_flag_type __x, match_flag_type __y)
|
||||
{
|
||||
@@ -851,7 +852,7 @@ operator&(match_flag_type __x, match_flag_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
match_flag_type
|
||||
operator|(match_flag_type __x, match_flag_type __y)
|
||||
{
|
||||
@@ -859,7 +860,7 @@ operator|(match_flag_type __x, match_flag_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
_LIBCPP_CONSTEXPR
|
||||
match_flag_type
|
||||
operator^(match_flag_type __x, match_flag_type __y)
|
||||
{
|
||||
@@ -867,7 +868,6 @@ operator^(match_flag_type __x, match_flag_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
match_flag_type&
|
||||
operator&=(match_flag_type& __x, match_flag_type __y)
|
||||
{
|
||||
@@ -876,7 +876,6 @@ operator&=(match_flag_type& __x, match_flag_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
match_flag_type&
|
||||
operator|=(match_flag_type& __x, match_flag_type __y)
|
||||
{
|
||||
@@ -885,7 +884,6 @@ operator|=(match_flag_type& __x, match_flag_type __y)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/
|
||||
match_flag_type&
|
||||
operator^=(match_flag_type& __x, match_flag_type __y)
|
||||
{
|
||||
@@ -1233,11 +1231,11 @@ regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
|
||||
|
||||
template <class _CharT> class __node;
|
||||
|
||||
template <class _BidirectionalIterator> class sub_match;
|
||||
template <class _BidirectionalIterator> class _LIBCPP_VISIBLE sub_match;
|
||||
|
||||
template <class _BidirectionalIterator,
|
||||
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
|
||||
class match_results;
|
||||
class _LIBCPP_VISIBLE match_results;
|
||||
|
||||
template <class _CharT>
|
||||
struct __state
|
||||
@@ -2435,16 +2433,16 @@ private:
|
||||
|
||||
public:
|
||||
// constants:
|
||||
static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase;
|
||||
static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
|
||||
static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize;
|
||||
static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate;
|
||||
static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
|
||||
static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic;
|
||||
static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended;
|
||||
static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk;
|
||||
static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep;
|
||||
static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
||||
static const regex_constants::syntax_option_type icase = regex_constants::icase;
|
||||
static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
|
||||
static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
|
||||
static const regex_constants::syntax_option_type collate = regex_constants::collate;
|
||||
static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
|
||||
static const regex_constants::syntax_option_type basic = regex_constants::basic;
|
||||
static const regex_constants::syntax_option_type extended = regex_constants::extended;
|
||||
static const regex_constants::syntax_option_type awk = regex_constants::awk;
|
||||
static const regex_constants::syntax_option_type grep = regex_constants::grep;
|
||||
static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
||||
|
||||
// construct/copy/destroy:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -2508,6 +2506,11 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex& assign(const basic_regex& __that)
|
||||
{return *this = __that;}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex& assign(basic_regex&& __that) _NOEXCEPT
|
||||
{return *this = _VSTD::move(__that);}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
|
||||
{return assign(__p, __p + __traits_.length(__p), __f);}
|
||||
@@ -2559,6 +2562,7 @@ public:
|
||||
{
|
||||
__member_init(__f);
|
||||
__parse(__first, __last);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
@@ -2790,54 +2794,75 @@ private:
|
||||
match_results<const _CharT*, _Allocator>& __m,
|
||||
regex_constants::match_flag_type __flags, bool) const;
|
||||
|
||||
template <class _B, class _A, class _C, class _T>
|
||||
template <class _Bp, class _Ap, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
|
||||
regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||
regex_constants::match_flag_type);
|
||||
|
||||
template <class _A, class _C, class _T>
|
||||
template <class _Ap, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(const _C*, const _C*, match_results<const _C*, _A>&,
|
||||
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
|
||||
regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
|
||||
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
|
||||
|
||||
template <class _B, class _C, class _T>
|
||||
template <class _Bp, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(_B, _B, const basic_regex<_C, _T>&,
|
||||
regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
|
||||
regex_constants::match_flag_type);
|
||||
|
||||
template <class _C, class _T>
|
||||
template <class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(const _C*, const _C*,
|
||||
const basic_regex<_C, _T>&, regex_constants::match_flag_type);
|
||||
regex_search(const _Cp*, const _Cp*,
|
||||
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
|
||||
|
||||
template <class _C, class _A, class _T>
|
||||
template <class _Cp, class _Ap, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&,
|
||||
regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||
regex_constants::match_flag_type);
|
||||
|
||||
template <class _ST, class _SA, class _C, class _T>
|
||||
template <class _ST, class _SA, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(const basic_string<_C, _ST, _SA>& __s,
|
||||
const basic_regex<_C, _T>& __e,
|
||||
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
|
||||
const basic_regex<_Cp, _Tp>& __e,
|
||||
regex_constants::match_flag_type __flags);
|
||||
|
||||
template <class _ST, class _SA, class _A, class _C, class _T>
|
||||
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_search(const basic_string<_C, _ST, _SA>& __s,
|
||||
match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&,
|
||||
const basic_regex<_C, _T>& __e,
|
||||
regex_search(const basic_string<_Cp, _ST, _SA>& __s,
|
||||
match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
|
||||
const basic_regex<_Cp, _Tp>& __e,
|
||||
regex_constants::match_flag_type __flags);
|
||||
|
||||
template <class, class> friend class __lookahead;
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
|
||||
template <class _CharT, class _Traits>
|
||||
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
|
||||
@@ -4400,7 +4425,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
||||
if (__hd == -1)
|
||||
throw regex_error(regex_constants::error_escape);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__sum = 16 * __sum + __hd;
|
||||
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||
++__first;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__first == __last)
|
||||
@@ -4411,7 +4436,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
||||
if (__hd == -1)
|
||||
throw regex_error(regex_constants::error_escape);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__sum = 16 * __sum + __hd;
|
||||
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||
// drop through
|
||||
case 'x':
|
||||
++__first;
|
||||
@@ -4424,7 +4449,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
||||
if (__hd == -1)
|
||||
throw regex_error(regex_constants::error_escape);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__sum = 16 * __sum + __hd;
|
||||
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||
++__first;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
if (__first == __last)
|
||||
@@ -4435,7 +4460,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
|
||||
if (__hd == -1)
|
||||
throw regex_error(regex_constants::error_escape);
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__sum = 16 * __sum + __hd;
|
||||
__sum = 16 * __sum + static_cast<unsigned>(__hd);
|
||||
if (__str)
|
||||
*__str = _CharT(__sum);
|
||||
else
|
||||
@@ -4736,7 +4761,7 @@ public:
|
||||
bool matched;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
/*constexpr*/ sub_match() : matched() {}
|
||||
_LIBCPP_CONSTEXPR sub_match() : matched() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
difference_type length() const
|
||||
@@ -5259,12 +5284,12 @@ public:
|
||||
// swap:
|
||||
void swap(match_results& __m);
|
||||
|
||||
template <class _B, class _A>
|
||||
template <class _Bp, class _Ap>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
|
||||
const match_results<_B, _A>& __m, bool __no_update_pos)
|
||||
const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
|
||||
{
|
||||
_B __mf = __m.prefix().first;
|
||||
_Bp __mf = __m.prefix().first;
|
||||
__matches_.resize(__m.size());
|
||||
for (size_type __i = 0; __i < __matches_.size(); ++__i)
|
||||
{
|
||||
@@ -5293,16 +5318,16 @@ private:
|
||||
|
||||
template <class, class> friend class basic_regex;
|
||||
|
||||
template <class _B, class _A, class _C, class _T>
|
||||
template <class _Bp, class _Ap, class _Cp, class _Tp>
|
||||
friend
|
||||
bool
|
||||
regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
|
||||
regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
|
||||
regex_constants::match_flag_type);
|
||||
|
||||
template <class _B, class _A>
|
||||
template <class _Bp, class _Ap>
|
||||
friend
|
||||
bool
|
||||
operator==(const match_results<_B, _A>&, const match_results<_B, _A>&);
|
||||
operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
|
||||
|
||||
template <class, class> friend class __lookahead;
|
||||
};
|
||||
@@ -5492,8 +5517,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
||||
regex_constants::match_flag_type __flags, bool __at_first) const
|
||||
{
|
||||
vector<__state> __states;
|
||||
ptrdiff_t __j = 0;
|
||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
||||
__node* __st = __start_.get();
|
||||
if (__st)
|
||||
{
|
||||
@@ -5507,7 +5530,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
|
||||
__states.back().__node_ = __st;
|
||||
__states.back().__flags_ = __flags;
|
||||
__states.back().__at_first_ = __at_first;
|
||||
bool __matched = false;
|
||||
do
|
||||
{
|
||||
__state& __s = __states.back();
|
||||
@@ -5559,7 +5581,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
||||
{
|
||||
deque<__state> __states;
|
||||
ptrdiff_t __highest_j = 0;
|
||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
||||
ptrdiff_t _Np = _VSTD::distance(__first, __last);
|
||||
__node* __st = __start_.get();
|
||||
if (__st)
|
||||
{
|
||||
@@ -5584,7 +5606,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
|
||||
if (!__matched || __highest_j < __s.__current_ - __s.__first_)
|
||||
__highest_j = __s.__current_ - __s.__first_;
|
||||
__matched = true;
|
||||
if (__highest_j == _N)
|
||||
if (__highest_j == _Np)
|
||||
__states.clear();
|
||||
else
|
||||
__states.pop_back();
|
||||
@@ -5639,7 +5661,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
||||
__state __best_state;
|
||||
ptrdiff_t __j = 0;
|
||||
ptrdiff_t __highest_j = 0;
|
||||
ptrdiff_t _N = _VSTD::distance(__first, __last);
|
||||
ptrdiff_t _Np = _VSTD::distance(__first, __last);
|
||||
__node* __st = __start_.get();
|
||||
if (__st)
|
||||
{
|
||||
@@ -5669,7 +5691,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
|
||||
__best_state = __s;
|
||||
}
|
||||
__matched = true;
|
||||
if (__highest_j == _N)
|
||||
if (__highest_j == _Np)
|
||||
__states.clear();
|
||||
else
|
||||
__states.pop_back();
|
||||
@@ -6084,11 +6106,11 @@ public:
|
||||
regex_constants::match_flag_type __m =
|
||||
regex_constants::match_default);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
template <size_t _N>
|
||||
template <size_t _Np>
|
||||
regex_token_iterator(_BidirectionalIterator __a,
|
||||
_BidirectionalIterator __b,
|
||||
const regex_type& __re,
|
||||
const int (&__submatches)[_N],
|
||||
const int (&__submatches)[_Np],
|
||||
regex_constants::match_flag_type __m =
|
||||
regex_constants::match_default);
|
||||
regex_token_iterator(const regex_token_iterator&);
|
||||
@@ -6190,15 +6212,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _BidirectionalIterator, class _CharT, class _Traits>
|
||||
template <size_t _N>
|
||||
template <size_t _Np>
|
||||
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
|
||||
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
|
||||
const regex_type& __re,
|
||||
const int (&__submatches)[_N],
|
||||
const int (&__submatches)[_Np],
|
||||
regex_constants::match_flag_type __m)
|
||||
: __position_(__a, __b, __re, __m),
|
||||
_N_(0),
|
||||
__subs_(__submatches, __submatches + _N)
|
||||
__subs_(__submatches, __submatches + _Np)
|
||||
{
|
||||
__init(__a, __b);
|
||||
}
|
||||
|
@@ -106,7 +106,9 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
|
||||
#include <__config>
|
||||
#include <memory>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -338,7 +338,9 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
|
||||
#include <__tree>
|
||||
#include <functional>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -175,7 +175,11 @@ typedef basic_stringstream<wchar_t> wstringstream;
|
||||
#include <istream>
|
||||
#include <string>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@@ -85,17 +85,21 @@ template <class T, class Container>
|
||||
#include <__config>
|
||||
#include <deque>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Container> class stack;
|
||||
template <class _Tp, class _Container> class _LIBCPP_VISIBLE stack;
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
template <class _Tp, class _Container>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
|
||||
|
||||
|
@@ -46,7 +46,9 @@ public:
|
||||
#include <exception>
|
||||
#include <iosfwd> // for string forward decl
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
@@ -112,7 +112,9 @@ protected:
|
||||
#include <iosfwd>
|
||||
#include <ios>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::pos_type
|
||||
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __which)
|
||||
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
|
||||
ios_base::openmode)
|
||||
{
|
||||
return pos_type(off_type(-1));
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::pos_type
|
||||
basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
|
||||
basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
|
||||
{
|
||||
return pos_type(off_type(-1));
|
||||
}
|
||||
@@ -538,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
||||
{
|
||||
if (__nout_ < __eout_)
|
||||
*__nout_++ = *__s;
|
||||
else if (overflow(*__s) == __eof)
|
||||
else if (overflow(traits_type::to_int_type(*__s)) == __eof)
|
||||
break;
|
||||
}
|
||||
return __i;
|
||||
@@ -546,16 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
typename basic_streambuf<_CharT, _Traits>::int_type
|
||||
basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
|
||||
basic_streambuf<_CharT, _Traits>::overflow(int_type)
|
||||
{
|
||||
return traits_type::eof();
|
||||
}
|
||||
|
||||
extern template class basic_streambuf<char>;
|
||||
extern template class basic_streambuf<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>)
|
||||
|
||||
extern template class basic_ios<char>;
|
||||
extern template class basic_ios<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
144
include/string
144
include/string
@@ -51,8 +51,8 @@ struct char_traits
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
static void assign(char_type& c1, const char_type& c2) noexcept;
|
||||
static bool eq(char_type c1, char_type c2) noexcept;
|
||||
static bool lt(char_type c1, char_type c2) noexcept;
|
||||
static constexpr bool eq(char_type c1, char_type c2) noexcept;
|
||||
static constexpr bool lt(char_type c1, char_type c2) noexcept;
|
||||
|
||||
static int compare(const char_type* s1, const char_type* s2, size_t n);
|
||||
static size_t length(const char_type* s);
|
||||
@@ -61,11 +61,11 @@ struct char_traits
|
||||
static char_type* copy(char_type* s1, const char_type* s2, size_t n);
|
||||
static char_type* assign(char_type* s, size_t n, char_type a);
|
||||
|
||||
static int_type not_eof(int_type c) noexcept;
|
||||
static char_type to_char_type(int_type c) noexcept;
|
||||
static int_type to_int_type(char_type c) noexcept;
|
||||
static bool eq_int_type(int_type c1, int_type c2) noexcept;
|
||||
static int_type eof() noexcept;
|
||||
static constexpr int_type not_eof(int_type c) noexcept;
|
||||
static constexpr char_type to_char_type(int_type c) noexcept;
|
||||
static constexpr int_type to_int_type(char_type c) noexcept;
|
||||
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
|
||||
static constexpr int_type eof() noexcept;
|
||||
};
|
||||
|
||||
template <> struct char_traits<char>;
|
||||
@@ -446,7 +446,11 @@ template <> struct hash<wstring>;
|
||||
#include <cassert>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -502,10 +506,10 @@ struct _LIBCPP_VISIBLE char_traits
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -515,19 +519,20 @@ struct _LIBCPP_VISIBLE char_traits
|
||||
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type eof() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -627,10 +632,10 @@ struct _LIBCPP_VISIBLE char_traits<char>
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return (unsigned char)__c1 < (unsigned char)__c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -651,19 +656,20 @@ struct _LIBCPP_VISIBLE char_traits<char>
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a)
|
||||
{return (char_type*)memset(__s, to_int_type(__a), __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type((unsigned char)__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type eof() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(EOF);}
|
||||
};
|
||||
|
||||
@@ -682,10 +688,10 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -708,19 +714,19 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
|
||||
{return (char_type*)wmemset(__s, __a, __n);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type eof() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(WEOF);}
|
||||
};
|
||||
|
||||
@@ -739,10 +745,10 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -753,19 +759,19 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type eof() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xDFFF);}
|
||||
};
|
||||
|
||||
@@ -859,10 +865,10 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
|
||||
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
|
||||
{__c1 = __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
|
||||
{return __c1 < __c2;}
|
||||
|
||||
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
|
||||
@@ -873,19 +879,19 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
|
||||
static char_type* assign(char_type* __s, size_t __n, char_type __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type not_eof(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
|
||||
{return char_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
|
||||
{return int_type(__c);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
|
||||
{return __c1 == __c2;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static int_type eof() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
|
||||
{return int_type(0xFFFFFFFF);}
|
||||
};
|
||||
|
||||
@@ -1021,7 +1027,14 @@ __basic_string_common<__b>::__throw_out_of_range() const
|
||||
#endif
|
||||
}
|
||||
|
||||
extern template class __basic_string_common<true>;
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4231 )
|
||||
#endif // _MSC_VER
|
||||
_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning( pop )
|
||||
#endif // _MSC_VER
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_VISIBLE basic_string
|
||||
@@ -1068,7 +1081,7 @@ private:
|
||||
enum {__long_mask = ~(size_type(~0) >> 1)};
|
||||
#else // _LIBCPP_BIG_ENDIAN
|
||||
enum {__short_mask = 0x01};
|
||||
enum {__long_mask = 0x1};
|
||||
enum {__long_mask = 0x1ul};
|
||||
#endif // _LIBCPP_BIG_ENDIAN
|
||||
|
||||
enum {__mask = size_type(~0) >> 1};
|
||||
@@ -1081,14 +1094,14 @@ private:
|
||||
union
|
||||
{
|
||||
unsigned char __size_;
|
||||
value_type _;
|
||||
value_type __lx;
|
||||
};
|
||||
value_type __data_[__min_cap];
|
||||
};
|
||||
|
||||
union _{__long _; __short __;};
|
||||
union __lx{__long __lx; __short __lxx;};
|
||||
|
||||
enum {__n_words = sizeof(_) / sizeof(size_type)};
|
||||
enum {__n_words = sizeof(__lx) / sizeof(size_type)};
|
||||
|
||||
struct __raw
|
||||
{
|
||||
@@ -1490,7 +1503,7 @@ private:
|
||||
{__r_.first().__l.__cap_ = __long_mask | __s;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type __get_long_cap() const _NOEXCEPT
|
||||
{return __r_.first().__l.__cap_ & ~__long_mask;}
|
||||
{return __r_.first().__l.__cap_ & size_type(~__long_mask);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __set_long_pointer(pointer __p) _NOEXCEPT
|
||||
@@ -1580,7 +1593,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT
|
||||
void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
@@ -1608,7 +1621,7 @@ private:
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(basic_string& __c, false_type)
|
||||
void __move_assign_alloc(basic_string&, false_type)
|
||||
_NOEXCEPT
|
||||
{}
|
||||
|
||||
@@ -1627,7 +1640,7 @@ private:
|
||||
swap(__x, __y);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT
|
||||
static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
@@ -1658,7 +1671,11 @@ template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_INLINE_VISIBILITY inline
|
||||
#endif
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
__pos
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
const_iterator __beg = begin();
|
||||
@@ -2191,6 +2208,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input
|
||||
clear();
|
||||
for (; __first != __last; ++__first)
|
||||
push_back(*__first);
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -2774,7 +2792,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
|
||||
iterator __b = begin();
|
||||
size_type __r = static_cast<size_type>(__pos - __b);
|
||||
erase(__r, 1);
|
||||
return __b + __r;
|
||||
return __b + static_cast<difference_type>(__r);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -2785,7 +2803,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
|
||||
iterator __b = begin();
|
||||
size_type __r = static_cast<size_type>(__first - __b);
|
||||
erase(__r, static_cast<size_type>(__last - __first));
|
||||
return __b + __r;
|
||||
return __b + static_cast<difference_type>(__r);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3472,7 +3490,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
int
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const
|
||||
basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
|
||||
{
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
assert(__s != 0);
|
||||
@@ -3900,16 +3918,8 @@ template<class _CharT, class _Traits, class _Allocator>
|
||||
template<class _Ptr>
|
||||
size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
|
||||
{
|
||||
size_t __r = 0;
|
||||
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
|
||||
const size_t __m = size_t(0xF) << (__sr + 4);
|
||||
for (; __p != __e; ++__p)
|
||||
{
|
||||
__r = (__r << 4) + *__p;
|
||||
size_t __g = __r & __m;
|
||||
__r ^= __g | (__g >> __sr);
|
||||
}
|
||||
return __r;
|
||||
typedef typename iterator_traits<_Ptr>::value_type value_type;
|
||||
return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
|
||||
}
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
@@ -3965,8 +3975,8 @@ getline(basic_istream<_CharT, _Traits>&& __is,
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
extern template class basic_string<char>;
|
||||
extern template class basic_string<wchar_t>;
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_string<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>)
|
||||
|
||||
extern template
|
||||
string
|
||||
|
@@ -131,7 +131,9 @@ private:
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
5
include/support/solaris/floatingpoint.h
Normal file
5
include/support/solaris/floatingpoint.h
Normal file
@@ -0,0 +1,5 @@
|
||||
#define atof sun_atof
|
||||
#define strtod sun_strtod
|
||||
#include_next "floatingpoint.h"
|
||||
#undef atof
|
||||
#undef strtod
|
38
include/support/solaris/wchar.h
Normal file
38
include/support/solaris/wchar.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#define iswalpha sun_iswalpha
|
||||
#define iswupper sun_iswupper
|
||||
#define iswlower sun_iswlower
|
||||
#define iswdigit sun_iswdigit
|
||||
#define iswxdigit sun_iswxdigit
|
||||
#define iswalnum sun_iswalnum
|
||||
#define iswspace sun_iswspace
|
||||
#define iswpunct sun_iswpunct
|
||||
#define iswprint sun_iswprint
|
||||
#define iswgraph sun_iswgraph
|
||||
#define iswcntrl sun_iswcntrl
|
||||
#define iswctype sun_iswctype
|
||||
#define towlower sun_towlower
|
||||
#define towupper sun_towupper
|
||||
#define wcswcs sun_wcswcs
|
||||
#define wcswidth sun_wcswidth
|
||||
#define wcwidth sun_wcwidth
|
||||
#define wctype sun_wctype
|
||||
#define _WCHAR_T 1
|
||||
#include_next "wchar.h"
|
||||
#undef iswalpha
|
||||
#undef iswupper
|
||||
#undef iswlower
|
||||
#undef iswdigit
|
||||
#undef iswxdigit
|
||||
#undef iswalnum
|
||||
#undef iswspace
|
||||
#undef iswpunct
|
||||
#undef iswprint
|
||||
#undef iswgraph
|
||||
#undef iswcntrl
|
||||
#undef iswctype
|
||||
#undef towlower
|
||||
#undef towupper
|
||||
#undef wcswcs
|
||||
#undef wcswidth
|
||||
#undef wcwidth
|
||||
#undef wctype
|
146
include/support/solaris/xlocale.h
Normal file
146
include/support/solaris/xlocale.h
Normal file
@@ -0,0 +1,146 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Minimal xlocale implementation for Solaris. This implements the subset of
|
||||
// the xlocale APIs that libc++ depends on.
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifndef __XLOCALE_H_INCLUDED
|
||||
#define __XLOCALE_H_INCLUDED
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _LC_locale_t* locale_t;
|
||||
|
||||
#define LC_COLLATE_MASK (1<<0)
|
||||
#define LC_CTYPE_MASK (1<<1)
|
||||
#define LC_MESSAGES_MASK (1<<2)
|
||||
#define LC_MONETARY_MASK (1<<3)
|
||||
#define LC_NUMERIC_MASK (1<<4)
|
||||
#define LC_TIME_MASK (1<<5)
|
||||
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
|
||||
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
|
||||
|
||||
#define LC_GLOBAL_LOCALE ((locale_t)-1)
|
||||
|
||||
size_t __mb_cur_max(locale_t l);
|
||||
#define MB_CUR_MAX_L(l) __mb_cur_max(l)
|
||||
|
||||
locale_t newlocale(int mask, const char * locale, locale_t base);
|
||||
void freelocale(locale_t loc);
|
||||
|
||||
wint_t btowc_l(int __c, locale_t __l);
|
||||
|
||||
int wctob_l(wint_t __c, locale_t __l);
|
||||
|
||||
size_t wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l);
|
||||
|
||||
size_t mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l);
|
||||
|
||||
int mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l);
|
||||
|
||||
size_t mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l);
|
||||
|
||||
struct lconv *localeconv_l(locale_t __l);
|
||||
|
||||
size_t mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l);
|
||||
|
||||
int sprintf_l(char *__s, locale_t __l, const char *__format, ...);
|
||||
|
||||
int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
|
||||
|
||||
int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
|
||||
|
||||
int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
|
||||
|
||||
int isalnum_l(int,locale_t);
|
||||
int isalpha_l(int,locale_t);
|
||||
int isblank_l(int,locale_t);
|
||||
int iscntrl_l(int,locale_t);
|
||||
int isdigit_l(int,locale_t);
|
||||
int isgraph_l(int,locale_t);
|
||||
int islower_l(int,locale_t);
|
||||
int isprint_l(int,locale_t);
|
||||
int ispunct_l(int,locale_t);
|
||||
int isspace_l(int,locale_t);
|
||||
int isupper_l(int,locale_t);
|
||||
int isxdigit_l(int,locale_t);
|
||||
|
||||
int iswalnum_l(wchar_t,locale_t);
|
||||
int iswalpha_l(wchar_t,locale_t);
|
||||
int iswblank_l(wchar_t,locale_t);
|
||||
int iswcntrl_l(wchar_t,locale_t);
|
||||
int iswdigit_l(wchar_t,locale_t);
|
||||
int iswgraph_l(wchar_t,locale_t);
|
||||
int iswlower_l(wchar_t,locale_t);
|
||||
int iswprint_l(wchar_t,locale_t);
|
||||
int iswpunct_l(wchar_t,locale_t);
|
||||
int iswspace_l(wchar_t,locale_t);
|
||||
int iswupper_l(wchar_t,locale_t);
|
||||
int iswxdigit_l(wchar_t,locale_t);
|
||||
|
||||
int iswctype_l(wint_t, wctype_t, locale_t);
|
||||
|
||||
int toupper_l(int __c, locale_t __l);
|
||||
int tolower_l(int __c, locale_t __l);
|
||||
wint_t towupper_l(wint_t __c, locale_t __l);
|
||||
wint_t towlower_l(wint_t __c, locale_t __l);
|
||||
|
||||
|
||||
int strcoll_l(const char *__s1, const char *__s2, locale_t __l);
|
||||
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t __l);
|
||||
size_t strftime_l(char *__s, size_t __size, const char *__fmt, const struct tm
|
||||
*__tm, locale_t __l);
|
||||
|
||||
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t __l);
|
||||
|
||||
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
|
||||
locale_t __l);
|
||||
|
||||
|
||||
|
||||
size_t
|
||||
mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
|
||||
size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc);
|
||||
|
||||
|
||||
size_t
|
||||
wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src,
|
||||
size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc);
|
||||
|
||||
locale_t __cloc(void);
|
||||
|
||||
// FIXME: These are quick-and-dirty hacks to make things pretend to work
|
||||
static inline
|
||||
long long strtoll_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoll(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long strtol_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtol(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
long double strtold_l(const char *__nptr, char **__endptr,
|
||||
locale_t __loc) {
|
||||
return strtold(__nptr, __endptr);
|
||||
}
|
||||
static inline
|
||||
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoull(__nptr, __endptr, __base);
|
||||
}
|
||||
static inline
|
||||
unsigned long strtoul_l(const char *__nptr, char **__endptr,
|
||||
int __base, locale_t __loc) {
|
||||
return strtoul(__nptr, __endptr, __base);
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
79
include/support/win32/limits_win32.h
Normal file
79
include/support/win32/limits_win32.h
Normal file
@@ -0,0 +1,79 @@
|
||||
// -*- C++ -*-
|
||||
//===--------------------- support/win32/limits_win32.h -------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#error "This header is MSVC specific, Clang and GCC should not include it"
|
||||
#else
|
||||
|
||||
#ifndef NOMINMAX
|
||||
#define NOMINMAX
|
||||
#endif
|
||||
#include <windows.h> // ymath.h works correctly
|
||||
|
||||
#include <float.h> // limit constants
|
||||
|
||||
#define __FLT_MANT_DIG__ FLT_MANT_DIG
|
||||
#define __FLT_DIG__ FLT_DIG
|
||||
#define __FLT_RADIX__ FLT_RADIX
|
||||
#define __FLT_MIN_EXP__ FLT_MIN_EXP
|
||||
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
|
||||
#define __FLT_MAX_EXP__ FLT_MAX_EXP
|
||||
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
|
||||
#define __FLT_MIN__ FLT_MIN
|
||||
#define __FLT_MAX__ FLT_MAX
|
||||
#define __FLT_EPSILON__ FLT_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
|
||||
|
||||
#define __DBL_MANT_DIG__ DBL_MANT_DIG
|
||||
#define __DBL_DIG__ DBL_DIG
|
||||
#define __DBL_RADIX__ DBL_RADIX
|
||||
#define __DBL_MIN_EXP__ DBL_MIN_EXP
|
||||
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
|
||||
#define __DBL_MAX_EXP__ DBL_MAX_EXP
|
||||
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
|
||||
#define __DBL_MIN__ DBL_MIN
|
||||
#define __DBL_MAX__ DBL_MAX
|
||||
#define __DBL_EPSILON__ DBL_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
|
||||
|
||||
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
|
||||
#define __LDBL_DIG__ LDBL_DIG
|
||||
#define __LDBL_RADIX__ LDBL_RADIX
|
||||
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
|
||||
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
|
||||
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
|
||||
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
|
||||
#define __LDBL_MIN__ LDBL_MIN
|
||||
#define __LDBL_MAX__ LDBL_MAX
|
||||
#define __LDBL_EPSILON__ LDBL_EPSILON
|
||||
// predefined by MinGW GCC
|
||||
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
|
||||
|
||||
// __builtin replacements/workarounds
|
||||
#include <math.h> // HUGE_VAL
|
||||
#include <ymath.h> // internal MSVC header providing the needed functionality
|
||||
#define __builtin_huge_val() HUGE_VAL
|
||||
#define __builtin_huge_valf() _FInf._Float
|
||||
#define __builtin_huge_vall() _LInf._Long_double
|
||||
#define __builtin_nan(__dummy) _Nan._Double
|
||||
#define __builtin_nanf(__dummy) _FNan._Float
|
||||
#define __builtin_nanl(__dummmy) _LNan._Long_double
|
||||
#define __builtin_nans(__dummy) _Snan._Double
|
||||
#define __builtin_nansf(__dummy) _FSnan._Float
|
||||
#define __builtin_nansl(__dummy) _LSnan._Long_double
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
|
@@ -107,4 +107,10 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ )
|
||||
return ( c == L' ' || c == L'\t' );
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
inline int isblank( int c, locale_t /*loc*/ )
|
||||
{ return ( c == ' ' || c == '\t' ); }
|
||||
inline int iswblank( wint_t c, locale_t /*loc*/ )
|
||||
{ return ( c == L' ' || c == L'\t' ); }
|
||||
#endif // _MSC_VER
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
|
||||
|
113
include/support/win32/math_win32.h
Normal file
113
include/support/win32/math_win32.h
Normal file
@@ -0,0 +1,113 @@
|
||||
// -*- C++ -*-
|
||||
//===---------------------- support/win32/math_win32.h --------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is dual licensed under the MIT and the University of Illinois Open
|
||||
// Source Licenses. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
#error "This header is MSVC specific, Clang and GCC should not include it"
|
||||
#else
|
||||
|
||||
#include <math.h>
|
||||
|
||||
typedef float float_t;
|
||||
typedef double double_t;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
|
||||
{
|
||||
return _finite(num) != 0;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isinf( double num )
|
||||
{
|
||||
return !isfinite(num) && !_isnan(num);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isnan( double num )
|
||||
{
|
||||
return _isnan(num) != 0;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
|
||||
{
|
||||
int class_ = _fpclass(num);
|
||||
return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x > y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x >= y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
|
||||
{
|
||||
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x < y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
|
||||
{
|
||||
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x <= y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
|
||||
{
|
||||
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
|
||||
else return x < y || x > y;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
|
||||
{
|
||||
return isnan(x) || isnan(y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE bool signbit( double num )
|
||||
{
|
||||
switch(_fpclass(num))
|
||||
{
|
||||
case _FPCLASS_SNAN:
|
||||
case _FPCLASS_QNAN:
|
||||
case _FPCLASS_NINF:
|
||||
case _FPCLASS_NN:
|
||||
case _FPCLASS_ND:
|
||||
case _FPCLASS_NZ:
|
||||
return true;
|
||||
case _FPCLASS_PZ:
|
||||
case _FPCLASS_PD:
|
||||
case _FPCLASS_PN:
|
||||
case _FPCLASS_PINF:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
|
||||
{
|
||||
return (signbit (x) != signbit (y) ? - x : x);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
|
||||
{
|
||||
return ::_copysign(x,y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
|
||||
{
|
||||
return ::_copysignl(x,y);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
|
||||
{
|
||||
return _fpclass(num);
|
||||
}
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
|
@@ -15,17 +15,101 @@
|
||||
Functions and constants used in libc++ that are missing from the Windows C library.
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <wchar.h> // mbstate_t
|
||||
#include <stdio.h> // _snwprintf
|
||||
#define swprintf _snwprintf
|
||||
#define vswprintf _vsnwprintf
|
||||
#define vfscnaf fscanf
|
||||
|
||||
int vasprintf( char **sptr, const char *__restrict__ fmt , va_list ap );
|
||||
int asprintf(char **sptr, const char *__restrict__ fmt, ...);
|
||||
int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
|
||||
int asprintf( char **sptr, const char *__restrict fmt, ...);
|
||||
//int vfscanf( FILE *__restrict stream, const char *__restrict format,
|
||||
// va_list arg);
|
||||
|
||||
size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
|
||||
size_t nmc, size_t len, mbstate_t *__restrict__ ps );
|
||||
size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict__ ps );
|
||||
size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
|
||||
size_t nmc, size_t len, mbstate_t *__restrict ps );
|
||||
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
|
||||
size_t nwc, size_t len, mbstate_t *__restrict ps );
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
||||
#if defined(_MSC_VER)
|
||||
#define snprintf _snprintf
|
||||
|
||||
#include <xlocinfo.h>
|
||||
#define atoll _atoi64
|
||||
#define strtoll _strtoi64
|
||||
#define strtoull _strtoui64
|
||||
#define wcstoll _wcstoi64
|
||||
#define wcstoull _wcstoui64
|
||||
_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
|
||||
{ return _Stof(nptr, endptr, 0); }
|
||||
_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
|
||||
{ return _Stod(nptr, endptr, 0); }
|
||||
_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
|
||||
{ return _Stold(nptr, endptr, 0); }
|
||||
|
||||
#define _Exit _exit
|
||||
|
||||
#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
|
||||
#include <intrin.h>
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
|
||||
static const unsigned int m1 = 0x55555555; //binary: 0101...
|
||||
static const unsigned int m2 = 0x33333333; //binary: 00110011..
|
||||
static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
|
||||
static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
|
||||
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
|
||||
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
|
||||
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
|
||||
return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
|
||||
return __builtin_popcount(static_cast<int>(x));
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
|
||||
static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
|
||||
static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
|
||||
static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
|
||||
static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
|
||||
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
|
||||
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
|
||||
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
|
||||
return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
|
||||
{
|
||||
DWORD r = 0;
|
||||
_BitScanReverse(&r, x);
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
// sizeof(long) == sizeof(int) on Windows
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
|
||||
{ return __builtin_ctz( static_cast<int>(x) ); }
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
|
||||
{
|
||||
DWORD r = 0;
|
||||
_BitScanReverse64(&r, x);
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
|
||||
{
|
||||
DWORD r = 0;
|
||||
_BitScanForward(&r, x);
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
// sizeof(long) == sizeof(int) on Windows
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
|
||||
{ return __builtin_clz( static_cast<int>(x) ); }
|
||||
_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
|
||||
{
|
||||
DWORD r = 0;
|
||||
_BitScanForward64(&r, x);
|
||||
return static_cast<int>(r);
|
||||
}
|
||||
#endif // !__clang__
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
|
||||
|
@@ -223,7 +223,9 @@ template <> struct hash<std::error_code>;
|
||||
#include <stdexcept>
|
||||
#include <__functional_base>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@@ -243,9 +245,8 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
|
||||
// for them:
|
||||
|
||||
//enum class errc
|
||||
struct errc
|
||||
_LIBCPP_DECLARE_STRONG_ENUM(errc)
|
||||
{
|
||||
enum _ {
|
||||
address_family_not_supported = EAFNOSUPPORT,
|
||||
address_in_use = EADDRINUSE,
|
||||
address_not_available = EADDRNOTAVAIL,
|
||||
@@ -341,38 +342,32 @@ enum _ {
|
||||
value_too_large = EOVERFLOW,
|
||||
wrong_protocol_type = EPROTOTYPE
|
||||
};
|
||||
|
||||
_ __v_;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
errc(_ __v) : __v_(__v) {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
operator int() const {return __v_;}
|
||||
|
||||
};
|
||||
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
|
||||
: true_type { };
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
template <>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
|
||||
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::__lx>
|
||||
: true_type { };
|
||||
#endif
|
||||
|
||||
class error_condition;
|
||||
class error_code;
|
||||
class _LIBCPP_VISIBLE error_condition;
|
||||
class _LIBCPP_VISIBLE error_code;
|
||||
|
||||
// class error_category
|
||||
|
||||
class __do_message;
|
||||
class _LIBCPP_HIDDEN __do_message;
|
||||
|
||||
class _LIBCPP_VISIBLE error_category
|
||||
{
|
||||
public:
|
||||
virtual ~error_category() _NOEXCEPT;
|
||||
|
||||
private:
|
||||
error_category() _NOEXCEPT;
|
||||
private:
|
||||
error_category(const error_category&);// = delete;
|
||||
error_category& operator=(const error_category&);// = delete;
|
||||
|
||||
@@ -392,7 +387,7 @@ public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
|
||||
|
||||
friend class __do_message;
|
||||
friend class _LIBCPP_HIDDEN __do_message;
|
||||
};
|
||||
|
||||
class _LIBCPP_HIDDEN __do_message
|
||||
@@ -417,10 +412,10 @@ public:
|
||||
error_condition(int __val, const error_category& __cat) _NOEXCEPT
|
||||
: __val_(__val), __cat_(&__cat) {}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_condition(_E __e,
|
||||
typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
|
||||
error_condition(_Ep __e,
|
||||
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_condition(__e);}
|
||||
|
||||
@@ -431,14 +426,14 @@ public:
|
||||
__cat_ = &__cat;
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
typename enable_if
|
||||
<
|
||||
is_error_condition_enum<_E>::value,
|
||||
is_error_condition_enum<_Ep>::value,
|
||||
error_condition&
|
||||
>::type
|
||||
operator=(_E __e) _NOEXCEPT
|
||||
operator=(_Ep __e) _NOEXCEPT
|
||||
{*this = make_error_condition(__e); return *this;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
@@ -456,7 +451,7 @@ public:
|
||||
string message() const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
//explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||
};
|
||||
|
||||
@@ -472,7 +467,7 @@ bool
|
||||
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() < __y.category()
|
||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
||||
|| (__x.category() == __y.category() && __x.value() < __y.value());
|
||||
}
|
||||
|
||||
// error_code
|
||||
@@ -489,10 +484,10 @@ public:
|
||||
error_code(int __val, const error_category& __cat) _NOEXCEPT
|
||||
: __val_(__val), __cat_(&__cat) {}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
error_code(_E __e,
|
||||
typename enable_if<is_error_code_enum<_E>::value>::type* = 0
|
||||
error_code(_Ep __e,
|
||||
typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_code(__e);}
|
||||
|
||||
@@ -503,14 +498,14 @@ public:
|
||||
__cat_ = &__cat;
|
||||
}
|
||||
|
||||
template <class _E>
|
||||
template <class _Ep>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
typename enable_if
|
||||
<
|
||||
is_error_code_enum<_E>::value,
|
||||
is_error_code_enum<_Ep>::value,
|
||||
error_code&
|
||||
>::type
|
||||
operator=(_E __e) _NOEXCEPT
|
||||
operator=(_Ep __e) _NOEXCEPT
|
||||
{*this = make_error_code(__e); return *this;}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
@@ -533,7 +528,7 @@ public:
|
||||
string message() const;
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
//explicit
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __val_ != 0;}
|
||||
};
|
||||
|
||||
@@ -549,7 +544,7 @@ bool
|
||||
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
|
||||
{
|
||||
return __x.category() < __y.category()
|
||||
|| __x.category() == __y.category() && __x.value() < __y.value();
|
||||
|| (__x.category() == __y.category() && __x.value() < __y.value());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@@ -22,6 +22,8 @@
|
||||
#include <complex.h>
|
||||
#include <math.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_TGMATH_H
|
||||
|
171
include/thread
171
include/thread
@@ -26,41 +26,41 @@ public:
|
||||
class id;
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
thread();
|
||||
thread() noexcept;
|
||||
template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
|
||||
~thread();
|
||||
|
||||
thread(const thread&) = delete;
|
||||
thread(thread&& t);
|
||||
thread(thread&& t) noexcept;
|
||||
|
||||
thread& operator=(const thread&) = delete;
|
||||
thread& operator=(thread&& t);
|
||||
thread& operator=(thread&& t) noexcept;
|
||||
|
||||
void swap(thread& t);
|
||||
void swap(thread& t) noexcept;
|
||||
|
||||
bool joinable() const;
|
||||
bool joinable() const noexcept;
|
||||
void join();
|
||||
void detach();
|
||||
id get_id() const;
|
||||
id get_id() const noexcept;
|
||||
native_handle_type native_handle();
|
||||
|
||||
static unsigned hardware_concurrency();
|
||||
static unsigned hardware_concurrency() noexcept;
|
||||
};
|
||||
|
||||
void swap(thread& x, thread& y);
|
||||
void swap(thread& x, thread& y) noexcept;
|
||||
|
||||
class thread::id
|
||||
{
|
||||
public:
|
||||
id();
|
||||
id() noexcept;
|
||||
};
|
||||
|
||||
bool operator==(thread::id x, thread::id y);
|
||||
bool operator!=(thread::id x, thread::id y);
|
||||
bool operator< (thread::id x, thread::id y);
|
||||
bool operator<=(thread::id x, thread::id y);
|
||||
bool operator> (thread::id x, thread::id y);
|
||||
bool operator>=(thread::id x, thread::id y);
|
||||
bool operator==(thread::id x, thread::id y) noexcept;
|
||||
bool operator!=(thread::id x, thread::id y) noexcept;
|
||||
bool operator< (thread::id x, thread::id y) noexcept;
|
||||
bool operator<=(thread::id x, thread::id y) noexcept;
|
||||
bool operator> (thread::id x, thread::id y) noexcept;
|
||||
bool operator>=(thread::id x, thread::id y) noexcept;
|
||||
|
||||
template<class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
@@ -69,9 +69,9 @@ operator<<(basic_ostream<charT, traits>& out, thread::id id);
|
||||
namespace this_thread
|
||||
{
|
||||
|
||||
thread::id get_id();
|
||||
thread::id get_id() noexcept;
|
||||
|
||||
void yield();
|
||||
void yield() noexcept;
|
||||
|
||||
template <class Clock, class Duration>
|
||||
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
|
||||
@@ -100,7 +100,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define __STDCPP_THREADS__ __cplusplus
|
||||
|
||||
@@ -135,52 +137,55 @@ template <class _Tp>
|
||||
void
|
||||
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
|
||||
{
|
||||
delete static_cast<pointer>(__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");
|
||||
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_);
|
||||
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;
|
||||
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;
|
||||
pointer __p_old = get();
|
||||
pthread_setspecific(__key_, __p);
|
||||
delete __p_old;
|
||||
}
|
||||
|
||||
class thread;
|
||||
class __thread_id;
|
||||
class _LIBCPP_VISIBLE thread;
|
||||
class _LIBCPP_VISIBLE __thread_id;
|
||||
|
||||
namespace this_thread
|
||||
{
|
||||
|
||||
__thread_id get_id();
|
||||
_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
|
||||
|
||||
} // this_thread
|
||||
|
||||
class _LIBCPP_VISIBLE __thread_id;
|
||||
template<> struct _LIBCPP_VISIBLE hash<__thread_id>;
|
||||
|
||||
class _LIBCPP_VISIBLE __thread_id
|
||||
{
|
||||
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
|
||||
@@ -190,25 +195,25 @@ class _LIBCPP_VISIBLE __thread_id
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id() : __id_(0) {}
|
||||
__thread_id() _NOEXCEPT : __id_(0) {}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(__thread_id __x, __thread_id __y)
|
||||
bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return __x.__id_ == __y.__id_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(__thread_id __x, __thread_id __y)
|
||||
bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator< (__thread_id __x, __thread_id __y)
|
||||
bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return __x.__id_ < __y.__id_;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator<=(__thread_id __x, __thread_id __y)
|
||||
bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return !(__y < __x);}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator> (__thread_id __x, __thread_id __y)
|
||||
bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return __y < __x ;}
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator>=(__thread_id __x, __thread_id __y)
|
||||
bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
|
||||
{return !(__x < __y);}
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
@@ -222,12 +227,11 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id(pthread_t __id) : __id_(__id) {}
|
||||
|
||||
friend __thread_id this_thread::get_id();
|
||||
friend __thread_id this_thread::get_id() _NOEXCEPT;
|
||||
friend class _LIBCPP_VISIBLE thread;
|
||||
friend struct _LIBCPP_VISIBLE hash<__thread_id>;
|
||||
};
|
||||
|
||||
template<class _Tp> struct hash;
|
||||
|
||||
template<>
|
||||
struct _LIBCPP_VISIBLE hash<__thread_id>
|
||||
: public unary_function<__thread_id, size_t>
|
||||
@@ -235,8 +239,7 @@ struct _LIBCPP_VISIBLE hash<__thread_id>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(__thread_id __v) const
|
||||
{
|
||||
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
|
||||
return *__p;
|
||||
return hash<pthread_t>()(__v.__id_);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -245,7 +248,7 @@ namespace this_thread
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__thread_id
|
||||
get_id()
|
||||
get_id() _NOEXCEPT
|
||||
{
|
||||
return pthread_self();
|
||||
}
|
||||
@@ -263,39 +266,39 @@ public:
|
||||
typedef pthread_t native_handle_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread() : __t_(0) {}
|
||||
thread() _NOEXCEPT : __t_(0) {}
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _F, class ..._Args,
|
||||
template <class _Fp, class ..._Args,
|
||||
class = typename enable_if
|
||||
<
|
||||
!is_same<typename decay<_F>::type, thread>::value
|
||||
!is_same<typename decay<_Fp>::type, thread>::value
|
||||
>::type
|
||||
>
|
||||
explicit thread(_F&& __f, _Args&&... __args);
|
||||
explicit thread(_Fp&& __f, _Args&&... __args);
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
template <class _F> explicit thread(_F __f);
|
||||
template <class _Fp> explicit thread(_Fp __f);
|
||||
#endif
|
||||
~thread();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread& operator=(thread&& __t);
|
||||
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
|
||||
thread& operator=(thread&& __t) _NOEXCEPT;
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);}
|
||||
void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool joinable() const {return __t_ != 0;}
|
||||
bool joinable() const _NOEXCEPT {return __t_ != 0;}
|
||||
void join();
|
||||
void detach();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
id get_id() const {return __t_;}
|
||||
id get_id() const _NOEXCEPT {return __t_;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
native_handle_type native_handle() {return __t_;}
|
||||
native_handle_type native_handle() _NOEXCEPT {return __t_;}
|
||||
|
||||
static unsigned hardware_concurrency();
|
||||
static unsigned hardware_concurrency() _NOEXCEPT;
|
||||
};
|
||||
|
||||
class __assoc_sub_state;
|
||||
@@ -320,34 +323,34 @@ __thread_specific_ptr<__thread_struct>& __thread_local_data();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F, class ..._Args, size_t ..._Indices>
|
||||
template <class _Fp, class ..._Args, size_t ..._Indices>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
|
||||
__threaad_execute(tuple<_Fp, _Args...>& __t, __tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
template <class _Fp>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
{
|
||||
__thread_local_data().reset(new __thread_struct);
|
||||
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
|
||||
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
|
||||
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
|
||||
__threaad_execute(*__p, _Index());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _F, class ..._Args,
|
||||
template <class _Fp, class ..._Args,
|
||||
class
|
||||
>
|
||||
thread::thread(_F&& __f, _Args&&... __args)
|
||||
thread::thread(_Fp&& __f, _Args&&... __args)
|
||||
{
|
||||
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
|
||||
_VSTD::unique_ptr<_G> __p(new _G(__decay_copy(_VSTD::forward<_F>(__f)),
|
||||
typedef tuple<typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp;
|
||||
_VSTD::unique_ptr<_Gp> __p(new _Gp(__decay_copy(_VSTD::forward<_Fp>(__f)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
else
|
||||
@@ -356,21 +359,21 @@ thread::thread(_F&& __f, _Args&&... __args)
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _F>
|
||||
template <class _Fp>
|
||||
void*
|
||||
__thread_proxy(void* __vp)
|
||||
{
|
||||
__thread_local_data().reset(new __thread_struct);
|
||||
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
|
||||
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
(*__p)();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _F>
|
||||
thread::thread(_F __f)
|
||||
template <class _Fp>
|
||||
thread::thread(_Fp __f)
|
||||
{
|
||||
std::unique_ptr<_F> __p(new _F(__f));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_F>, __p.get());
|
||||
std::unique_ptr<_Fp> __p(new _Fp(__f));
|
||||
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Fp>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
else
|
||||
@@ -383,7 +386,7 @@ thread::thread(_F __f)
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
thread&
|
||||
thread::operator=(thread&& __t)
|
||||
thread::operator=(thread&& __t) _NOEXCEPT
|
||||
{
|
||||
if (__t_ != 0)
|
||||
terminate();
|
||||
@@ -395,7 +398,7 @@ thread::operator=(thread&& __t)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(thread& __x, thread& __y) {__x.swap(__y);}
|
||||
void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
|
||||
|
||||
namespace this_thread
|
||||
{
|
||||
@@ -407,10 +410,20 @@ void
|
||||
sleep_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
nanoseconds __ns = duration_cast<nanoseconds>(__d);
|
||||
if (__ns < __d)
|
||||
++__ns;
|
||||
sleep_for(__ns);
|
||||
if (__d > duration<_Rep, _Period>::zero())
|
||||
{
|
||||
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
|
||||
nanoseconds __ns;
|
||||
if (__d < _Max)
|
||||
{
|
||||
__ns = duration_cast<nanoseconds>(__d);
|
||||
if (__ns < __d)
|
||||
++__ns;
|
||||
}
|
||||
else
|
||||
__ns = nanoseconds::max();
|
||||
sleep_for(__ns);
|
||||
}
|
||||
}
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
@@ -435,7 +448,7 @@ sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void yield() {sched_yield();}
|
||||
void yield() _NOEXCEPT {sched_yield();}
|
||||
|
||||
} // this_thread
|
||||
|
||||
|
275
include/tuple
275
include/tuple
@@ -116,13 +116,78 @@ template <class... Types>
|
||||
#include <__config>
|
||||
#include <__tuple>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
#include <__functional_base>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// allocator_arg_t
|
||||
|
||||
struct _LIBCPP_VISIBLE allocator_arg_t { };
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||
extern const allocator_arg_t allocator_arg;
|
||||
#else
|
||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
#endif
|
||||
|
||||
// uses_allocator
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_allocator_type
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
|
||||
struct __uses_allocator
|
||||
: public integral_constant<bool,
|
||||
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
struct __uses_allocator<_Tp, _Alloc, false>
|
||||
: public false_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
struct _LIBCPP_VISIBLE uses_allocator
|
||||
: public __uses_allocator<_Tp, _Alloc>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// uses-allocator construction
|
||||
|
||||
template <class _Tp, class _Alloc, class ..._Args>
|
||||
struct __uses_alloc_ctor_imp
|
||||
{
|
||||
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
|
||||
static const bool __ic =
|
||||
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
|
||||
static const int value = __ua ? 2 - __ic : 0;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Alloc, class ..._Args>
|
||||
struct __uses_alloc_ctor
|
||||
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
|
||||
{};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// tuple_size
|
||||
@@ -144,7 +209,11 @@ public:
|
||||
|
||||
// __tuple_leaf
|
||||
|
||||
template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
|
||||
template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value
|
||||
#if __has_feature(is_final)
|
||||
&& !__is_final(_Hp)
|
||||
#endif
|
||||
>
|
||||
class __tuple_leaf;
|
||||
|
||||
template <size_t _Ip, class _Hp, bool _Ep>
|
||||
@@ -162,7 +231,8 @@ class __tuple_leaf
|
||||
|
||||
__tuple_leaf& operator=(const __tuple_leaf&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __tuple_leaf() : value()
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
|
||||
{static_assert(!is_reference<_Hp>::value,
|
||||
"Attempted to default construct a reference element in a tuple");}
|
||||
|
||||
@@ -190,16 +260,16 @@ public:
|
||||
template <class _Tp,
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
|
||||
: value(_VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_reference<_Hp>::value ||
|
||||
is_lvalue_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");}
|
||||
@@ -209,13 +279,13 @@ public:
|
||||
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
|
||||
: value(_VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_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)),
|
||||
"Attempted to construct a reference element in a tuple with an rvalue");}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -223,13 +293,13 @@ public:
|
||||
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
|
||||
: value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Hp>::value &&
|
||||
(is_lvalue_reference<_Tp>::value ||
|
||||
is_same<typename remove_reference<_Tp>::type,
|
||||
reference_wrapper<
|
||||
typename remove_reference<_Hp>::type
|
||||
>
|
||||
>::value),
|
||||
>::value)),
|
||||
"Attempted to construct a reference element in a tuple with an rvalue");}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -237,28 +307,29 @@ public:
|
||||
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
|
||||
: value(_VSTD::forward<_Tp>(__t), __a)
|
||||
{static_assert(!is_lvalue_reference<_Hp>::value ||
|
||||
is_lvalue_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)),
|
||||
"Attempted to construct a reference element in a tuple with an rvalue");}
|
||||
|
||||
__tuple_leaf(const __tuple_leaf& __t)
|
||||
__tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
|
||||
: 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)
|
||||
_NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
|
||||
: value(__t.get()) {}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_leaf&
|
||||
operator=(_Tp&& __t)
|
||||
operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
|
||||
{
|
||||
value = _VSTD::forward<_Tp>(__t);
|
||||
return *this;
|
||||
@@ -271,8 +342,8 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _Hp& get() {return value;}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return value;}
|
||||
_LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return value;}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return value;}
|
||||
};
|
||||
|
||||
template <size_t _Ip, class _Hp>
|
||||
@@ -282,7 +353,8 @@ class __tuple_leaf<_Ip, _Hp, true>
|
||||
|
||||
__tuple_leaf& operator=(const __tuple_leaf&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __tuple_leaf() {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
|
||||
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@@ -301,7 +373,7 @@ public:
|
||||
template <class _Tp,
|
||||
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(_Tp&& __t)
|
||||
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
|
||||
: _Hp(_VSTD::forward<_Tp>(__t)) {}
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
@@ -322,12 +394,13 @@ public:
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
|
||||
_NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
|
||||
: _Hp(__t.get()) {}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_leaf&
|
||||
operator=(_Tp&& __t)
|
||||
operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
|
||||
{
|
||||
_Hp::operator=(_VSTD::forward<_Tp>(__t));
|
||||
return *this;
|
||||
@@ -341,13 +414,13 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _Hp& get() {return static_cast<_Hp&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
|
||||
};
|
||||
|
||||
template <class ..._Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __swallow(_Tp&&...) {}
|
||||
void __swallow(_Tp&&...) _NOEXCEPT {}
|
||||
|
||||
template <bool ...> struct __all;
|
||||
|
||||
@@ -357,10 +430,10 @@ struct __all<>
|
||||
static const bool value = true;
|
||||
};
|
||||
|
||||
template <bool _B0, bool ... _B>
|
||||
struct __all<_B0, _B...>
|
||||
template <bool _B0, bool ... _Bp>
|
||||
struct __all<_B0, _Bp...>
|
||||
{
|
||||
static const bool value = _B0 && __all<_B...>::value;
|
||||
static const bool value = _B0 && __all<_Bp...>::value;
|
||||
};
|
||||
|
||||
// __tuple_impl
|
||||
@@ -371,13 +444,19 @@ template<size_t ..._Indx, class ..._Tp>
|
||||
struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
: public __tuple_leaf<_Indx, _Tp>...
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR __tuple_impl()
|
||||
_NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
|
||||
|
||||
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...>,
|
||||
_Up&&... __u) :
|
||||
_Up&&... __u)
|
||||
_NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
|
||||
__all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
|
||||
__tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
|
||||
__tuple_leaf<_Ul, _Tl>()...
|
||||
{}
|
||||
@@ -402,7 +481,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
>::type
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_impl(_Tuple&& __t)
|
||||
__tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
|
||||
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
|
||||
{}
|
||||
@@ -428,13 +508,22 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
|
||||
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
|
||||
__tuple_impl&
|
||||
>::type
|
||||
operator=(_Tuple&& __t)
|
||||
operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
|
||||
{
|
||||
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
|
||||
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__tuple_impl&
|
||||
operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
|
||||
{
|
||||
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(__tuple_impl& __t)
|
||||
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
|
||||
@@ -451,15 +540,19 @@ class _LIBCPP_VISIBLE tuple
|
||||
base base_;
|
||||
|
||||
template <size_t _Jp, class ..._Up> friend
|
||||
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
|
||||
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
|
||||
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...>&) _NOEXCEPT;
|
||||
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...>&&) _NOEXCEPT;
|
||||
public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit tuple(const _Tp& ... __t)
|
||||
_LIBCPP_CONSTEXPR tuple()
|
||||
_NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
|
||||
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
|
||||
typename __make_tuple_indices<0>::type(),
|
||||
@@ -479,7 +572,7 @@ public:
|
||||
) {}
|
||||
|
||||
template <class ..._Up,
|
||||
class = typename enable_if
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Up) <= sizeof...(_Tp) &&
|
||||
__tuple_convertible
|
||||
@@ -489,12 +582,62 @@ public:
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value
|
||||
>::type
|
||||
>::value,
|
||||
bool
|
||||
>::type = false
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(_Up&&... __u)
|
||||
_NOEXCEPT_((
|
||||
is_nothrow_constructible<
|
||||
typename __make_tuple_indices<sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
_Up...
|
||||
>::value
|
||||
))
|
||||
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
_VSTD::forward<_Up>(__u)...) {}
|
||||
|
||||
template <class ..._Up,
|
||||
typename enable_if
|
||||
<
|
||||
sizeof...(_Up) <= sizeof...(_Tp) &&
|
||||
__tuple_constructible
|
||||
<
|
||||
tuple<_Up...>,
|
||||
typename __make_tuple_types<tuple,
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value &&
|
||||
!__tuple_convertible
|
||||
<
|
||||
tuple<_Up...>,
|
||||
typename __make_tuple_types<tuple,
|
||||
sizeof...(_Up) < sizeof...(_Tp) ?
|
||||
sizeof...(_Up) :
|
||||
sizeof...(_Tp)>::type
|
||||
>::value,
|
||||
bool
|
||||
>::type =false
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit
|
||||
tuple(_Up&&... __u)
|
||||
_NOEXCEPT_((
|
||||
is_nothrow_constructible<
|
||||
typename __make_tuple_indices<sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
|
||||
_Up...
|
||||
>::value
|
||||
))
|
||||
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
|
||||
@@ -525,13 +668,27 @@ public:
|
||||
_VSTD::forward<_Up>(__u)...) {}
|
||||
|
||||
template <class _Tuple,
|
||||
class = typename enable_if
|
||||
typename enable_if
|
||||
<
|
||||
__tuple_convertible<_Tuple, tuple>::value
|
||||
>::type
|
||||
__tuple_convertible<_Tuple, tuple>::value,
|
||||
bool
|
||||
>::type = false
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(_Tuple&& __t)
|
||||
tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
|
||||
: base_(_VSTD::forward<_Tuple>(__t)) {}
|
||||
|
||||
template <class _Tuple,
|
||||
typename enable_if
|
||||
<
|
||||
__tuple_constructible<_Tuple, tuple>::value &&
|
||||
!__tuple_convertible<_Tuple, tuple>::value,
|
||||
bool
|
||||
>::type = false
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit
|
||||
tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
|
||||
: base_(_VSTD::forward<_Tuple>(__t)) {}
|
||||
|
||||
template <class _Alloc, class _Tuple,
|
||||
@@ -552,7 +709,7 @@ public:
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple&
|
||||
operator=(_Tuple&& __t)
|
||||
operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
|
||||
{
|
||||
base_.operator=(_VSTD::forward<_Tuple>(__t));
|
||||
return *this;
|
||||
@@ -568,19 +725,19 @@ class _LIBCPP_VISIBLE tuple<>
|
||||
{
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple() {}
|
||||
_LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&) {}
|
||||
tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
|
||||
template <class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
|
||||
template <class _U>
|
||||
tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
|
||||
template <class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(array<_U, 0>) {}
|
||||
template <class _Alloc, class _U>
|
||||
tuple(array<_Up, 0>) _NOEXCEPT {}
|
||||
template <class _Alloc, class _Up>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
|
||||
tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(tuple&) _NOEXCEPT {}
|
||||
};
|
||||
@@ -601,7 +758,7 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(tuple<_Tp...>& __t)
|
||||
get(tuple<_Tp...>& __t) _NOEXCEPT
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
|
||||
@@ -610,7 +767,7 @@ get(tuple<_Tp...>& __t)
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
|
||||
get(const tuple<_Tp...>& __t)
|
||||
get(const tuple<_Tp...>& __t) _NOEXCEPT
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
|
||||
@@ -619,7 +776,7 @@ get(const tuple<_Tp...>& __t)
|
||||
template <size_t _Ip, class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(tuple<_Tp...>&& __t)
|
||||
get(tuple<_Tp...>&& __t) _NOEXCEPT
|
||||
{
|
||||
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
|
||||
return static_cast<type&&>(
|
||||
@@ -631,7 +788,7 @@ get(tuple<_Tp...>&& __t)
|
||||
template <class ..._Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp&...>
|
||||
tie(_Tp&... __t)
|
||||
tie(_Tp&... __t) _NOEXCEPT
|
||||
{
|
||||
return tuple<_Tp&...>(__t...);
|
||||
}
|
||||
@@ -646,7 +803,7 @@ struct __ignore_t
|
||||
|
||||
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
|
||||
|
||||
template <class _Tp> class reference_wrapper;
|
||||
template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_tuple_return
|
||||
@@ -677,19 +834,19 @@ make_tuple(_Tp&&... __t)
|
||||
template <class... _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Tp&&...>
|
||||
forward_as_tuple(_Tp&&... __t)
|
||||
forward_as_tuple(_Tp&&... __t) _NOEXCEPT
|
||||
{
|
||||
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
|
||||
}
|
||||
|
||||
template <size_t _I>
|
||||
template <size_t _Ip>
|
||||
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);
|
||||
return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -720,15 +877,15 @@ operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
|
||||
return !(__x == __y);
|
||||
}
|
||||
|
||||
template <size_t _I>
|
||||
template <size_t _Ip>
|
||||
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) ||
|
||||
(!__tuple_less<_I-1>()(__y, __x) && get<_I-1>(__x) < get<_I-1>(__y));
|
||||
return __tuple_less<_Ip-1>()(__x, __y) ||
|
||||
(!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -833,7 +990,7 @@ tuple_cat()
|
||||
return tuple<>();
|
||||
}
|
||||
|
||||
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
|
||||
template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
|
||||
struct __tuple_cat_return_ref_imp;
|
||||
|
||||
template <class ..._Types, size_t ..._I0, class _Tuple0>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user