Compare commits

...

431 Commits

Author SHA1 Message Date
Pawel Wodnicki
1b3775e38c Merging r170026: into the 3.2 release branch.
Zhang Xiongpang:  Add definitions for const data members.  Fixes http://llvm.org/bugs/show_bug.cgi?id=14585.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_32@170137 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-13 16:31:31 +00:00
Pawel Wodnicki
864e2aaa4c 3.2 release branch r167706
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_32@167706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-12 04:17:58 +00:00
Howard Hinnant
0919dbaab3 Dimitry Andric: Silence some miscellaneous warnings.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167493 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:55:44 +00:00
Howard Hinnant
9bae2a9dc5 Dimitry Andric: Silence some warnings in <locale>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:48:33 +00:00
Howard Hinnant
9d5e9d3d66 Enable the tuple interface of pair in C++03 mode.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167491 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:42:45 +00:00
Howard Hinnant
22b781bf0c Update instructions for building and using libc++ on Mac OS
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167490 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:31:37 +00:00
Howard Hinnant
ff9267709d Provide a way to disable use of extern templates in libc++. This is intended for the clients of libc++, not the libc++ build. The dylib should always contain the extern templates. To disable the client needs to put -D'_LIBCPP_EXTERN_TEMPLATE(...)=' on the command line.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167486 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-06 21:08:48 +00:00
Howard Hinnant
73c85c7725 peek should set eofbit if sgetc() returns eof.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167238 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-01 17:32:07 +00:00
Howard Hinnant
4af2cf38f0 Richard Smith: This fixes a problem in std::is_constructible for incomplete types, and those types with a user-defined operator,().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167233 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-01 16:32:14 +00:00
Howard Hinnant
9c0df1416f Rename uses of _ and __ because these are getting stepped on by macros from other system code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@167038 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-30 19:06:59 +00:00
Argyrios Kyrtzidis
eac2a01863 Add an entry in CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165949 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-15 17:34:53 +00:00
Howard Hinnant
1c0be3864a Use traits_type::to_int_type in basic_streambuf<_CharT, _Traits>::xsputn when calling overflow to correctly handle negative signed character types. This fixes http://llvm.org/bugs/show_bug.cgi?id=14074.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165884 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 19:31:51 +00:00
Howard Hinnant
999fc97ef2 Dimitry Andric: FreeBSD only: Add the C11 aligned_alloc to <cstdlib> and adjust the inclusion of quick_exit.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165882 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 18:03:53 +00:00
Argyrios Kyrtzidis
1dc6f7ab97 Don't neglect to "return *this".
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165860 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-13 02:03:45 +00:00
Howard Hinnant
75536baae7 Holger Arnold: Correct the use and testing of __GNUC__ and __GNUC_MINOR__ in <__config>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165151 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-03 20:48:05 +00:00
Howard Hinnant
95c0e9f9e1 Make vector::iterator and string::iterator more resilient against overly generic relational operators.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@165033 91177308-0d34-0410-b5e6-96231b3b80d8
2012-10-02 19:45:42 +00:00
Howard Hinnant
155ff6e95a Due to a mistake on my own part, I need to burn some version numbers. This does not impact any of the implementation of libc++, and does not impact the ABI in any way.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164832 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-28 17:42:25 +00:00
Howard Hinnant
8d36c432f2 Bump _LIBCPP_VERSION to 1002
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164700 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-26 15:38:09 +00:00
Howard Hinnant
c25d158c62 Apply the emulated nullptr_t with constexpr. This is an unusual configuration that would take advantage of this. But it has popped up in the wild and does no harm to support it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164575 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-24 23:36:40 +00:00
Marshall Clow
c004e2e7d7 Updating email address
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164489 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-24 14:27:10 +00:00
Bob Wilson
3c6fefdf44 Fix installheaders target to do what it did prior to r161760. rdar://12348765
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164413 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-21 20:49:54 +00:00
Howard Hinnant
2d3f4ee99f Add overflow check to tanh(complex) and reduce to finite answer. Fixes http://llvm.org/bugs/show_bug.cgi?id=13874
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164266 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 23:51:47 +00:00
Howard Hinnant
a585de645c Overloaded __pad_and_output on ostreambuf_iterator and in this overload call sputn instead of dereferencing the iterator which calls sputc. This is intended to be purely a performance optimization, especially for clients who may have overloaded the virtual function xsputn.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164241 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-19 19:14:15 +00:00
Howard Hinnant
7eb9f1e3a3 Align <atomic> with clang r163964 which disallows const _Atomic types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@164004 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-16 20:33:09 +00:00
Howard Hinnant
6cb977bf0c Update CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163949 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 23:28:54 +00:00
Howard Hinnant
33be35effe Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you send me a patch to CREDITS.TXT?
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163862 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-14 00:39:16 +00:00
Howard Hinnant
5c90cbad38 Dimitry Andric: FreeBSD porting tweaks for PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163626 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-11 16:10:20 +00:00
Howard Hinnant
460b4cadde Some minor mingw64 porting tweaks from Glen.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@163120 91177308-0d34-0410-b5e6-96231b3b80d8
2012-09-03 18:13:11 +00:00
Howard Hinnant
cf115d2cc6 Change sleep_for, sleep_until, and the condition_variable timed wait
functions to protect against duration and time_point overflow.  Since
we're about to wait anyway, we can afford to spend a few more cycles on
this checking.  I purposefully did not treat the timed try_locks with
overflow checking.  This fixes
http://llvm.org/bugs/show_bug.cgi?id=13721 .  I'm unsure if the standard
needs clarification in this area, or if this is simply QOI.  The
<chrono> facilities were never intended to overflow check, but just to
not overflow if durations stayed within +/- 292 years.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162925 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-30 19:14:33 +00:00
Howard Hinnant
c417a802ed Hyeon-bin Jeong: libc++ fails to create any classes inherit from basic_ios if they
provided char type other than char or wchar_t. It throw exception during
construction, so there is no chance to imbue own ctype.

This fixes http://llvm.org/bugs/show_bug.cgi?id=13698

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162648 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-26 18:05:35 +00:00
Howard Hinnant
70e441a9b0 Update CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162647 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-26 17:46:29 +00:00
Howard Hinnant
a5160283a4 Michel Morin: My previous fix for C++03 was incomplete.
It does not consider user-defined conversions that convert an rvalue
into an lvalue and works incorrectly for types with such a conversion
operator.
For example, 

    struct foo
    {
        operator int&();
    };

 returns false_type. 
Attached a patch that fixes this problem. 
http://llvm.org/bugs/show_bug.cgi?id=13601

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162644 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-25 15:06:50 +00:00
Howard Hinnant
3882d397c4 Wrap throw in _LIBCPP_NO_EXCEPTIONS in debug.cpp. Calls abort if can't throw an exception. Fixes http://llvm.org/bugs/show_bug.cgi?id=13082.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 22:15:12 +00:00
Howard Hinnant
37bdf0e6bd Have basic_istream seekg, putback and unget first clear eofbit. Fixes http://llvm.org/bugs/show_bug.cgi?id=13089.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 22:03:03 +00:00
Howard Hinnant
d57de091c3 Add Hyeon-bin Jeong to CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 21:45:19 +00:00
Howard Hinnant
d305d3c1a2 Hyeon-Bin Jeong: 1. sync() should reset it’s external buffer pointers.
Remaining characters should be discarded once sync() called. If don’t, garbage
characters can be inserted to the front of external buffer in underflow().
Because underflow() copies remaining characters in external buffer to it’s
front. This results wrong characters insertion when seekpos() or seekoff() is
called.

this line should be inserted in sync() just before return:
__extbufnext_ = __extbufend_ = __extbuf_;

2. sync() should use length() rather than out() to calculate offset.
Reversing iterators and calling out() to calculate offset from behind is
working fine in stateless character encoding. However, in stateful encoding,
escape sequences could differ in length. As a result, out() could return wrong
length. 

For example, if we have internal buffer converted from this external sequence:
(capital letters mean escape sequence)
… a a a a B b b b b

out() produces this sequence. 
b b b b A a a a a

Because out() inserts escape sequence A rather than B, result sequence doesn't
match to external sequence. A and B could have different lengths, result offset
could be wrong value too.

length() method in codecvt is right for calculating offset, but it counts
offset from the beginning of buffer. So it requires another state member
variable to hold state before conversion.
Fixes http://llvm.org/bugs/show_bug.cgi?id=13667

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162601 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 21:20:56 +00:00
Howard Hinnant
ec423cb8d4 Fix basic_filebuf's internal buffer is shrinking when using with some codecvt. http://llvm.org/bugs/show_bug.cgi?id=13602
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 20:37:00 +00:00
Howard Hinnant
e7d59f2601 Fixed order of calling use_facet vs setbuf in basic_filebuf default constructor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162571 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 18:06:47 +00:00
Howard Hinnant
8540d4c9d2 basic_filebuf needs to delay obtaining a codecvt facet from the global locale to give the client a chance to imbue the proper locale. Fixes http://llvm.org/bugs/show_bug.cgi?id=13663.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162567 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-24 16:52:47 +00:00
Marshall Clow
08a0b48c09 Fix a typo in the docs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162335 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-22 00:57:11 +00:00
Howard Hinnant
ffab05833f In C++03 mode add an explicit conversion from int to the emulated class enum. Fixes a problem reported by C. Bergström.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162189 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 17:14:47 +00:00
Howard Hinnant
96c60b482e Patch contributed by Dev Dude for mingw64 port.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-19 15:13:16 +00:00
Howard Hinnant
a0852ffbe8 Apply patches supplied by Michel Morin in http://llvm.org/bugs/show_bug.cgi?id=13601 to correct bugs in is_convertible for the case that the intrinsic __is_convertible_to is not available.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162111 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 17:54:11 +00:00
Howard Hinnant
4ae952ab9a Consistently label __bit_array as a struct, not a class.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@162108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-17 17:10:18 +00:00
Howard Hinnant
364e94575b Remove obsolete do-installhdrs target (again).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161761 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 16:32:15 +00:00
Howard Hinnant
2a03b71f09 Remove obsolete do-installhdrs target.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161760 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 16:17:12 +00:00
Howard Hinnant
e87514aa94 Patch constributed by Michel Moren in http://llvm.org/bugs/show_bug.cgi?id=13592 . Fixes is_convertible<From, To> when To is an abstract type.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161755 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-13 12:29:17 +00:00
Howard Hinnant
4490c4aaed Change size of reference count field in __libcpp_nmstr from 32 bits to 64 bits for 64 bit targets. This is controls the data layout of all exceptions defined in <stdexcept>. This aligns the ABI with that of gcc-4.2.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161497 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-08 16:17:31 +00:00
Howard Hinnant
584db4287b std::equal operating on non-const __bit_iterators was not working. This fixes it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161309 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-05 21:43:11 +00:00
Howard Hinnant
e103a3d69b Andrew Morrow: The current CMake setup for libc++ incorrectly uses the variable
LLVM_ENABLE_ASSERTIONS instead of LIBCXX_ENABLE_ASSERTIONS when
figuring out what _DEBUG/NDEBUG defines to set. It also tries to test
the non-existent variable 'uppercase_CMAKE_BUILD_TYPE', which the top
level LLVM CMakeLists.txt sets up, but which the top level libc++
CMakeLists.txt currently does not. Changing the variable name tested
and creating the uppercase release name variable allows libc++ to
honor the LIBCXX_ENABLE_ASSERTIONS option correctly.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161308 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-05 17:37:39 +00:00
Howard Hinnant
6886dd19c4 Loosen up the timing requirements on 4 more tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161289 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-04 00:47:42 +00:00
Howard Hinnant
4b2f4203a2 Performance tweaking rotate.
rotate is a critical algorithm because it is often used by other algorithms,
both std and non-std.  The main thrust of this optimization is a specialized
algorithm when the 'distance' to be shifted is 1 (either left or right).  To my
surprise, this 'optimization' was not effective for types like std::string.
std::string favors rotate algorithms which only use swap.  But for types like
scalars, and especially when the sequence is random access, these new
specializations are a big win.  If it is a vector<size_t> for example, the
rotate is done via a memmove and can be several times faster than the gcd
algorithm.

I'm using is_trivially_move_assignable to distinguish between types like int and
types like string.  This is obviously an ad-hoc approximation, but I haven't
found a case where it doesn't give good results.

I've used a 'static if' (with is_trivially_move_assignable) in three places. 
Testing with both -Os and -O3 showed that clang eliminated all code not be
executed by the 'static if' (including the 'static if' itself).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161247 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-03 18:01:20 +00:00
Howard Hinnant
cd99236231 Andrew Morrow: The attached patch updates the initialization of the 'struct tm' in
__time_get_storage<char> to match the initialization behavior in
__time_get_storage<wchar>. Without the initialization, valgrind
reports errors in the subsequent calls to strftime_l.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161196 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:44:17 +00:00
Howard Hinnant
069bdd52c1 Andrew Morrow: There are two tests under test/utilities/memory that heap allocate two
integers which remain unused and are subsequently leaked, so the test
fail when run under valgrind. Unless I'm overlooking a subtle reason
why they are needed I think they can be removed, allowing these tests
to pass under valgrind. The attached patch removes the variables. If
there is a reason for them to exist, I can change this to just delete
them at the end of the test.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161195 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:39:48 +00:00
Howard Hinnant
63b2f4f2dc Andrew Morrow: The attached patch updates the lit.config for libc++ unit tests so
that the valgrind configuration passed to lit.py is used to run .pass
tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161193 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:36:47 +00:00
Howard Hinnant
ef793f2513 Andrew Morrow: Among the various libc++ tests that currently don't pass on Linux are
localization/locale.categories/category.collate/category.ctype/locale.ctype.byname/is_1.pass.cpp
and scan_is.pass.cpp. The tests fail when the character class being
tested is compound, like ctype_base::alnum or ctype_base::graph,
because the existing series of conditionals in do_is an do_scan_is
will abort too early. For instance, if the character class being
tested is alnum, and the character is numeric, do_is will return false
because iswalpha_l will return false, 'result' becomes false, and the
'true' result from the later call to iswdigit_l ends up being ignored
. A similar problem exists in do_scan_is.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161192 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:35:07 +00:00
Howard Hinnant
403f91ad2c Andrew Morrow: The attached patch is an attempt to implement
std:🧵:hardware_concurrency for platforms that don't offer
sysctl, but do provide a POSIX sysconf and _SC_NPROCESSORS_ONLN.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161190 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:17:49 +00:00
Howard Hinnant
6d39f9f356 Andrew Morrow: This patch fixes
test/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/pointer.pass.cpp
to accept '(nil)' as a valid representation for NULL so that the test
passes on Linux. The same thing is already done in some other tests,
like in /test/localization/locale.categories/category.numeric/locale.nm.put/facet.num.put.members/put_pointer.pass.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161188 91177308-0d34-0410-b5e6-96231b3b80d8
2012-08-02 18:12:06 +00:00
Howard Hinnant
ee7a0bf265 Andrew Morrow: Attached is a writeup of the current state of the libc++ test suite on Linux.
There are a few tests that are listed as failing here for which I have
a patch in the works. I'll be sending those along soon. There are
others where I know what is going on but don't yet have a solution,
and I've included some notes for those. Several still need to be
investigated, mostly in localization and the regex test suite. I think
that many of these failures are due to locale implementation
variations that make the expected test results not match the actual
results. I'm not sure what the best way to make the tests accomodate
this sort of variation might be.

The failures in the unique_ptr test suite are very new and are caused
by a clang crash which I've not yet looked into.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@161079 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-31 21:30:28 +00:00
Howard Hinnant
65f059b842 Despite my pathological distrust of spin locks, the number just don't lie. I've put a small spin in __sp_mut::lock() on std::mutex::try_lock(), which is testing quite well. In my experience, putting in a yield for every failed iteration is also a major performance booster. This change makes one of the performance tests I was using (a highly contended one) run about 20 times faster.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 17:13:21 +00:00
Howard Hinnant
7a7b6d8283 Updated status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160959 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 13:59:36 +00:00
Howard Hinnant
30055c68d4 Updated the complete by-chapter graph
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160943 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 02:29:34 +00:00
Howard Hinnant
5fec82dc0d Implement [util.smartptr.shared.atomic]. This is the last unimplemented
section in libc++.  This requires a recompiled dylib.  Failure to rebuild
the dylib will result in a link-time error if and only if the functions from
[util.smartptr.shared.atomic] are used.

The implementation is not lock free.  After considerable thought, I know of no
way to make the implementation lock free.  Ideas welcome along that front.  But
changing the ABI of shared_ptr is not on the table at this point.

The mutex used to lock these function is encapsulated by std::__sp_mut.  The
only thing the client knows about std::__sp_mut is that it has a void* data
member, can't be constructed, and has lock and unlock members.  Within the
binary __sp_mut is currently implemented as a pointer to a std::mutex.  That can
change in the future without disturbing the ABI (as long as sizeof(__sp_mut)
remains constant.

I specifically did not make __sp_mut a spin lock as I have a pathological
distrust of spin locks.  Testing on OS X reveals that the use of std::mutex in
this role is not a large performance penalty as long as the contention for the
mutex is low (more likely to get the lock than to have to wait).  In the future
we can still make __sp_mut a spin lock if that is what is desired (without ABI
damage).

The dylib contains 16 __sp_mut's to be chosen based on the hash of the address
of the shared_ptr.  The constant 16 is a ball-park reasonable space/time
tradeoff.

std::hash<T*> was changed to call __murmur2_or_cityhash, instead of the identity
function.  I had thought we had already done this, but I was mistaken.

All of this is under #if __has_feature(cxx_atomic) even though the
implementation is not lock free, because the signatures require access to
std::memory_order, which is currently available only under
__has_feature(cxx_atomic).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160940 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-30 01:40:57 +00:00
Howard Hinnant
116ce6a312 Update CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160812 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 20:22:37 +00:00
Howard Hinnant
afcac1ac46 Patch by Andrew C. Morrow: shims to work around macroized getc and putc on linux. On my eglibc 2.13 based Debian system 'getc' is a macro defined in
/usr/include/stdio.h. This decision to make it a macro doesn't seem to
be guarded by any feature test macro as far as I can see.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160799 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 20:01:13 +00:00
Howard Hinnant
8b5bb3c5af Patch by Andrew C. Morrow: Conditionally include cxxabi.h in new.cpp and typeinfo.cpp. Both new.cpp and typeinfo.cpp have code that is conditionally compiled
based on the LIBCXXRT and _LIBCPPABI_VERSION defines, but those files
do not currently include <cxxabi.h> in the non __APPLE__ case. The
attached patch updates those files so that for non __APPLE__ builds
<cxxabi.h> is included if available or if LIBCXXRT is set. I'm
modeling this on the recent updates to exception.cpp.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160790 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 17:42:39 +00:00
Howard Hinnant
ca8eb830dd <algorithm> no longer needs to include <cstdlib>, but can get away with just <cstddef>. This was brought to my attention by Salvatore Benedetto in his port to a bare-metal coretex-m3. This exposed two test bugs where an explicit #include <cstdlib> was needed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160786 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 17:09:09 +00:00
Howard Hinnant
f3d62ea57f locale::id really needs to be constructed at compile time.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160785 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 16:14:37 +00:00
Richard Smith
0405cc4ae0 libc++: switch from using _ATTRIBUTE(noreturn) (which conflicts with a
platform-provided macro on some systems) to _LIBCPP_NORETURN.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160773 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-26 02:04:22 +00:00
Howard Hinnant
8131a01a9c Apple LWG 2067: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3318.html#2067 . This is the only actionable change that has been made to the C++ draft since C++11. In general it has not been decided exactly how libc++ will track changes made to C++11. New features and design changes will probably be #ifdef'd, especially if they are not backwards compatible. Defects and 'dumb mistakes' are more likely to just be put in. Decisions on telling one from the other will be made on a case by case basis.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160608 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 19:34:12 +00:00
Howard Hinnant
8bf01ddd30 noexcept applied to <future>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160607 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 17:46:55 +00:00
Howard Hinnant
6e1d851be8 noexcept applied to <thread>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160606 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:50:47 +00:00
Howard Hinnant
c8f7413908 noexcept applied to <condition_variable>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160605 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:32:53 +00:00
Howard Hinnant
499c61f999 noexcept and constexpr applied to <mutex>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160604 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 16:13:09 +00:00
Howard Hinnant
46623a09ee noexcept and constexpr applied to <regex>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160594 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 01:31:58 +00:00
Howard Hinnant
f57bd564fd noexcept and constexpr applied to <ios>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160593 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 01:03:40 +00:00
Howard Hinnant
bd143086ac noexcept applied to <valarray>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160592 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-21 00:51:28 +00:00
Howard Hinnant
410f2def47 constexpr applied to <complex>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160585 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 22:18:27 +00:00
Howard Hinnant
c83960a9e4 noexcept applied to <random>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160579 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 21:44:27 +00:00
Howard Hinnant
fe4c9dd747 Relax the tolerances on some timing tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160566 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:48:05 +00:00
Howard Hinnant
d06a640ba7 noexcept applied to <iterator>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160565 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:36:34 +00:00
Howard Hinnant
08bce1754d constexpr applied to <array>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160564 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:20:49 +00:00
Howard Hinnant
03d7181b0e constexpr applied to <string>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160563 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 19:09:12 +00:00
Howard Hinnant
e41f475a44 Further tweaks on relaxing complete type checking for function.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160562 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-20 18:56:07 +00:00
Howard Hinnant
7d87f6be1b Jean-Daniel : clang now supports all required type_traits.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160510 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 15:59:52 +00:00
Howard Hinnant
af3473404e Jean-Daniel updates the libc++ index page to reflect not so recent changes in C++ standard status.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160509 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-19 15:57:51 +00:00
Howard Hinnant
c425307238 Relax the complete-type checks that are happening under __invokable<Fp, Args...> to only check Fp, and not Args... . This should be sufficient to give the desired high quality diagnostics under both bind and function. And this allows a test reported by Rich E on cfe-dev to pass. Tracked by <rdar://problem/11880602>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160285 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-16 16:17:34 +00:00
Howard Hinnant
473f838128 Applied constexpr to <chrono>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160184 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-13 19:17:27 +00:00
Howard Hinnant
1ca23672a0 Fixed a bug in wstring_convert concerning zero-length inputs. Thanks to Jonathan Coxhead for reporting this bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160136 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-12 18:07:41 +00:00
Richard Smith
591e32d624 Teach libc++ to check for libc++abi and use its features if they're available.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@160038 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-11 09:35:47 +00:00
Howard Hinnant
d586248597 Add test for self-referencing emplace test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159921 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-09 02:47:43 +00:00
Howard Hinnant
a58402abb9 Change emplace for vector and deque to create the temporary (when necessary) before any changes to the container are made. Nikolay Ivchenkov deserves the credit for pushing this problem and the solution for it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-08 23:23:04 +00:00
Howard Hinnant
46e9493c68 Appy constexpr to <memory>. Picked up a few missing noexcepts as well.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159902 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 20:56:04 +00:00
Howard Hinnant
384608e90d Apply constexpr to the mutex constructor. As a conforming extension, apply constexpr to the condition_variable constructor. These are important because it enables the compiler to construct these types at compile time, even though the object will be non-const. Since they are constructed at compile time, there is no chance of a data race before they are constructed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159901 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 20:01:52 +00:00
Howard Hinnant
90d8723476 Apply constexpr to <bitset>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159899 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-07 17:04:52 +00:00
Howard Hinnant
74f26f251b Apply noexcept to tuple.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159865 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 21:53:48 +00:00
Howard Hinnant
4eebfc3394 As a conforming extension give tuple a noexcept default constructor conditionalized on its held types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159858 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 20:50:27 +00:00
Howard Hinnant
5394c1ed30 Give tuple a constexpr default constructor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159857 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 20:39:45 +00:00
Howard Hinnant
a0b5befbd3 New Windows libc++ test results provided by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159852 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:35:31 +00:00
Howard Hinnant
9b12f23e30 Apply noexcept to those functions implemented in <cstdlib> as a conforming extension.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159850 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:16:56 +00:00
Howard Hinnant
cac0c46abb Apply noexcept to those functions implemented in <cmath> as a conforming extension.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159849 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 19:13:50 +00:00
Howard Hinnant
71499ad176 Add noexcept test for offsetof macro per [support.types]/p4.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159846 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 18:39:01 +00:00
Howard Hinnant
7a44515588 This commit establishes a new bucket_count policy in the unordered containers: The policy now allows a power-of-2 number of buckets to be requested (and that request honored) by the client. And if the number of buckets is set to a power of 2, then the constraint of the hash to the number of buckets uses & instead of %. If the client does not specify a number of buckets, then the policy remains unchanged: a prime number of buckets is selected. The growth policy is that the number of buckets is roughly doubled when needed. While growing, either the prime, or the power-of-2 strategy will be preserved. There is a small run time cost for putting in this switch. For very cheap hash functions, e.g. identity for int, the cost can be as high as 18%. However with more typical use cases, e.g. strings, the cost is in the noise level. I've measured cases with very cheap hash functions (int) that using a power-of-2 number of buckets can make look up about twice as fast. However I've also noted that a power-of-2 number of buckets is more susceptible to accidental catastrophic collisions. Though I've also noted that accidental catastrophic collisions are also possible when using a prime number of buckets (but seems far less likely). In short, this patch adds an extra tuning knob for those clients trying to get the last bit of performance squeezed out of their hash containers. Casual users of the hash containers will not notice the introduction of this tuning knob. Those clients who swear by power-of-2 hash containers can now opt-in to that strategy. Clients who prefer a prime number of buckets can continue as they have.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159836 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 17:31:14 +00:00
Howard Hinnant
820e00755a link to Marshall's notes.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159791 91177308-0d34-0410-b5e6-96231b3b80d8
2012-07-06 00:39:38 +00:00
Nuno Lopes
518d150040 mark operator new(std::nothrow) as noalias (aka __attribute__((malloc))
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159359 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-28 16:47:34 +00:00
Howard Hinnant
2d62229b96 Fixed a bug regarding result_of reported by Sven Behne. The fix is C++11 only mainly because result_of is a variadic beast and working with variadics is just such a problem in C++03 mode. This should bring result_of up to full conformance with the C++11 spec.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159211 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-26 17:37:15 +00:00
Nuno Lopes
67c8082a18 fix help with bash
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@159177 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-25 23:51:05 +00:00
Howard Hinnant
fe59276f04 Revert pair constructors back to using is_convertible instead of is_constructible. This should pull things into alignment with the final draft. Fixes http://llvm.org/bugs/show_bug.cgi?id=13063#add_comment.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@158280 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-09 20:01:23 +00:00
Douglas Gregor
f9b6e7eeef Fix warning flags for CMake builds, from Andrew C. Morrow!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@158172 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-07 22:26:00 +00:00
Howard Hinnant
caee2b093f Fix a few testsuite bugs involving trailing null (or lack thereof) in strstream.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157832 91177308-0d34-0410-b5e6-96231b3b80d8
2012-06-01 20:02:59 +00:00
Howard Hinnant
dbd9eacde0 Fix dangling else clause. Bug found and fixed by Dimitry Andric.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157779 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 23:12:03 +00:00
Howard Hinnant
6467aeb7c9 Fix the new _ALIGNAS_TYPE per instructions supplied by Eli Friedman.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157765 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 20:14:00 +00:00
Howard Hinnant
cbdd0896d3 Protect use of alignas against older versions of clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157764 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-31 19:31:14 +00:00
Howard Hinnant
635ce1d127 The rules for emplace in map, multimap, unordered_map and unordered_multimap changed a while back and I'm just now updating to these new rules. In a nutshell, you've got to know you're emplacing to a pair and use one of pair's constructors. I made one extension: If you want to emplace the key and default construct the mapped_type, you can just emplace(key), as opposed to emplace(piecewise_construct, forward_as_tuple(key), forward_as_tuple()).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157503 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 22:04:21 +00:00
Howard Hinnant
3e3e5ebc72 Fix memory corruption bug found and fixed by Andrew C. Morrow.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157476 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-25 15:55:46 +00:00
Howard Hinnant
51065657aa Add documentation regarding -fno-rtti.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157157 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-20 13:03:53 +00:00
Howard Hinnant
9b763e0945 Revert fix to http://llvm.org/bugs/show_bug.cgi?id=12867 for the reason now included in the code comment.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157128 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 20:20:49 +00:00
Douglas Gregor
0855ddeb24 Revert my _LIBCPP_INLINE_VISIBILITY changes, r157097 and r157107
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 07:14:17 +00:00
Douglas Gregor
f20f0d3fc5 valarray resize should not be _LIBCPP_INLINE_VISIBILITY
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157107 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 07:01:14 +00:00
Douglas Gregor
e9e4b855b8 Move _LIBCPP_VISIBLE_INLINE from the out-of-line definitions of member
functions to the original declarations, so that Clang will actually
see them. Part of <rdar://problem/11489333>.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157097 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-19 04:41:25 +00:00
Howard Hinnant
762657693d Protect __shared_weak_count::__get_deleter declaration with _LIBCPP_NO_RTTI. Fixes http://llvm.org/bugs/show_bug.cgi?id=12867
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@157049 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-18 13:06:21 +00:00
Howard Hinnant
ffa7fbef7b Fix several bugs in find/count specialized for bits.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156546 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 14:55:00 +00:00
Howard Hinnant
b3cf4b5b54 Add friends __count_bool_true and __count_bool_false to __bit_iterator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156543 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-10 14:01:40 +00:00
Howard Hinnant
f867f6326b SFINAE __bit_iterator such that it will only get instantiated with a container that has the nested type __storage_type. This prevents accidental instantiation such as in http://llvm.org/bugs/show_bug.cgi?id=12755. This fixes http://llvm.org/bugs/show_bug.cgi?id=12755.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156308 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-07 16:50:38 +00:00
Howard Hinnant
d2da6d2322 Constrain __bind functor constructor such that it won't accidentally get used as a copy constructor from a non-const lvalue. Fixes <rdar://problem/11359080>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156182 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-04 17:21:02 +00:00
Howard Hinnant
f07a529b77 Change std::abs from a template function to three overloads for float, double and long double.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@156064 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-03 14:58:34 +00:00
Howard Hinnant
87073e4bfb Greatly scale back ambitions of emulating move semantics in C++03 mode. It was causing more problems than it solved. This fixes http://llvm.org/bugs/show_bug.cgi?id=12704.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@155918 91177308-0d34-0410-b5e6-96231b3b80d8
2012-05-01 15:37:54 +00:00
Richard Smith
c756f5b4e8 libc++: only #include <cxxabi.h> if it exists. This allows libc++ to build
out of the box on Linux systems. If you're building against libc++abi, you
still need to make sure it can find <cxxabi.h> so it knows not to export
symbols which libc++abi provides.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@155091 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 01:36:12 +00:00
Richard Smith
9efdc0bd5f libc++: Add some missing #includes to atomics tests. libc++ doesn't need these
at the moment, but they allow these tests to be used to test clang against
libstdc++. Add myself to the credits file, as suggested by Howard.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@155085 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-19 00:50:47 +00:00
Howard Hinnant
300c67ab92 Apply noexcept and constexpr to <atomic>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154526 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 20:14:21 +00:00
Richard Smith
6186c7fe6a Switch libc++ from __atomic_* builtins to __c11_atomic_* builtins.
Per discussion with Howard, we are not interested in maintaining
compatibility with older versions of clang.

All tests pass with ToT clang, except for two which assert due to
a pre-existing, unrelated bug.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154521 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 18:55:46 +00:00
David Chisnall
b2292091cb Now that clang supports doing the right thing with regard to atomic
initialisation, do the right thing with regard to atomic initialisation.

Note: clang r154507 or later required for <atomic> to work now.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-11 17:26:23 +00:00
David Chisnall
d3eca759a2 Fix the remaining atomic tests, all of which were wrong for the case where a
compare-and-exchange failed (it should update the expected value to the current
value, and the tests were checking that it didn't...).

Results of the atomics part of the test suite on FreeBSD with clang trunk and
the atomic.c from compiler-rt (currently kludged into the test, not installed
properly):

****************************************************
Results for /root/libc++/test/atomics:
using clang version 3.1 (trunk 153415)
Target: x86_64-unknown-freebsd10.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -pthread /tmp/atomic.o  
----------------------------------------------------
sections without tests   : 0
sections with failures   : 0
sections without failures: 14
                       +   ----
total number of sections : 14
----------------------------------------------------
number of tests failed   : 0
number of tests passed   : 52
                       +   ----
total number of tests    : 52
****************************************************

Yay!



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154095 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05 13:48:16 +00:00
David Chisnall
1ee87fa41a Fix test cases that were trying to make atomic things that are not trivially copyable.
Now all of the test cases compile.  Some of them even run!



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154094 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05 13:23:08 +00:00
David Chisnall
0341c820a0 Fix use of __atomic_is_lock_free() intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@154093 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-05 13:13:24 +00:00
Howard Hinnant
616e92d748 Put std::piecewise_construct_t back into the dylib for ABI stability. When clients are in C++11/constexpr mode this will be safely ignored because piecewise_construct is then declared with internal linkage.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153981 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 23:45:46 +00:00
Howard Hinnant
2a5349ba66 constexpr support for <utility>. Patch contributed by Jonathan Sauer.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153968 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 21:09:48 +00:00
Howard Hinnant
271a1c03c3 Updated documentation contributed by Christopher Jefferson.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153955 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-03 15:08:42 +00:00
Howard Hinnant
8efd3dac5d Update <random> with constexpr support. Patch contributed by Jonathan Sauer.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153896 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 21:00:45 +00:00
Howard Hinnant
60cb7d267f Update <limits> with constexpr support. Patch contributed by Jonathan Sauer.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153888 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 19:23:15 +00:00
Howard Hinnant
2cf89a71df Fix test for default constructor of discrete_distribution. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=12436.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153873 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 15:00:14 +00:00
Howard Hinnant
27b4fd30ef This is an initial commit of constexpr support as proposed by Richard Smith. This by no means completes constexpr support. Indeed, it hardly scratches the surface. All it does is lay the foundation in <__config> and changes those few places in the library that are already using that foundation.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153856 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-02 00:40:41 +00:00
Howard Hinnant
dc1345fd44 I believe tuple is still under development in the standard. Daniel Krugler is/will be making convincing arguments that a modified form of LWG 2051 (currently NAD Future) is easily acheivable and desirable. He has demonstrated that a tuple<T...> where all of the T are implicitly convertible from U... should have a tuple constructor that is also implicit, instead of explicit. This would support the use cases in LWG 2051 while not undermining T... with explicit conversions from U.... This check-in is an experimental implementation of Daniel's work. I believe this work to be mature enough to warrant inclusion into libc++. If anyone sees real-world problems that this check in causes, please let me know and I will revert it, and provide the feedback to the LWG.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153855 91177308-0d34-0410-b5e6-96231b3b80d8
2012-04-01 23:10:42 +00:00
Howard Hinnant
9aa4e11451 It appears that the standard accidentally removed the default constructor for error_category. I'm putting it back in. This fixes http://llvm.org/bugs/show_bug.cgi?id=12321.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153194 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-21 16:18:57 +00:00
Howard Hinnant
87c61a61fe Allow libc++ to be built with CMake from within the LLVM tree. The libc++ part is just some renaming as the variable was already in use, conflicting with something else in the LLVM tree. Contributed by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@153036 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-19 15:40:23 +00:00
Howard Hinnant
1378397721 Alter the terminal streams such that they do not get added to the atexit chain, and thus never get destructed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152926 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-16 15:13:51 +00:00
David Chisnall
21a84cfb8f Undo some overzealous #ifdefs for LIBCXXRT.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 14:11:13 +00:00
David Chisnall
f2533a8798 Make sure [at_]quick_exit is in std::
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 14:10:37 +00:00
David Chisnall
b407d45d83 Don't refer to a function that doesn't exist in the quick_exit test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152716 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-14 14:02:15 +00:00
Jeffrey Yasskin
558ae17391 Fix moneypunct_byname algorithm to more accurately represent C locales in C++.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152501 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-10 18:31:43 +00:00
Howard Hinnant
05b57d5cdf Change some smart_ptr == 0 to smart_ptr == nullptr. Fixes http://llvm.org/bugs/show_bug.cgi?id=12185.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@152240 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-07 20:37:43 +00:00
David Chisnall
b56a4ada33 Define _WCHAR_T in solaris/wchar.h. This fixes a bug where Solaris 10 headers
try to define C++ keywords as typedefs (fixed in Solaris 11).



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151890 91177308-0d34-0410-b5e6-96231b3b80d8
2012-03-02 10:56:04 +00:00
David Chisnall
b6e7c305d4 Fix MSVC / Sun #ifdef ordering. Remove another #if-nothing-#endif.
Sorry for the churn.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151731 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:41:21 +00:00
David Chisnall
26cba271cb Remove a spurious #ifdef / #endif pair with nothing between them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151729 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:22:33 +00:00
Howard Hinnant
fcbaf48f21 Add a warning to ctype<char>::classic_table() if not implemented.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151728 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 16:08:57 +00:00
Howard Hinnant
d0ed21e94d I'm reverting one of the changes made to exception.cpp in r151717. I'm unsure what the change was trying to do, but it didn't do the right thing for __APPLE__. So instead of trying to guess what was intended, I'm just putting it back the way it was.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151727 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 15:37:30 +00:00
David Chisnall
ea2741973a Add support files required for building on Solaris.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151721 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:17:28 +00:00
David Chisnall
997e454139 Solaris port. Currently sees around 200 test failures, mostly related to
Solaris not providing some of the locales that the test suite uses.

Note: This depends on an xlocale (partial) implementation for Solaris and a
couple of fixed standard headers.  These will be committed to a branch later
today.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151720 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:05:08 +00:00
David Chisnall
f2b2cc6440 Make the failure reporting in testit a bit more useful.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151719 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:00:44 +00:00
David Chisnall
8fa14e97ca Don't define __locale_raii if we are not going to be using it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151718 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 13:00:07 +00:00
David Chisnall
1e8b3f96c0 Some libcxxrt-compatibility cleanups (avoid defining things twice).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151717 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-29 12:59:17 +00:00
Howard Hinnant
4a13b2dce9 Reduce the number of move constructions when constructing a std::function. This fixes http://llvm.org/bugs/show_bug.cgi?id=12105.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151652 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-28 19:47:38 +00:00
Howard Hinnant
0438ea241e vector::emplace_back was mistakenly requiring move assignable. Fixed that and did a little drive-by optimization at the same time. This fixes http://llvm.org/bugs/show_bug.cgi?id=12085.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151492 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-26 15:30:12 +00:00
Howard Hinnant
a231c37df7 update test for explicit bool operator.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151461 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 21:43:14 +00:00
Howard Hinnant
9d84832741 At least temporarily move operator new/delete from the abi back to here. I'm having trouble reexporting it as a weak symbol.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151459 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 21:36:01 +00:00
Howard Hinnant
8417c46f8d ReExport some mor symbols from libc++abi.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151453 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 20:25:07 +00:00
Howard Hinnant
896baa2547 Silence some warnings in a test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151451 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-25 20:04:11 +00:00
Howard Hinnant
4300839b5f Hook up to the new clang __is_trivially_constructible and __is_trivially_assignable traits. Fixes r10925427 and http://llvm.org/bugs/show_bug.cgi?id=12038.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151406 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-24 23:32:26 +00:00
Dave Zarzycki
b9344c218b Use Xcode relative compilers when possible
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151108 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-22 00:20:30 +00:00
Howard Hinnant
7786188d15 Modernize conversion to bool to the explicit bool conversion operator (library wide). This fixes http://llvm.org/bugs/show_bug.cgi?id=12058.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151088 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-21 21:46:43 +00:00
Howard Hinnant
3fadda314a Modernize relational operators for shared_ptr and unique_ptr. This includes adding support for nullptr, and using less<T*>. Fixes http://llvm.org/bugs/show_bug.cgi?id=12056.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@151084 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-21 21:02:58 +00:00
Bob Wilson
d41b60b2b4 Add missing newlines at EOF.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150965 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-20 16:56:13 +00:00
Howard Hinnant
335b1518e4 Silence -Wmissing-field-initializers a little higher in the source.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150964 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-20 16:51:43 +00:00
Jeffrey Yasskin
e0c3b1e55c Add myself to the CREDITS file.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150935 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-19 18:22:03 +00:00
Howard Hinnant
3074a05cdc Initialize all the fields of struct tm before passing it to strftime. One of the uninitialized fields, probably the pointer field tm_zone, was causing a segfault on linux. Patch contributed by Jeffrey Yasskin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150929 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-19 14:55:32 +00:00
Howard Hinnant
6df1412ca6 Relax pointer output test to accept glibc's output. Patch supplied by Jeffrey Yasskin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150927 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-19 14:51:01 +00:00
Howard Hinnant
3508b3836b Give the emulated nullptr_t a default constructor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150893 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-18 22:01:22 +00:00
Howard Hinnant
01198b313c Exercise rvalue arguements to make_shared for C++11 mode.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150887 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-18 20:12:03 +00:00
Howard Hinnant
e1642e1c00 Move typeinfos for exceptions in <stdexcept> to the abi
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150835 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-17 19:24:42 +00:00
Howard Hinnant
1e9f55f2d2 Use __is_polymorphic if available. This fixes http://llvm.org/bugs/show_bug.cgi?id=11983 . Patch contributed by Jonathan Sauer.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150614 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 20:47:11 +00:00
Howard Hinnant
2848444954 tuple was accidentally lacking a valid copy assignment operator. It went undetected because I had failed to test assigning from a const lvalue. This fixes http://llvm.org/bugs/show_bug.cgi?id=11921
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150613 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 20:13:52 +00:00
Howard Hinnant
b04ad4162d Do not parse sign if a sign is not the next legal character when parsing floating point from an input stream. Fixes http://llvm.org/bugs/show_bug.cgi?id=11871
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150609 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 19:19:37 +00:00
Howard Hinnant
d7a2ad6a99 Another stab at fixing http://llvm.org/bugs/show_bug.cgi?id=12007. I earlier missed that there are two common_type definitions and corrected only one of them.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150599 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 18:08:09 +00:00
Howard Hinnant
e5285fd6b6 Remove reference from common_type definition. It looks like a recent clang decltype implementation got fixed/improved and exposed this. Fixes http://llvm.org/bugs/show_bug.cgi?id=12007.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150581 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 15:08:30 +00:00
Howard Hinnant
b0bfd9bdd6 Implement a few optimizations for vector push_back and insert. Fixes r10828365.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150542 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-15 00:41:34 +00:00
Howard Hinnant
5f3f35fe64 Provide a move(const T&) overload for C++03 mode to enable moving from rvalues. This is to support proxy references. Fixes r10858112.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150488 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-14 16:03:09 +00:00
Howard Hinnant
982331b66e Fix up narrowing conversions in switch statement.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@150082 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-08 19:15:06 +00:00
Howard Hinnant
67872dde14 Make attributes on definition consistent with those on declaration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@149701 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-03 18:31:43 +00:00
Howard Hinnant
3c8432fb5b Added some more symbols to the v2 rexport list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@149636 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 22:01:34 +00:00
Howard Hinnant
dea7f39af1 Prepare for running on top of new libc++abi.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@149634 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 20:48:35 +00:00
Howard Hinnant
b1bc0c4975 Explicitly convert int to future_errc. Fixes http://llvm.org/bugs/show_bug.cgi?id=11428
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@149630 91177308-0d34-0410-b5e6-96231b3b80d8
2012-02-02 20:31:36 +00:00
Bob Wilson
1dd5ccf06c Fix .PHONY target to match new installheaders target.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148629 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-21 06:16:39 +00:00
Howard Hinnant
a18778751c Enable full functionality of shared_ptr<const void> by adding allocator<const void>. Credit to John Hurley for discovering this bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148508 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-19 23:15:22 +00:00
Howard Hinnant
6e4971fafe Added installheaders target.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148399 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 17:44:31 +00:00
Howard Hinnant
798e880364 Remove installhdrs target from Makefile
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148396 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 16:07:25 +00:00
Howard Hinnant
ca1f44d19f Create target installhdrs as a synonym for do-installhdrs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148365 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-18 00:30:57 +00:00
Howard Hinnant
b9b932fdef Put do-installhdrs target back into Makefile.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148310 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 17:01:18 +00:00
Howard Hinnant
fcf7bd1ffe Stop installing headers, this is now done by clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148309 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-17 16:09:32 +00:00
Howard Hinnant
e1a7b04c58 Fix http://llvm.org/bugs/show_bug.cgi?id=11752
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@148069 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-12 23:37:51 +00:00
Howard Hinnant
ae8b16e047 Fix http://llvm.org/bugs/show_bug.cgi?id=11734
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147853 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-10 15:15:47 +00:00
Howard Hinnant
571994088f 1. Fix make_shared<const T>. 2. Allow allocator<const T> as an extension. 3. Refactor work which fixed unique_ptr<const T[]>. 4. Remove no-longer-needed private declarations from unique_ptr. 5. Add constraints to some shared_ptr and weak_ptr constructors and assignment operators so that is_constructible/is_assignable give the correct answers for shared_ptr and weak_ptr. 6. Make defensive preparations in the shared_ptr free functions for the introduction of shared_ptr<T[]> in the future. 7. As an optimization, add move constructor and move assignment to weak_ptr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147437 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-02 17:56:02 +00:00
NAKAMURA Takumi
e4d24cec24 Happy new year 2012!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147395 91177308-0d34-0410-b5e6-96231b3b80d8
2012-01-01 08:16:56 +00:00
Howard Hinnant
8292d74270 The exception recovery mechanism for the uninitialized_* algorithms did not work for iterators into discontiguous memory.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-29 17:45:35 +00:00
Howard Hinnant
5586c020c9 Fix memory leak in converting weak_ptr to shared_ptr
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@147298 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-27 22:20:51 +00:00
Howard Hinnant
6cc99fa338 Fix http://llvm.org/bugs/show_bug.cgi?id=11616
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146881 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-19 17:58:44 +00:00
David Chisnall
83b2c84a3c Some fixes to <atomic> operations to explicitly use atomic types and operations.
The integral types now work with clang trunk (if you remove the guard), although we're still missing an intrinsic for initialising atomics (needed for C1x too).

Howard: Please review.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146865 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-19 11:44:20 +00:00
Howard Hinnant
8e84350ebf Allow unique_ptr<T const []> to be constructed and assigned from a unique_ptr<T[]>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146853 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-18 21:19:44 +00:00
Howard Hinnant
0a63119a76 Allow unique_ptr<T const []> to be constructed with a T* (in addition to a const T*)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146736 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-16 15:37:23 +00:00
Howard Hinnant
8e50a9cf73 Remove quotes from locale name identifier. Credit Edward Meewis.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-15 15:01:38 +00:00
Howard Hinnant
f8880d0b85 As an extension, support incomplete types in the unordered containers to match what we already do in the associative containers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146376 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-12 17:26:24 +00:00
Howard Hinnant
d4cf215e08 Fix http://llvm.org/bugs/show_bug.cgi?id=11461. Credit Alberto Ganesh Barbati.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146345 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-11 20:31:33 +00:00
Howard Hinnant
c00f75dc75 Installation of CityHash by Craig Silverstein
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@146329 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-10 20:28:56 +00:00
Howard Hinnant
40c13d31c5 Starting using murmur2 when combining multiple size_t's into a single hash, and also for basic_string. Also made hash<thread::id> ever so slighly more portable. I had to tweak one test which is questionable (definitely not portable) anyway.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145795 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-05 00:08:45 +00:00
Howard Hinnant
cf2654bae7 Version #next on the hash functions for scalars. This builds on Dave's work, extends it to T*, and changes the way double and long double are handled (no longer convert to float on 32 bit). I also picked up a minor bug with uninitialized bits on the upper end of size_t when sizeof(size_t) > sizeof(T), e.g. in hash<float>. Most of the functionality has been put in one place: __scalar_hash in <memory>. Unfortunately I could not reuse __scalar_hash for hash<long double> on x86 because of the padding bits which need to be zeroed. I didn't want to add this zeroing step to the more general __scalar_hash when it isn't needed (in the absence of padding bits). I'm not ignoring the hash<string> issue (possibly changing that to a better hash). I just haven't gotten there yet.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145778 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-03 21:11:36 +00:00
Howard Hinnant
2891675aad I had picked up the wrong version of DaveZ's hash patches. Corrected here.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145728 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 23:45:22 +00:00
Howard Hinnant
62453ea71d Fixes to hash for long long, unsigned long long, float, double and long double. Credit Dave Zarzycki
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145721 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 22:52:09 +00:00
Howard Hinnant
f836d531b4 unord test fixes by Edward Meewis
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145707 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 21:23:14 +00:00
Howard Hinnant
e814a90f74 Fix http://llvm.org/bugs/show_bug.cgi?id=11459. Patch supplied by Alberto Ganesh Barbati.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145703 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 20:41:47 +00:00
Howard Hinnant
f6d875f7f5 Fix http://llvm.org/bugs/show_bug.cgi?id=11428. Fix provided by Alberto Ganesh Barbati
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145698 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 19:36:40 +00:00
Howard Hinnant
438377c051 Jean-Daniel: __builtin_popcountll support for Windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145684 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-02 17:22:38 +00:00
Howard Hinnant
ec3773c2da Quash a whole bunch of warnings
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145624 91177308-0d34-0410-b5e6-96231b3b80d8
2011-12-01 20:21:04 +00:00
Howard Hinnant
9996844df0 Further macro protection by replacing _[A-Z] with _[A-Z]p
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 18:15:50 +00:00
Howard Hinnant
66c6f9733b Add protection from min/max macros
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-29 16:45:27 +00:00
Howard Hinnant
34869adacb Remove redundant iterator assignment detected by Marshall Clow
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-28 19:49:26 +00:00
Bob Wilson
0dd0b4d758 Refactor libcxx makefile. No functional changes intended.
Besides cleaning up the repetition in the installhdrs target, the point of this
change is to provide a separate do-installhdrs target that can be used directly
from clang's runtime/libcxx makefile to install a copy of the headers along
with clang.  <rdar://problem/10397739>


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@145162 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-27 05:39:58 +00:00
Howard Hinnant
704f09b212 Clarify building instructions for 10.7
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@144910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-17 17:14:16 +00:00
David Chisnall
91a8272cbd On FreeBSD, define a macro that causes the unimplemented C99 math.h functions to be declared. This prevents <cmath> users from being broken, unless they actually use the C++ wrappers that call the missing functions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@144501 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-13 17:15:33 +00:00
Howard Hinnant
c13b147280 Remove support folder from Apple install
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143702 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-04 15:59:51 +00:00
Howard Hinnant
ce6884cc76 Fix ratio arithmetic with zero
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143519 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 23:13:37 +00:00
Howard Hinnant
6cd051bc34 Add include file install path
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143497 91177308-0d34-0410-b5e6-96231b3b80d8
2011-11-01 21:06:50 +00:00
Howard Hinnant
9f8884e6c1 Windows port work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143105 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 16:24:42 +00:00
Howard Hinnant
8faa95ff8c Fixed bug in __independent_bits_engine found by Nick (from stackoverflow)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@143104 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-27 16:12:10 +00:00
Howard Hinnant
78b6828f14 More windows port work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142732 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-22 20:59:45 +00:00
Howard Hinnant
f46fc939cb Windows port work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142578 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-20 12:49:21 +00:00
Howard Hinnant
8db4acad3b de-tabbify
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142237 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 20:08:59 +00:00
Howard Hinnant
08e17472e4 Windows support by Ruben Van Boxem.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@142235 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-17 20:05:10 +00:00
Howard Hinnant
2baccd81f1 Fix http://llvm.org/bugs/show_bug.cgi?id=11113
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141714 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 21:28:38 +00:00
Howard Hinnant
11624459ef Starting on musl port by Arvid Picciani
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141672 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-11 16:00:46 +00:00
Howard Hinnant
bc90e2a47d Remove -Wglobal-constructors from flags. This was an accidental addition.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141551 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-10 17:36:59 +00:00
Howard Hinnant
907732644c Update instructions for building on Mac OS 10.6
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141507 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-09 15:25:34 +00:00
Howard Hinnant
b97de44471 Fix <rdar://problem/10256836> getline of an empty string mistakenly causes failure
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141506 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-09 15:20:46 +00:00
Howard Hinnant
c6fe8cafc3 Fix <rdar://problem/10255403> match_results::begin() is off by one
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141494 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-08 14:36:16 +00:00
Howard Hinnant
fdcbd1db25 reverting change to compatibility_version
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 23:55:11 +00:00
Howard Hinnant
e0a0e51248 Change compatibility_version
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141391 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-07 19:52:29 +00:00
Howard Hinnant
9677458967 Fix <rdar://problem/10136825>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141132 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 23:11:56 +00:00
Howard Hinnant
15e48f9239 Fix <rdar://problem/10226704>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-04 01:25:20 +00:00
Howard Hinnant
c0d0cbad9e Windows porting work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@141003 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-03 15:23:59 +00:00
Howard Hinnant
8452d21f41 Updated testit to run on Windows and fresh Windows results by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140950 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-01 15:34:27 +00:00
Howard Hinnant
f8800b12c5 Fix <rdar://problem/10217868>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-01 00:26:36 +00:00
Howard Hinnant
2481cba8b7 Provide link to developer's policy
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140857 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-30 16:58:02 +00:00
Howard Hinnant
14fa9f9d8f Windows port work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140805 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 20:33:10 +00:00
Howard Hinnant
3c466fc631 Windows patch work by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-29 13:33:15 +00:00
Howard Hinnant
866569b8c3 Attempted locale refactoring. _LIBCPP_LOCALE__L_EXTENSIONS now should be defined if one has all of the xxx_l() functions. I've defined this for apple, freebsd and win32. _LIBCPP_HAS_DEFAULTRUNELOCALE should be defined if there is a _DefaultRuneLocale. I've defined this for apple and freebsd. The block of code we're trying to migrate away from is now under #ifdef __linux__. I've tested only on OS X. I hope I haven't broken things too badly elsewhere. Please let me know.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140734 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 23:39:33 +00:00
Howard Hinnant
efbe4067f2 Work on Windows port by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140728 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 21:39:20 +00:00
Howard Hinnant
2ea1ca9bdd Attempt to enable locale simplification. On which platforms can we now #define _LIBCPP_STABLE_APPLE_ABI?
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140724 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 21:05:01 +00:00
Howard Hinnant
0cbb3a16e2 Ruben's Windows test results.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140700 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-28 15:44:39 +00:00
Howard Hinnant
1c3ec6d480 Another installment on debug mode. This addresses list. However this should be considered a temporary state. The API of the debug database and how vector and list use it, is unsatisfactory at the moment. It is both inefficient and overly verbose. I wanted to get this functionality checked in though. In the next day or so I'll refactor what is there in an attempt to streamline things.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140660 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-27 23:55:03 +00:00
Howard Hinnant
6cd05eeb35 Work on Windows port by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140384 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-23 16:11:27 +00:00
Howard Hinnant
92a07003b2 Partial Windows port by Ruben Van Boxem
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-22 19:10:18 +00:00
Howard Hinnant
59832523ac Fix test bugs found by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 18:33:46 +00:00
David Chisnall
9e02b90405 Fix locales used in re tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 17:38:03 +00:00
David Chisnall
2fb1a9d1e8 Remove undefines in cstdio test. Fix these properly rather than bodging the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 17:37:18 +00:00
David Chisnall
86698890db More +.UTF-8 fixes.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140262 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 17:35:42 +00:00
Howard Hinnant
709c3d27f5 Fix failure found by David Chisnall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 16:42:32 +00:00
Howard Hinnant
336f41ae0c Correct change to exception.cpp from r140245
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140253 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 15:12:26 +00:00
David Chisnall
db2e99f852 More fixes to the tests. Add UTF-8 encoding to all locales that don't specify one. Undefine some stdio.h macros that break the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140252 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 14:59:10 +00:00
David Chisnall
a824f53600 Fully-qualify some more locales in the tests...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 14:48:49 +00:00
David Chisnall
eb2c855c44 Don't check STREAMS error numbers on systems that don't implement the obsolete (as described in POSIX2008) XSI STREAMS extension.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 12:23:11 +00:00
David Chisnall
6b8ac3acda More locale cleanups. Fully specify locales in iostream tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 12:09:17 +00:00
David Chisnall
c512df1950 Fixes for FreeBSD, including some fairly obvious copy-and-paste errors.
libc++ now mostly works on FreeBSD with libcxxrt and this patch applied to the base system:

http://lists.freebsd.org/pipermail/freebsd-hackers/attachments/20110920/e666632c/xlocale-0001.obj

Summary of tests on FreeBSD:


****************************************************
Results for /root/libcxx/test:
using FreeBSD clang version 3.0 (trunk 135360) 20110717
Target: x86_64-unknown-freebsd9.0
Thread model: posix
with -std=c++0x -stdlib=libc++ -I/root/libcxx/include -L/root/libcxx/build/lib
----------------------------------------------------
sections without tests   : 1
sections with failures   : 48
sections without failures: 1015
                       +   ----
total number of sections : 1064
----------------------------------------------------
number of tests failed   : 145
number of tests passed   : 4179
                       +   ----
total number of tests    : 4324
****************************************************

(Many due to this clang version not supporting C++ atomics)

More fixes to follow...



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140245 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 08:39:44 +00:00
David Chisnall
e2f2a15066 Localisation test fixes to make the tests pass on FreeBSD, which does not provide shortened forms of the various locales (e.g. en_US, rather than en_US.UTF-8 / en_US.ISO{whatever}).
Reviewed by Howard Hinnant.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140242 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-21 08:19:20 +00:00
Howard Hinnant
e6125bdeae Chris Jefferson noted that vector iterator ownership can be transferred from source to target under move construction and move assignment. This commit makes that happen for debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140023 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 16:34:29 +00:00
Howard Hinnant
be969d7c7d Removed unneeded boost implementation of is_base_of
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140014 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-19 13:19:31 +00:00
David Chisnall
68ebc448f0 Enable __locale to work on FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@140005 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-18 19:23:04 +00:00
Howard Hinnant
7608b4aac2 Doug Gregor pointed out some problems with debug mode enabled in one TU and not another. This patch helps detect those situations and offers improved error messages to help get debug mode enabled in more TU's when it is absolutely necessary to do so. Thanks Doug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139933 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16 19:52:23 +00:00
Howard Hinnant
0442b12591 The vector test suite now passes for no-debug, debug-lite and debug-regular
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139930 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16 18:41:29 +00:00
Howard Hinnant
abe2628b43 Create multilevel debug mode
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139913 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-16 17:29:17 +00:00
Howard Hinnant
7a563db09a Initial checkin for debug mode (version 2)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139711 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-14 18:33:51 +00:00
Howard Hinnant
8b3fae3cc7 Address PR10909: http://llvm.org/bugs/show_bug.cgi?id=10909
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139493 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-12 14:15:45 +00:00
Howard Hinnant
9cbee430da Fix const correctness bug in __move_assign. Found and fixed by Ion Gaztañaga.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@139032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-02 20:42:31 +00:00
Howard Hinnant
6b171c557b Up version number by 1. This is a 'minor version' update.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@138978 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-01 23:13:01 +00:00
Howard Hinnant
92a836c03d Reimplemented much of <istream> such that single character extractions do not check to see if this is the last character in the stream and thus never set eofbit. This fixes http://llvm.org/bugs/show_bug.cgi?id=10817 . This fix requires a recompiled libc++.dylib to be fully implemented. The recompiled libc++.dylib is ABI compatible with that shipped on Lion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@138961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-09-01 21:02:45 +00:00
Howard Hinnant
5f255944ac __split_buffer should only require default constructible. Bug found and fixed by Jared Hoberock
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@138726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-28 15:21:29 +00:00
Dave Zarzycki
2b56659c60 Merge the Apple branch into trunk
We will eventually rebranch for the next Apple release and when we do, we don't want to drop changes.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137940 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-18 15:53:00 +00:00
Howard Hinnant
3fdbbd2a6f Don't move assign string::allocator_type when propagate_on_container_move_assignment is false.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137862 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-17 20:36:18 +00:00
Howard Hinnant
43edf2d1e1 Fix needle-in-haystack bug found by Walter Brown
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137617 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-15 17:22:22 +00:00
Howard Hinnant
e3e3291f3a Fixed PR10574: http://llvm.org/bugs/show_bug.cgi?id=10574
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@137522 91177308-0d34-0410-b5e6-96231b3b80d8
2011-08-12 21:56:02 +00:00
Howard Hinnant
8caf423916 Correct misspelling:_LIBCPP_APPLE_STABLE_ABI -> _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136597 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31 17:16:32 +00:00
Howard Hinnant
8775816ba3 Change how _LIBCPP_HAS_NO_ADVANCED_SFINAE gets set.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136596 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31 17:10:44 +00:00
Howard Hinnant
199d0aec1b Fixed PR10507 (http://llvm.org/bugs/show_bug.cgi?id=10507)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136595 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-31 17:04:30 +00:00
Chandler Carruth
9d7530935d Revert r136547, r136545, and r136542 by removing slist.
This was checked in without review. It is not clear its reasonable to
include with libc++ at all, and needs discussion at a highlevel before
moving forward.

It's also completely lacking tests, and included several bugs in the
implementation.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136577 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 21:10:18 +00:00
Chandler Carruth
a73da5d2ca Revert r136546, which was submitted without review.
Original change:
Destruct elements of hash tables when removing individual entries from
the hash_table. I think this is the correct solution to PR10507, but I'm
not sure since this is a little bit cargo-culted. Howard, please review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 21:10:16 +00:00
Sean Hunt
8f0396e443 Add the missing default argument for the allocator and use a cleaner
implementation of previous().

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136547 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 00:47:53 +00:00
Sean Hunt
b59b929cc9 Destruct elements of hash tables when removing individual entries from
the hash_table. I think this is the correct solution to PR10507, but I'm
not sure since this is a little bit cargo-culted. Howard, please review.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136546 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 00:18:12 +00:00
Sean Hunt
70bbcae9b5 Oops. That last commit was from an earlier revision of the file and was
more than just a bit broken. This one should compile and run without
infinite loops.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136545 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-30 00:06:52 +00:00
Sean Hunt
d50c1c7429 Include an "implementation" if SGI's slist. This was quickly hacked
together to get it working with code, and is neither optimal
(erase(Iterator, Iterator) calculates the previous iterator twice,
rather than calculating the previous iterator of the first one, then
advancing it until the second is found) nor complete (splice() was not
implemented). Most of the implementation is borrowed from forward_list
via using-declarations.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136542 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 23:42:36 +00:00
Sean Hunt
110b8bf57e Explicitly invoke the size_type specialization of max and min. This
avoids bugs where, when the allocator's size_type was smaller than int,
the multiplication or division would cause integral promotions and, with
two different integer types as arguments, deduction of the template
arguments would fail.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136540 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 23:31:58 +00:00
Sean Hunt
affd9e5d43 Add a new hash class in __gnu_ext for the extension containers. There
are two motivations for this.

First, this allows users who are specializing __gnu_ext::hash to
continue doing so without changing their code.

Second, SGI specifies hash overloads for char* and const char* that
perform a hash of the string, not of the pointer.

In order to support this, the hashing code for string is factored out.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136539 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 23:31:56 +00:00
Sean Hunt
e36a196049 Add two missing members from the extension hash containers. The first is
the type name 'data_type', which is specified by the SGI spec as being
the correct type name for the mapped type. The second is an overload of
insert found in standard containers, taking an iterator as a 'hint'
(which we ignore in the standard containers as well). libstdc++'s
implementation includes these overloads, and they are needed to make
insert_iterator work (which I suspect is the real motivation for
including them in the standard containers).

The motivation for including these overloads of insert and leaving the
mapped_type typedef is to make it easier for clients to migrate to the
standard containers.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136538 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 23:31:53 +00:00
Howard Hinnant
23369ee812 Configure to get along with 2.9 clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136526 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 21:35:53 +00:00
Howard Hinnant
db86663223 Optimizing valarray::operator=(some-valarray-expression)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-27 23:19:59 +00:00
Howard Hinnant
9c59d38112 Fix PR10509: http://llvm.org/bugs/show_bug.cgi?id=10509
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-27 19:25:28 +00:00
Howard Hinnant
d36369d910 Fix PR10510: http://llvm.org/bugs/show_bug.cgi?id=10510
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@136232 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-27 18:34:06 +00:00
Howard Hinnant
4f598034d2 http://llvm.org/bugs/show_bug.cgi?id=10469
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135897 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 23:59:50 +00:00
Howard Hinnant
fa06d75e8d Optimization of string::operator< by M.E. O'Neill. Discussion in http://llvm.org/bugs/show_bug.cgi?id=10461
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135893 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 21:45:06 +00:00
Howard Hinnant
2644a7b3da http://llvm.org/bugs/show_bug.cgi?id=10461
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135873 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-24 15:07:21 +00:00
Howard Hinnant
099084d52f http://llvm.org/bugs/show_bug.cgi?id=10455
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135854 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23 16:14:35 +00:00
Dave Zarzycki
b3296ae5bc Test commit
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135774 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-22 17:08:57 +00:00
Howard Hinnant
bf6666f7a0 Correct test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135460 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-19 01:07:49 +00:00
Sean Hunt
541cb301a1 Adjust two tests to account for a nasty change in copying behavior
between C++03 and C++0x and its effect on exceptions, and another two to
not test move construction when rvalue references are not available.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135445 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 23:51:25 +00:00
Sean Hunt
13aaf422e4 Make all fstream tests use tmpnam if creating files, rather than
hard-coded names.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135444 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 23:51:21 +00:00
Sean Hunt
e6440c6fa2 Do a litmus test of using tmpnam to generate safe temporary file names
for the tests that open new data files.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135422 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 20:46:16 +00:00
Sean Hunt
737a351850 Given that __underlying_type is now available in clang, implement
std::underlying_type.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 18:37:21 +00:00
Sean Hunt
2d81f3d1f3 Give A an explicitly non-throwing destructor so that B's destructor is
itself non-throwing.  Since nested_exception's destructor is
non-throwing, if B's destructor is not, this causes an error in C++03
mode due to the overriding function having a more lax specification.
This did not occur in C++0x mode as A's destructor was implicitly
non-throwing.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135400 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:07:53 +00:00
Howard Hinnant
464aa5cad3 http://llvm.org/bugs/show_bug.cgi?id=10390
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135393 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 15:51:59 +00:00
Howard Hinnant
bcbbd4d14f Revert locale for apple back to original design, getting rid of now useless helper *_l functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135272 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 14:46:11 +00:00
Howard Hinnant
9a2078137f _LIBCXX_STABLE_APPLE_ABI -> _LIBCPP_STABLE_APPLE_ABI
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 14:25:40 +00:00
Sean Hunt
a78264f872 Fix wchar tests by not assuming that tm is complete and by using the
proper va_list time on non-darwin platforms.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135247 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:44:47 +00:00
Sean Hunt
f3907e6cc0 Reapply 135035 with proper conditional inclusion, hopefully solving
issues with it.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135246 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-15 05:40:33 +00:00
Howard Hinnant
912012e949 http://llvm.org/bugs/show_bug.cgi?id=10353
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-14 01:34:46 +00:00
Howard Hinnant
22ba71b8ef http://llvm.org/bugs/show_bug.cgi?id=10346
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135045 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 16:00:50 +00:00
Howard Hinnant
8d75632ad0 Reverted to 134947. Once I got into it, I discovered there were too many problems to fix in 135035.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135044 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 15:48:16 +00:00
Sean Hunt
c97da3a590 Implement the __nolocale functions properly so that they will work on
all platforms. Unfortunately a lot of this remains conditionally
compiled so as not to break Apple's ABI.

The new _LIBCPP_LOCALE__L_EXTENSIONS macro can be defined on other
platforms that support _l suffixes for all functions in order to use
them.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@135035 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-13 06:40:50 +00:00
Sean Hunt
0389c53f44 Make sure that __time_put constructors properly on non-Apple platforms.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134947 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12 00:55:04 +00:00
Howard Hinnant
66f2641ac9 Toralf Niebuhr: This is just a tiny patch fixing some small (probably copy & paste) errors.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134843 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 19:47:01 +00:00
Howard Hinnant
2bf1c08510 Make vector<bool>::reference and const_reference public
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134815 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 15:50:42 +00:00
Sean Hunt
6f0342cf2e Don't assume that wctype produces a nice mask on all platforms. On
glibc, for instance, it's a const char *.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134787 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 03:40:04 +00:00
Sean Hunt
e59f724f79 Conditionally wrap the changes from r134781.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134783 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 01:09:31 +00:00
Sean Hunt
62a6ac33a2 Implement generalized table lookups for upper, lower, and character
traits.

To the best of my knowledge, this will not break the ABI for Apple.
However, it does introduce three publicly visible (although with
reserved name) functions that will fail to link against the just-shipped
Apple version of libc++. Since they are not used in any inline
functions, no actual breakage should occur.

If Howard doesn't want to put undefined functions (even internal ones)
into a header, they could be surrounded by additional conditional
compilation.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134781 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-09 00:56:23 +00:00
Howard Hinnant
043fe1d931 provide ~future_error() definition
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134663 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-08 00:04:40 +00:00
Sean Hunt
cb05a0801a Fix typo
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 22:45:07 +00:00
Howard Hinnant
ac6de546bd Fixing up some ABI issues
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-07 21:03:52 +00:00
Sean Hunt
12c3d374a5 <inttypes.h> does not necessarily include <stdint.h>. Accordingly, do
not test for this.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134531 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-06 20:52:28 +00:00
Howard Hinnant
9f66bffdbe Fix uninitialized loop counter. http://llvm.org/bugs/show_bug.cgi?id=10278
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134405 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05 14:14:17 +00:00
Howard Hinnant
3c8894b078 Make the default Makefile less destructive: John McCall
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134375 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-04 14:12:27 +00:00
Howard Hinnant
f03c3b4612 http://llvm.org/bugs/show_bug.cgi?id=10248
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-02 20:33:23 +00:00
Howard Hinnant
90d7785eba http://llvm.org/bugs/show_bug.cgi?id=10250
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134325 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-02 18:22:36 +00:00
Howard Hinnant
74248888ab Changed constraints on pair and tuple constructors from is_convertible to is_constructible.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134252 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 20:12:51 +00:00
Howard Hinnant
61aa6013c3 Correct for new rules regarding implicitly deleted special members. http://llvm.org/bugs/show_bug.cgi?id=10191
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134248 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01 19:24:36 +00:00
Howard Hinnant
0949eedbd6 _STD -> _VSTD to avoid macro clash on windows
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 21:18:19 +00:00
Howard Hinnant
d318d49e5c Patch by Petteri Räty, http://llvm.org/bugs/show_bug.cgi?id=8992
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134155 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-30 14:21:55 +00:00
Howard Hinnant
a2a08b43ee test for pair piecewise construction
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 23:51:19 +00:00
Douglas Gregor
35d2fcfc8e Teach libc++ about the addressof() overloads it needs to work with
Objective-C Automatic Reference Counting, where Objective-C object
pointers can have several different qualifiers (__strong, __weak,
__autoreleasing, __unsafe_unretained). These addressof() overloads are
only provided in ARC mode, and the __weak variant is conditionalized
on having weak-reference support in the ARC runtime.

For historical reasons, Clang provides these definitions itself, and
defines the macro _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF to note when
it as done so. The code belongs here, and this redundancy will be
eliminated in the future.

Addresses <rdar://problem/9658274>.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 22:17:44 +00:00
Howard Hinnant
f5d76a7afc Add instructions for -U__STRICT_ANSI__ for Mac OS 10.6
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133616 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 12:13:55 +00:00
Howard Hinnant
7604fea08c More fixes: One of my fixes to type_traits earlier today was incorrect, so that is reverted. Recently clang appears to have tightened up its definition of is_convertible and that has caused some failures in [unordered_][multi]map. I've switched to using is_constructible to restablish the desired functionality in [unordered_][multi]map. Specifically, inserting rvalues of move-only types for the keys.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133402 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-19 21:45:00 +00:00
Howard Hinnant
d4b957820c Miscellaneous minor fixes in <type_traits>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-19 19:12:59 +00:00
Howard Hinnant
2b1b2d40d7 Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133008 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 19:58:17 +00:00
Nick Kledzik
8f5f2563aa more Apple build system tweaks
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132819 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-09 23:31:35 +00:00
Howard Hinnant
c7c3891199 Update CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132780 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-09 16:53:33 +00:00
Howard Hinnant
c28dbeee52 Move nullptr_t to unversioned namespace: Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132665 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-05 13:00:46 +00:00
Howard Hinnant
58cd8231d8 noexcept for <stack>. This completes noexcept for Chapter 23 [containers].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132652 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 22:09:19 +00:00
Howard Hinnant
6a09441022 noexcept for <queue>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132650 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 21:32:33 +00:00
Howard Hinnant
04dae1df22 noexcept for <unordered_set>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132647 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 20:18:37 +00:00
Howard Hinnant
5f2f14c5d2 noexcept for <unordered_map>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132646 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 18:54:24 +00:00
Howard Hinnant
8b53768dac Made more implementation details of [multi]map/set noexcept.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132642 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 17:10:24 +00:00
Howard Hinnant
b2e2a8f6f3 noexcept for <set>. Plus a few fixes to noexcept for <map>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132640 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 15:22:34 +00:00
Howard Hinnant
7686add61e noexcept for <map>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04 14:31:57 +00:00
Howard Hinnant
d1d27a4afa noexcept for <vector>. This also includes installing move_if_noexcept() into vector.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132577 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 19:40:40 +00:00
Howard Hinnant
53f7d4cc62 Bring noexcept for <string> inline with other containers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132573 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 18:40:47 +00:00
Howard Hinnant
c560727d5e noexcept for <list>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132562 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 17:30:28 +00:00
Howard Hinnant
b965fed10b noexcept for <forward_list>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132553 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 16:20:53 +00:00
Howard Hinnant
009b2c4583 After sleeping on it I've decided that all special members that can be noexcept, should be declared so. The client has the traits to detect and branch on this information, and it is often an important optimization. Give deque() a noexcept. Add test for deque default constructor and deque destructor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132549 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 15:16:49 +00:00
Howard Hinnant
93f2764b16 Add noexcept tests for deque.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132523 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 01:46:22 +00:00
Howard Hinnant
18884f4e9f Second try at getting noexcept on move and swap for deque. I changed std::alloctor to propagate_on_container_move_assignment so as to make deque<T> move assignment noexcept. What we really need is a compile-time switch that says an allocator always compares equal.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132490 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 21:38:57 +00:00
Howard Hinnant
0a612b0891 I've become quite disatsified with the lack of noexcept specifications on container move construction, move assignment operator and swap. Without proper decoration on at least move construction, vectors of containers will have unacceptable performance. Here's the fix for deque.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132480 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 20:00:14 +00:00
Howard Hinnant
8790cabd86 noexcept for forward_list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132461 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 16:44:28 +00:00
Howard Hinnant
a12beb35e5 noexcept for deque.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132459 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-02 16:10:22 +00:00
Howard Hinnant
aabf28721b Experimental support for a meaningful __is_swappable<T>::value. This does not appear to be strictly needed for correct functioning of the library. If it causes any problems, I'd rather pull it sooner rather than later.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132421 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-01 19:59:32 +00:00
Howard Hinnant
d737382dfd Turning on cxx_nullptr exposed a latent bug in is_function, causing nullptr to wrongly classify as a function. Fixed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132406 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-01 17:25:11 +00:00
Howard Hinnant
083ba5f5ca I've seen this question enough times to know that it should be fixed: http://stackoverflow.com/questions/6193734/implicit-conversions-with-stdfunction
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132363 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 21:45:26 +00:00
Howard Hinnant
f0562af9dd noexcept for <array>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132359 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 21:06:33 +00:00
Howard Hinnant
20eda8b563 Upgrade <ratio> to use template aliases when available.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132342 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 16:55:36 +00:00
Howard Hinnant
c983454d30 noexcept for Chapter 22 [localization].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132337 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 15:34:58 +00:00
Howard Hinnant
c26fd8061e Add _ATTRIBUTE macro for gcc: Justin Hibbits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132334 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-31 13:13:49 +00:00
Howard Hinnant
a6119a86c5 noexcept for Chapter 21 [strings].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-29 19:57:12 +00:00
Howard Hinnant
d5fed03778 http://llvm.org/bugs/show_bug.cgi?id=10045 . Please review, I have not tested this on linux.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132287 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-29 13:57:49 +00:00
Howard Hinnant
ad1a5cc5f0 minor documentation update
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132286 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-29 13:53:56 +00:00
Howard Hinnant
0687adca37 noexcept for <typeindex>. This completes Chapter 20 [utilities].
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132267 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 18:57:24 +00:00
Howard Hinnant
0667433587 noexcept for <scoped_allocator>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 18:51:12 +00:00
Howard Hinnant
756a1763d1 noexcept for <chrono>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 18:34:36 +00:00
Howard Hinnant
603d2c0989 noexcept for <functional>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 17:59:48 +00:00
Howard Hinnant
1694d23e23 noexcept for <memory>. I've added a few extension noexcept to: allocator_traits<A>::deallocate, allocaate<T>::deallocate, return_temporary_buffer, and default_delete<T>::operator()(T*) const. My rationale was: If a std-dicated noexcept function needs to call another std-defined function, that called function must be noexcept. We're all a little new to noexcept, so things like this are to be expected. Also included fix for broken __is_swappable trait pointed out by Marc Glisse, thanks Marc|. And fixed a test case for is_nothrow_destructible. Destructors are now noexcept by default|
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132261 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-28 14:41:13 +00:00
Howard Hinnant
10f25d2739 noexcept for <bitset>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132216 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27 20:52:28 +00:00
Howard Hinnant
a5e0121b8d noexcept for <tuple>. And in the process learned that I had done it wrong for pair's swap. I needed to create an __is_nothrow_swappable<T>::value trait that was smart enought to answer false when __is_swappable<T>::value is false. Otherwise one gets compile-time errors when using pair or tuple of non-swappable types, even if you never try to swap the pair or tuple.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132204 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27 19:08:18 +00:00
Howard Hinnant
e9b2c2d669 noexcept for <utility>. This included a little repair on pair, and some noexcept workarounds.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132186 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-27 15:04:19 +00:00
Howard Hinnant
1e15fd1856 Applied noexcept to everything in [diagnostics] (Chapter 19)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132137 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 19:48:01 +00:00
Howard Hinnant
19ce6a4792 Turn on cxx_alias_templates support
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132134 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 19:07:54 +00:00
Howard Hinnant
ed56921d6e Applied noexcept to everything in [language.support] (Chapter 18)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132129 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 18:23:59 +00:00
Howard Hinnant
4b7a43da34 Added [[noreturn]] attribute everywhere it should be
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@132125 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-26 17:07:32 +00:00
Nick Kledzik
8feadca3fa support another Apple build environment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131996 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 20:27:31 +00:00
Nick Kledzik
1122fec973 on Darwin re-export C++0x type infos
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131995 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 20:26:04 +00:00
Howard Hinnant
20542c0b94 http://llvm.org/bugs/show_bug.cgi?id=9399 fixed by Ryuta Suzuki
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131961 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-24 12:54:00 +00:00
Howard Hinnant
ef54251a84 Fix const correctness bug in bind involving reference_wrapper found by Jonathan Sauer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 15:07:43 +00:00
Howard Hinnant
e003ce4899 __invokable and __invoke_of now check for incomplete types and issue a compile-time diagnostic if they are used with incomplete types for anything except a return type. Note that both arguments *and* parameters are checked for completeness.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131818 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-22 00:09:02 +00:00
Howard Hinnant
bd89e4b0dd This is a simplified (and superior) implementation of __invoke, __invokable and __invoke_of. It is superior in that __invoke now handles reference qualified member functions whereas the previous implementation did not. And it simply has less infrastructure in its implementation. I'm still learning how to program in C++11 (and probably will be for a long time). This change does not impact the behavior we're seeing in http://llvm.org/bugs/show_bug.cgi?id=9975
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131761 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-20 22:02:53 +00:00
Howard Hinnant
0148a838d0 Simplied bind using __invoke. In the process, found and fixed a couple of bugs. C++11 only.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131667 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 19:41:47 +00:00
Howard Hinnant
57cff290a4 I had a giant misunderstanding of what 'synchronizes with' meant in [futures.async]/p5. This invalidated the current design of async in <future>. This is a new design, based on my new understanding, which has been confirmed on the lwg mailing list. The summary is that ~future() (and ~shared_future()) will block when they are created from within async, and the thread hasn't finished yet. As part of this work I created two new type traits: __invokable<F, Args...>::value and __invoke_of<F, Args...>::type. These are what result_of<F(Args...)> wanted to be when it grew up, but never will be. __invoke_of is carefully crafted so that it can serve as its own enable_if (type doesn't exist if the signature isn't invokable). All of this work is C++11 only.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131639 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-19 15:05:04 +00:00
Howard Hinnant
3dd965bdf9 This commit was accidental. Reverting.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131514 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-18 00:47:00 +00:00
Howard Hinnant
932209b344 A bunch of future tests got invalidated with the latest updates to thread. Fixed the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131509 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 23:32:48 +00:00
Howard Hinnant
fead2e2de9 Fix ambiguity in operator== of scoped_allocator_adaptor.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:41:18 +00:00
Howard Hinnant
6b9826b2dc Fixed bug in recently introduced bind move constructor
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:27:51 +00:00
Howard Hinnant
6cbf9f9b25 Fix and beef up test bug for move_if_noexcept
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131483 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 20:10:42 +00:00
Howard Hinnant
97ecd64913 Clean up a bunch of warnings in the tests, 3 of which actually turned out to be test bugs.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131479 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-17 19:12:55 +00:00
Howard Hinnant
ad935d583d Brought call_once variadic call up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131414 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 19:05:11 +00:00
Howard Hinnant
656bdc3667 Brought thread variadic constructor up to current spec, which allows move-only functors and move-only arguments, but disallows functors with non-const lvalue reference parameters.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131413 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 18:40:35 +00:00
Howard Hinnant
ed22f562e5 Supply missing std::qualifier to call.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131410 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:20:59 +00:00
Howard Hinnant
941138f8c9 Spit 5th bullet __invoke into function pointers and everything else because result_of doesn't deal with function pointers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131409 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:20:21 +00:00
Howard Hinnant
496934a803 Supply missing move ctor in __bind_r, though this one will eventually be defaulted
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131408 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:19:01 +00:00
Howard Hinnant
37c53b6221 Redesign of result_of to handle reference-qualified member functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131407 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-16 16:17:21 +00:00
Howard Hinnant
5ec7f5a518 Fix type-o found by Justin Hibbits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131348 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 18:20:45 +00:00
Howard Hinnant
e06b9965ad Fix type-o found by Justin Hibbits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131346 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 17:24:22 +00:00
Howard Hinnant
f6cc833ae7 Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131344 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 15:38:08 +00:00
Howard Hinnant
783b810cae Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131343 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 15:36:25 +00:00
Howard Hinnant
a5a0ba86c8 Warning suppression in test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131341 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 14:53:12 +00:00
Howard Hinnant
e80c36e27b Correction to hexfloat hack.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131340 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 14:33:56 +00:00
Howard Hinnant
d515df2a50 Fix test bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131328 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 00:07:53 +00:00
Howard Hinnant
f1151efcb1 Suppress some warings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131327 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-14 00:04:05 +00:00
Howard Hinnant
2d01bf0665 Suppress some warings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131326 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 23:59:50 +00:00
Howard Hinnant
0a111118a6 http://llvm.org/bugs/show_bug.cgi?id=9854. Also created an emulated hexfloat literal for use in some of the tests. <sigh> And cleaned up some harmless but irritating warnings in the tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131318 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 21:52:40 +00:00
Howard Hinnant
11a58a68e1 http://llvm.org/bugs/show_bug.cgi?id=9118
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131296 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 17:16:06 +00:00
Howard Hinnant
6063ec176d A much improved type_traits for C++0x. Not yet done: is_trivially_constructible, is_trivially_assignable and underlying_type.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131291 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 14:08:16 +00:00
Howard Hinnant
0cfa1f7cbd CWG 1170 has been fixed for destructors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 13:39:08 +00:00
Sean Hunt
9e604b442c __is_trivially_copyable now supplied by clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131271 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:32:09 +00:00
Howard Hinnant
d5c2f255c5 Corrected misspelling
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131265 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:03:08 +00:00
Howard Hinnant
7bbce3c0e7 Updated to reflect updated use of existing clang support
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131264 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-13 00:01:01 +00:00
Howard Hinnant
6b41c6047b Corrected some bugs in both memory and the tests. Preparing for being able to turn on support for alias templates.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131199 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 20:21:19 +00:00
Howard Hinnant
5d37fb32d2 Redid nothrow traits in terms of non-nothrow traits when noexcept is available
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131198 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11 20:19:40 +00:00
Howard Hinnant
3666695f0d Updated type_traits and the type_traits design doc with recent work done in clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@131090 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09 19:21:17 +00:00
Nick Kledzik
d982028b92 change RC_BUILDIT to RC_XBS for detecting Apple build environment
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130970 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06 01:13:20 +00:00
Nick Kledzik
ffadfd4c1e add support for setjmp/longjmp based exceptions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130938 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-05 18:45:41 +00:00
Nick Kledzik
c6e08d6c44 <rdar://problem/9014045> more support for Apple internal build environments
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130872 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-04 21:50:46 +00:00
768 changed files with 30205 additions and 13029 deletions

View File

@@ -87,17 +87,17 @@ macro(append_if list condition var)
endmacro() endmacro()
# Get warning flags # Get warning flags
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall) append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W) append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter) append_if(LIBCXX_CXX_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_CXX_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_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR) if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror) append_if(LIBCXX_CXX_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_WX_FLAG -WX)
endif() endif()
if (LIBCXX_ENABLE_PEDANTIC) 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() endif()
# Get feature flags. # 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) append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif() endif()
# Assert # 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. # MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC) if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG) list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)

View File

@@ -13,6 +13,64 @@ E: hhinnant@apple.com
D: Architect and primary author of libc++ D: Architect and primary author of libc++
N: Marshall Clow N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes. D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
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.

View File

@@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
University of Illinois/NCSA University of Illinois/NCSA
Open Source License 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. 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 Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -9,6 +9,18 @@ OBJROOT=.
SYMROOT=. SYMROOT=.
export TRIPLE=-apple- export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders install
help::
@echo "Use make install DSTROOT=<destination>"
installsrc:: $(SRCROOT) installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include ditto $(SRCDIRS)/include $(SRCROOT)/include
@@ -18,21 +30,24 @@ installsrc:: $(SRCROOT)
clean:: 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)/usr/include/c++/v1/ext install::
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib 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 cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
mkdir -p $(DSTROOT)/usr/lib $(SYMROOT)/usr/lib/libc++.1.dylib
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib mkdir -p $(INSTALL_DIR)/usr/lib
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib 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

View File

@@ -25,6 +25,7 @@ check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB) check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB) check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB) check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features # Check C++0x features

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,15 @@
#ifndef _LIBCPP_CONFIG #ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG #define _LIBCPP_CONFIG
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header #pragma GCC system_header
#endif
#define _LIBCPP_VERSION 1000 #ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1 #define _LIBCPP_ABI_VERSION 1
@@ -47,6 +53,27 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__ #endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# 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) #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h> # include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN # if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -60,17 +87,49 @@
# endif # endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#ifndef _LIBCPP_VISIBILITY_TAG #if _WIN32
#define _LIBCPP_VISIBILITY_TAG 1
// 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 #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"))) #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif
#ifndef _LIBCPP_VISIBLE
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG #endif
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
@@ -80,14 +139,27 @@
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif #endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__) #if defined(__clang__)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #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 #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__ #ifdef __linux__
@@ -106,12 +178,18 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI #define _LIBCPP_NO_RTTI
#endif #endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype)) #if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#endif #endif
#if !(__has_feature(cxx_attributes)) #if __has_feature(cxx_attributes)
#define _LIBCPP_HAS_NO_ATTRIBUTES # define _LIBCPP_NORETURN [[noreturn]]
#else
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif #endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -140,6 +218,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_AUTO_TYPE #define _LIBCPP_HAS_NO_AUTO_TYPE
#endif #endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates)) #if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#endif #endif
@@ -148,24 +230,62 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif #endif
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
#if __has_feature(is_base_of)
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
#endif
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#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)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// Inline namespaces are available in Clang regardless of C++ dialect. // Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } } #define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE #define _VSTD std::_LIBCPP_NAMESPACE
namespace std { namespace std {
inline namespace _LIBCPP_NAMESPACE { inline namespace _LIBCPP_NAMESPACE {
} }
} }
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
// end defined(__clang__)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#if !__EXCEPTIONS #if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS
#endif #endif
@@ -173,6 +293,9 @@ namespace std {
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
@@ -191,24 +314,25 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) #if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif #endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3) #if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT #define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif #endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) #if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4) #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6) #if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_NULLPTR
#endif #endif
@@ -216,7 +340,7 @@ namespace std {
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } } #define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE #define _VSTD std::_LIBCPP_NAMESPACE
namespace std { namespace std {
namespace _LIBCPP_NAMESPACE { namespace _LIBCPP_NAMESPACE {
@@ -224,7 +348,29 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); 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 #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t; typedef unsigned short char16_t;
@@ -247,11 +393,73 @@ template <unsigned> struct __static_assert_check {};
#endif #endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR #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 #endif
#ifndef __has_feature #ifndef __has_feature
#define __has_feature(__x) 0 #define __has_feature(__x) 0
#endif #endif
#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__ || __sun__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#ifdef _LIBCPP_DEBUG2
# if _LIBCPP_DEBUG2 == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG2 == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
# endif
#endif
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG #endif // _LIBCPP_CONFIG

191
include/__debug Normal file
View File

@@ -0,0 +1,191 @@
// -*- C++ -*-
//===--------------------------- __debug ----------------------------------===//
//
// 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_DEBUG_H
#define _LIBCPP_DEBUG_H
#if _LIBCPP_DEBUG_LEVEL >= 1
# include <cstdlib>
# include <cstdio>
# include <cstddef>
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
#endif
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE __c_node;
struct _LIBCPP_VISIBLE __i_node
{
void* __i_;
__i_node* __next_;
__c_node* __c_;
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__i_node(void* __i, __i_node* __next, __c_node* __c)
: __i_(__i), __next_(__next), __c_(__c) {}
~__i_node();
};
struct _LIBCPP_VISIBLE __c_node
{
void* __c_;
__c_node* __next_;
__i_node** beg_;
__i_node** end_;
__i_node** cap_;
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__c_node(void* __c, __c_node* __next)
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
virtual ~__c_node();
virtual bool __dereferenceable(const void*) const = 0;
virtual bool __decrementable(const void*) const = 0;
virtual bool __addable(const void*, ptrdiff_t) const = 0;
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
void __add(__i_node* __i);
_LIBCPP_HIDDEN void __remove(__i_node* __i);
};
template <class _Cont>
struct _C_node
: public __c_node
{
_C_node(void* __c, __c_node* __n)
: __c_node(__c, __n) {}
virtual bool __dereferenceable(const void*) const;
virtual bool __decrementable(const void*) const;
virtual bool __addable(const void*, ptrdiff_t) const;
virtual bool __subscriptable(const void*, ptrdiff_t) const;
};
template <class _Cont>
bool
_C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__dereferenceable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__decrementable(__j);
}
template <class _Cont>
bool
_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* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__addable(__j, __n);
}
template <class _Cont>
bool
_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* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__subscriptable(__j, __n);
}
class _LIBCPP_VISIBLE __libcpp_db
{
__c_node** __cbeg_;
__c_node** __cend_;
size_t __csz_;
__i_node** __ibeg_;
__i_node** __iend_;
size_t __isz_;
__libcpp_db();
public:
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
~__libcpp_db();
class __db_c_iterator;
class __db_c_const_iterator;
class __db_i_iterator;
class __db_i_const_iterator;
__db_c_const_iterator __c_end() const;
__db_i_const_iterator __i_end() const;
template <class _Cont>
_LIBCPP_INLINE_VISIBILITY
void __insert_c(_Cont* __c)
{
__c_node* __n = __insert_c(static_cast<void*>(__c));
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
}
void __insert_i(void* __i);
__c_node* __insert_c(void* __c);
void __erase_c(void* __c);
void __insert_ic(void* __i, const void* __c);
void __iterator_copy(void* __i, const void* __i0);
void __erase_i(void* __i);
void* __find_c_from_i(void* __i) const;
void __invalidate_all(void* __c);
__c_node* __find_c_and_lock(void* __c) const;
__c_node* __find_c(void* __c) const;
void unlock() const;
void swap(void* __c1, void* __c2);
bool __dereferenceable(const void* __i) const;
bool __decrementable(const void* __i) const;
bool __addable(const void* __i, ptrdiff_t __n) const;
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
bool __comparable(const void* __i, const void* __j) const;
private:
_LIBCPP_HIDDEN
__i_node* __insert_iterator(void* __i);
_LIBCPP_HIDDEN
__i_node* __find_iterator(const void* __i) const;
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
};
_LIBCPP_VISIBLE __libcpp_db* __get_db();
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD
#endif
#endif // _LIBCPP_DEBUG_H

File diff suppressed because it is too large Load Diff

View File

@@ -16,7 +16,9 @@
#include <typeinfo> #include <typeinfo>
#include <exception> #include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -41,13 +43,20 @@ template <class _Tp>
struct __has_result_type struct __has_result_type
{ {
private: private:
struct __two {char _; char __;}; struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...); template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0); template <class _Up> static char __test(typename _Up::result_type* = 0);
public: public:
static const bool value = sizeof(__test<_Tp>(0)) == 1; 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 #ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03> #include <__functional_base_03>
@@ -60,11 +69,11 @@ template <class _Tp>
struct __derives_from_unary_function struct __derives_from_unary_function
{ {
private: private:
struct __two {char _; char __;}; struct __two {char __lx; char __lxx;};
static __two __test(...); static __two __test(...);
template <class _A, class _R> template <class _Ap, class _Rp>
static unary_function<_A, _R> static unary_function<_Ap, _Rp>
__test(const volatile unary_function<_A, _R>*); __test(const volatile unary_function<_Ap, _Rp>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -74,11 +83,11 @@ template <class _Tp>
struct __derives_from_binary_function struct __derives_from_binary_function
{ {
private: private:
struct __two {char _; char __;}; struct __two {char __lx; char __lxx;};
static __two __test(...); static __two __test(...);
template <class _A1, class _A2, class _R> template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _R> static binary_function<_A1, _A2, _Rp>
__test(const volatile binary_function<_A1, _A2, _R>*); __test(const volatile binary_function<_A1, _A2, _Rp>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -129,319 +138,213 @@ struct __weak_result_type
// 0 argument case // 0 argument case
template <class _R> template <class _Rp>
struct __weak_result_type<_R ()> struct __weak_result_type<_Rp ()>
{ {
typedef _R result_type; typedef _Rp result_type;
}; };
template <class _R> template <class _Rp>
struct __weak_result_type<_R (&)()> struct __weak_result_type<_Rp (&)()>
{ {
typedef _R result_type; typedef _Rp result_type;
}; };
template <class _R> template <class _Rp>
struct __weak_result_type<_R (*)()> struct __weak_result_type<_Rp (*)()>
{ {
typedef _R result_type; typedef _Rp result_type;
}; };
// 1 argument case // 1 argument case
template <class _R, class _A1> template <class _Rp, class _A1>
struct __weak_result_type<_R (_A1)> struct __weak_result_type<_Rp (_A1)>
: public unary_function<_A1, _R> : public unary_function<_A1, _Rp>
{ {
}; };
template <class _R, class _A1> template <class _Rp, class _A1>
struct __weak_result_type<_R (&)(_A1)> struct __weak_result_type<_Rp (&)(_A1)>
: public unary_function<_A1, _R> : public unary_function<_A1, _Rp>
{ {
}; };
template <class _R, class _A1> template <class _Rp, class _A1>
struct __weak_result_type<_R (*)(_A1)> struct __weak_result_type<_Rp (*)(_A1)>
: public unary_function<_A1, _R> : public unary_function<_A1, _Rp>
{ {
}; };
template <class _R, class _C> template <class _Rp, class _Cp>
struct __weak_result_type<_R (_C::*)()> struct __weak_result_type<_Rp (_Cp::*)()>
: public unary_function<_C*, _R> : public unary_function<_Cp*, _Rp>
{ {
}; };
template <class _R, class _C> template <class _Rp, class _Cp>
struct __weak_result_type<_R (_C::*)() const> struct __weak_result_type<_Rp (_Cp::*)() const>
: public unary_function<const _C*, _R> : public unary_function<const _Cp*, _Rp>
{ {
}; };
template <class _R, class _C> template <class _Rp, class _Cp>
struct __weak_result_type<_R (_C::*)() volatile> struct __weak_result_type<_Rp (_Cp::*)() volatile>
: public unary_function<volatile _C*, _R> : public unary_function<volatile _Cp*, _Rp>
{ {
}; };
template <class _R, class _C> template <class _Rp, class _Cp>
struct __weak_result_type<_R (_C::*)() const volatile> struct __weak_result_type<_Rp (_Cp::*)() const volatile>
: public unary_function<const volatile _C*, _R> : public unary_function<const volatile _Cp*, _Rp>
{ {
}; };
// 2 argument case // 2 argument case
template <class _R, class _A1, class _A2> template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_R (_A1, _A2)> struct __weak_result_type<_Rp (_A1, _A2)>
: public binary_function<_A1, _A2, _R> : public binary_function<_A1, _A2, _Rp>
{ {
}; };
template <class _R, class _A1, class _A2> template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_R (*)(_A1, _A2)> struct __weak_result_type<_Rp (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _R> : public binary_function<_A1, _A2, _Rp>
{ {
}; };
template <class _R, class _A1, class _A2> template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_R (&)(_A1, _A2)> struct __weak_result_type<_Rp (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _R> : public binary_function<_A1, _A2, _Rp>
{ {
}; };
template <class _R, class _C, class _A1> template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_R (_C::*)(_A1)> struct __weak_result_type<_Rp (_Cp::*)(_A1)>
: public binary_function<_C*, _A1, _R> : public binary_function<_Cp*, _A1, _Rp>
{ {
}; };
template <class _R, class _C, class _A1> template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const> struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
: public binary_function<const _C*, _A1, _R> : public binary_function<const _Cp*, _A1, _Rp>
{ {
}; };
template <class _R, class _C, class _A1> template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) volatile> struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
: public binary_function<volatile _C*, _A1, _R> : public binary_function<volatile _Cp*, _A1, _Rp>
{ {
}; };
template <class _R, class _C, class _A1> template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const volatile> struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
: public binary_function<const volatile _C*, _A1, _R> : public binary_function<const volatile _Cp*, _A1, _Rp>
{ {
}; };
// 3 or more arguments // 3 or more arguments
template <class _R, class _A1, class _A2, class _A3, class ..._A4> template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (_A1, _A2, _A3, _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> template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _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> template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _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> template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _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> template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const> 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> template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile> 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> template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile> struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{ {
typedef _R result_type; typedef _Rp result_type;
}; };
// __invoke // __invoke
// first bullet // bullets 1 and 2
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg> template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename enable_if auto
< __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
sizeof...(_Param) == sizeof...(_Arg) && -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{ {
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...); return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
} }
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg> template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename enable_if auto
< __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
sizeof...(_Param) == sizeof...(_Arg) && -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{ {
return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...); return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
} }
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg> // bullets 3 and 4
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename enable_if auto
< __invoke(_Fp&& __f, _A0&& __a0)
sizeof...(_Param) == sizeof...(_Arg) && -> decltype(_VSTD::forward<_A0>(__a0).*__f)
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{ {
return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...); return _VSTD::forward<_A0>(__a0).*__f;
} }
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg> template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename enable_if auto
< __invoke(_Fp&& __f, _A0&& __a0)
sizeof...(_Param) == sizeof...(_Arg) && -> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{ {
return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...); return (*_VSTD::forward<_A0>(__a0)).*__f;
} }
// second bullet // bullet 5
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg> template <class _Fp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename enable_if auto
< __invoke(_Fp&& __f, _Args&& ...__args)
sizeof...(_Param) == sizeof...(_Arg) && -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{ {
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...); return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
} }
template <class _Tp, class ..._Args> template <class _Tp, class ..._Args>
struct __invoke_return struct __invoke_return
{ {
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type; typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
}; };
template <class _Tp> template <class _Tp>
@@ -456,22 +359,22 @@ private:
public: public:
// construct/copy/destroy // construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {} _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif #endif
// access // access
_LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;} _LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;} _LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
// invoke // invoke
template <class... _ArgTypes> template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&, _ArgTypes...>::type typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const operator() (_ArgTypes&&... __args) const
{ {
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...); return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
} }
}; };
@@ -483,7 +386,7 @@ template <class _Tp> struct __is_reference_wrapper
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp> reference_wrapper<_Tp>
ref(_Tp& __t) ref(_Tp& __t) _NOEXCEPT
{ {
return reference_wrapper<_Tp>(__t); return reference_wrapper<_Tp>(__t);
} }
@@ -491,7 +394,7 @@ ref(_Tp& __t)
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp> reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t) ref(reference_wrapper<_Tp> __t) _NOEXCEPT
{ {
return ref(__t.get()); return ref(__t.get());
} }
@@ -499,7 +402,7 @@ ref(reference_wrapper<_Tp> __t)
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp> reference_wrapper<const _Tp>
cref(const _Tp& __t) cref(const _Tp& __t) _NOEXCEPT
{ {
return reference_wrapper<const _Tp>(__t); return reference_wrapper<const _Tp>(__t);
} }
@@ -507,7 +410,7 @@ cref(const _Tp& __t)
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp> reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t) cref(reference_wrapper<_Tp> __t) _NOEXCEPT
{ {
return cref(__t.get()); return cref(__t.get());
} }
@@ -515,13 +418,13 @@ cref(reference_wrapper<_Tp> __t)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t) = delete; template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&& __t) = delete; template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t);// = delete; template <class _Tp> void ref(const _Tp&&);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete; template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -19,23 +19,36 @@
#include <cstdint> #include <cstdint>
#include <cctype> #include <cctype>
#include <locale.h> #include <locale.h>
#include <xlocale.h> #if _WIN32
# include <support/win32/locale_win32.h>
#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 #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class locale; class _LIBCPP_VISIBLE locale;
template <class _Facet> bool has_facet(const locale&) throw(); template <class _Facet>
template <class _Facet> const _Facet& use_facet(const locale&); _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 class _LIBCPP_VISIBLE locale
{ {
public: public:
// types: // types:
class facet; class _LIBCPP_VISIBLE facet;
class id; class _LIBCPP_VISIBLE id;
typedef int category; typedef int category;
static const category // values assigned here are for exposition only static const category // values assigned here are for exposition only
@@ -49,8 +62,8 @@ public:
all = collate | ctype | monetary | numeric | time | messages; all = collate | ctype | monetary | numeric | time | messages;
// construct/copy/destroy: // construct/copy/destroy:
locale() throw(); locale() _NOEXCEPT;
locale(const locale&) throw(); locale(const locale&) _NOEXCEPT;
explicit locale(const char*); explicit locale(const char*);
explicit locale(const string&); explicit locale(const string&);
locale(const locale&, const char*, category); locale(const locale&, const char*, category);
@@ -59,9 +72,9 @@ public:
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*); _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
locale(const locale&, const locale&, category); locale(const locale&, const locale&, category);
~locale() throw(); ~locale();
const locale& operator=(const locale&) throw(); const locale& operator=(const locale&) _NOEXCEPT;
template <class _Facet> locale combine(const locale&) const; template <class _Facet> locale combine(const locale&) const;
@@ -86,7 +99,7 @@ private:
bool has_facet(id&) const; bool has_facet(id&) const;
const facet* use_facet(id&) const; const facet* use_facet(id&) const;
template <class _Facet> friend bool has_facet(const locale&) throw(); template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet> friend const _Facet& use_facet(const locale&); template <class _Facet> friend const _Facet& use_facet(const locale&);
}; };
@@ -103,7 +116,7 @@ protected:
// facet(const facet&) = delete; // effectively done in __shared_count // facet(const facet&) = delete; // effectively done in __shared_count
// void operator=(const facet&) = delete; // void operator=(const facet&) = delete;
private: private:
virtual void __on_zero_shared(); virtual void __on_zero_shared() _NOEXCEPT;
}; };
class _LIBCPP_VISIBLE locale::id class _LIBCPP_VISIBLE locale::id
@@ -113,7 +126,7 @@ class _LIBCPP_VISIBLE locale::id
static int32_t __next_id; static int32_t __next_id;
public: public:
_LIBCPP_INLINE_VISIBILITY id() {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
private: private:
void __init(); void __init();
void operator=(const id&); // = delete; void operator=(const id&); // = delete;
@@ -137,16 +150,16 @@ locale
locale::combine(const locale& __other) const locale::combine(const locale& __other) const
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (!_STD::has_facet<_Facet>(__other)) if (!_VSTD::has_facet<_Facet>(__other))
throw runtime_error("locale::combine: locale missing facet"); throw runtime_error("locale::combine: locale missing facet");
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other))); return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
} }
template <class _Facet> template <class _Facet>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
has_facet(const locale& __l) throw() has_facet(const locale& __l) _NOEXCEPT
{ {
return __l.has_facet(_Facet::id); return __l.has_facet(_Facet::id);
} }
@@ -227,22 +240,22 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
template <class _CharT> template <class _CharT>
long long
collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
{ {
size_t h = 0; size_t __h = 0;
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8; const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t mask = size_t(0xF) << (sr + 4); const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* p = lo; p != hi; ++p) 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; size_t __g = __h & __mask;
h ^= g | (g >> sr); __h ^= __g | (__g >> __sr);
} }
return static_cast<long>(h); return static_cast<long>(__h);
} }
extern template class _LIBCPP_VISIBLE collate<char>; _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<char>)
extern template class _LIBCPP_VISIBLE collate<wchar_t>; _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<wchar_t>)
// template <class CharT> class collate_byname; // template <class CharT> class collate_byname;
@@ -292,7 +305,7 @@ bool
locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
const basic_string<_CharT, _Traits, _Allocator>& __y) const const basic_string<_CharT, _Traits, _Allocator>& __y) const
{ {
return _STD::use_facet<_STD::collate<_CharT> >(*this).compare( return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
__x.data(), __x.data() + __x.size(), __x.data(), __x.data() + __x.size(),
__y.data(), __y.data() + __y.size()) < 0; __y.data(), __y.data() + __y.size()) < 0;
} }
@@ -302,20 +315,8 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_VISIBLE ctype_base class _LIBCPP_VISIBLE ctype_base
{ {
public: public:
typedef __uint32_t mask; #if __GLIBC__
typedef unsigned short mask;
#if __APPLE__
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
static const mask upper = _CTYPE_U;
static const mask lower = _CTYPE_L;
static const mask alpha = _CTYPE_A;
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#else // __APPLE__
static const mask space = _ISspace; static const mask space = _ISspace;
static const mask print = _ISprint; static const mask print = _ISprint;
static const mask cntrl = _IScntrl; static const mask cntrl = _IScntrl;
@@ -326,7 +327,59 @@ public:
static const mask punct = _ISpunct; static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit; static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank; static const mask blank = _ISblank;
#endif // __APPLE__ #elif _WIN32
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
static const mask cntrl = _CONTROL;
static const mask upper = _UPPER;
static const mask lower = _LOWER;
static const mask alpha = _ALPHA;
static const mask digit = _DIGIT;
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif (__APPLE__ || __FreeBSD__)
#if __APPLE__
typedef __uint32_t mask;
#elif __FreeBSD__
typedef unsigned long mask;
#endif
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
static const mask upper = _CTYPE_U;
static const mask lower = _CTYPE_L;
static const mask alpha = _CTYPE_A;
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#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;
static const mask cntrl = 1<<2;
static const mask upper = 1<<3;
static const mask lower = 1<<4;
static const mask alpha = 1<<5;
static const mask digit = 1<<6;
static const mask punct = 1<<7;
static const mask xdigit = 1<<8;
static const mask blank = 1<<9;
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
static const mask alnum = alpha | digit; static const mask alnum = alpha | digit;
static const mask graph = alnum | punct; static const mask graph = alnum | punct;
@@ -451,14 +504,14 @@ public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const 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 _LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{ {
for (; __low != __high; ++__low, ++__vec) for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[*__low] : 0; *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
return __low; return __low;
} }
@@ -466,7 +519,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[*__low] & __m)) if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
break; break;
return __low; return __low;
} }
@@ -475,7 +528,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[*__low] & __m))) if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
break; break;
return __low; return __low;
} }
@@ -535,8 +588,12 @@ public:
#else #else
static const size_t table_size = 256; // FIXME: Don't hardcode this. static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif #endif
_LIBCPP_ALWAYS_INLINE const mask* table() const throw() {return __tab_;} _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() throw(); static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
protected: protected:
~ctype(); ~ctype();
@@ -755,13 +812,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const throw() int encoding() const _NOEXCEPT
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw() bool always_noconv() const _NOEXCEPT
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -773,7 +830,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const throw() int max_length() const _NOEXCEPT
{ {
return do_max_length(); return do_max_length();
} }
@@ -795,10 +852,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw(); virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const throw(); virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw(); virtual int do_max_length() const _NOEXCEPT;
}; };
// template <> class codecvt<wchar_t, char, mbstate_t> // template <> class codecvt<wchar_t, char, mbstate_t>
@@ -840,13 +897,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const throw() int encoding() const _NOEXCEPT
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw() bool always_noconv() const _NOEXCEPT
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -858,7 +915,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const throw() int max_length() const _NOEXCEPT
{ {
return do_max_length(); return do_max_length();
} }
@@ -878,10 +935,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw(); virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const throw(); virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw(); virtual int do_max_length() const _NOEXCEPT;
}; };
// template <> class codecvt<char16_t, char, mbstate_t> // template <> class codecvt<char16_t, char, mbstate_t>
@@ -924,13 +981,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const throw() int encoding() const _NOEXCEPT
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw() bool always_noconv() const _NOEXCEPT
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -942,7 +999,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const throw() int max_length() const _NOEXCEPT
{ {
return do_max_length(); return do_max_length();
} }
@@ -964,10 +1021,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw(); virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const throw(); virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw(); virtual int do_max_length() const _NOEXCEPT;
}; };
// template <> class codecvt<char32_t, char, mbstate_t> // template <> class codecvt<char32_t, char, mbstate_t>
@@ -1010,13 +1067,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const throw() int encoding() const _NOEXCEPT
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw() bool always_noconv() const _NOEXCEPT
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -1028,7 +1085,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const throw() int max_length() const _NOEXCEPT
{ {
return do_max_length(); return do_max_length();
} }
@@ -1050,10 +1107,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw(); virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const throw(); virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw(); virtual int do_max_length() const _NOEXCEPT;
}; };
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
@@ -1078,14 +1135,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{ {
} }
extern template class codecvt_byname<char, char, mbstate_t>; _LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>)
extern template class codecvt_byname<wchar_t, char, mbstate_t>; _LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>)
extern template class codecvt_byname<char16_t, char, mbstate_t>; _LIBCPP_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<char32_t, char, mbstate_t>)
_LIBCPP_VISIBLE void __throw_runtime_error(const char*); _LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _N> template <size_t _Np>
struct __narrow_to_utf8 struct __narrow_to_utf8
{ {
template <class _OutputIterator, class _CharT> template <class _OutputIterator, class _CharT>
@@ -1175,7 +1232,7 @@ struct __narrow_to_utf8<32>
} }
}; };
template <size_t _N> template <size_t _Np>
struct __widen_from_utf8 struct __widen_from_utf8
{ {
template <class _OutputIterator> template <class _OutputIterator>

View File

@@ -16,13 +16,15 @@
#include <system_error> #include <system_error>
#include <pthread.h> #include <pthread.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef _LIBCPP_SHARED_LOCK #ifdef _LIBCPP_SHARED_LOCK
namespace ting { namespace ting {
template <class> class shared_lock; template <class _Mutex> class shared_lock;
template <class> class upgrade_lock; template <class _Mutex> class upgrade_lock;
} }
#endif // _LIBCPP_SHARED_LOCK #endif // _LIBCPP_SHARED_LOCK
@@ -36,7 +38,11 @@ class _LIBCPP_VISIBLE mutex
public: public:
_LIBCPP_INLINE_VISIBILITY _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(); ~mutex();
private: private:
@@ -45,8 +51,8 @@ private:
public: public:
void lock(); void lock();
bool try_lock(); bool try_lock() _NOEXCEPT;
void unlock(); void unlock() _NOEXCEPT;
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} _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 try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {}; struct _LIBCPP_VISIBLE adopt_lock_t {};
//constexpr #if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
extern const
defer_lock_t defer_lock;
//constexpr extern const defer_lock_t defer_lock;
extern const extern const try_to_lock_t try_to_lock;
try_to_lock_t try_to_lock; extern const adopt_lock_t adopt_lock;
//constexpr #else
extern const
adopt_lock_t adopt_lock; 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> template <class _Mutex>
class _LIBCPP_VISIBLE lock_guard class _LIBCPP_VISIBLE lock_guard
@@ -104,12 +112,12 @@ private:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock() : __m_(nullptr), __owns_(false) {} unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m) explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();} : __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t) unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
: __m_(&__m), __owns_(false) {} : __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t) unique_lock(mutex_type& __m, try_to_lock_t)
@@ -139,11 +147,11 @@ private:
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u) unique_lock(unique_lock&& __u) _NOEXCEPT
: __m_(__u.__m_), __owns_(__u.__owns_) : __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;} {__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u) unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
{ {
if (__owns_) if (__owns_)
__m_->unlock(); __m_->unlock();
@@ -188,13 +196,13 @@ public:
void unlock(); void unlock();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u) void swap(unique_lock& __u) _NOEXCEPT
{ {
_STD::swap(__m_, __u.__m_); _VSTD::swap(__m_, __u.__m_);
_STD::swap(__owns_, __u.__owns_); _VSTD::swap(__owns_, __u.__owns_);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
mutex_type* release() mutex_type* release() _NOEXCEPT
{ {
mutex_type* __m = __m_; mutex_type* __m = __m_;
__m_ = nullptr; __m_ = nullptr;
@@ -203,12 +211,12 @@ public:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;} bool owns_lock() const _NOEXCEPT {return __owns_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
// explicit _LIBCPP_EXPLICIT
operator bool () const {return __owns_;} operator bool () const _NOEXCEPT {return __owns_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;} mutex_type* mutex() const _NOEXCEPT {return __m_;}
}; };
template <class _Mutex> template <class _Mutex>
@@ -274,18 +282,19 @@ unique_lock<_Mutex>::unlock()
template <class _Mutex> template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void 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 struct _LIBCPP_VISIBLE cv_status
{ {
enum _ { enum __lx {
no_timeout, no_timeout,
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_;} _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
}; };
@@ -295,7 +304,11 @@ class _LIBCPP_VISIBLE condition_variable
pthread_cond_t __cv_; pthread_cond_t __cv_;
public: public:
_LIBCPP_INLINE_VISIBILITY _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;} condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
#endif
~condition_variable(); ~condition_variable();
private: private:
@@ -303,18 +316,13 @@ private:
condition_variable& operator=(const condition_variable&); // = delete; condition_variable& operator=(const condition_variable&); // = delete;
public: public:
void notify_one(); void notify_one() _NOEXCEPT;
void notify_all(); void notify_all() _NOEXCEPT;
void wait(unique_lock<mutex>& __lk); void wait(unique_lock<mutex>& __lk);
template <class _Predicate> template <class _Predicate>
void wait(unique_lock<mutex>& __lk, _Predicate __pred); 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> template <class _Clock, class _Duration>
cv_status cv_status
wait_until(unique_lock<mutex>& __lk, wait_until(unique_lock<mutex>& __lk,
@@ -369,28 +377,13 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
wait(__lk); 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> template <class _Clock, class _Duration>
cv_status cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk, condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t) const chrono::time_point<_Clock, _Duration>& __t)
{ {
using namespace chrono; using namespace chrono;
system_clock::time_point __s_now = system_clock::now(); wait_for(__lk, __t - _Clock::now());
typename _Clock::time_point __c_now = _Clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; 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) const chrono::duration<_Rep, _Period>& __d)
{ {
using namespace chrono; 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(); system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_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 : return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout; cv_status::timeout;
} }
@@ -429,7 +430,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
_Predicate __pred) _Predicate __pred)
{ {
return wait_until(__lk, chrono::steady_clock::now() + __d, return wait_until(__lk, chrono::steady_clock::now() + __d,
_STD::move(__pred)); _VSTD::move(__pred));
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -6,7 +6,11 @@
#include <type_traits> #include <type_traits>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -47,29 +51,36 @@ public:
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref; typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref; typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
__split_buffer(); __split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
explicit __split_buffer(__alloc_rr& __a); explicit __split_buffer(__alloc_rr& __a);
explicit __split_buffer(const __alloc_rr& __a); explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer(); ~__split_buffer();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__split_buffer(__split_buffer&& __c); __split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
__split_buffer& operator=(__split_buffer&& __c); __split_buffer& operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;} _LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY iterator end() {return __end_;} _LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __end_;} _LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);} _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);} _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} _LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
@@ -82,9 +93,9 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} _LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
void reserve(size_type __n); void reserve(size_type __n);
void shrink_to_fit(); void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x); 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) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x); void push_front(value_type&& __x);
void push_back(value_type&& __x); void push_back(value_type&& __x);
@@ -120,40 +131,49 @@ public:
void __destruct_at_begin(pointer __new_begin, false_type); void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type); void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last) _LIBCPP_INLINE_VISIBILITY
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());} void __destruct_at_end(pointer __new_last) _NOEXCEPT
void __destruct_at_end(pointer __new_last, false_type); {__destruct_at_end(__new_last, false_type());}
void __destruct_at_end(pointer __new_last, true_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); void swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value);
bool __invariants() const; bool __invariants() const;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, true_type) void __move_assign_alloc(__split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{ {
__alloc() = _STD::move(__c.__alloc()); __alloc() = _VSTD::move(__c.__alloc());
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, false_type) void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y) static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());} __alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type) static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
{} {}
}; };
@@ -194,7 +214,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
do do
{ {
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), value_type()); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
++this->__end_; ++this->__end_;
--__n; --__n;
} while (__n > 0); } while (__n > 0);
@@ -213,7 +233,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
do do
{ {
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), __x); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
++this->__end_; ++this->__end_;
--__n; --__n;
} while (__n > 0); } while (__n > 0);
@@ -235,14 +255,14 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
if (__end_ == __end_cap()) if (__end_ == __end_cap())
{ {
size_type __old_cap = __end_cap() - __first_; size_type __old_cap = __end_cap() - __first_;
size_type __new_cap = _STD::max<size_type>(2 * __old_cap, 8); size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
__split_buffer __buf(__new_cap, 0, __a); __split_buffer __buf(__new_cap, 0, __a);
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_) for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
__alloc_traits::construct(__buf.__alloc(), __alloc_traits::construct(__buf.__alloc(),
_STD::__to_raw_pointer(__buf.__end_), _STD::move(*__p)); _VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
swap(__buf); swap(__buf);
} }
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_; ++this->__end_;
} }
} }
@@ -259,7 +279,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
{ {
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first); __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_; ++this->__end_;
} }
} }
@@ -269,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) __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_++); __alloc_traits::destroy(__alloc(), __begin_++);
} }
@@ -284,16 +304,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{ {
while (__new_last < __end_) while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), --__end_); __alloc_traits::destroy(__alloc(), --__end_);
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
{ {
__end_ = __new_last; __end_ = __new_last;
} }
@@ -310,6 +330,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer() __split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0) : __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{ {
} }
@@ -340,10 +361,11 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
: __first_(_STD::move(__c.__first_)), _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
__begin_(_STD::move(__c.__begin_)), : __first_(_VSTD::move(__c.__first_)),
__end_(_STD::move(__c.__end_)), __begin_(_VSTD::move(__c.__begin_)),
__end_cap_(_STD::move(__c.__end_cap_)) __end_(_VSTD::move(__c.__end_)),
__end_cap_(_VSTD::move(__c.__end_cap_))
{ {
__c.__first_ = nullptr; __c.__first_ = nullptr;
__c.__begin_ = nullptr; __c.__begin_ = nullptr;
@@ -372,14 +394,17 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap); __first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_; __begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap; __end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _I; typedef move_iterator<iterator> _Ip;
__construct_at_end(_I(__c.begin()), _I(__c.end())); __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
} }
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>& __split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value)
{ {
clear(); clear();
shrink_to_fit(); shrink_to_fit();
@@ -399,11 +424,13 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
void void
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{ {
_STD::swap(__first_, __x.__first_); _VSTD::swap(__first_, __x.__first_);
_STD::swap(__begin_, __x.__begin_); _VSTD::swap(__begin_, __x.__begin_);
_STD::swap(__end_, __x.__end_); _VSTD::swap(__end_, __x.__end_);
_STD::swap(__end_cap(), __x.__end_cap()); _VSTD::swap(__end_cap(), __x.__end_cap());
__swap_alloc(__alloc(), __x.__alloc()); __swap_alloc(__alloc(), __x.__alloc());
} }
@@ -416,16 +443,16 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
void void
__split_buffer<_Tp, _Allocator>::shrink_to_fit() __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
{ {
if (capacity() > size()) if (capacity() > size())
{ {
@@ -437,10 +464,10 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit()
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
__t.__end_ = __t.__begin_ + (__end_ - __begin_); __t.__end_ = __t.__begin_ + (__end_ - __begin_);
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
@@ -460,22 +487,22 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
{ {
difference_type __d = __end_cap() - __end_; difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d); __begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d; __end_ += __d;
} }
else 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()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __x); __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
--__begin_; --__begin_;
} }
@@ -491,23 +518,23 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
{ {
difference_type __d = __end_cap() - __end_; difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d); __begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d; __end_ += __d;
} }
else 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()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
_STD::move(__x)); _VSTD::move(__x));
--__begin_; --__begin_;
} }
@@ -524,22 +551,22 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d); __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else 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()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __x); __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
++__end_; ++__end_;
} }
@@ -555,23 +582,23 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d); __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else 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()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_STD::move(__x)); _VSTD::move(__x));
++__end_; ++__end_;
} }
@@ -588,23 +615,23 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d); __end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else 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()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_); _VSTD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_); _VSTD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_); _VSTD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap()); _VSTD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_STD::forward<_Args>(__args)...); _VSTD::forward<_Args>(__args)...);
++__end_; ++__end_;
} }
@@ -612,6 +639,16 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SPLIT_BUFFER #endif // _LIBCPP_SPLIT_BUFFER

View File

@@ -15,24 +15,26 @@
#include <type_traits> #include <type_traits>
#include <new> #include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _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> template <size_t _Np>
class _LIBCPP_HIDDEN __sso_allocator<void, _N> class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
{ {
public: public:
typedef const void* const_pointer; typedef const void* const_pointer;
typedef void value_type; typedef void value_type;
}; };
template <class _Tp, size_t _N> template <class _Tp, size_t _Np>
class _LIBCPP_HIDDEN __sso_allocator class _LIBCPP_HIDDEN __sso_allocator
{ {
typename aligned_storage<sizeof(_Tp) * _N>::type buf_; typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
bool __allocated_; bool __allocated_;
public: public:
typedef size_t size_type; typedef size_t size_type;
@@ -41,14 +43,14 @@ public:
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {} _LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __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) {} : __allocated_(false) {}
private: private:
__sso_allocator& operator=(const __sso_allocator&); __sso_allocator& operator=(const __sso_allocator&);
public: 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; __allocated_ = true;
return (pointer)&buf_; return (pointer)&buf_;

View File

@@ -17,11 +17,15 @@
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
static const unsigned __limit = 8; static const int __limit = 8;
// __stdinbuf // __stdinbuf
@@ -97,10 +101,10 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume) __stdinbuf<_CharT>::__getchar(bool __consume)
{ {
char __extbuf[__limit]; char __extbuf[__limit];
int __nread = _STD::max(1, __encoding_); int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i) for (int __i = 0; __i < __nread; ++__i)
{ {
char __c = getc(__file_); int __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c); __extbuf[__i] = static_cast<char>(__c);
@@ -120,14 +124,14 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
&__1buf, &__1buf + 1, __inxt); &__1buf, &__1buf + 1, __inxt);
switch (__r) switch (__r)
{ {
case _STD::codecvt_base::ok: case _VSTD::codecvt_base::ok:
break; break;
case codecvt_base::partial: case codecvt_base::partial:
__st_ = __sv_st; __st_ = __sv_st;
if (__nread == sizeof(__extbuf)) if (__nread == sizeof(__extbuf))
return traits_type::eof(); return traits_type::eof();
{ {
char __c = getc(__file_); int __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c); __extbuf[__nread] = static_cast<char>(__c);
@@ -136,11 +140,11 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
break; break;
case codecvt_base::error: case codecvt_base::error:
return traits_type::eof(); return traits_type::eof();
case _STD::codecvt_base::noconv: case _VSTD::codecvt_base::noconv:
__1buf = static_cast<char_type>(__extbuf[0]); __1buf = static_cast<char_type>(__extbuf[0]);
break; break;
} }
} while (__r == _STD::codecvt_base::partial); } while (__r == _VSTD::codecvt_base::partial);
} }
if (!__consume) if (!__consume)
{ {
@@ -166,9 +170,9 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt, switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt)) __extbuf, __extbuf + sizeof(__extbuf), __enxt))
{ {
case _STD::codecvt_base::ok: case _VSTD::codecvt_base::ok:
break; break;
case _STD::codecvt_base::noconv: case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__c); __extbuf[0] = static_cast<char>(__c);
__enxt = __extbuf + 1; __enxt = __extbuf + 1;
break; break;
@@ -264,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial) if (__r == codecvt_base::partial)
{ {
this->setp((char_type*)__e, this->pptr()); this->setp((char_type*)__e, this->pptr());
this->pbump(this->epptr() - this->pbase()); this->pbump(static_cast<int>(this->epptr() - this->pbase()));
} }
} }
else else

View File

@@ -17,17 +17,25 @@
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class, class> class __tree; template <class _Tp, class _Compare, class _Allocator> class __tree;
template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator; template <class _Tp, class _NodePtr, class _DiffType>
template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator; class _LIBCPP_VISIBLE __tree_iterator;
template <class, class, class, class> class _LIBCPP_VISIBLE map; template <class _Tp, class _ConstNodePtr, class _DiffType>
template <class, class, class, class> class _LIBCPP_VISIBLE multimap; class _LIBCPP_VISIBLE __tree_const_iterator;
template <class, class, class> class _LIBCPP_VISIBLE set; template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class, class, class> class _LIBCPP_VISIBLE multiset; class _LIBCPP_VISIBLE map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE multimap;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE set;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE multiset;
/* /*
@@ -55,7 +63,7 @@ __root, have a non-null __parent_ field.
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__tree_is_left_child(_NodePtr __x) __tree_is_left_child(_NodePtr __x) _NOEXCEPT
{ {
return __x == __x->__parent_->__left_; return __x == __x->__parent_->__left_;
} }
@@ -121,7 +129,7 @@ __tree_invariant(_NodePtr __root)
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_NodePtr _NodePtr
__tree_min(_NodePtr __x) __tree_min(_NodePtr __x) _NOEXCEPT
{ {
while (__x->__left_ != nullptr) while (__x->__left_ != nullptr)
__x = __x->__left_; __x = __x->__left_;
@@ -133,7 +141,7 @@ __tree_min(_NodePtr __x)
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_NodePtr _NodePtr
__tree_max(_NodePtr __x) __tree_max(_NodePtr __x) _NOEXCEPT
{ {
while (__x->__right_ != nullptr) while (__x->__right_ != nullptr)
__x = __x->__right_; __x = __x->__right_;
@@ -144,7 +152,7 @@ __tree_max(_NodePtr __x)
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_next(_NodePtr __x) __tree_next(_NodePtr __x) _NOEXCEPT
{ {
if (__x->__right_ != nullptr) if (__x->__right_ != nullptr)
return __tree_min(__x->__right_); return __tree_min(__x->__right_);
@@ -157,7 +165,7 @@ __tree_next(_NodePtr __x)
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_prev(_NodePtr __x) __tree_prev(_NodePtr __x) _NOEXCEPT
{ {
if (__x->__left_ != nullptr) if (__x->__left_ != nullptr)
return __tree_max(__x->__left_); return __tree_max(__x->__left_);
@@ -170,7 +178,7 @@ __tree_prev(_NodePtr __x)
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_leaf(_NodePtr __x) __tree_leaf(_NodePtr __x) _NOEXCEPT
{ {
while (true) while (true)
{ {
@@ -194,7 +202,7 @@ __tree_leaf(_NodePtr __x)
// Precondition: __x->__right_ != nullptr // Precondition: __x->__right_ != nullptr
template <class _NodePtr> template <class _NodePtr>
void void
__tree_left_rotate(_NodePtr __x) __tree_left_rotate(_NodePtr __x) _NOEXCEPT
{ {
_NodePtr __y = __x->__right_; _NodePtr __y = __x->__right_;
__x->__right_ = __y->__left_; __x->__right_ = __y->__left_;
@@ -214,7 +222,7 @@ __tree_left_rotate(_NodePtr __x)
// Precondition: __x->__left_ != nullptr // Precondition: __x->__left_ != nullptr
template <class _NodePtr> template <class _NodePtr>
void void
__tree_right_rotate(_NodePtr __x) __tree_right_rotate(_NodePtr __x) _NOEXCEPT
{ {
_NodePtr __y = __x->__left_; _NodePtr __y = __x->__left_;
__x->__left_ = __y->__right_; __x->__left_ = __y->__right_;
@@ -239,7 +247,7 @@ __tree_right_rotate(_NodePtr __x)
// may be different than the value passed in as __root. // may be different than the value passed in as __root.
template <class _NodePtr> template <class _NodePtr>
void void
__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
{ {
__x->__is_black_ = __x == __root; __x->__is_black_ = __x == __root;
while (__x != __root && !__x->__parent_->__is_black_) while (__x != __root && !__x->__parent_->__is_black_)
@@ -309,7 +317,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
// may be different than the value passed in as __root. // may be different than the value passed in as __root.
template <class _NodePtr> template <class _NodePtr>
void void
__tree_remove(_NodePtr __root, _NodePtr __z) __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
{ {
// __z will be removed from the tree. Client still needs to destruct/deallocate it // __z will be removed from the tree. Client still needs to destruct/deallocate it
// __y is either __z, or if __z has two children, __tree_next(__z). // __y is either __z, or if __z has two children, __tree_next(__z).
@@ -494,7 +502,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z)
} }
} }
template <class> class __map_node_destructor; template <class _Allocator> class __map_node_destructor;
template <class _Allocator> template <class _Allocator>
class __tree_node_destructor class __tree_node_destructor
@@ -514,16 +522,16 @@ public:
bool __value_constructed; bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node_destructor(allocator_type& __na) explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT
: __na_(__na), : __na_(__na),
__value_constructed(false) __value_constructed(false)
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) void operator()(pointer __p) _NOEXCEPT
{ {
if (__value_constructed) if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_)); __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
if (__p) if (__p)
__alloc_traits::deallocate(__na_, __p, 1); __alloc_traits::deallocate(__na_, __p, 1);
} }
@@ -541,7 +549,7 @@ public:
pointer __left_; pointer __left_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_end_node() : __left_() {} __tree_end_node() _NOEXCEPT : __left_() {}
}; };
template <class _VoidPtr> template <class _VoidPtr>
@@ -580,7 +588,8 @@ public:
bool __is_black_; bool __is_black_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_node_base() : __right_(), __parent_(), __is_black_(false) {} __tree_node_base() _NOEXCEPT
: __right_(), __parent_(), __is_black_(false) {}
}; };
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
@@ -597,7 +606,7 @@ public:
template <class ..._Args> template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node(_Args&& ...__args) explicit __tree_node(_Args&& ...__args)
: __value_(_STD::forward<_Args>(__args)...) {} : __value_(_VSTD::forward<_Args>(__args)...) {}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node(const value_type& __v) explicit __tree_node(const value_type& __v)
@@ -605,8 +614,8 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
}; };
template <class> class __map_iterator; template <class _TreeIterator> class _LIBCPP_VISIBLE __map_iterator;
template <class> class __map_const_iterator; template <class _TreeIterator> class _LIBCPP_VISIBLE __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType> template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_iterator class _LIBCPP_VISIBLE __tree_iterator
@@ -632,7 +641,7 @@ public:
#endif #endif
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() {} _LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
@@ -662,7 +671,7 @@ public:
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {} explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator; template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __map_iterator; template <class> friend class _LIBCPP_VISIBLE __map_iterator;
@@ -716,7 +725,8 @@ private:
__non_const_iterator; __non_const_iterator;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {} __tree_const_iterator(__non_const_iterator __p) _NOEXCEPT
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
@@ -746,7 +756,8 @@ public:
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {} explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
: __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
@@ -805,7 +816,7 @@ private:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __end_node() __node_pointer __end_node() _NOEXCEPT
{ {
return static_cast<__node_pointer> return static_cast<__node_pointer>
( (
@@ -813,7 +824,7 @@ public:
); );
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __end_node() const __node_const_pointer __end_node() const _NOEXCEPT
{ {
return static_cast<__node_const_pointer> return static_cast<__node_const_pointer>
( (
@@ -821,39 +832,45 @@ public:
); );
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __pair1_.second();} __node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __pair1_.second();} const __node_allocator& __node_alloc() const _NOEXCEPT
{return __pair1_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer& __begin_node() {return __begin_node_;} __node_pointer& __begin_node() _NOEXCEPT {return __begin_node_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_pointer& __begin_node() const {return __begin_node_;} const __node_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type __alloc() const {return allocator_type(__node_alloc());} allocator_type __alloc() const _NOEXCEPT
{return allocator_type(__node_alloc());}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type& size() {return __pair3_.first();} size_type& size() _NOEXCEPT {return __pair3_.first();}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const size_type& size() const {return __pair3_.first();} const size_type& size() const _NOEXCEPT {return __pair3_.first();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
value_compare& value_comp() {return __pair3_.second();} value_compare& value_comp() _NOEXCEPT {return __pair3_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const value_compare& value_comp() const {return __pair3_.second();} const value_compare& value_comp() const _NOEXCEPT
{return __pair3_.second();}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __root() __node_pointer __root() _NOEXCEPT
{return static_cast<__node_pointer> (__end_node()->__left_);} {return static_cast<__node_pointer> (__end_node()->__left_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __root() const __node_const_pointer __root() const _NOEXCEPT
{return static_cast<__node_const_pointer>(__end_node()->__left_);} {return static_cast<__node_const_pointer>(__end_node()->__left_);}
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator; typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator; typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
explicit __tree(const value_compare& __comp); explicit __tree(const value_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_copy_constructible<value_compare>::value);
explicit __tree(const allocator_type& __a); explicit __tree(const allocator_type& __a);
__tree(const value_compare& __comp, const allocator_type& __a); __tree(const value_compare& __comp, const allocator_type& __a);
__tree(const __tree& __t); __tree(const __tree& __t);
@@ -863,28 +880,40 @@ public:
template <class _InputIterator> template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last); void __assign_multi(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__tree(__tree&& __t); __tree(__tree&& __t)
_NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<value_compare>::value);
__tree(__tree&& __t, const allocator_type& __a); __tree(__tree&& __t, const allocator_type& __a);
__tree& operator=(__tree&& __t); __tree& operator=(__tree&& __t)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~__tree(); ~__tree();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__begin_node());} iterator begin() _NOEXCEPT {return iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__begin_node());} const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(__end_node());} iterator end() _NOEXCEPT {return iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(__end_node());} const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __node_traits::max_size(__node_alloc());} size_type max_size() const _NOEXCEPT
{return __node_traits::max_size(__node_alloc());}
void clear(); void clear() _NOEXCEPT;
void swap(__tree& __t); void swap(__tree& __t)
_NOEXCEPT_(
__is_nothrow_swappable<value_compare>::value &&
(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value));
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -903,14 +932,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args); __emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _V> template <class _Vp>
pair<iterator, bool> __insert_unique(_V&& __v); pair<iterator, bool> __insert_unique(_Vp&& __v);
template <class _V> template <class _Vp>
iterator __insert_unique(const_iterator __p, _V&& __v); iterator __insert_unique(const_iterator __p, _Vp&& __v);
template <class _V> template <class _Vp>
iterator __insert_multi(_V&& __v); iterator __insert_multi(_Vp&& __v);
template <class _V> template <class _Vp>
iterator __insert_multi(const_iterator __p, _V&& __v); iterator __insert_multi(const_iterator __p, _Vp&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v); pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -992,10 +1021,10 @@ public:
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const; __equal_range_multi(const _Key& __k) const;
typedef __tree_node_destructor<__node_allocator> _D; typedef __tree_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _D> __node_holder; typedef unique_ptr<__node, _Dp> __node_holder;
__node_holder remove(const_iterator __p); __node_holder remove(const_iterator __p) _NOEXCEPT;
private: private:
typename __node_base::pointer& typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v); __find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
@@ -1019,7 +1048,7 @@ private:
__node_holder __construct_node(const value_type& __v); __node_holder __construct_node(const value_type& __v);
#endif #endif
void destroy(__node_pointer __nd); void destroy(__node_pointer __nd) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t) void __copy_assign_alloc(const __tree& __t)
@@ -1033,31 +1062,42 @@ private:
void __copy_assign_alloc(const __tree& __t, false_type) {} void __copy_assign_alloc(const __tree& __t, false_type) {}
void __move_assign(__tree& __t, false_type); void __move_assign(__tree& __t, false_type);
void __move_assign(__tree& __t, true_type); void __move_assign(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t) void __move_assign_alloc(__tree& __t)
_NOEXCEPT_(
!__node_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<__node_allocator>::value)
{__move_assign_alloc(__t, integral_constant<bool, {__move_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());} __node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, true_type) void __move_assign_alloc(__tree& __t, true_type)
{__node_alloc() = _STD::move(__t.__node_alloc());} _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
{__node_alloc() = _VSTD::move(__t.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, false_type) {} void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
_NOEXCEPT_(
!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());} __node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
_NOEXCEPT
{} {}
__node_pointer __detach(); __node_pointer __detach();
@@ -1066,6 +1106,9 @@ private:
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_copy_constructible<value_compare>::value)
: __pair3_(0, __comp) : __pair3_(0, __comp)
{ {
__begin_node() = __end_node(); __begin_node() = __end_node();
@@ -1240,9 +1283,12 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
: __begin_node_(_STD::move(__t.__begin_node_)), _NOEXCEPT_(
__pair1_(_STD::move(__t.__pair1_)), is_nothrow_move_constructible<__node_allocator>::value &&
__pair3_(_STD::move(__t.__pair3_)) is_nothrow_move_constructible<value_compare>::value)
: __begin_node_(_VSTD::move(__t.__begin_node_)),
__pair1_(_VSTD::move(__t.__pair1_)),
__pair3_(_VSTD::move(__t.__pair3_))
{ {
if (size() == 0) if (size() == 0)
__begin_node() = __end_node(); __begin_node() = __end_node();
@@ -1258,7 +1304,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
: __pair1_(__node_allocator(__a)), : __pair1_(__node_allocator(__a)),
__pair3_(0, _STD::move(__t.value_comp())) __pair3_(0, _VSTD::move(__t.value_comp()))
{ {
if (__a == __t.__alloc()) if (__a == __t.__alloc())
{ {
@@ -1284,12 +1330,14 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value)
{ {
destroy(static_cast<__node_pointer>(__end_node()->__left_)); destroy(static_cast<__node_pointer>(__end_node()->__left_));
__begin_node_ = __t.__begin_node_; __begin_node_ = __t.__begin_node_;
__pair1_.first() = __t.__pair1_.first(); __pair1_.first() = __t.__pair1_.first();
__move_assign_alloc(__t); __move_assign_alloc(__t);
__pair3_ = _STD::move(__t.__pair3_); __pair3_ = _VSTD::move(__t.__pair3_);
if (size() == 0) if (size() == 0)
__begin_node() = __end_node(); __begin_node() = __end_node();
else else
@@ -1309,7 +1357,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
__move_assign(__t, true_type()); __move_assign(__t, true_type());
else else
{ {
value_comp() = _STD::move(__t.value_comp()); value_comp() = _VSTD::move(__t.value_comp());
const_iterator __e = end(); const_iterator __e = end();
if (size() != 0) if (size() != 0)
{ {
@@ -1320,7 +1368,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
while (__cache != nullptr && __t.size() != 0) while (__cache != nullptr && __t.size() != 0)
{ {
__cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_); __cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
__node_pointer __next = __detach(__cache); __node_pointer __next = __detach(__cache);
__node_insert_multi(__cache); __node_insert_multi(__cache);
__cache = __next; __cache = __next;
@@ -1343,13 +1391,18 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
} }
} }
while (__t.size() != 0) while (__t.size() != 0)
__insert_multi(__e, _STD::move(__t.remove(__t.begin())->__value_)); __insert_multi(__e, _VSTD::move(__t.remove(__t.begin())->__value_));
} }
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>&
__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value)
{ {
__move_assign(__t, integral_constant<bool, __move_assign(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>()); __node_traits::propagate_on_container_move_assignment::value>());
@@ -1366,14 +1419,14 @@ __tree<_Tp, _Compare, _Allocator>::~__tree()
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
{ {
if (__nd != nullptr) if (__nd != nullptr)
{ {
destroy(static_cast<__node_pointer>(__nd->__left_)); destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_)); destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, _STD::addressof(__nd->__value_)); __node_traits::destroy(__na, _VSTD::addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1); __node_traits::deallocate(__na, __nd, 1);
} }
} }
@@ -1381,8 +1434,12 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
_NOEXCEPT_(
__is_nothrow_swappable<value_compare>::value &&
(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value))
{ {
using _STD::swap; using _VSTD::swap;
swap(__begin_node_, __t.__begin_node_); swap(__begin_node_, __t.__begin_node_);
swap(__pair1_.first(), __t.__pair1_.first()); swap(__pair1_.first(), __t.__pair1_.first());
__swap_alloc(__node_alloc(), __t.__node_alloc()); __swap_alloc(__node_alloc(), __t.__node_alloc());
@@ -1399,7 +1456,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::clear() __tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT
{ {
destroy(__root()); destroy(__root());
size() = 0; size() = 0;
@@ -1606,10 +1663,10 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
else if (value_comp()(*__hint, __v)) // check after else if (value_comp()(*__hint, __v)) // check after
{ {
// *__hint < __v // *__hint < __v
const_iterator __next = _STD::next(__hint); const_iterator __next = _VSTD::next(__hint);
if (__next == end() || value_comp()(__v, *__next)) if (__next == end() || value_comp()(__v, *__next))
{ {
// *__hint < __v < *_STD::next(__hint) // *__hint < __v < *_VSTD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr) if (__hint.__ptr_->__right_ == nullptr)
{ {
__parent = const_cast<__node_pointer&>(__hint.__ptr_); __parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1654,8 +1711,8 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{ {
__node_allocator& __na = __node_alloc(); __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, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return __h; return __h;
} }
@@ -1665,7 +1722,7 @@ template <class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
{ {
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __h->__value_); __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child); __node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1684,7 +1741,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args)
{ {
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child); __node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1701,7 +1758,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
{ {
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1714,7 +1771,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
_Args&&... __args) _Args&&... __args)
{ {
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1724,11 +1781,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _V> template <class _Vp>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> 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(_STD::forward<_V>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get()); pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second) if (__r.second)
__h.release(); __h.release();
@@ -1736,11 +1793,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _V> template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator 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(_STD::forward<_V>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
iterator __r = __node_insert_unique(__p, __h.get()); iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get()) if (__r.__ptr_ == __h.get())
__h.release(); __h.release();
@@ -1748,11 +1805,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _V> template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator 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(_STD::forward<_V>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1760,11 +1817,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _V> template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator 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(_STD::forward<_V>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1778,10 +1835,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v) __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{ {
__node_allocator& __na = __node_alloc(); __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, _STD::addressof(__h->__value_), __v); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return _STD::move(__h); return _VSTD::move(__h);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1907,7 +1964,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_; __begin_node() = __r.__ptr_;
--size(); --size();
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p))); __node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
__tree_remove(__end_node()->__left_, __tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np)); static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1); __node_traits::deallocate(__na, __np, 1);
@@ -1996,7 +2053,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const __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 __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2009,7 +2066,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _STD::distance( return _VSTD::distance(
__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), __lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result) __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)
); );
@@ -2103,7 +2160,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) __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 __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2116,13 +2173,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else else
return _P(iterator(__rt), return _Pp(iterator(__rt),
iterator( iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_)) static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _P(iterator(__result), iterator(__result)); return _Pp(iterator(__result), iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2131,7 +2188,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
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 __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 __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2144,13 +2201,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _P(const_iterator(__rt), return _Pp(const_iterator(__rt),
const_iterator( const_iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_)) static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _P(const_iterator(__result), const_iterator(__result)); return _Pp(const_iterator(__result), const_iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2159,7 +2216,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) __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 __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2172,10 +2229,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else 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)); __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> template <class _Tp, class _Compare, class _Allocator>
@@ -2184,7 +2241,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
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 __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 __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2197,15 +2254,15 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else 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)); __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> template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
{ {
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_); __node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
if (__begin_node() == __np) if (__begin_node() == __np)
@@ -2218,7 +2275,17 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p)
--size(); --size();
__tree_remove(__end_node()->__left_, __tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np)); 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>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(__tree<_Tp, _Compare, _Allocator>& __x,
__tree<_Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -15,7 +15,9 @@
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS #ifdef _LIBCPP_HAS_NO_VARIADICS
@@ -63,7 +65,7 @@ public:
}; };
template <class ..._Tp> class _LIBCPP_VISIBLE tuple; 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, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {}; template <class _Tp> struct __tuple_like : false_type {};
@@ -77,40 +79,49 @@ 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 <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type& typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&); get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type& const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&); get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&& typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&); get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type& typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&); get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type& const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&); get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&& typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&); get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp& _Tp&
get(array<_Tp, _Size>&); get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
const _Tp& const _Tp&
get(const array<_Tp, _Size>&); get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp&& _Tp&&
get(array<_Tp, _Size>&&); get(array<_Tp, _Size>&&) _NOEXCEPT;
// __make_tuple_indices // __make_tuple_indices
@@ -214,11 +225,7 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up> template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool, : public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value && is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; __tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <> template <>
@@ -237,6 +244,33 @@ struct __tuple_convertible<_Tp, _Up, true, true>
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type> 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 // __tuple_assignable
template <bool, class _Tp, class _Up> template <bool, class _Tp, class _Up>

View File

@@ -13,7 +13,9 @@
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -1,3 +1,4 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// //
// The LLVM Compiler Infrastructure // The LLVM Compiler Infrastructure
@@ -7,13 +8,12 @@
// //
//===----------------------------------------------------------------------===// //===----------------------------------------------------------------------===//
// type_traits #ifdef min
#warning: macro min is incompatible with C++. #undefing min
#undef min
#endif
// aligned_union #ifdef max
#warning: macro max is incompatible with C++. #undefing max
#include <type_traits> #undef max
#endif
int main()
{
#error aligned_union is not implemented
}

File diff suppressed because it is too large Load Diff

View File

@@ -34,28 +34,28 @@ struct array
// No explicit construct/copy/destroy for aggregate type // No explicit construct/copy/destroy for aggregate type
void fill(const T& u); void fill(const T& u);
void swap(array& a); void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
// iterators: // iterators:
iterator begin(); iterator begin() noexcept;
const_iterator begin() const; const_iterator begin() const noexcept;
iterator end(); iterator end() noexcept;
const_iterator end() const; const_iterator end() const noexcept;
reverse_iterator rbegin(); reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const; const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend(); reverse_iterator rend() noexcept;
const_reverse_iterator rend() const; const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const; const_iterator cbegin() const noexcept;
const_iterator cend() const; const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const; const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const; const_reverse_iterator crend() const noexcept;
// capacity: // capacity:
constexpr size_type size() const; constexpr size_type size() const noexcept;
constexpr size_type max_size() const; constexpr size_type max_size() const noexcept;
bool empty() const; constexpr bool empty() const noexcept;
// element access: // element access:
reference operator[](size_type n); reference operator[](size_type n);
@@ -68,8 +68,8 @@ struct array
reference back(); reference back();
const_reference back() const; const_reference back() const;
T* data(); T* data() noexcept;
const T* data() const; const T* data() const noexcept;
}; };
template <class T, size_t N> template <class T, size_t N>
@@ -86,15 +86,15 @@ template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y); bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N > template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y); void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
template <class T> class tuple_size; template <class T> class tuple_size;
template <int I, class T> class tuple_element; template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>; template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>; template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&); template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
template <int I, class T, size_t N> const T& get(const array<T, N>&); template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
template <int I, class T, size_t N> T&& get(array<T, N>&&); template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
} // std } // std
@@ -111,7 +111,9 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&);
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -136,30 +138,46 @@ struct _LIBCPP_VISIBLE array
// No explicit construct/copy/destroy for aggregate type // No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_STD::fill_n(__elems_, _Size, __u);} {_VSTD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a) _LIBCPP_INLINE_VISIBILITY
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);} void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators: // iterators:
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);} iterator begin() _NOEXCEPT {return iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);} const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());} const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();} const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();} const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
// capacity: // capacity:
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;} _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access: // element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
@@ -172,8 +190,10 @@ struct _LIBCPP_VISIBLE array
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY value_type* data() {return __elems_;} _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;} value_type* data() _NOEXCEPT {return __elems_;}
_LIBCPP_INLINE_VISIBILITY
const value_type* data() const _NOEXCEPT {return __elems_;}
}; };
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -207,7 +227,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{ {
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_); return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
} }
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -223,7 +243,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{ {
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size); return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
} }
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -252,8 +272,13 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void typename enable_if
<
__is_swappable<_Tp>::value,
void
>::type
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -283,7 +308,7 @@ public:
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
_Tp& _Tp&
get(array<_Tp, _Size>& __a) get(array<_Tp, _Size>& __a) _NOEXCEPT
{ {
return __a[_Ip]; return __a[_Ip];
} }
@@ -291,7 +316,7 @@ get(array<_Tp, _Size>& __a)
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
const _Tp& const _Tp&
get(const array<_Tp, _Size>& __a) get(const array<_Tp, _Size>& __a) _NOEXCEPT
{ {
return __a[_Ip]; return __a[_Ip];
} }
@@ -301,9 +326,9 @@ get(const array<_Tp, _Size>& __a)
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
_Tp&& _Tp&&
get(array<_Tp, _Size>&& __a) get(array<_Tp, _Size>&& __a) _NOEXCEPT
{ {
return _STD::move(__a[_Ip]); return _VSTD::move(__a[_Ip]);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

File diff suppressed because it is too large Load Diff

View File

@@ -27,19 +27,19 @@ public:
class reference class reference
{ {
friend class bitset; friend class bitset;
reference(); reference() noexcept;
public: public:
~reference(); ~reference() noexcept;
reference& operator=(bool x); // for b[i] = x; reference& operator=(bool x) noexcept; // for b[i] = x;
reference& operator=(const reference&); // for b[i] = b[j]; reference& operator=(const reference&) noexcept; // for b[i] = b[j];
bool operator~() const; // flips the bit bool operator~() const noexcept; // flips the bit
operator bool() const; // for x = b[i]; operator bool() const noexcept; // for x = b[i];
reference& flip(); // for b[i].flip(); reference& flip() noexcept; // for b[i].flip();
}; };
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
constexpr bitset(); constexpr bitset() noexcept;
constexpr bitset(unsigned long long val); constexpr bitset(unsigned long long val) noexcept;
template <class charT> template <class charT>
explicit bitset(const charT* str, explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos, typename basic_string<charT>::size_type n = basic_string<charT>::npos,
@@ -52,17 +52,17 @@ public:
charT zero = charT('0'), charT one = charT('1')); charT zero = charT('0'), charT one = charT('1'));
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& rhs); bitset& operator&=(const bitset& rhs) noexcept;
bitset& operator|=(const bitset& rhs); bitset& operator|=(const bitset& rhs) noexcept;
bitset& operator^=(const bitset& rhs); bitset& operator^=(const bitset& rhs) noexcept;
bitset& operator<<=(size_t pos); bitset& operator<<=(size_t pos) noexcept;
bitset& operator>>=(size_t pos); bitset& operator>>=(size_t pos) noexcept;
bitset& set(); bitset& set() noexcept;
bitset& set(size_t pos, bool val = true); bitset& set(size_t pos, bool val = true);
bitset& reset(); bitset& reset() noexcept;
bitset& reset(size_t pos); bitset& reset(size_t pos);
bitset operator~() const; bitset operator~() const noexcept;
bitset& flip(); bitset& flip() noexcept;
bitset& flip(size_t pos); bitset& flip(size_t pos);
// element access: // element access:
@@ -77,27 +77,27 @@ public:
template <class charT> template <class charT>
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
size_t count() const; size_t count() const noexcept;
constexpr size_t size() const; constexpr size_t size() const noexcept;
bool operator==(const bitset& rhs) const; bool operator==(const bitset& rhs) const noexcept;
bool operator!=(const bitset& rhs) const; bool operator!=(const bitset& rhs) const noexcept;
bool test(size_t pos) const; bool test(size_t pos) const;
bool all() const; bool all() const noexcept;
bool any() const; bool any() const noexcept;
bool none() const; bool none() const noexcept;
bitset operator<<(size_t pos) const; bitset operator<<(size_t pos) const noexcept;
bitset operator>>(size_t pos) const; bitset operator>>(size_t pos) const noexcept;
}; };
// 23.3.5.3 bitset operators: // 23.3.5.3 bitset operators:
template <size_t N> template <size_t N>
bitset<N> operator&(const bitset<N>&, const bitset<N>&); bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N> template <size_t N>
bitset<N> operator|(const bitset<N>&, const bitset<N>&); bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N> template <size_t N>
bitset<N> operator^(const bitset<N>&, const bitset<N>&); bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
template <class charT, class traits, size_t N> template <class charT, class traits, size_t N>
basic_istream<charT, traits>& basic_istream<charT, traits>&
@@ -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 #pragma GCC system_header
#endif
#include <__config> #include <__config>
#include <__bit_reference> #include <__bit_reference>
@@ -127,17 +129,28 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <cassert> #include <cassert>
#endif #endif
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
class __bitset;
template <size_t _N_words, size_t _Size>
struct __has_storage_type<__bitset<_N_words, _Size> >
{
static const bool value = true;
};
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
class __bitset class __bitset
{ {
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -146,7 +159,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>; friend struct __bit_array<__bitset>;
__storage_type __first_[_N_words]; __storage_type __first_[_N_words];
@@ -155,34 +168,36 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
__bitset(); _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v); explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _LIBCPP_INLINE_VISIBILITY _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);} {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v); void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v); void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v); void operator^=(const __bitset& __v) _NOEXCEPT;
void flip(); void flip() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());} {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());} {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
bool all() const; bool all() const _NOEXCEPT;
bool any() const; bool any() const _NOEXCEPT;
size_t __hash_code() const; size_t __hash_code() const _NOEXCEPT;
private: private:
void __init(unsigned long long __v, false_type); #ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, true_type); void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const; unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const; unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const; unsigned long long to_ullong(false_type) const;
@@ -193,43 +208,59 @@ private:
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset() _LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
: __first_{0}
#endif
{ {
_STD::fill_n(__first_, _N_words, __storage_type(0)); #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> template <size_t _N_words, size_t _Size>
void 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)]; __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) for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
__t[__i] = static_cast<__storage_type>(__v); __t[__i] = static_cast<__storage_type>(__v);
_STD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_); _VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
_STD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]), _VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
__storage_type(0)); __storage_type(0));
} }
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void 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; __first_[0] = __v;
_STD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
} }
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _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)>()); __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
} }
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] &= __v.__first_[__i]; __first_[__i] &= __v.__first_[__i];
@@ -238,7 +269,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] |= __v.__first_[__i]; __first_[__i] |= __v.__first_[__i];
@@ -247,7 +278,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] ^= __v.__first_[__i]; __first_[__i] ^= __v.__first_[__i];
@@ -255,7 +286,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
void void
__bitset<_N_words, _Size>::flip() __bitset<_N_words, _Size>::flip() _NOEXCEPT
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -277,7 +308,7 @@ unsigned long
__bitset<_N_words, _Size>::to_ulong(false_type) const __bitset<_N_words, _Size>::to_ulong(false_type) const
{ {
const_iterator __e = __make_iter(_Size); const_iterator __e = __make_iter(_Size);
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
if (__i != __e) if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ulong overflow error"); throw overflow_error("bitset to_ulong overflow error");
@@ -300,7 +331,7 @@ unsigned long long
__bitset<_N_words, _Size>::to_ullong(false_type) const __bitset<_N_words, _Size>::to_ullong(false_type) const
{ {
const_iterator __e = __make_iter(_Size); const_iterator __e = __make_iter(_Size);
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
if (__i != __e) if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ullong overflow error"); throw overflow_error("bitset to_ullong overflow error");
@@ -338,7 +369,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
bool bool
__bitset<_N_words, _Size>::all() const __bitset<_N_words, _Size>::all() const _NOEXCEPT
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -358,7 +389,7 @@ __bitset<_N_words, _Size>::all() const
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
bool bool
__bitset<_N_words, _Size>::any() const __bitset<_N_words, _Size>::any() const _NOEXCEPT
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -379,7 +410,7 @@ __bitset<_N_words, _Size>::any() const
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
__bitset<_N_words, _Size>::__hash_code() const __bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{ {
size_t __h = 0; size_t __h = 0;
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
@@ -393,9 +424,9 @@ class __bitset<1, _Size>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -404,7 +435,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>; friend struct __bit_array<__bitset>;
__storage_type __first_; __storage_type __first_;
@@ -413,43 +444,45 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
__bitset(); _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v); explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);} {return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);} {return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v); void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v); void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v); void operator^=(const __bitset& __v) _NOEXCEPT;
void flip(); void flip() _NOEXCEPT;
unsigned long to_ulong() const; unsigned long to_ulong() const;
unsigned long long to_ullong() const; unsigned long long to_ullong() const;
bool all() const; bool all() const _NOEXCEPT;
bool any() const; bool any() const _NOEXCEPT;
size_t __hash_code() const; size_t __hash_code() const _NOEXCEPT;
}; };
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset() _LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0) : __first_(0)
{ {
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset(unsigned long long __v) _LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v)) : __first_(static_cast<__storage_type>(__v))
{ {
} }
@@ -457,7 +490,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator&=(const __bitset& __v) __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{ {
__first_ &= __v.__first_; __first_ &= __v.__first_;
} }
@@ -465,7 +498,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator|=(const __bitset& __v) __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{ {
__first_ |= __v.__first_; __first_ |= __v.__first_;
} }
@@ -473,7 +506,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator^=(const __bitset& __v) __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{ {
__first_ ^= __v.__first_; __first_ ^= __v.__first_;
} }
@@ -481,7 +514,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::flip() __bitset<1, _Size>::flip() _NOEXCEPT
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
__first_ = ~__first_; __first_ = ~__first_;
@@ -507,7 +540,7 @@ __bitset<1, _Size>::to_ullong() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__bitset<1, _Size>::all() const __bitset<1, _Size>::all() const _NOEXCEPT
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return !(~__first_ & __m); return !(~__first_ & __m);
@@ -516,7 +549,7 @@ __bitset<1, _Size>::all() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__bitset<1, _Size>::any() const __bitset<1, _Size>::any() const _NOEXCEPT
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return __first_ & __m; return __first_ & __m;
@@ -525,7 +558,7 @@ __bitset<1, _Size>::any() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
__bitset<1, _Size>::__hash_code() const __bitset<1, _Size>::__hash_code() const _NOEXCEPT
{ {
return __first_; return __first_;
} }
@@ -536,9 +569,9 @@ class __bitset<0, 0>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -547,51 +580,53 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>; friend struct __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference; typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference; typedef __bit_const_reference<__bitset> const_reference;
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
__bitset(); _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit __bitset(unsigned long long); explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);} {return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);} {return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
{return iterator(0, 0);} {return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
{return const_iterator(0, 0);} {return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {} _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {} _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {} _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void flip() {} _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;} _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;} _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY bool all() const {return true;} _LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const {return false;} _LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;} _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset() _LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{ {
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset(unsigned long long) _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> struct hash<bitset<_Size> >;
template <size_t _Size> template <size_t _Size>
@@ -606,8 +641,9 @@ public:
typedef typename base::const_reference const_reference; typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT> template<class _CharT>
explicit bitset(const _CharT* __str, explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@@ -620,21 +656,22 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs); bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
bitset& operator|=(const bitset& __rhs); bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
bitset& operator^=(const bitset& __rhs); bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos); bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos); bitset& operator>>=(size_t __pos) _NOEXCEPT;
bitset& set(); bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true); bitset& set(size_t __pos, bool __val = true);
bitset& reset(); bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos); bitset& reset(size_t __pos);
bitset operator~() const; bitset operator~() const _NOEXCEPT;
bitset& flip(); bitset& flip() _NOEXCEPT;
bitset& flip(size_t __pos); bitset& flip(size_t __pos);
// element access: // 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);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const; unsigned long to_ulong() const;
unsigned long long to_ullong() const; unsigned long long to_ullong() const;
@@ -649,21 +686,21 @@ public:
_CharT __one = _CharT('1')) const; _CharT __one = _CharT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const; char __one = '1') const;
size_t count() const; size_t count() const _NOEXCEPT;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const; bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const; bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const; bool test(size_t __pos) const;
bool all() const; bool all() const _NOEXCEPT;
bool any() const; bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();} _LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
bitset operator<<(size_t __pos) const; bitset operator<<(size_t __pos) const _NOEXCEPT;
bitset operator>>(size_t __pos) const; bitset operator>>(size_t __pos) const _NOEXCEPT;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const {return base::__hash_code();} size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
friend struct hash<bitset>; friend struct hash<bitset>;
}; };
@@ -674,7 +711,7 @@ bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n, typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one) _CharT __zero, _CharT __one)
{ {
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str)); size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
for (size_t __i = 0; __i < __rlen; ++__i) for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != __zero && __str[__i] != __one) if (__str[__i] != __zero && __str[__i] != __one)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -682,17 +719,17 @@ bitset<_Size>::bitset(const _CharT* __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _M = _STD::min(__rlen, _Size); size_t _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0; 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) if (__c == __zero)
(*this)[__i] = false; (*this)[__i] = false;
else else
(*this)[__i] = true; (*this)[__i] = true;
} }
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
} }
template <size_t _Size> template <size_t _Size>
@@ -708,7 +745,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else #else
assert(!"bitset string pos out of range"); assert(!"bitset string pos out of range");
#endif #endif
size_t __rlen = _STD::min(__n, __str.size() - __pos); size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
for (size_t __i = __pos; __i < __pos + __rlen; ++__i) for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -716,23 +753,23 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _M = _STD::min(__rlen, _Size); size_t _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0; 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)) if (_Traits::eq(__c, __zero))
(*this)[__i] = false; (*this)[__i] = false;
else else
(*this)[__i] = true; (*this)[__i] = true;
} }
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); _VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{ {
base::operator&=(__rhs); base::operator&=(__rhs);
return *this; return *this;
@@ -741,7 +778,7 @@ bitset<_Size>::operator&=(const bitset& __rhs)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{ {
base::operator|=(__rhs); base::operator|=(__rhs);
return *this; return *this;
@@ -750,7 +787,7 @@ bitset<_Size>::operator|=(const bitset& __rhs)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{ {
base::operator^=(__rhs); base::operator^=(__rhs);
return *this; return *this;
@@ -758,30 +795,30 @@ bitset<_Size>::operator^=(const bitset& __rhs)
template <size_t _Size> template <size_t _Size>
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator<<=(size_t __pos) bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
{ {
__pos = _STD::min(__pos, _Size); __pos = _VSTD::min(__pos, _Size);
_STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); _VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
_STD::fill_n(base::__make_iter(0), __pos, false); _VSTD::fill_n(base::__make_iter(0), __pos, false);
return *this; return *this;
} }
template <size_t _Size> template <size_t _Size>
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator>>=(size_t __pos) bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
{ {
__pos = _STD::min(__pos, _Size); __pos = _VSTD::min(__pos, _Size);
_STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); _VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
_STD::fill_n(base::__make_iter(_Size - __pos), __pos, false); _VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
return *this; return *this;
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::set() bitset<_Size>::set() _NOEXCEPT
{ {
_STD::fill_n(base::__make_iter(0), _Size, true); _VSTD::fill_n(base::__make_iter(0), _Size, true);
return *this; return *this;
} }
@@ -802,9 +839,9 @@ bitset<_Size>::set(size_t __pos, bool __val)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::reset() bitset<_Size>::reset() _NOEXCEPT
{ {
_STD::fill_n(base::__make_iter(0), _Size, false); _VSTD::fill_n(base::__make_iter(0), _Size, false);
return *this; return *this;
} }
@@ -825,7 +862,7 @@ bitset<_Size>::reset(size_t __pos)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator~() const bitset<_Size>::operator~() const _NOEXCEPT
{ {
bitset __x(*this); bitset __x(*this);
__x.flip(); __x.flip();
@@ -835,7 +872,7 @@ bitset<_Size>::operator~() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::flip() bitset<_Size>::flip() _NOEXCEPT
{ {
base::flip(); base::flip();
return *this; return *this;
@@ -915,23 +952,23 @@ bitset<_Size>::to_string(char __zero, char __one) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
bitset<_Size>::count() const bitset<_Size>::count() const _NOEXCEPT
{ {
return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true)); return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::operator==(const bitset& __rhs) const bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{ {
return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::operator!=(const bitset& __rhs) const bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{ {
return !(*this == __rhs); return !(*this == __rhs);
} }
@@ -952,7 +989,7 @@ bitset<_Size>::test(size_t __pos) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::all() const bitset<_Size>::all() const _NOEXCEPT
{ {
return base::all(); return base::all();
} }
@@ -960,7 +997,7 @@ bitset<_Size>::all() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::any() const bitset<_Size>::any() const _NOEXCEPT
{ {
return base::any(); return base::any();
} }
@@ -968,7 +1005,7 @@ bitset<_Size>::any() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{ {
bitset __r = *this; bitset __r = *this;
__r <<= __pos; __r <<= __pos;
@@ -978,7 +1015,7 @@ bitset<_Size>::operator<<(size_t __pos) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{ {
bitset __r = *this; bitset __r = *this;
__r >>= __pos; __r >>= __pos;
@@ -988,7 +1025,7 @@ bitset<_Size>::operator>>(size_t __pos) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r &= __y; __r &= __y;
@@ -998,7 +1035,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r |= __y; __r |= __y;
@@ -1008,7 +1045,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r ^= __y; __r ^= __y;
@@ -1020,10 +1057,18 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t> : public unary_function<bitset<_Size>, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
{return __bs.__hash_code();} {return __bs.__hash_code();}
}; };
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_BITSET #endif // _LIBCPP_BITSET

View File

@@ -20,4 +20,6 @@ Macros:
#include <__config> #include <__config>
#include <assert.h> #include <assert.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif

View File

@@ -20,7 +20,9 @@
#include <complex> #include <complex>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
// hh 080623 Created // hh 080623 Created

View File

@@ -37,8 +37,13 @@ int toupper(int c);
#include <__config> #include <__config>
#include <ctype.h> #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 #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -26,7 +26,9 @@ Macros:
#include <__config> #include <__config>
#include <errno.h> #include <errno.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
@@ -72,4 +74,320 @@ const int __elast2 = 105;
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) #endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 9901
#endif
#ifndef EADDRINUSE
#define EADDRINUSE 9902
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL 9903
#endif
#ifndef EISCONN
#define EISCONN 9904
#endif
#ifndef EBADMSG
#define EBADMSG 9905
#endif
#ifndef ECONNABORTED
#define ECONNABORTED 9906
#endif
#ifndef EALREADY
#define EALREADY 9907
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED 9908
#endif
#ifndef ECONNRESET
#define ECONNRESET 9909
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ 9910
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH 9911
#endif
#ifndef EIDRM
#define EIDRM 9912
#endif
#ifndef EMSGSIZE
#define EMSGSIZE 9913
#endif
#ifndef ENETDOWN
#define ENETDOWN 9914
#endif
#ifndef ENETRESET
#define ENETRESET 9915
#endif
#ifndef ENETUNREACH
#define ENETUNREACH 9916
#endif
#ifndef ENOBUFS
#define ENOBUFS 9917
#endif
#ifndef ENOLINK
#define ENOLINK 9918
#endif
#ifndef ENODATA
#define ENODATA 9919
#endif
#ifndef ENOMSG
#define ENOMSG 9920
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 9921
#endif
#ifndef ENOSR
#define ENOSR 9922
#endif
#ifndef ENOTSOCK
#define ENOTSOCK 9923
#endif
#ifndef ENOSTR
#define ENOSTR 9924
#endif
#ifndef ENOTCONN
#define ENOTCONN 9925
#endif
#ifndef ENOTSUP
#define ENOTSUP 9926
#endif
#ifndef ECANCELED
#define ECANCELED 9927
#endif
#ifndef EINPROGRESS
#define EINPROGRESS 9928
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 9929
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 9930
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 9931
#endif
#ifndef EPROTO
#define EPROTO 9932
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 9933
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 9934
#endif
#ifndef ETIME
#define ETIME 9935
#endif
#ifndef ETXTBSY
#define ETXTBSY 9936
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 9938
#endif
#ifndef ELOOP
#define ELOOP 9939
#endif
#ifndef EOVERFLOW
#define EOVERFLOW 9940
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE 9941
#endif
#ifndef ENOSYS
#define ENOSYS 9942
#endif
#ifndef EINVAL
#define EINVAL 9943
#endif
#ifndef ERANGE
#define ERANGE 9944
#endif
#ifndef EILSEQ
#define EILSEQ 9945
#endif
// Windows Mobile doesn't appear to define these:
#ifndef E2BIG
#define E2BIG 9946
#endif
#ifndef EDOM
#define EDOM 9947
#endif
#ifndef EFAULT
#define EFAULT 9948
#endif
#ifndef EBADF
#define EBADF 9949
#endif
#ifndef EPIPE
#define EPIPE 9950
#endif
#ifndef EXDEV
#define EXDEV 9951
#endif
#ifndef EBUSY
#define EBUSY 9952
#endif
#ifndef ENOTEMPTY
#define ENOTEMPTY 9953
#endif
#ifndef ENOEXEC
#define ENOEXEC 9954
#endif
#ifndef EEXIST
#define EEXIST 9955
#endif
#ifndef EFBIG
#define EFBIG 9956
#endif
#ifndef ENAMETOOLONG
#define ENAMETOOLONG 9957
#endif
#ifndef ENOTTY
#define ENOTTY 9958
#endif
#ifndef EINTR
#define EINTR 9959
#endif
#ifndef ESPIPE
#define ESPIPE 9960
#endif
#ifndef EIO
#define EIO 9961
#endif
#ifndef EISDIR
#define EISDIR 9962
#endif
#ifndef ECHILD
#define ECHILD 9963
#endif
#ifndef ENOLCK
#define ENOLCK 9964
#endif
#ifndef ENOSPC
#define ENOSPC 9965
#endif
#ifndef ENXIO
#define ENXIO 9966
#endif
#ifndef ENODEV
#define ENODEV 9967
#endif
#ifndef ENOENT
#define ENOENT 9968
#endif
#ifndef ESRCH
#define ESRCH 9969
#endif
#ifndef ENOTDIR
#define ENOTDIR 9970
#endif
#ifndef ENOMEM
#define ENOMEM 9971
#endif
#ifndef EPERM
#define EPERM 9972
#endif
#ifndef EACCES
#define EACCES 9973
#endif
#ifndef EROFS
#define EROFS 9974
#endif
#ifndef EDEADLK
#define EDEADLK 9975
#endif
#ifndef EAGAIN
#define EAGAIN 9976
#endif
#ifndef ENFILE
#define ENFILE 9977
#endif
#ifndef EMFILE
#define EMFILE 9978
#endif
#ifndef EMLINK
#define EMLINK 9979
#endif
#endif // _LIBCPP_CERRNO #endif // _LIBCPP_CERRNO

View File

@@ -56,7 +56,9 @@ int feupdateenv(const fenv_t* envp);
#include <__config> #include <__config>
#include <fenv.h> #include <fenv.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -63,7 +63,9 @@ Macros:
#include <__config> #include <__config>
#include <float.h> #include <float.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifndef FLT_EVAL_METHOD #ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__

View File

@@ -20,6 +20,7 @@ namespace chrono
{ {
template <class ToDuration, class Rep, class Period> template <class ToDuration, class Rep, class Period>
constexpr
ToDuration ToDuration
duration_cast(const duration<Rep, Period>& fd); duration_cast(const duration<Rep, Period>& fd);
@@ -29,9 +30,9 @@ template <class Rep>
struct duration_values struct duration_values
{ {
public: public:
static Rep zero(); static constexpr Rep zero();
static Rep max(); static constexpr Rep max();
static Rep min(); static constexpr Rep min();
}; };
// duration // duration
@@ -46,9 +47,9 @@ public:
typedef Rep rep; typedef Rep rep;
typedef Period period; typedef Period period;
duration() = default; constexpr duration() = default;
template <class Rep2> template <class Rep2>
explicit duration(const Rep2& r, constexpr explicit duration(const Rep2& r,
typename enable_if typename enable_if
< <
is_convertible<Rep2, rep>::value && is_convertible<Rep2, rep>::value &&
@@ -58,7 +59,7 @@ public:
// conversions // conversions
template <class Rep2, class Period2> template <class Rep2, class Period2>
duration(const duration<Rep2, Period2>& d, constexpr duration(const duration<Rep2, Period2>& d,
typename enable_if typename enable_if
< <
treat_as_floating_point<rep>::value || treat_as_floating_point<rep>::value ||
@@ -67,12 +68,12 @@ public:
// observer // observer
rep count() const; constexpr rep count() const;
// arithmetic // arithmetic
duration operator+() const; constexpr duration operator+() const;
duration operator-() const; constexpr duration operator-() const;
duration& operator++(); duration& operator++();
duration operator++(int); duration operator++(int);
duration& operator--(); duration& operator--();
@@ -86,9 +87,9 @@ public:
// special values // special values
static duration zero(); static constexpr duration zero();
static duration min(); static constexpr duration min();
static duration max(); static constexpr duration max();
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -145,36 +146,48 @@ namespace chrono {
// duration arithmetic // duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s); operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d); operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s); operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<Rep1, Rep2>::type typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons // duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast // duration_cast
@@ -225,9 +238,9 @@ public:
typedef chrono::time_point<system_clock> time_point; typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; static const bool is_steady = false;
static time_point now(); static time_point now() noexcept;
static time_t to_time_t (const time_point& __t); static time_t to_time_t (const time_point& __t) noexcept;
static time_point from_time_t(time_t __t); static time_point from_time_t(time_t __t) noexcept;
}; };
class steady_clock class steady_clock
@@ -239,7 +252,7 @@ public:
typedef chrono::time_point<steady_clock, duration> time_point; typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; static const bool is_steady = true;
static time_point now(); static time_point now() noexcept;
}; };
typedef steady_clock high_resolution_clock; typedef steady_clock high_resolution_clock;
@@ -255,7 +268,11 @@ typedef steady_clock high_resolution_clock;
#include <ratio> #include <ratio>
#include <limits> #include <limits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -302,7 +319,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count())); 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> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; 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> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; 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> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; 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> template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
__is_duration<_ToDuration>::value, __is_duration<_ToDuration>::value,
@@ -365,9 +383,9 @@ template <class _Rep>
struct _LIBCPP_VISIBLE duration_values struct _LIBCPP_VISIBLE duration_values
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _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 min() {return numeric_limits<_Rep>::lowest();}
}; };
// duration // duration
@@ -385,9 +403,9 @@ private:
rep __rep_; rep __rep_;
public: public:
_LIBCPP_INLINE_VISIBILITY duration() {} // = default; _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
template <class _Rep2> template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
explicit duration(const _Rep2& __r, explicit duration(const _Rep2& __r,
typename enable_if typename enable_if
< <
@@ -399,7 +417,7 @@ public:
// conversions // conversions
template <class _Rep2, class _Period2> template <class _Rep2, class _Period2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
duration(const duration<_Rep2, _Period2>& __d, duration(const duration<_Rep2, _Period2>& __d,
typename enable_if typename enable_if
< <
@@ -407,16 +425,16 @@ public:
(ratio_divide<_Period2, period>::type::den == 1 && (ratio_divide<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value) !treat_as_floating_point<_Rep2>::value)
>::type* = 0) >::type* = 0)
: __rep_(_STD::chrono::duration_cast<duration>(__d).count()) {} : __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
// observer // observer
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
// arithmetic // arithmetic
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -432,9 +450,9 @@ public:
// special values // special values
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR 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 max() {return duration(duration_values<rep>::max());}
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -449,7 +467,7 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration> template <class _LhsDuration, class _RhsDuration>
struct __duration_eq struct __duration_eq
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -460,13 +478,14 @@ struct __duration_eq
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration> struct __duration_eq<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();} {return __lhs.count() == __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _LhsDuration, class _RhsDuration>
struct __duration_lt struct __duration_lt
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -499,13 +519,14 @@ struct __duration_lt
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration> struct __duration_lt<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();} {return __lhs.count() < __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs; typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
__r += __rhs; return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
return __r;
} }
// Duration - // Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs; typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
__r -= __rhs; return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
return __r;
} }
// Duration * // Duration *
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, 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) operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d; typedef duration<_Cr, _Period> _Cd;
__r *= static_cast<_Cr>(__s); return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
return __r;
} }
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, 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> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d; typedef duration<_Cr, _Period> _Cd;
__r /= static_cast<_Cr>(__s); return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) 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> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d; typedef duration<_Cr, _Period> _Cd;
__r %= static_cast<_Cr>(__s); return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
__r %= __rhs; typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return __r; return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@@ -701,13 +728,13 @@ public:
// arithmetic // arithmetic
_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;} _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
// special values // special values
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());} _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR 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 max() {return time_point(duration::max());}
}; };
} // chrono } // chrono
@@ -726,7 +753,7 @@ inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, _ToDuration> time_point<_Clock, _ToDuration>
time_point_cast(const time_point<_Clock, _Duration>& __t) time_point_cast(const time_point<_Clock, _Duration>& __t)
{ {
return time_point<_Clock, _ToDuration>(_STD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
} }
// time_point == // time_point ==
@@ -845,9 +872,9 @@ public:
typedef chrono::time_point<system_clock> time_point; typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; static const bool is_steady = false;
static time_point now(); static time_point now() _NOEXCEPT;
static time_t to_time_t (const time_point& __t); static time_t to_time_t (const time_point& __t) _NOEXCEPT;
static time_point from_time_t(time_t __t); static time_point from_time_t(time_t __t) _NOEXCEPT;
}; };
class _LIBCPP_VISIBLE steady_clock class _LIBCPP_VISIBLE steady_clock
@@ -859,7 +886,7 @@ public:
typedef chrono::time_point<steady_clock, duration> time_point; typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; static const bool is_steady = true;
static time_point now(); static time_point now() _NOEXCEPT;
}; };
typedef steady_clock high_resolution_clock; typedef steady_clock high_resolution_clock;

View File

@@ -239,7 +239,9 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
#include <cstdint> #include <cstdint>
#include <inttypes.h> #include <inttypes.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -18,6 +18,8 @@
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CISO646 #endif // _LIBCPP_CISO646

View File

@@ -41,6 +41,8 @@ Macros:
#include <__config> #include <__config>
#include <limits.h> #include <limits.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CLIMITS #endif // _LIBCPP_CLIMITS

View File

@@ -38,7 +38,9 @@ lconv* localeconv();
#include <__config> #include <__config>
#include <locale.h> #include <locale.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,9 @@ class codecvt_utf8_utf16
#include <__config> #include <__config>
#include <__locale> #include <__locale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -249,7 +249,9 @@ template<class T, class charT, class traits>
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -280,7 +282,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _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; 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;} _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: public:
typedef float value_type; 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) {} : __re_(__re), __im_(__im) {}
explicit /*constexpr*/ complex(const complex<double>& __c); explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c); explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _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; 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;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -382,18 +386,19 @@ class _LIBCPP_VISIBLE complex<double>
public: public:
typedef double value_type; 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) {} : __re_(__re), __im_(__im) {}
/*constexpr*/ complex(const complex<float>& __c); _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c); explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _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; 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;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -437,18 +442,19 @@ class _LIBCPP_VISIBLE complex<long double>
public: public:
typedef long double value_type; 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) {} : __re_(__re), __im_(__im) {}
/*constexpr*/ complex(const complex<float>& __c); _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
/*constexpr*/ complex(const complex<double>& __c); _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;} _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 real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _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; 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;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -484,33 +490,33 @@ public:
} }
}; };
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c) complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c) complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c) complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c) complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c) complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c) complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
@@ -1173,7 +1179,7 @@ complex<typename __promote<_Tp, _Up>::type>
pow(const complex<_Tp>& __x, const complex<_Up>& __y) pow(const complex<_Tp>& __x, const complex<_Up>& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y)); return _VSTD::pow(result_type(__x), result_type(__y));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -1186,7 +1192,7 @@ typename enable_if
pow(const complex<_Tp>& __x, const _Up& __y) pow(const complex<_Tp>& __x, const _Up& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y)); return _VSTD::pow(result_type(__x), result_type(__y));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -1199,7 +1205,7 @@ typename enable_if
pow(const _Tp& __x, const complex<_Up>& __y) pow(const _Tp& __x, const complex<_Up>& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y)); return _VSTD::pow(result_type(__x), result_type(__y));
} }
// asinh // asinh
@@ -1243,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag())) if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag()); return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag())) if (isinf(__x.imag()))
{
if (__x.real() > 0) if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0) if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __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 __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag()); _Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i)); _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 // asin

View File

@@ -28,6 +28,8 @@
#endif // __cplusplus #endif // __cplusplus
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_COMPLEX_H #endif // _LIBCPP_COMPLEX_H

View File

@@ -28,8 +28,8 @@ public:
condition_variable(const condition_variable&) = delete; condition_variable(const condition_variable&) = delete;
condition_variable& operator=(const condition_variable&) = delete; condition_variable& operator=(const condition_variable&) = delete;
void notify_one(); void notify_one() noexcept;
void notify_all(); void notify_all() noexcept;
void wait(unique_lock<mutex>& lock); void wait(unique_lock<mutex>& lock);
template <class Predicate> template <class Predicate>
@@ -72,8 +72,8 @@ public:
condition_variable_any(const condition_variable_any&) = delete; condition_variable_any(const condition_variable_any&) = delete;
condition_variable_any& operator=(const condition_variable_any&) = delete; condition_variable_any& operator=(const condition_variable_any&) = delete;
void notify_one(); void notify_one() noexcept;
void notify_all(); void notify_all() noexcept;
template <class Lock> template <class Lock>
void wait(Lock& lock); void wait(Lock& lock);
@@ -111,7 +111,9 @@ public:
#include <__mutex_base> #include <__mutex_base>
#include <memory> #include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -122,8 +124,8 @@ class _LIBCPP_VISIBLE condition_variable_any
public: public:
condition_variable_any(); condition_variable_any();
void notify_one(); void notify_one() _NOEXCEPT;
void notify_all(); void notify_all() _NOEXCEPT;
template <class _Lock> template <class _Lock>
void wait(_Lock& __lock); void wait(_Lock& __lock);
@@ -159,17 +161,17 @@ condition_variable_any::condition_variable_any()
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
condition_variable_any::notify_one() condition_variable_any::notify_one() _NOEXCEPT
{ {
{lock_guard<mutex> _(*__mut_);} {lock_guard<mutex> __lx(*__mut_);}
__cv_.notify_one(); __cv_.notify_one();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
condition_variable_any::notify_all() condition_variable_any::notify_all() _NOEXCEPT
{ {
{lock_guard<mutex> _(*__mut_);} {lock_guard<mutex> __lx(*__mut_);}
__cv_.notify_all(); __cv_.notify_all();
} }
@@ -186,8 +188,8 @@ condition_variable_any::wait(_Lock& __lock)
shared_ptr<mutex> __mut = __mut_; shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut); unique_lock<mutex> __lk(*__mut);
__lock.unlock(); __lock.unlock();
unique_ptr<_Lock, __lock_external> __(&__lock); unique_ptr<_Lock, __lock_external> __lxx(&__lock);
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock); lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
__cv_.wait(__lk); __cv_.wait(__lk);
} // __mut_.unlock(), __lock.lock() } // __mut_.unlock(), __lock.lock()
@@ -208,8 +210,8 @@ condition_variable_any::wait_until(_Lock& __lock,
shared_ptr<mutex> __mut = __mut_; shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut); unique_lock<mutex> __lk(*__mut);
__lock.unlock(); __lock.unlock();
unique_ptr<_Lock, __lock_external> __(&__lock); unique_ptr<_Lock, __lock_external> __lxx(&__lock);
lock_guard<unique_lock<mutex> > _(__lk, adopt_lock); lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock);
return __cv_.wait_until(__lk, __t); return __cv_.wait_until(__lk, __t);
} // __mut_.unlock(), __lock.lock() } // __mut_.unlock(), __lock.lock()
@@ -243,7 +245,7 @@ condition_variable_any::wait_for(_Lock& __lock,
_Predicate __pred) _Predicate __pred)
{ {
return wait_until(__lock, chrono::steady_clock::now() + __d, return wait_until(__lock, chrono::steady_clock::now() + __d,
_STD::move(__pred)); _VSTD::move(__pred));
} }
_LIBCPP_VISIBLE _LIBCPP_VISIBLE

View File

@@ -34,7 +34,9 @@ void longjmp(jmp_buf env, int val);
#include <__config> #include <__config>
#include <setjmp.h> #include <setjmp.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifndef setjmp #ifndef setjmp
#define setjmp(env) setjmp(env) #define setjmp(env) setjmp(env)

View File

@@ -43,7 +43,9 @@ int raise(int sig);
#include <__config> #include <__config>
#include <signal.h> #include <signal.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -35,7 +35,9 @@ Types:
#include <__config> #include <__config>
#include <stdarg.h> #include <stdarg.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -22,7 +22,9 @@ Macros:
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#undef __bool_true_false_are_defined #undef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1 #define __bool_true_false_are_defined 1

View File

@@ -43,7 +43,9 @@ Types:
#include <stddef.h> #include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -56,40 +58,46 @@ typedef long double max_align_t;
struct _LIBCPP_VISIBLE nullptr_t struct _LIBCPP_VISIBLE nullptr_t
{ {
void* _; void* __lx;
struct __nat {int __for_bool_;}; 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> template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;} operator _Tp* () const {return 0;}
template <class _Tp, class _Up> template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;} operator _Tp _Up::* () const {return 0;}
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 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 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 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 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 bool operator>=(nullptr_t, nullptr_t) {return true;} 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 _STD::__get_nullptr_t() #define nullptr _VSTD::__get_nullptr_t()
#else // _LIBCPP_HAS_NO_NULLPTR
typedef decltype(nullptr) nullptr_t;
#endif // _LIBCPP_HAS_NO_NULLPTR #endif // _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_CSTDDEF #endif // _LIBCPP_CSTDDEF

View File

@@ -144,7 +144,9 @@ Types:
#include <__config> #include <__config>
#include <stdint.h> #include <stdint.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -99,7 +99,21 @@ void perror(const char* s);
#include <__config> #include <__config>
#include <stdio.h> #include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC 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 _LIBCPP_BEGIN_NAMESPACE_STD
@@ -124,13 +138,15 @@ using ::scanf;
using ::snprintf; using ::snprintf;
using ::sprintf; using ::sprintf;
using ::sscanf; using ::sscanf;
#ifndef _MSC_VER
using ::vfprintf; using ::vfprintf;
using ::vfscanf; using ::vfscanf;
using ::vprintf;
using ::vscanf; using ::vscanf;
using ::vsscanf;
#endif // _MSC_VER
using ::vprintf;
using ::vsnprintf; using ::vsnprintf;
using ::vsprintf; using ::vsprintf;
using ::vsscanf;
using ::fgetc; using ::fgetc;
using ::fgets; using ::fgets;
using ::fputc; using ::fputc;

View File

@@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar); int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); 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); 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 } // std
@@ -81,8 +84,13 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
#include <__config> #include <__config>
#include <stdlib.h> #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 #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -126,12 +134,22 @@ using ::mbtowc;
using ::wctomb; using ::wctomb;
using ::mbstowcs; using ::mbstowcs;
using ::wcstombs; 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);} // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);} #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 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) {return lldiv(__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 _LIBCPP_END_NAMESPACE_STD

View File

@@ -60,7 +60,9 @@ size_t strlen(const char* s);
#include <__config> #include <__config>
#include <string.h> #include <string.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -91,7 +93,8 @@ using ::strspn;
using ::strstr; 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* 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* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}

View File

@@ -22,6 +22,8 @@
#include <ccomplex> #include <ccomplex>
#include <cmath> #include <cmath>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CTGMATH #endif // _LIBCPP_CTGMATH

View File

@@ -47,7 +47,9 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
#include <__config> #include <__config>
#include <time.h> #include <time.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -106,8 +106,13 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config> #include <__config>
#include <cwctype> #include <cwctype>
#include <wchar.h> #include <wchar.h>
#if _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -119,13 +124,15 @@ using ::FILE;
using ::fwprintf; using ::fwprintf;
using ::fwscanf; using ::fwscanf;
using ::swprintf; using ::swprintf;
using ::swscanf;
using ::vfwprintf; using ::vfwprintf;
using ::vfwscanf;
using ::vswprintf; using ::vswprintf;
using ::vswscanf;
using ::vwprintf; using ::vwprintf;
#ifndef _MSC_VER
using ::swscanf;
using ::vfwscanf;
using ::vswscanf;
using ::vwscanf; using ::vwscanf;
#endif // _MSC_VER
using ::wprintf; using ::wprintf;
using ::wscanf; using ::wscanf;
using ::fgetwc; using ::fgetwc;
@@ -139,8 +146,10 @@ using ::putwc;
using ::putwchar; using ::putwchar;
using ::ungetwc; using ::ungetwc;
using ::wcstod; using ::wcstod;
#ifndef _MSC_VER
using ::wcstof; using ::wcstof;
using ::wcstold; using ::wcstold;
#endif // _MSC_VER
using ::wcstol; using ::wcstol;
using ::wcstoll; using ::wcstoll;
using ::wcstoul; using ::wcstoul;

View File

@@ -54,7 +54,9 @@ wctrans_t wctrans(const char* property);
#include <cctype> #include <cctype>
#include <wctype.h> #include <wctype.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -20,56 +20,56 @@ namespace std
class exception class exception
{ {
public: public:
exception() throw(); exception() noexcept;
exception(const exception&) throw(); exception(const exception&) noexcept;
exception& operator=(const exception&) throw(); exception& operator=(const exception&) noexcept;
virtual ~exception() throw(); virtual ~exception() noexcept;
virtual const char* what() const throw(); virtual const char* what() const noexcept;
}; };
class bad_exception class bad_exception
: public exception : public exception
{ {
public: public:
bad_exception() throw(); bad_exception() noexcept;
bad_exception(const bad_exception&) throw(); bad_exception(const bad_exception&) noexcept;
bad_exception& operator=(const bad_exception&) throw(); bad_exception& operator=(const bad_exception&) noexcept;
virtual ~bad_exception() throw(); virtual ~bad_exception() noexcept;
virtual const char* what() const throw(); virtual const char* what() const noexcept;
}; };
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f ) throw(); unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
unexpected_handler get_unexpected() throw(); unexpected_handler get_unexpected() noexcept;
void unexpected [[noreturn]] (); [[noreturn]] void unexpected();
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) throw(); terminate_handler set_terminate(terminate_handler f ) noexcept;
terminate_handler get_terminate() throw(); terminate_handler get_terminate() noexcept;
void terminate [[noreturn]] (); [[noreturn]] void terminate() noexcept;
bool uncaught_exception() throw(); bool uncaught_exception() noexcept;
typedef unspecified exception_ptr; typedef unspecified exception_ptr;
exception_ptr current_exception(); exception_ptr current_exception() noexcept;
void rethrow_exception [[noreturn]] (exception_ptr p); void rethrow_exception [[noreturn]] (exception_ptr p);
template<class E> exception_ptr make_exception_ptr(E e); template<class E> exception_ptr make_exception_ptr(E e) noexcept;
class nested_exception class nested_exception
{ {
public: public:
nested_exception() throw(); nested_exception() noexcept;
nested_exception(const nested_exception&) throw() = default; nested_exception(const nested_exception&) noexcept = default;
nested_exception& operator=(const nested_exception&) throw() = default; nested_exception& operator=(const nested_exception&) noexcept = default;
virtual ~nested_exception() = default; virtual ~nested_exception() = default;
// access functions // access functions
void rethrow_nested [[noreturn]] () const; [[noreturn]] void rethrow_nested() const;
exception_ptr nested_ptr() const; exception_ptr nested_ptr() const noexcept;
}; };
template <class T> void throw_with_nested [[noreturn]] (T&& t); template <class T> [[noreturn]] void throw_with_nested(T&& t);
template <class E> void rethrow_if_nested(const E& e); template <class E> void rethrow_if_nested(const E& e);
} // std } // std
@@ -80,7 +80,9 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -88,65 +90,65 @@ namespace std // purposefully not using versioning namespace
class _LIBCPP_EXCEPTION_ABI exception class _LIBCPP_EXCEPTION_ABI exception
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY exception() throw() {} _LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
virtual ~exception() throw(); virtual ~exception() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI bad_exception class _LIBCPP_EXCEPTION_ABI bad_exception
: public exception : public exception
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY bad_exception() throw() {} _LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
virtual ~bad_exception() throw(); virtual ~bad_exception() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw(); _LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw(); _LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
_LIBCPP_VISIBLE void unexpected(); _LIBCPP_NORETURN _LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw(); _LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_VISIBLE terminate_handler get_terminate() throw(); _LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__)); _LIBCPP_NORETURN _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
_LIBCPP_VISIBLE bool uncaught_exception() throw(); _LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
class exception_ptr; class _LIBCPP_VISIBLE exception_ptr;
exception_ptr current_exception(); exception_ptr current_exception() _NOEXCEPT;
void rethrow_exception(exception_ptr); // noreturn _LIBCPP_NORETURN void rethrow_exception(exception_ptr);
class _LIBCPP_VISIBLE exception_ptr class _LIBCPP_VISIBLE exception_ptr
{ {
void* __ptr_; void* __ptr_;
public: public:
_LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
exception_ptr(const exception_ptr&); exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&); exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr(); ~exception_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
// explicit _LIBCPP_EXPLICIT
operator bool() const {return __ptr_ != nullptr;} operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y) bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return __x.__ptr_ == __y.__ptr_;} {return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return !(__x == __y);} {return !(__x == __y);}
friend exception_ptr current_exception(); friend exception_ptr current_exception() _NOEXCEPT;
friend void rethrow_exception(exception_ptr); // noreturn _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr);
}; };
template<class _E> template<class _Ep>
exception_ptr exception_ptr
make_exception_ptr(_E __e) make_exception_ptr(_Ep __e) _NOEXCEPT
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
@@ -166,14 +168,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception
{ {
exception_ptr __ptr_; exception_ptr __ptr_;
public: public:
nested_exception(); nested_exception() _NOEXCEPT;
// nested_exception(const nested_exception&) throw() = default; // nested_exception(const nested_exception&) noexcept = default;
// nested_exception& operator=(const nested_exception&) throw() = default; // nested_exception& operator=(const nested_exception&) noexcept = default;
virtual ~nested_exception(); virtual ~nested_exception() _NOEXCEPT;
// access functions // access functions
void rethrow_nested /*[[noreturn]]*/ () const; _LIBCPP_NORETURN void rethrow_nested() const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;} _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
}; };
template <class _Tp> template <class _Tp>
@@ -185,9 +187,10 @@ struct __nested
}; };
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if< throw_with_nested(_Tp&& __t, typename enable_if<
is_class<typename remove_reference<_Tp>::type>::value && is_class<typename remove_reference<_Tp>::type>::value &&
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0) >::type* = 0)
@@ -198,14 +201,15 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t)); throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
#endif #endif
} }
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if< throw_with_nested(_Tp&& __t, typename enable_if<
!is_class<typename remove_reference<_Tp>::type>::value || !is_class<typename remove_reference<_Tp>::type>::value ||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0) >::type* = 0)
@@ -216,15 +220,15 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw _STD::forward<_Tp>(__t); throw _VSTD::forward<_Tp>(__t);
#endif #endif
} }
template <class _E> template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _E& __e, typename enable_if< rethrow_if_nested(const _Ep& __e, typename enable_if<
is_polymorphic<_E>::value is_polymorphic<_Ep>::value
>::type* = 0) >::type* = 0)
{ {
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e); const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
@@ -232,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
__nep->rethrow_nested(); __nep->rethrow_nested();
} }
template <class _E> template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _E& __e, typename enable_if< rethrow_if_nested(const _Ep&, typename enable_if<
!is_polymorphic<_E>::value !is_polymorphic<_Ep>::value
>::type* = 0) >::type* = 0)
{ {
} }

46
include/ext/__hash Normal file
View File

@@ -0,0 +1,46 @@
// -*- C++ -*-
//===------------------------- hash_set ------------------------------------===//
//
// 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_EXT_HASH
#define _LIBCPP_EXT_HASH
#pragma GCC system_header
#include <string>
#include <cstring>
namespace __gnu_cxx {
using namespace std;
template <typename T> struct _LIBCPP_VISIBLE hash : public std::hash<T>
{ };
template <> struct _LIBCPP_VISIBLE hash<const char*>
: public unary_function<const char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const char *__c) const _NOEXCEPT
{
return __do_string_hash(__c, __c + strlen(__c));
}
};
template <> struct _LIBCPP_VISIBLE hash<char *>
: public unary_function<char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char *__c) const _NOEXCEPT
{
return __do_string_hash<const char *>(__c, __c + strlen(__c));
}
};
}
#endif // _LIBCPP_EXT_HASH

View File

@@ -203,8 +203,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table> #include <__hash_table>
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map> #warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header #pragma GCC system_header
@@ -212,7 +215,11 @@ namespace __gnu_cxx {
using namespace std; 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 class __hash_map_hasher
: private _Hash : private _Hash
{ {
@@ -244,7 +251,11 @@ public:
{return __hash_(__x);} {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 class __hash_map_equal
: private _Pred : private _Pred
{ {
@@ -341,9 +352,9 @@ public:
void operator()(pointer __p) void operator()(pointer __p)
{ {
if (__second_constructed) if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second)); __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
if (__first_constructed) if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first)); __alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
if (__p) if (__p)
__alloc_traits::deallocate(__na_, __p, 1); __alloc_traits::deallocate(__na_, __p, 1);
} }
@@ -466,6 +477,7 @@ public:
// types // types
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher; typedef _Hash hasher;
typedef _Pred key_equal; typedef _Pred key_equal;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -495,8 +507,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _D; typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _D> __node_holder; typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;
@@ -549,6 +561,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x) pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);} {return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -665,12 +679,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{ {
__node_allocator& __na = __table_.__node_alloc(); __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, _STD::addressof(__h->__value_.first), __k); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return _STD::move(__h); return _VSTD::move(__h);
} }
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -742,6 +756,7 @@ public:
// types // types
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher; typedef _Hash hasher;
typedef _Pred key_equal; typedef _Pred key_equal;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -769,8 +784,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _D; typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _D> __node_holder; typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;
@@ -823,6 +838,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -963,9 +980,9 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
{ {
_EqRng __xeq = __x.equal_range(__i->first); _EqRng __xeq = __x.equal_range(__i->first);
_EqRng __yeq = __y.equal_range(__i->first); _EqRng __yeq = __y.equal_range(__i->first);
if (_STD::distance(__xeq.first, __xeq.second) != if (_VSTD::distance(__xeq.first, __xeq.second) !=
_STD::distance(__yeq.first, __yeq.second) || _VSTD::distance(__yeq.first, __yeq.second) ||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false; return false;
__i = __xeq.second; __i = __xeq.second;
} }

View File

@@ -196,14 +196,17 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config> #include <__config>
#include <__hash_table> #include <__hash_table>
#include <functional> #include <functional>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set> #warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx { namespace __gnu_cxx {
using namespace std; using namespace std;
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>, template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> > class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE hash_set class _LIBCPP_VISIBLE hash_set
{ {
@@ -272,6 +275,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x) pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);} {return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -490,6 +495,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -627,9 +634,9 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
{ {
_EqRng __xeq = __x.equal_range(*__i); _EqRng __xeq = __x.equal_range(*__i);
_EqRng __yeq = __y.equal_range(*__i); _EqRng __yeq = __y.equal_range(*__i);
if (_STD::distance(__xeq.first, __xeq.second) != if (_VSTD::distance(__xeq.first, __xeq.second) !=
_STD::distance(__yeq.first, __yeq.second) || _VSTD::distance(__yeq.first, __yeq.second) ||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) !_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false; return false;
__i = __xeq.second; __i = __xeq.second;
} }

View File

@@ -34,7 +34,8 @@ public:
typedef <details> iterator; typedef <details> iterator;
typedef <details> const_iterator; typedef <details> const_iterator;
forward_list(); forward_list()
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit forward_list(const allocator_type& a); explicit forward_list(const allocator_type& a);
explicit forward_list(size_type n); explicit forward_list(size_type n);
forward_list(size_type n, const value_type& v); forward_list(size_type n, const value_type& v);
@@ -45,7 +46,8 @@ public:
forward_list(InputIterator first, InputIterator last, const allocator_type& a); forward_list(InputIterator first, InputIterator last, const allocator_type& a);
forward_list(const forward_list& x); forward_list(const forward_list& x);
forward_list(const forward_list& x, const allocator_type& a); forward_list(const forward_list& x, const allocator_type& a);
forward_list(forward_list&& x); forward_list(forward_list&& x)
noexcept(is_nothrow_move_constructible<allocator_type>::value);
forward_list(forward_list&& x, const allocator_type& a); forward_list(forward_list&& x, const allocator_type& a);
forward_list(initializer_list<value_type> il); forward_list(initializer_list<value_type> il);
forward_list(initializer_list<value_type> il, const allocator_type& a); forward_list(initializer_list<value_type> il, const allocator_type& a);
@@ -53,7 +55,10 @@ public:
~forward_list(); ~forward_list();
forward_list& operator=(const forward_list& x); forward_list& operator=(const forward_list& x);
forward_list& operator=(forward_list&& x); forward_list& operator=(forward_list&& x)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
forward_list& operator=(initializer_list<value_type> il); forward_list& operator=(initializer_list<value_type> il);
template <class InputIterator> template <class InputIterator>
@@ -61,22 +66,22 @@ public:
void assign(size_type n, const value_type& v); void assign(size_type n, const value_type& v);
void assign(initializer_list<value_type> il); void assign(initializer_list<value_type> il);
allocator_type get_allocator() const; allocator_type get_allocator() const noexcept;
iterator begin(); iterator begin() noexcept;
const_iterator begin() const; const_iterator begin() const noexcept;
iterator end(); iterator end() noexcept;
const_iterator end() const; const_iterator end() const noexcept;
const_iterator cbegin() const; const_iterator cbegin() const noexcept;
const_iterator cend() const; const_iterator cend() const noexcept;
iterator before_begin(); iterator before_begin() noexcept;
const_iterator before_begin() const; const_iterator before_begin() const noexcept;
const_iterator cbefore_begin() const; const_iterator cbefore_begin() const noexcept;
bool empty() const; bool empty() const noexcept;
size_type max_size() const; size_type max_size() const noexcept;
reference front(); reference front();
const_reference front() const; const_reference front() const;
@@ -100,11 +105,13 @@ public:
iterator erase_after(const_iterator p); iterator erase_after(const_iterator p);
iterator erase_after(const_iterator first, const_iterator last); iterator erase_after(const_iterator first, const_iterator last);
void swap(forward_list& x); void swap(forward_list& x)
noexcept(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
void resize(size_type n); void resize(size_type n);
void resize(size_type n, const value_type& v); void resize(size_type n, const value_type& v);
void clear(); void clear() noexcept;
void splice_after(const_iterator p, forward_list& x); void splice_after(const_iterator p, forward_list& x);
void splice_after(const_iterator p, forward_list&& x); void splice_after(const_iterator p, forward_list&& x);
@@ -124,7 +131,7 @@ public:
template <class Compare> void merge(forward_list&& x, Compare comp); template <class Compare> void merge(forward_list&& x, Compare comp);
void sort(); void sort();
template <class Compare> void sort(Compare comp); template <class Compare> void sort(Compare comp);
void reverse(); void reverse() noexcept;
}; };
template <class T, class Allocator> template <class T, class Allocator>
@@ -152,7 +159,8 @@ template <class T, class Allocator>
const forward_list<T, Allocator>& y); const forward_list<T, Allocator>& y);
template <class T, class Allocator> template <class T, class Allocator>
void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y); void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y)
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -166,11 +174,15 @@ template <class T, class Allocator>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class, class> struct __forward_list_node; template <class _Tp, class _VoidPtr> struct __forward_list_node;
template <class _NodePtr> template <class _NodePtr>
struct __forward_begin_node struct __forward_begin_node
@@ -200,8 +212,8 @@ struct __forward_list_node
value_type __value_; value_type __value_;
}; };
template<class, class> class forward_list; template<class _Tp, class _Alloc> class _LIBCPP_VISIBLE forward_list;
template<class> class __forward_list_const_iterator; template<class _NodeConstPtr> class _LIBCPP_VISIBLE __forward_list_const_iterator;
template <class _NodePtr> template <class _NodePtr>
class _LIBCPP_VISIBLE __forward_list_iterator class _LIBCPP_VISIBLE __forward_list_iterator
@@ -211,10 +223,10 @@ class _LIBCPP_VISIBLE __forward_list_iterator
__node_pointer __ptr_; __node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {} explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template<class, class> friend class forward_list; template<class, class> friend class _LIBCPP_VISIBLE forward_list;
template<class> friend class __forward_list_const_iterator; template<class> friend class _LIBCPP_VISIBLE __forward_list_const_iterator;
public: public:
typedef forward_iterator_tag iterator_category; typedef forward_iterator_tag iterator_category;
@@ -232,7 +244,7 @@ public:
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() : __ptr_(nullptr) {} __forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;} reference operator*() const {return __ptr_->__value_;}
@@ -271,7 +283,7 @@ class _LIBCPP_VISIBLE __forward_list_const_iterator
__node_const_pointer __ptr_; __node_const_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __forward_list_const_iterator(__node_const_pointer __p) explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT
: __ptr_(__p) {} : __ptr_(__p) {}
typedef typename remove_const typedef typename remove_const
@@ -303,9 +315,9 @@ public:
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() : __ptr_(nullptr) {} __forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT
: __ptr_(__p.__ptr_) {} : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -361,41 +373,47 @@ protected:
__compressed_pair<__begin_node, __node_allocator> __before_begin_; __compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin() __node_pointer __before_begin() _NOEXCEPT
{return pointer_traits<__node_pointer>::pointer_to( {return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));} static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const __node_const_pointer __before_begin() const _NOEXCEPT
{return pointer_traits<__node_const_pointer>::pointer_to( {return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));} static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() {return __before_begin_.second();} __node_allocator& __alloc() _NOEXCEPT
{return __before_begin_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_allocator& __alloc() const {return __before_begin_.second();} const __node_allocator& __alloc() const _NOEXCEPT
{return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator; typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator; typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_base() __forward_list_base()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
: __before_begin_(__begin_node()) {} : __before_begin_(__begin_node()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_base(const allocator_type& __a) __forward_list_base(const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a)) {} : __before_begin_(__begin_node(), __node_allocator(__a)) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__forward_list_base(__forward_list_base&& __x); public:
__forward_list_base(__forward_list_base&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a); __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: private:
__forward_list_base(const __forward_list_base&); __forward_list_base(const __forward_list_base&);
__forward_list_base& operator=(const __forward_list_base&); __forward_list_base& operator=(const __forward_list_base&);
protected:
public:
~__forward_list_base(); ~__forward_list_base();
protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x) void __copy_assign_alloc(const __forward_list_base& __x)
{__copy_assign_alloc(__x, integral_constant<bool, {__copy_assign_alloc(__x, integral_constant<bool,
@@ -403,11 +421,17 @@ protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x) void __move_assign_alloc(__forward_list_base& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<__node_allocator>::value)
{__move_assign_alloc(__x, integral_constant<bool, {__move_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());} __node_traits::propagate_on_container_move_assignment::value>());}
void swap(__forward_list_base& __x); public:
void clear(); void swap(__forward_list_base& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value);
protected:
void clear() _NOEXCEPT;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -421,24 +445,30 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, false_type) {} void __move_assign_alloc(__forward_list_base& __x, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, true_type) void __move_assign_alloc(__forward_list_base& __x, true_type)
{__alloc() = _STD::move(__x.__alloc());} _NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
{__alloc() = _VSTD::move(__x.__alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());} __node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
false_type) false_type)
_NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
true_type) true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(__x, __y); swap(__x, __y);
} }
}; };
@@ -448,7 +478,8 @@ private:
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
: __before_begin_(_STD::move(__x.__before_begin_)) _NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
: __before_begin_(_VSTD::move(__x.__before_begin_))
{ {
__x.__before_begin()->__next_ = nullptr; __x.__before_begin()->__next_ = nullptr;
} }
@@ -478,21 +509,23 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{ {
__swap_alloc(__alloc(), __x.__alloc()); __swap_alloc(__alloc(), __x.__alloc());
using _STD::swap; using _VSTD::swap;
swap(__before_begin()->__next_, __x.__before_begin()->__next_); swap(__before_begin()->__next_, __x.__before_begin()->__next_);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
__forward_list_base<_Tp, _Alloc>::clear() __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
{ {
__node_allocator& __a = __alloc(); __node_allocator& __a = __alloc();
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{ {
__node_pointer __next = __p->__next_; __node_pointer __next = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1); __node_traits::deallocate(__a, __p, 1);
__p = __next; __p = __next;
} }
@@ -504,6 +537,11 @@ class _LIBCPP_VISIBLE forward_list
: private __forward_list_base<_Tp, _Alloc> : private __forward_list_base<_Tp, _Alloc>
{ {
typedef __forward_list_base<_Tp, _Alloc> base; typedef __forward_list_base<_Tp, _Alloc> base;
typedef typename base::__node_allocator __node_allocator;
typedef typename base::__node __node;
typedef typename base::__node_traits __node_traits;
typedef typename base::__node_pointer __node_pointer;
public: public:
typedef _Tp value_type; typedef _Tp value_type;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -518,7 +556,10 @@ public:
typedef typename base::iterator iterator; typedef typename base::iterator iterator;
typedef typename base::const_iterator const_iterator; typedef typename base::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY forward_list() {} // = default; _LIBCPP_INLINE_VISIBILITY
forward_list()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
{} // = default;
explicit forward_list(const allocator_type& __a); explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n); explicit forward_list(size_type __n);
forward_list(size_type __n, const value_type& __v); forward_list(size_type __n, const value_type& __v);
@@ -538,19 +579,28 @@ public:
forward_list(const forward_list& __x, const allocator_type& __a); forward_list(const forward_list& __x, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
forward_list(forward_list&& __x) : base(_STD::move(__x)) {} forward_list(forward_list&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a); forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list(initializer_list<value_type> __il); forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a); forward_list(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~forward_list() = default; // ~forward_list() = default;
forward_list& operator=(const forward_list& __x); forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list& operator=(forward_list&& __x); forward_list& operator=(forward_list&& __x)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list& operator=(initializer_list<value_type> __il); forward_list& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator> template <class _InputIterator>
typename enable_if typename enable_if
@@ -560,36 +610,50 @@ public:
>::type >::type
assign(_InputIterator __f, _InputIterator __l); assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v); void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void assign(initializer_list<value_type> __il); void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return allocator_type(base::__alloc());} allocator_type get_allocator() const _NOEXCEPT
{return allocator_type(base::__alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(base::__before_begin()->__next_);} iterator begin() _NOEXCEPT
{return iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);} const_iterator begin() const _NOEXCEPT
{return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(nullptr);} iterator end() _NOEXCEPT
{return iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(nullptr);} const_iterator end() const _NOEXCEPT
{return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);} const_iterator cbegin() const _NOEXCEPT
{return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return const_iterator(nullptr);} const_iterator cend() const _NOEXCEPT
{return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator before_begin() {return iterator(base::__before_begin());} iterator before_begin() _NOEXCEPT
{return iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator before_begin() const {return const_iterator(base::__before_begin());} const_iterator before_begin() const _NOEXCEPT
{return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());} const_iterator cbefore_begin() const _NOEXCEPT
{return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::__before_begin()->__next_ == nullptr;} bool empty() const _NOEXCEPT
{return base::__before_begin()->__next_ == nullptr;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<size_type>::max();} size_type max_size() const _NOEXCEPT
{return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reference front() {return base::__before_begin()->__next_->__value_;} reference front() {return base::__before_begin()->__next_->__value_;}
@@ -623,19 +687,24 @@ public:
iterator iterator
>::type >::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator insert_after(const_iterator __p, initializer_list<value_type> __il) iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());} {return insert_after(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l); iterator erase_after(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(forward_list& __x) {base::swap(__x);} void swap(forward_list& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{base::swap(__x);}
void resize(size_type __n); void resize(size_type __n);
void resize(size_type __n, const value_type& __v); void resize(size_type __n, const value_type& __v);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();} void clear() _NOEXCEPT {base::clear();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -661,7 +730,7 @@ public:
template <class _Compare> template <class _Compare>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp) void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _STD::move(__comp));} {merge(__x, _VSTD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());} void merge(forward_list& __x) {merge(__x, __less<value_type>());}
@@ -669,16 +738,13 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void sort() {sort(__less<value_type>());} void sort() {sort(__less<value_type>());}
template <class _Compare> void sort(_Compare __comp); template <class _Compare> void sort(_Compare __comp);
void reverse(); void reverse() _NOEXCEPT;
private: private:
typedef typename base::__node_allocator __node_allocator;
typedef typename base::__node __node;
typedef typename base::__node_traits __node_traits;
typedef typename base::__node_pointer __node_pointer;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void __move_assign(forward_list& __x, true_type); void __move_assign(forward_list& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(forward_list& __x, false_type); void __move_assign(forward_list& __x, false_type);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -706,13 +772,13 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n, for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_) __p = __p->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr; __h->__next_ = nullptr;
__p->__next_ = __h.release(); __p->__next_ = __h.release();
} }
@@ -778,17 +844,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
const allocator_type& __a) const allocator_type& __a)
: base(_STD::move(__x), __a) : base(_VSTD::move(__x), __a)
{ {
if (base::__alloc() != __x.__alloc()) if (base::__alloc() != __x.__alloc())
{ {
typedef move_iterator<iterator> _I; typedef move_iterator<iterator> _Ip;
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end())); insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
} }
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{ {
@@ -803,6 +871,8 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end()); insert_after(cbefore_begin(), __il.begin(), __il.end());
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
@@ -820,6 +890,7 @@ forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{ {
clear(); clear();
base::__move_assign_alloc(__x); base::__move_assign_alloc(__x);
@@ -835,8 +906,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type()); __move_assign(__x, true_type());
else else
{ {
typedef move_iterator<iterator> _I; typedef move_iterator<iterator> _Ip;
assign(_I(__x.begin()), _I(__x.end())); assign(_Ip(__x.begin()), _Ip(__x.end()));
} }
} }
@@ -844,6 +915,9 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
{ {
__move_assign(__x, integral_constant<bool, __move_assign(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>()); __node_traits::propagate_on_container_move_assignment::value>());
@@ -852,6 +926,8 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
@@ -861,6 +937,8 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
template <class _InputIterator> template <class _InputIterator>
typename enable_if typename enable_if
@@ -871,7 +949,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{ {
iterator __i = before_begin(); iterator __i = before_begin();
iterator __j = _STD::next(__i); iterator __j = _VSTD::next(__i);
iterator __e = end(); iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f) for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f; *__j = *__f;
@@ -886,7 +964,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{ {
iterator __i = before_begin(); iterator __i = before_begin();
iterator __j = _STD::next(__i); iterator __j = _VSTD::next(__i);
iterator __e = end(); iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j) for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v; *__j = __v;
@@ -896,6 +974,8 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e); erase_after(__i, __e);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
@@ -904,6 +984,8 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end()); assign(__il.begin(), __il.end());
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -913,10 +995,10 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...); _VSTD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -928,9 +1010,9 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v) forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -942,9 +1024,9 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v) forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -956,7 +1038,7 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
__node_pointer __p = base::__before_begin()->__next_; __node_pointer __p = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __p->__next_; base::__before_begin()->__next_ = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1); __node_traits::deallocate(__a, __p, 1);
} }
@@ -970,10 +1052,10 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...); _VSTD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -987,9 +1069,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -1003,9 +1085,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -1020,9 +1102,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1032,7 +1114,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
for (--__n; __n != 0; --__n, __last = __last->__next_) for (--__n; __n != 0; --__n, __last = __last->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__last->__next_ = __h.release(); __last->__next_ = __h.release();
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1042,7 +1124,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
while (__first != nullptr) while (__first != nullptr)
{ {
__node_pointer __next = __first->__next_; __node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1); __node_traits::deallocate(__a, __first, 1);
__first = __next; __first = __next;
} }
@@ -1070,9 +1152,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
if (__f != __l) if (__f != __l)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1)); unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1082,7 +1164,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
for (++__f; __f != __l; ++__f, __last = __last->__next_) for (++__f; __f != __l; ++__f, __last = __last->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__last->__next_ = __h.release(); __last->__next_ = __h.release();
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1092,7 +1174,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr) while (__first != nullptr)
{ {
__node_pointer __next = __first->__next_; __node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1); __node_traits::deallocate(__a, __first, 1);
__first = __next; __first = __next;
} }
@@ -1114,7 +1196,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
__node_pointer __n = __p->__next_; __node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_; __p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
__node_traits::destroy(__a, _STD::addressof(__n->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1); __node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_); return iterator(__p->__next_);
} }
@@ -1135,7 +1217,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do do
{ {
__p = __n->__next_; __p = __n->__next_;
__node_traits::destroy(__a, _STD::addressof(__n->__value_)); __node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1); __node_traits::deallocate(__a, __n, 1);
__n = __p; __n = __p;
} while (__n != __e); } while (__n != __e);
@@ -1162,13 +1244,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr; __h->__next_ = nullptr;
__ptr->__next_ = __h.release(); __ptr->__next_ = __h.release();
} }
@@ -1194,13 +1276,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D; typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1)); unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = nullptr; __h->__next_ = nullptr;
__ptr->__next_ = __h.release(); __ptr->__next_ = __h.release();
} }
@@ -1235,7 +1317,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list& __x, forward_list& __x,
const_iterator __i) const_iterator __i)
{ {
const_iterator __lm1 = _STD::next(__i); const_iterator __lm1 = _VSTD::next(__i);
if (__p != __i && __p != __lm1) if (__p != __i && __p != __lm1)
{ {
const_cast<__node_pointer>(__i.__ptr_)->__next_ = const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1312,7 +1394,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{ {
if (__i.__ptr_->__next_->__value_ == __v) if (__i.__ptr_->__next_->__value_ == __v)
{ {
iterator __j = _STD::next(__i, 2); iterator __j = _VSTD::next(__i, 2);
for (; __j != __e && *__j == __v; ++__j) for (; __j != __e && *__j == __v; ++__j)
; ;
erase_after(__i, __j); erase_after(__i, __j);
@@ -1335,7 +1417,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{ {
if (__pred(__i.__ptr_->__next_->__value_)) if (__pred(__i.__ptr_->__next_->__value_))
{ {
iterator __j = _STD::next(__i, 2); iterator __j = _VSTD::next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j) for (; __j != __e && __pred(*__j); ++__j)
; ;
erase_after(__i, __j); erase_after(__i, __j);
@@ -1355,7 +1437,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{ {
for (iterator __i = begin(), __e = end(); __i != __e;) for (iterator __i = begin(), __e = end(); __i != __e;)
{ {
iterator __j = _STD::next(__i); iterator __j = _VSTD::next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j) for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
; ;
if (__i.__ptr_->__next_ != __j.__ptr_) if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1430,7 +1512,7 @@ void
forward_list<_Tp, _Alloc>::sort(_Compare __comp) forward_list<_Tp, _Alloc>::sort(_Compare __comp)
{ {
base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
_STD::distance(begin(), end()), __comp); _VSTD::distance(begin(), end()), __comp);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
@@ -1456,7 +1538,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
} }
difference_type __sz1 = __sz / 2; difference_type __sz1 = __sz / 2;
difference_type __sz2 = __sz - __sz1; difference_type __sz2 = __sz - __sz1;
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_; __node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_; __node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr; __t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp), return __merge(__sort(__f1, __sz1, __comp),
@@ -1465,7 +1547,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
forward_list<_Tp, _Alloc>::reverse() forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT
{ {
__node_pointer __p = base::__before_begin()->__next_; __node_pointer __p = base::__before_begin()->__next_;
if (__p != nullptr) if (__p != nullptr)
@@ -1487,12 +1569,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x, bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y) const forward_list<_Tp, _Alloc>& __y)
{ {
typedef forward_list<_Tp, _Alloc> _C; typedef forward_list<_Tp, _Alloc> _Cp;
typedef typename _C::const_iterator _I; typedef typename _Cp::const_iterator _Ip;
_I __ix = __x.begin(); _Ip __ix = __x.begin();
_I __ex = __x.end(); _Ip __ex = __x.end();
_I __iy = __y.begin(); _Ip __iy = __y.begin();
_I __ey = __y.end(); _Ip __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy)) if (!(*__ix == *__iy))
return false; return false;
@@ -1512,7 +1594,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator< (const forward_list<_Tp, _Alloc>& __x, bool operator< (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y) const forward_list<_Tp, _Alloc>& __y)
{ {
return _STD::lexicographical_compare(__x.begin(), __x.end(), return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end()); __y.begin(), __y.end());
} }
@@ -1544,6 +1626,7 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -171,7 +171,11 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -230,6 +234,7 @@ private:
FILE* __file_; FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_; const codecvt<char_type, char, state_type>* __cv_;
state_type __st_; state_type __st_;
state_type __st_last_;
ios_base::openmode __om_; ios_base::openmode __om_;
ios_base::openmode __cm_; ios_base::openmode __cm_;
bool __owns_eb_; bool __owns_eb_;
@@ -249,14 +254,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__intbuf_(0), __intbuf_(0),
__ibs_(0), __ibs_(0),
__file_(0), __file_(0),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())), __cv_(nullptr),
__st_(), __st_(),
__st_last_(),
__om_(0), __om_(0),
__cm_(0), __cm_(0),
__owns_eb_(false), __owns_eb_(false),
__owns_ib_(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); setbuf(0, 4096);
} }
@@ -284,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__file_ = __rhs.__file_; __file_ = __rhs.__file_;
__cv_ = __rhs.__cv_; __cv_ = __rhs.__cv_;
__st_ = __rhs.__st_; __st_ = __rhs.__st_;
__st_last_ = __rhs.__st_last_;
__om_ = __rhs.__om_; __om_ = __rhs.__om_;
__cm_ = __rhs.__cm_; __cm_ = __rhs.__cm_;
__owns_eb_ = __rhs.__owns_eb_; __owns_eb_ = __rhs.__owns_eb_;
@@ -316,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__rhs.__ibs_ = 0; __rhs.__ibs_ = 0;
__rhs.__file_ = 0; __rhs.__file_ = 0;
__rhs.__st_ = state_type(); __rhs.__st_ = state_type();
__rhs.__st_last_ = state_type();
__rhs.__om_ = 0; __rhs.__om_ = 0;
__rhs.__cm_ = 0; __rhs.__cm_ = 0;
__rhs.__owns_eb_ = false; __rhs.__owns_eb_ = false;
@@ -331,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
{ {
close(); close();
swap(__rhs); swap(__rhs);
return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -362,9 +376,9 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
basic_streambuf<char_type, traits_type>::swap(__rhs); basic_streambuf<char_type, traits_type>::swap(__rhs);
if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
{ {
_STD::swap(__extbuf_, __rhs.__extbuf_); _VSTD::swap(__extbuf_, __rhs.__extbuf_);
_STD::swap(__extbufnext_, __rhs.__extbufnext_); _VSTD::swap(__extbufnext_, __rhs.__extbufnext_);
_STD::swap(__extbufend_, __rhs.__extbufend_); _VSTD::swap(__extbufend_, __rhs.__extbufend_);
} }
else else
{ {
@@ -387,17 +401,18 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
__rhs.__extbufnext_ = __rhs.__extbuf_ + __ln; __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
__rhs.__extbufend_ = __rhs.__extbuf_ + __le; __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
} }
_STD::swap(__ebs_, __rhs.__ebs_); _VSTD::swap(__ebs_, __rhs.__ebs_);
_STD::swap(__intbuf_, __rhs.__intbuf_); _VSTD::swap(__intbuf_, __rhs.__intbuf_);
_STD::swap(__ibs_, __rhs.__ibs_); _VSTD::swap(__ibs_, __rhs.__ibs_);
_STD::swap(__file_, __rhs.__file_); _VSTD::swap(__file_, __rhs.__file_);
_STD::swap(__cv_, __rhs.__cv_); _VSTD::swap(__cv_, __rhs.__cv_);
_STD::swap(__st_, __rhs.__st_); _VSTD::swap(__st_, __rhs.__st_);
_STD::swap(__om_, __rhs.__om_); _VSTD::swap(__st_last_, __rhs.__st_last_);
_STD::swap(__cm_, __rhs.__cm_); _VSTD::swap(__om_, __rhs.__om_);
_STD::swap(__owns_eb_, __rhs.__owns_eb_); _VSTD::swap(__cm_, __rhs.__cm_);
_STD::swap(__owns_ib_, __rhs.__owns_ib_); _VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
_STD::swap(__always_noconv_, __rhs.__always_noconv_); _VSTD::swap(__owns_ib_, __rhs.__owns_ib_);
_VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
if (this->eback() == (char_type*)__rhs.__extbuf_min_) if (this->eback() == (char_type*)__rhs.__extbuf_min_)
{ {
ptrdiff_t __n = this->gptr() - this->eback(); ptrdiff_t __n = this->gptr() - this->eback();
@@ -545,7 +560,7 @@ basic_filebuf<_CharT, _Traits>::close()
{ {
__rt = this; __rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
if ((__cm_ & ios_base::out) && sync()) if (sync())
__rt = 0; __rt = 0;
if (fclose(__h.release()) == 0) if (fclose(__h.release()) == 0)
__file_ = 0; __file_ = 0;
@@ -587,18 +602,22 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _STD::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_)); static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r; codecvt_base::result __r;
state_type __svs = __st_; __st_last_ = __st_;
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
if (__nr != 0) if (__nr != 0)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
__extbufend_ = __extbufnext_ + __nr; __extbufend_ = __extbufnext_ + __nr;
char_type* __inext; char_type* __inext;
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
this->eback() + __unget_sz, this->eback() + __unget_sz,
this->egptr(), __inext); this->eback() + __ibs_, __inext);
if (__r == codecvt_base::noconv) if (__r == codecvt_base::noconv)
{ {
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); 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; codecvt_base::result __r;
do do
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
const char_type* __e; const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe); __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, basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode) ios_base::openmode)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
int __width = __cv_->encoding(); int __width = __cv_->encoding();
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1)); 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)); return pos_type(off_type(-1));
if (fseeko(__file_, __sp, SEEK_SET)) if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1)); return pos_type(off_type(-1));
__st_ = __sp.state();
return __sp; return __sp;
} }
@@ -804,6 +832,10 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (__file_ == 0) if (__file_ == 0)
return 0; return 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
if (__cm_ & ios_base::out) if (__cm_ & ios_base::out)
{ {
if (this->pptr() != this->pbase()) if (this->pptr() != this->pbase())
@@ -826,6 +858,8 @@ basic_filebuf<_CharT, _Traits>::sync()
else if (__cm_ & ios_base::in) else if (__cm_ & ios_base::in)
{ {
off_type __c; off_type __c;
state_type __state = __st_last_;
bool __update_st = false;
if (__always_noconv_) if (__always_noconv_)
__c = this->egptr() - this->gptr(); __c = this->egptr() - this->gptr();
else else
@@ -838,32 +872,19 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (this->gptr() != this->egptr()) if (this->gptr() != this->egptr())
{ {
reverse(this->gptr(), this->egptr()); const int __off = __cv_->length(__state, __extbuf_,
codecvt_base::result __r; __extbufnext_,
const char_type* __e = this->gptr(); this->gptr() - this->eback());
char* __extbe; __c += __extbufnext_ - __extbuf_ - __off;
do __update_st = true;
{
__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);
} }
} }
} }
if (fseeko(__file_, -__c, SEEK_CUR)) if (fseeko(__file_, -__c, SEEK_CUR))
return -1; return -1;
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;
this->setg(0, 0, 0); this->setg(0, 0, 0);
__cm_ = 0; __cm_ = 0;
} }
@@ -1019,8 +1040,8 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
: basic_istream<char_type, traits_type>(_STD::move(__rhs)), : basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1030,8 +1051,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>&
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
{ {
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -1164,8 +1185,8 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
: basic_ostream<char_type, traits_type>(_STD::move(__rhs)), : basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1175,8 +1196,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>&
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
{ {
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -1309,8 +1330,8 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
: basic_iostream<char_type, traits_type>(_STD::move(__rhs)), : basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1320,8 +1341,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>&
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
{ {
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -29,15 +29,15 @@ public:
typedef const E* iterator; typedef const E* iterator;
typedef const E* const_iterator; typedef const E* const_iterator;
initializer_list(); initializer_list() noexcept;
size_t size() const; size_t size() const noexcept;
const E* begin() const; const E* begin() const noexcept;
const E* end() const; const E* end() const noexcept;
}; };
template<class E> const E* begin(initializer_list<E> il); template<class E> const E* begin(initializer_list<E> il) noexcept;
template<class E> const E* end(initializer_list<E> il); template<class E> const E* end(initializer_list<E> il) noexcept;
} // std } // std
@@ -46,54 +46,60 @@ template<class E> const E* end(initializer_list<E> il);
#include <__config> #include <__config>
#include <cstddef> #include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not versioned namespace std // purposefully not versioned
{ {
template<class _E> #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Ep>
class _LIBCPP_VISIBLE initializer_list class _LIBCPP_VISIBLE initializer_list
{ {
const _E* __begin_; const _Ep* __begin_;
size_t __size_; size_t __size_;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
initializer_list(const _E* __b, size_t __s) initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
: __begin_(__b), : __begin_(__b),
__size_(__s) __size_(__s)
{} {}
public: public:
typedef _E value_type; typedef _Ep value_type;
typedef const _E& reference; typedef const _Ep& reference;
typedef const _E& const_reference; typedef const _Ep& const_reference;
typedef size_t size_type; typedef size_t size_type;
typedef const _E* iterator; typedef const _Ep* iterator;
typedef const _E* const_iterator; typedef const _Ep* const_iterator;
_LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {} _LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;} _LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
_LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;} _LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;} _LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
}; };
template<class _E> template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
const _E* const _Ep*
begin(initializer_list<_E> __il) begin(initializer_list<_Ep> __il) _NOEXCEPT
{ {
return __il.begin(); return __il.begin();
} }
template<class _E> template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
const _E* const _Ep*
end(initializer_list<_E> __il) end(initializer_list<_Ep> __il) _NOEXCEPT
{ {
return __il.end(); return __il.end();
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
} // std } // std
#endif // _LIBCPP_INITIALIZER_LIST #endif // _LIBCPP_INITIALIZER_LIST

View File

@@ -33,7 +33,9 @@ template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
#include <__config> #include <__config>
#include <istream> #include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -275,10 +277,10 @@ public:
__iom_t7(_MoneyT& __mon, bool __intl) __iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {} : __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _M> template <class _CharT, class _Traits, class _Mp>
friend friend
basic_istream<_CharT, _Traits>& 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> 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); typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I; typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef money_get<_CharT, _I> _F; typedef money_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
const _F& __mf = use_facet<_F>(__is.getloc()); const _Fp& __mf = use_facet<_Fp>(__is.getloc());
__mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_); __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err); __is.setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -335,10 +337,10 @@ public:
__iom_t8(const _MoneyT& __mon, bool __intl) __iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {} : __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _M> template <class _CharT, class _Traits, class _Mp>
friend friend
basic_ostream<_CharT, _Traits>& 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> 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); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _O; typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef money_put<_CharT, _O> _F; typedef money_put<_CharT, _Op> _Fp;
const _F& __mf = use_facet<_F>(__os.getloc()); const _Fp& __mf = use_facet<_Fp>(__os.getloc());
if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit); __os.setstate(ios_base::badbit);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -394,10 +396,10 @@ public:
__iom_t9(tm* __tm, const _CharT* __fmt) __iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {} : __tm_(__tm), __fmt_(__fmt) {}
template <class _C, class _Traits> template <class _Cp, class _Traits>
friend friend
basic_istream<_C, _Traits>& basic_istream<_Cp, _Traits>&
operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x); operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
}; };
template <class _CharT, class _Traits> 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); typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I; typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef time_get<_CharT, _I> _F; typedef time_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
const _F& __tf = use_facet<_F>(__is.getloc()); const _Fp& __tf = use_facet<_Fp>(__is.getloc());
__tf.get(_I(__is), _I(), __is, __err, __x.__tm_, __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err); __is.setstate(__err);
} }
@@ -455,10 +457,10 @@ public:
__iom_t10(const tm* __tm, const _CharT* __fmt) __iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {} : __tm_(__tm), __fmt_(__fmt) {}
template <class _C, class _Traits> template <class _Cp, class _Traits>
friend friend
basic_ostream<_C, _Traits>& basic_ostream<_Cp, _Traits>&
operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x); operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
}; };
template <class _CharT, class _Traits> 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); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _O; typedef ostreambuf_iterator<_CharT, _Traits> _Op;
typedef time_put<_CharT, _O> _F; typedef time_put<_CharT, _Op> _Fp;
const _F& __tf = use_facet<_F>(__os.getloc()); const _Fp& __tf = use_facet<_Fp>(__os.getloc());
if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_, if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
__os.setstate(ios_base::badbit); __os.setstate(ios_base::badbit);
} }

View File

@@ -29,43 +29,43 @@ public:
class failure; class failure;
typedef T1 fmtflags; typedef T1 fmtflags;
static const fmtflags boolalpha; static constexpr fmtflags boolalpha;
static const fmtflags dec; static constexpr fmtflags dec;
static const fmtflags fixed; static constexpr fmtflags fixed;
static const fmtflags hex; static constexpr fmtflags hex;
static const fmtflags internal; static constexpr fmtflags internal;
static const fmtflags left; static constexpr fmtflags left;
static const fmtflags oct; static constexpr fmtflags oct;
static const fmtflags right; static constexpr fmtflags right;
static const fmtflags scientific; static constexpr fmtflags scientific;
static const fmtflags showbase; static constexpr fmtflags showbase;
static const fmtflags showpoint; static constexpr fmtflags showpoint;
static const fmtflags showpos; static constexpr fmtflags showpos;
static const fmtflags skipws; static constexpr fmtflags skipws;
static const fmtflags unitbuf; static constexpr fmtflags unitbuf;
static const fmtflags uppercase; static constexpr fmtflags uppercase;
static const fmtflags adjustfield; static constexpr fmtflags adjustfield;
static const fmtflags basefield; static constexpr fmtflags basefield;
static const fmtflags floatfield; static constexpr fmtflags floatfield;
typedef T2 iostate; typedef T2 iostate;
static const iostate badbit; static constexpr iostate badbit;
static const iostate eofbit; static constexpr iostate eofbit;
static const iostate failbit; static constexpr iostate failbit;
static const iostate goodbit; static constexpr iostate goodbit;
typedef T3 openmode; typedef T3 openmode;
static const openmode app; static constexpr openmode app;
static const openmode ate; static constexpr openmode ate;
static const openmode binary; static constexpr openmode binary;
static const openmode in; static constexpr openmode in;
static const openmode out; static constexpr openmode out;
static const openmode trunc; static constexpr openmode trunc;
typedef T4 seekdir; typedef T4 seekdir;
static const seekdir beg; static constexpr seekdir beg;
static const seekdir cur; static constexpr seekdir cur;
static const seekdir end; static constexpr seekdir end;
class Init; class Init;
@@ -160,7 +160,7 @@ protected:
basic_ios(); basic_ios();
void init(basic_streambuf<charT,traits>* sb); void init(basic_streambuf<charT,traits>* sb);
void move(basic_ios& rhs); void move(basic_ios& rhs);
void swap(basic_ios& rhs); void swap(basic_ios& rhs) noexcept;
void set_rdbuf(basic_streambuf<charT, traits>* sb); void set_rdbuf(basic_streambuf<charT, traits>* sb);
}; };
@@ -216,7 +216,9 @@ storage-class-specifier const error_category& iostream_category;
#include <__locale> #include <__locale>
#include <system_error> #include <system_error>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -225,7 +227,7 @@ typedef ptrdiff_t streamsize;
class _LIBCPP_VISIBLE ios_base class _LIBCPP_VISIBLE ios_base
{ {
public: public:
class failure; class _LIBCPP_VISIBLE failure;
typedef unsigned int fmtflags; typedef unsigned int fmtflags;
static const fmtflags boolalpha = 0x0001; static const fmtflags boolalpha = 0x0001;
@@ -266,10 +268,10 @@ public:
enum seekdir {beg, cur, end}; enum seekdir {beg, cur, end};
typedef seekdir seek_dir; typedef seekdir seek_dir;
typedef _STD::streamoff streamoff; typedef _VSTD::streamoff streamoff;
typedef _STD::streampos streampos; typedef _VSTD::streampos streampos;
class Init; class _LIBCPP_VISIBLE Init;
// 27.5.2.2 fmtflags state: // 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const; _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
@@ -340,7 +342,7 @@ protected:
void __call_callbacks(event); void __call_callbacks(event);
void copyfmt(const ios_base&); void copyfmt(const ios_base&);
void move(ios_base&); void move(ios_base&);
void swap(ios_base&); void swap(ios_base&) _NOEXCEPT;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void set_rdbuf(void* __sb) void set_rdbuf(void* __sb)
@@ -371,21 +373,19 @@ private:
}; };
//enum class io_errc //enum class io_errc
struct _LIBCPP_VISIBLE io_errc _LIBCPP_DECLARE_STRONG_ENUM(io_errc)
{ {
enum _ {
stream = 1 stream = 1
}; };
_ __v_; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
};
template <> template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { }; struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <> 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 _LIBCPP_VISIBLE
const error_category& iostream_category(); const error_category& iostream_category();
@@ -572,7 +572,8 @@ public:
typedef typename traits_type::pos_type pos_type; typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
_LIBCPP_ALWAYS_INLINE // explicit _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT
operator bool() const {return !fail();} operator bool() const {return !fail();}
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
@@ -631,12 +632,12 @@ protected:
void move(basic_ios&& __rhs) {move(__rhs);} void move(basic_ios&& __rhs) {move(__rhs);}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs); void swap(basic_ios& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb); void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private: private:
basic_ostream<char_type, traits_type>* __tie_; basic_ostream<char_type, traits_type>* __tie_;
char_type __fill_; mutable int_type __fill_;
}; };
template <class _CharT, class _Traits> 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); ios_base::init(__sb);
__tie_ = 0; __tie_ = 0;
__fill_ = widen(' '); __fill_ = traits_type::eof();
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -730,6 +731,8 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT _CharT
basic_ios<_CharT, _Traits>::fill() const basic_ios<_CharT, _Traits>::fill() const
{ {
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
__fill_ = widen(' ');
return __fill_; return __fill_;
} }
@@ -773,11 +776,11 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
{ {
ios_base::swap(__rhs); ios_base::swap(__rhs);
_STD::swap(__tie_, __rhs.__tie_); _VSTD::swap(__tie_, __rhs.__tie_);
_STD::swap(__fill_, __rhs.__fill_); _VSTD::swap(__fill_, __rhs.__fill_);
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>

View File

@@ -20,6 +20,7 @@ namespace std
template<class charT> struct char_traits; template<class charT> struct char_traits;
template<class T> class allocator; template<class T> class allocator;
class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios; template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf; template <class charT, class traits = char_traits<charT> > class basic_streambuf;
@@ -88,11 +89,13 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
#include <__config> #include <__config>
#include <wchar.h> // for mbstate_t #include <wchar.h> // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class ios_base; class _LIBCPP_VISIBLE ios_base;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits; template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator; template<class _Tp> class _LIBCPP_VISIBLE allocator;

View File

@@ -40,7 +40,9 @@ extern wostream wclog;
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -155,7 +155,11 @@ template <class charT, class traits, class T>
#include <__config> #include <__config>
#include <ostream> #include <ostream>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -177,18 +181,20 @@ public:
virtual ~basic_istream(); virtual ~basic_istream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_istream(basic_istream&& __rhs); basic_istream(basic_istream&& __rhs);
#endif #endif
// 27.7.1.1.2 Assign/swap: // 27.7.1.1.2 Assign/swap:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_istream& operator=(basic_istream&& __rhs); basic_istream& operator=(basic_istream&& __rhs);
#endif #endif
void swap(basic_istream& __rhs); void swap(basic_istream& __rhs);
public: public:
// 27.7.1.1.3 Prefix/suffix: // 27.7.1.1.3 Prefix/suffix:
class sentry; class _LIBCPP_VISIBLE sentry;
// 27.7.1.2 Formatted input: // 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)); basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -250,7 +256,7 @@ public:
// ~sentry() = default; // ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
// explicit _LIBCPP_EXPLICIT
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -265,10 +271,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.tie()->flush(); __is.tie()->flush();
if (!__noskipws && (__is.flags() & ios_base::skipws)) 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()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_I __i(__is); _Ip __i(__is);
_I __eof; _Ip __eof;
for (; __i != __eof; ++__i) for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i)) if (!__ct.is(__ct.space, *__i))
break; break;
@@ -321,7 +327,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs) basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
{ {
_STD::swap(__gc_, __rhs.__gc_); _VSTD::swap(__gc_, __rhs.__gc_);
basic_ios<char_type, traits_type>::swap(__rhs); basic_ios<char_type, traits_type>::swap(__rhs);
} }
@@ -336,10 +342,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -363,10 +369,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -390,10 +396,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -417,10 +423,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -444,10 +450,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -471,10 +477,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -498,10 +504,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -525,10 +531,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -552,10 +558,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -579,10 +585,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -606,10 +612,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; 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); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -633,11 +639,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; 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()) if (__temp < numeric_limits<short>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -673,11 +679,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; typedef istreambuf_iterator<char_type, traits_type> _Ip;
typedef num_get<char_type, _I> _F; typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; 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()) if (__temp < numeric_limits<int>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -740,26 +746,29 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is); typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) if (__sen)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width(); streamsize __n = __is.width();
if (__n == 0) if (__n <= 0)
__n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1; __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
streamsize __c = 0; streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_I __i(__is); ios_base::iostate __err = ios_base::goodbit;
_I __eof; while (__c < __n-1)
for (; __i != __eof && __c < __n-1; ++__i, ++__s, ++__c)
{ {
_CharT __ch = *__i; typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (__ct.is(__ct.space, __ch)) if (__ct.is(__ct.space, __ch))
break; break;
*__s = __ch; *__s++ = __ch;
++__c;
__is.rdbuf()->sbumpc();
} }
*__s = _CharT(); *__s = _CharT();
__is.width(0); __is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -801,25 +810,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is); typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) if (__sen)
{ {
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof())) if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit); __is.setstate(ios_base::eofbit | ios_base::failbit);
else else
__c = _Traits::to_char_type(__i); __c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
if (__i != __eof)
{
__c = *__i;
if (++__i == __eof)
__is.setstate(ios_base::eofbit);
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -859,42 +854,42 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
sentry __s(*this, true); sentry __s(*this, true);
if (__s) if (__s)
{ {
streamsize __c = 0;
if (__sb) if (__sb)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{
*__o = *__i;
if (__o.failed())
break;
}
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof) while (true)
__err |= ios_base::eofbit; {
if (__c == 0) typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
if (traits_type::eq_int_type(
__sb->sputc(traits_type::to_char_type(__i)),
traits_type::eof()))
break;
++__gc_;
this->rdbuf()->sbumpc();
}
if (__gc_ == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
{ {
if (__c == 0) if (__gc_ == 0)
this->__set_failbit_and_consider_rethrow(); this->__set_failbit_and_consider_rethrow();
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -919,22 +914,11 @@ basic_istream<_CharT, _Traits>::get()
sentry __s(*this, true); sentry __s(*this, true);
if (__s) if (__s)
{ {
streamsize __c = 0; __r = this->rdbuf()->sbumpc();
typedef istreambuf_iterator<char_type, traits_type> _I; if (traits_type::eq_int_type(__r, traits_type::eof()))
_I __i(*this); this->setstate(ios_base::failbit | ios_base::eofbit);
_I __eof;
ios_base::iostate __err = ios_base::goodbit;
if (__i != __eof)
{
__r = traits_type::to_int_type(*__i);
++__c;
if (++__i == __eof)
__err |= ios_base::eofbit;
}
else else
__err |= ios_base::failbit | ios_base::eofbit; __gc_ = 1;
this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -969,30 +953,31 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0;
if (__n > 0) if (__n > 0)
{ {
typedef istreambuf_iterator<char_type, traits_type> _I; ios_base::iostate __err = ios_base::goodbit;
_I __i(*this); while (__gc_ < __n-1)
_I __eof;
for (; __i != __eof && __n > 1; ++__i, ++__s, ++__c)
{ {
char_type __ch = *__i; int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, __dlm))
break; break;
*__s = __ch; *__s++ = __ch;
++__gc_;
this->rdbuf()->sbumpc();
} }
*__s = char_type(); *__s = char_type();
ios_base::iostate __err = ios_base::goodbit; if (__gc_ == 0)
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1025,38 +1010,36 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<char_type, traits_type> _I; while (true)
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(&__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
char_type __ch = *__i; typename traits_type::int_type __i = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, __dlm))
break; break;
*__o = __ch; if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof()))
if (__o.failed())
break; break;
++__gc_;
this->rdbuf()->sbumpc();
} }
if (__i == __eof)
__err |= ios_base::eofbit;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
{ {
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
if (__c == 0) if (__gc_ == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1088,33 +1071,36 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0; ios_base::iostate __err = ios_base::goodbit;
typedef istreambuf_iterator<char_type, traits_type> _I; while (true)
_I __i(*this);
_I __eof;
for (; __i != __eof; ++__s, --__n)
{ {
char_type __ch = *__i; typename traits_type::int_type __i = this->rdbuf()->sgetc();
++__i; if (traits_type::eq_int_type(__i, traits_type::eof()))
++__c;
if (traits_type::eq(__ch, __dlm))
break;
if (__n < 2)
{ {
this->setstate(ios_base::failbit); __err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm))
{
this->rdbuf()->sbumpc();
++__gc_;
break; break;
} }
*__s = __ch; if (__gc_ >= __n-1)
{
__err |= ios_base::failbit;
break;
}
*__s++ = __ch;
this->rdbuf()->sbumpc();
++__gc_;
} }
if (__n) if (__n > 0)
*__s = char_type(); *__s = char_type();
ios_base::iostate __err = ios_base::goodbit; if (__gc_ == 0)
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1146,35 +1132,40 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0; ios_base::iostate __err = ios_base::goodbit;
typedef istreambuf_iterator<char_type, traits_type> _I; if (__n == numeric_limits<streamsize>::max())
_I __i(*this);
_I __eof;
if (__n != numeric_limits<streamsize>::max())
{ {
for (; __n > 0 && __i != __eof; --__n) while (true)
{ {
char_type __ch = *__i; typename traits_type::int_type __i = this->rdbuf()->sbumpc();
++__i; if (traits_type::eq_int_type(__i, traits_type::eof()))
++__c; {
if (traits_type::eq(__ch, __dlm)) __err |= ios_base::eofbit;
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
else else
{ {
while (__i != __eof) while (__gc_ < __n)
{ {
char_type __ch = *__i; typename traits_type::int_type __i = this->rdbuf()->sbumpc();
++__i; if (traits_type::eq_int_type(__i, traits_type::eof()))
++__c; {
if (traits_type::eq(__ch, __dlm)) __err |= ios_base::eofbit;
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
if (__i == __eof) this->setstate(__err);
this->setstate(ios_base::eofbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1198,7 +1189,11 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{
__r = this->rdbuf()->sgetc(); __r = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
@@ -1221,20 +1216,16 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0; for (; __gc_ < __n; ++__gc_)
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 0; ++__i, ++__s, ++__c, --__n)
*__s = *__i;
if (__i == __eof)
{ {
ios_base::iostate __err = ios_base::eofbit; typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (__n > 0) if (traits_type::eq_int_type(__i, traits_type::eof()))
__err |= ios_base::failbit; {
this->setstate(__err); this->setstate(ios_base::failbit | ios_base::eofbit);
break;
}
*__s++ = traits_type::to_char_type(__i);
} }
__gc_ = __c;
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
@@ -1252,45 +1243,19 @@ template<class _CharT, class _Traits>
streamsize streamsize
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{ {
__gc_ = 0; streamsize __c = this->rdbuf()->in_avail();
streamsize __c = 0; switch (__c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS case -1:
sentry __sen(*this, true); this->setstate(ios_base::eofbit);
if (__sen) break;
{ case 0:
typedef istreambuf_iterator<char_type, traits_type> _I; break;
_I __i(*this); default:
_I __eof; read(__s, _VSTD::min(__c, __n));
__c = this->rdbuf()->in_avail(); break;
switch (__c)
{
case -1:
__i = __eof;
break;
case 0:
break;
default:
__c = _STD::min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) return __gc_;
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
return __c;
} }
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
@@ -1302,6 +1267,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1329,6 +1295,7 @@ basic_istream<_CharT, _Traits>::unget()
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1407,6 +1374,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
@@ -1453,15 +1421,19 @@ ws(basic_istream<_CharT, _Traits>& __is)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen) if (__sen)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_I __i(__is); while (true)
_I __eof; {
for (; __i != __eof; ++__i) typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (!__ct.is(__ct.space, *__i)) if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__is.setstate(ios_base::eofbit);
break;
}
if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
break; break;
if (__i == __eof) __is.rdbuf()->sbumpc();
__is.setstate(ios_base::failbit | ios_base::eofbit); }
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1504,11 +1476,13 @@ public:
virtual ~basic_iostream(); virtual ~basic_iostream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_iostream(basic_iostream&& __rhs); basic_iostream(basic_iostream&& __rhs);
#endif #endif
// assign/swap // assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_iostream& operator=(basic_iostream&& __rhs); basic_iostream& operator=(basic_iostream&& __rhs);
#endif #endif
void swap(basic_iostream& __rhs); void swap(basic_iostream& __rhs);
@@ -1527,7 +1501,7 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)) : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
{ {
} }
@@ -1568,27 +1542,30 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
if (__sen) if (__sen)
{ {
__str.clear(); __str.clear();
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width(); streamsize __n = __is.width();
if (__n == 0) if (__n <= 0)
__n = __str.max_size(); __n = __str.max_size();
if (__n < 0) if (__n <= 0)
__n = numeric_limits<streamsize>::max(); __n = numeric_limits<streamsize>::max();
streamsize __c = 0; streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_I __i(__is); ios_base::iostate __err = ios_base::goodbit;
_I __eof; while (__c < __n)
for (; __i != __eof && __c < __n; ++__i, ++__c)
{ {
_CharT __ch = *__i; typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (__ct.is(__ct.space, __ch)) if (__ct.is(__ct.space, __ch))
break; break;
__str.push_back(__ch); __str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
} }
__is.width(0); __is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -1618,31 +1595,28 @@ getline(basic_istream<_CharT, _Traits>& __is,
if (__sen) if (__sen)
{ {
__str.clear(); __str.clear();
streamsize __c = 0; ios_base::iostate __err = ios_base::goodbit;
typedef istreambuf_iterator<_CharT, _Traits> _I; streamsize __extr = 0;
_I __i(__is); while (true)
_I __eof;
streamsize __n = __str.max_size();
if (__n < 0)
__n = numeric_limits<streamsize>::max();
for (; __i != __eof;)
{ {
_CharT __ch = *__i; typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
++__i; if (_Traits::eq_int_type(__i, _Traits::eof()))
++__c; {
__err |= ios_base::eofbit;
break;
}
++__extr;
_CharT __ch = _Traits::to_char_type(__i);
if (_Traits::eq(__ch, __dlm)) if (_Traits::eq(__ch, __dlm))
break; break;
if (__c == __n) __str.push_back(__ch);
if (__str.size() == __str.max_size())
{ {
__is.setstate(ios_base::failbit); __err |= ios_base::failbit;
break; break;
} }
__str.push_back(__ch);
} }
ios_base::iostate __err = ios_base::goodbit; if (__extr == 0)
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
} }
@@ -1700,24 +1674,26 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{ {
basic_string<_CharT, _Traits> __str; basic_string<_CharT, _Traits> __str;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __c = 0; streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
_CharT __zero = __ct.widen('0'); _CharT __zero = __ct.widen('0');
_CharT __one = __ct.widen('1'); _CharT __one = __ct.widen('1');
_I __i(__is); while (__c < _Size)
_I __eof;
for (; __i != __eof && __c < _Size; ++__i, ++__c)
{ {
_CharT __ch = *__i; typename _Traits::int_type __i = __is.rdbuf()->sgetc();
if (__ch != __zero && __ch != __one) if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
break; break;
__str.push_back(__ch); __str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
} }
__is.width(0);
__x = bitset<_Size>(__str); __x = bitset<_Size>(__str);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -1734,9 +1710,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is; return __is;
} }
extern template class basic_istream<char>; _LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>)
extern template class basic_istream<wchar_t>; _LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>)
extern template class basic_iostream<char>; _LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>)
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -263,10 +263,10 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_istream<charT,traits> istream_type; typedef basic_istream<charT,traits> istream_type;
istreambuf_iterator() throw(); istreambuf_iterator() noexcept;
istreambuf_iterator(istream_type& s) throw(); istreambuf_iterator(istream_type& s) noexcept;
istreambuf_iterator(streambuf_type* s) throw(); istreambuf_iterator(streambuf_type* s) noexcept;
istreambuf_iterator(a-private-type) throw(); istreambuf_iterator(a-private-type) noexcept;
charT operator*() const; charT operator*() const;
pointer operator->() const; pointer operator->() const;
@@ -293,13 +293,13 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_ostream<charT,traits> ostream_type; typedef basic_ostream<charT,traits> ostream_type;
ostreambuf_iterator(ostream_type& s) throw(); ostreambuf_iterator(ostream_type& s) noexcept;
ostreambuf_iterator(streambuf_type* s) throw(); ostreambuf_iterator(streambuf_type* s) noexcept;
ostreambuf_iterator& operator=(charT c); ostreambuf_iterator& operator=(charT c);
ostreambuf_iterator& operator*(); ostreambuf_iterator& operator*();
ostreambuf_iterator& operator++(); ostreambuf_iterator& operator++();
ostreambuf_iterator& operator++(int); ostreambuf_iterator& operator++(int);
bool failed() const throw(); bool failed() const noexcept;
}; };
template <class C> auto begin(C& c) -> decltype(c.begin()); 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> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -335,7 +337,7 @@ template <class _Tp>
struct __has_iterator_category struct __has_iterator_category
{ {
private: private:
struct __two {char _; char __;}; struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...); template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::iterator_category* = 0); template <class _Up> static char __test(typename _Up::iterator_category* = 0);
public: public:
@@ -488,7 +490,7 @@ next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1, typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0) typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{ {
_STD::advance(__x, __n); _VSTD::advance(__x, __n);
return __x; return __x;
} }
@@ -499,7 +501,7 @@ prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0) typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{ {
_STD::advance(__x, -__n); _VSTD::advance(__x, -__n);
return __x; return __x;
} }
@@ -624,11 +626,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_back(__value); return *this;} {container->push_back(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_back(_STD::move(__value)); return *this;} {container->push_back(_VSTD::move(__value_)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
@@ -657,11 +659,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_front(__value); return *this;} {container->push_front(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_front(_STD::move(__value)); return *this;} {container->push_front(_VSTD::move(__value_)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {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) _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {} : container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
{iter = container->insert(iter, __value); ++iter; return *this;} {iter = container->insert(iter, __value_); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
{iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;} {iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
@@ -767,9 +769,9 @@ public:
: __out_stream_(&__s), __delim_(0) {} : __out_stream_(&__s), __delim_(0) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
: __out_stream_(&__s), __delim_(__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_) if (__delim_)
*__out_stream_ << __delim_; *__out_stream_ << __delim_;
return *this; return *this;
@@ -813,15 +815,16 @@ private:
__sbuf_ = 0; __sbuf_ = 0;
} }
public: public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {__test_for_eof();} : __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();} : __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_) {} : __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 char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{ {
@@ -864,9 +867,9 @@ public:
private: private:
streambuf_type* __sbuf_; streambuf_type* __sbuf_;
public: public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw() _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {} : __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw() _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
: __sbuf_(__s) {} : __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) _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++() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {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> template <class _Iter>
@@ -1006,43 +1017,52 @@ make_move_iterator(const _Iter& __i)
template <class _Iter> class __wrap_iter; template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter> template <class _Iter>
_LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter> __wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, const __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 _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
template <class _I, class _O> _O move(_I, _I, _O); template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if typename enable_if
< <
is_trivially_copy_assignable<_Tp>::value, is_trivially_copy_assignable<_Tp>::value,
@@ -1063,33 +1083,108 @@ public:
private: private:
iterator_type __i; iterator_type __i;
public: public:
_LIBCPP_INLINE_VISIBILITY __wrap_iter() {} _LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
#endif
}
template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u, template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u,
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
: __i(__u.base()) {} : __i(__u.base())
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;} {
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());} #if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() {++__i; return *this;} __get_db()->__iterator_copy(this, &__u);
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) #endif
{__wrap_iter __tmp(*this); ++__i; return __tmp;} }
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() {--__i; return *this;} #if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _LIBCPP_INLINE_VISIBILITY
{__wrap_iter __tmp(*this); --__i; return __tmp;} __wrap_iter(const __wrap_iter& __x)
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const : __i(__x.base())
{return __wrap_iter(__i + __n);} {
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) __get_db()->__iterator_copy(this, &__x);
{__i += __n; return *this;} }
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _LIBCPP_INLINE_VISIBILITY
{return __wrap_iter(__i - __n);} __wrap_iter& operator=(const __wrap_iter& __x)
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) {
{__i -= __n; return *this;} if (this != &__x)
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const {
{return __i[__n];} __get_db()->__iterator_copy(this, &__x);
__i = __x.__i;
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY
~__wrap_iter()
{
__get_db()->__erase_i(this);
}
#endif
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable iterator");
#endif
return *__i;
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to increment non-incrementable iterator");
#endif
++__i;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT
{__wrap_iter __tmp(*this); ++(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
"Attempted to decrement non-decrementable iterator");
#endif
--__i;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
{__wrap_iter __w(*this); __w += __n; return __w;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
"Attempted to add/subtract iterator outside of valid range");
#endif
__i += __n;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT
{return *this + (-__n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
{*this += -__n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
"Attempted to subscript iterator outside of valid range");
#endif
return __i[__n];
}
_LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;} _LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
private: private:
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) : __i(__x) {} _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
{
__get_db()->__insert_ic(this, __p);
}
#endif
template <class _Up> friend class __wrap_iter; template <class _Up> friend class __wrap_iter;
template <class _CharT, class _Traits, class _Alloc> friend class basic_string; template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
@@ -1098,46 +1193,46 @@ private:
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&); operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1> template <class _Iter1>
friend friend
__wrap_iter<_Iter1> __wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, const __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 _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 _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
@@ -1153,56 +1248,100 @@ private:
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() == __y.base(); return __x.base() == __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() < __y.base(); return __x.base() < __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
return __x.base() != __y.base(); return !(__x == __y);
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
return __x.base() > __y.base(); return __y < __x;
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
return __x.base() >= __y.base(); return !(__x < __y);
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
return __x.base() <= __y.base(); 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> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to subtract incompatible iterators");
#endif
return __x.base() - __y.base(); return __x.base() - __y.base();
} }
@@ -1210,9 +1349,10 @@ template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter> __wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type __n, operator+(typename __wrap_iter<_Iter>::difference_type __n,
const __wrap_iter<_Iter>& __x) __wrap_iter<_Iter> __x) _NOEXCEPT
{ {
return __wrap_iter<_Iter>(__x.base() + __n); __x += __n;
return __x;
} }
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
@@ -1222,34 +1362,42 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
template <class _Container, class _Iter> class __debug_iter; template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter> template <class _Container, class _Iter>
_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter> __debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&); operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
@@ -1625,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) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(_C& __c) -> decltype(__c.begin()) begin(_Cp& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(const _C& __c) -> decltype(__c.begin()) begin(const _Cp& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(_C& __c) -> decltype(__c.end()) end(_Cp& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(const _C& __c) -> decltype(__c.end()) end(const _Cp& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator typename _Cp::iterator
begin(_C& __c) begin(_Cp& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator typename _Cp::const_iterator
begin(const _C& __c) begin(const _Cp& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator typename _Cp::iterator
end(_C& __c) end(_Cp& __c)
{ {
return __c.end(); return __c.end();
} }
template <class _C> template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator typename _Cp::const_iterator
end(const _C& __c) end(const _Cp& __c)
{ {
return __c.end(); return __c.end();
} }
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #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 inline _LIBCPP_INLINE_VISIBILITY
_T* _Tp*
begin(_T (&__array)[_N]) begin(_Tp (&__array)[_Np])
{ {
return __array; return __array;
} }
template <class _T, size_t _N> template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_T* _Tp*
end(_T (&__array)[_N]) end(_Tp (&__array)[_Np])
{ {
return __array + _N; return __array + _Np;
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ namespace std
class mutex class mutex
{ {
public: public:
mutex(); constexpr mutex() noexcept;
~mutex(); ~mutex();
mutex(const mutex&) = delete; mutex(const mutex&) = delete;
@@ -44,7 +44,7 @@ public:
recursive_mutex& operator=(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete;
void lock(); void lock();
bool try_lock(); bool try_lock() noexcept;
void unlock(); void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
@@ -79,7 +79,7 @@ public:
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void lock(); void lock();
bool try_lock(); bool try_lock() noexcept;
template <class Rep, class Period> template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time); bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -114,9 +114,9 @@ class unique_lock
{ {
public: public:
typedef Mutex mutex_type; typedef Mutex mutex_type;
unique_lock(); unique_lock() noexcept;
explicit unique_lock(mutex_type& m); 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, try_to_lock_t);
unique_lock(mutex_type& m, adopt_lock_t); unique_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -128,8 +128,8 @@ public:
unique_lock(unique_lock const&) = delete; unique_lock(unique_lock const&) = delete;
unique_lock& operator=(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete;
unique_lock(unique_lock&& u); unique_lock(unique_lock&& u) noexcept;
unique_lock& operator=(unique_lock&& u); unique_lock& operator=(unique_lock&& u) noexcept;
void lock(); void lock();
bool try_lock(); bool try_lock();
@@ -141,16 +141,16 @@ public:
void unlock(); void unlock();
void swap(unique_lock& u); void swap(unique_lock& u) noexcept;
mutex_type* release(); mutex_type* release() noexcept;
bool owns_lock() const; bool owns_lock() const noexcept;
explicit operator bool () const; explicit operator bool () const noexcept;
mutex_type* mutex() const; mutex_type* mutex() const noexcept;
}; };
template <class Mutex> 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> template <class L1, class L2, class... L3>
int try_lock(L1&, L2&, L3&...); int try_lock(L1&, L2&, L3&...);
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
struct once_flag struct once_flag
{ {
constexpr once_flag(); constexpr once_flag() noexcept;
once_flag(const once_flag&) = delete; once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete;
@@ -175,8 +175,15 @@ template<class Callable, class ...Args>
#include <__config> #include <__config>
#include <__mutex_base> #include <__mutex_base>
#include <functional> #include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -194,8 +201,8 @@ private:
public: public:
void lock(); void lock();
bool try_lock(); bool try_lock() _NOEXCEPT;
void unlock(); void unlock() _NOEXCEPT;
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -217,14 +224,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock(); bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock(); void unlock() _NOEXCEPT;
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -260,14 +267,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock(); bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock(); void unlock() _NOEXCEPT;
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -418,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct once_flag; struct _LIBCPP_VISIBLE once_flag;
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Callable, class... _Args> 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 #else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable> template<class _Callable>
void call_once(once_flag&, _Callable); _LIBCPP_INLINE_VISIBILITY
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_VISIBLE once_flag struct _LIBCPP_VISIBLE once_flag
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
// constexpr _LIBCPP_CONSTEXPR
once_flag() {} once_flag() _NOEXCEPT : __state_(0) {}
private: private:
once_flag(const once_flag&); // = delete; once_flag(const once_flag&); // = delete;
@@ -455,17 +464,50 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
}; };
template <class _F> #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp>
class __call_once_param class __call_once_param
{ {
_F __f_; _Fp __f_;
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {} explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else #else
_LIBCPP_INLINE_VISIBILITY _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<_Fp>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
}
};
#else
template <class _Fp>
class __call_once_param
{
_Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -475,11 +517,13 @@ public:
} }
}; };
template <class _F> #endif
template <class _Fp>
void void
__call_once_proxy(void* __vp) __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)(); (*__p)();
} }
@@ -492,13 +536,12 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{ {
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul) if (__flag.__state_ != ~0ul)
{ {
typedef decltype(std::bind(std::forward<_Callable>(__func), typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
std::forward<_Args>(__args)...)) _G; __call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func), __decay_copy(_VSTD::forward<_Args>(__args))...));
std::forward<_Args>(__args)...)); __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
} }
} }

View File

@@ -21,35 +21,34 @@ class bad_alloc
: public exception : public exception
{ {
public: public:
bad_alloc() throw(); bad_alloc() noexcept;
bad_alloc(const bad_alloc&) throw(); bad_alloc(const bad_alloc&) noexcept;
bad_alloc& operator=(const bad_alloc&) throw(); bad_alloc& operator=(const bad_alloc&) noexcept;
virtual ~bad_alloc() throw(); virtual const char* what() const noexcept;
virtual const char* what() const throw();
}; };
struct nothrow_t {}; struct nothrow_t {};
extern const nothrow_t nothrow; extern const nothrow_t nothrow;
typedef void (*new_handler)(); typedef void (*new_handler)();
new_handler set_new_handler(new_handler new_p) throw(); new_handler set_new_handler(new_handler new_p) noexcept;
new_handler get_new_handler() throw(); new_handler get_new_handler() noexcept;
} // std } // std
void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable void* operator new(std::size_t size); // replaceable
void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete(void* ptr) throw(); // replaceable void operator delete(void* ptr) noexcept; // replaceable
void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable void* operator new[](std::size_t size); // replaceable
void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete[](void* ptr) throw(); // replaceable void operator delete[](void* ptr) noexcept; // replaceable
void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
void* operator new (std::size_t size, void* ptr) throw(); void* operator new (std::size_t size, void* ptr) noexcept;
void* operator new[](std::size_t size, void* ptr) throw(); void* operator new[](std::size_t size, void* ptr) noexcept;
void operator delete (void* ptr, void*) throw(); void operator delete (void* ptr, void*) noexcept;
void operator delete[](void* ptr, void*) throw(); void operator delete[](void* ptr, void*) noexcept;
*/ */
@@ -57,7 +56,9 @@ void operator delete[](void* ptr, void*) throw();
#include <exception> #include <exception>
#include <cstddef> #include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -66,18 +67,18 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception : public exception
{ {
public: public:
bad_alloc() throw(); bad_alloc() _NOEXCEPT;
virtual ~bad_alloc() throw(); virtual ~bad_alloc() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI bad_array_new_length class _LIBCPP_EXCEPTION_ABI bad_array_new_length
: public bad_alloc : public bad_alloc
{ {
public: public:
bad_array_new_length() throw(); bad_array_new_length() _NOEXCEPT;
virtual ~bad_array_new_length() throw(); virtual ~bad_array_new_length() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
void __throw_bad_alloc(); // not in C++ spec void __throw_bad_alloc(); // not in C++ spec
@@ -85,24 +86,32 @@ void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_VISIBLE nothrow_t {}; struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow; extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)(); typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw(); _LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_VISIBLE new_handler get_new_handler() throw(); _LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
} // std } // std
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc); _LIBCPP_VISIBLE void* operator new(std::size_t __sz)
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw(); #if !__has_feature(cxx_noexcept)
_LIBCPP_VISIBLE void operator delete(void*) throw(); throw(std::bad_alloc)
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw(); #endif
;
_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;
_LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc); _LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw(); #if !__has_feature(cxx_noexcept)
_LIBCPP_VISIBLE void operator delete[](void*) throw(); throw(std::bad_alloc)
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw(); #endif
;
_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;
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {} _LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {} _LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
#endif // _LIBCPP_NEW #endif // _LIBCPP_NEW

View File

@@ -60,7 +60,9 @@ template <class ForwardIterator, class T>
#include <__config> #include <__config>
#include <iterator> #include <iterator>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -184,10 +186,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value) iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
{ {
for (; __first != __last; ++__first, ++__value) for (; __first != __last; ++__first, ++__value_)
*__first = __value; *__first = __value_;
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -133,7 +133,9 @@ template <class charT, class traits, class T>
#include <iterator> #include <iterator>
#include <bitset> #include <bitset>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -154,18 +156,20 @@ public:
virtual ~basic_ostream(); virtual ~basic_ostream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream(basic_ostream&& __rhs); basic_ostream(basic_ostream&& __rhs);
#endif #endif
// 27.7.2.3 Assign/swap // 27.7.2.3 Assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs); basic_ostream& operator=(basic_ostream&& __rhs);
#endif #endif
void swap(basic_ostream& __rhs); void swap(basic_ostream& __rhs);
public: public:
// 27.7.2.4 Prefix/suffix: // 27.7.2.4 Prefix/suffix:
class sentry; class _LIBCPP_VISIBLE sentry;
// 27.7.2.6 Formatted output: // 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
@@ -216,7 +220,7 @@ public:
~sentry(); ~sentry();
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
// explicit _LIBCPP_EXPLICIT
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -338,11 +342,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _I; typedef istreambuf_iterator<_CharT, _Traits> _Ip;
typedef ostreambuf_iterator<_CharT, _Traits> _O; typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_I __i(__sb); _Ip __i(__sb);
_I __eof; _Ip __eof;
_O __o(*this); _Op __o(*this);
size_t __c = 0; size_t __c = 0;
for (; __i != __eof; ++__i, ++__o, ++__c) for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
@@ -384,8 +388,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -411,8 +415,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) : static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -440,8 +444,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -467,8 +471,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) : static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -496,8 +500,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -522,8 +526,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -548,8 +552,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -574,8 +578,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -600,8 +604,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -626,8 +630,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -652,8 +656,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -678,8 +682,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -704,8 +708,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
const _F& __f = use_facet<_F>(this->getloc()); const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -730,8 +734,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _I; typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -763,8 +767,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
if (__s) if (__s)
{ {
_CharT __c = __os.widen(__cn); _CharT __c = __os.widen(__cn);
typedef ostreambuf_iterator<_CharT, _Traits> _I; typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -795,8 +799,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -827,8 +831,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -859,8 +863,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -891,9 +895,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _I; typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -924,7 +928,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _I; typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = char_traits<char>::length(__strn); size_t __len = char_traits<char>::length(__strn);
const int __bs = 100; const int __bs = 100;
_CharT __wbb[__bs]; _CharT __wbb[__bs];
@@ -939,7 +943,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
} }
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn); *__p = __os.widen(*__strn);
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
__wb, __wb,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__wb + __len : __wb + __len :
@@ -970,9 +974,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -1003,9 +1007,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1036,9 +1040,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _I; typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1069,8 +1073,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _O; typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_O __o(*this); _Op __o(*this);
*__o = __c; *__o = __c;
if (__o.failed()) if (__o.failed())
this->setstate(ios_base::badbit); this->setstate(ios_base::badbit);
@@ -1096,8 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
sentry __sen(*this); sentry __sen(*this);
if (__sen && __n) if (__sen && __n)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _O; typedef ostreambuf_iterator<_CharT, _Traits> _Op;
_O __o(*this); _Op __o(*this);
for (; __n; --__n, ++__o, ++__s) for (; __n; --__n, ++__o, ++__s)
{ {
*__o = *__s; *__o = *__s;
@@ -1214,12 +1218,12 @@ typename enable_if
< <
!is_lvalue_reference<_Stream>::value && !is_lvalue_reference<_Stream>::value &&
is_base_of<ios_base, _Stream>::value, is_base_of<ios_base, _Stream>::value,
_Stream& _Stream&&
>::type >::type
operator<<(_Stream&& __os, const _Tp& __x) operator<<(_Stream&& __os, const _Tp& __x)
{ {
__os << __x; __os << __x;
return __os; return _VSTD::move(__os);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1236,9 +1240,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _I; typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = __str.size(); size_t __len = __str.size();
if (__pad_and_output(_I(__os), if (__pad_and_output(_Ip(__os),
__str.data(), __str.data(),
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str.data() + __len : __str.data() + __len :
@@ -1266,10 +1270,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
return __os << __ec.category().name() << ':' << __ec.value(); 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 inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>& 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(); return __os << __p.get();
} }
@@ -1283,8 +1287,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
} }
extern template class basic_ostream<char>; _LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>)
extern template class basic_ostream<wchar_t>; _LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>)
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -31,21 +31,28 @@ protected:
container_type c; container_type c;
public: public:
queue(); queue() = default;
~queue() = default;
queue(const queue& q) = default;
queue(queue&& q) = default;
queue& operator=(const queue& q) = default;
queue& operator=(queue&& q) = default;
explicit queue(const container_type& c); explicit queue(const container_type& c);
explicit queue(container_type&& c); explicit queue(container_type&& c)
queue(queue&& q);
template <class Alloc> template <class Alloc>
explicit queue(const Alloc& a); explicit queue(const Alloc& a);
template <class Alloc> template <class Alloc>
queue(const container_type& c, const Alloc& a); queue(const container_type& c, const Alloc& a);
template <class Alloc> template <class Alloc>
queue(container_type&& c, const Alloc& a); queue(container_type&& c, const Alloc& a);
template <class Alloc>
queue(const queue& q, const Alloc& a);
template <class Alloc> template <class Alloc>
queue(queue&& q, const Alloc& a); queue(queue&& q, const Alloc& a);
queue& operator=(queue&& q);
bool empty() const; bool empty() const;
size_type size() const; size_type size() const;
@@ -59,7 +66,7 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(queue& q); void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
}; };
template <class T, class Container> template <class T, class Container>
@@ -81,7 +88,8 @@ template <class T, class Container>
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y); bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
template <class T, class Container> template <class T, class Container>
void swap(queue<T, Container>& x, queue<T, Container>& y); void swap(queue<T, Container>& x, queue<T, Container>& y)
noexcept(noexcept(x.swap(y)));
template <class T, class Container = vector<T>, template <class T, class Container = vector<T>,
class Compare = less<typename Container::value_type>> class Compare = less<typename Container::value_type>>
@@ -99,7 +107,16 @@ protected:
Compare comp; Compare comp;
public: public:
explicit priority_queue(const Compare& comp = Compare()); priority_queue() = default;
~priority_queue() = default;
priority_queue(const priority_queue& q) = default;
priority_queue(priority_queue&& q) = default;
priority_queue& operator=(const priority_queue& q) = default;
priority_queue& operator=(priority_queue&& q) = default;
explicit priority_queue(const Compare& comp);
priority_queue(const Compare& comp, const container_type& c); priority_queue(const Compare& comp, const container_type& c);
explicit priority_queue(const Compare& comp, container_type&& c); explicit priority_queue(const Compare& comp, container_type&& c);
template <class InputIterator> template <class InputIterator>
@@ -111,8 +128,6 @@ public:
template <class InputIterator> template <class InputIterator>
priority_queue(InputIterator first, InputIterator last, priority_queue(InputIterator first, InputIterator last,
const Compare& comp, container_type&& c); const Compare& comp, container_type&& c);
priority_queue(priority_queue&& q);
priority_queue& operator=(priority_queue&& q);
template <class Alloc> template <class Alloc>
explicit priority_queue(const Alloc& a); explicit priority_queue(const Alloc& a);
template <class Alloc> template <class Alloc>
@@ -123,6 +138,8 @@ public:
template <class Alloc> template <class Alloc>
priority_queue(const Compare& comp, container_type&& c, priority_queue(const Compare& comp, container_type&& c,
const Alloc& a); const Alloc& a);
template <class Alloc>
priority_queue(const priority_queue& q, const Alloc& a);
template <class Alloc> template <class Alloc>
priority_queue(priority_queue&& q, const Alloc& a); priority_queue(priority_queue&& q, const Alloc& a);
@@ -135,12 +152,14 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(priority_queue& q); void swap(priority_queue& q)
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
}; };
template <class T, class Container, class Compare> template <class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x, void swap(priority_queue<T, Container, Compare>& x,
priority_queue<T, Container, Compare>& y); priority_queue<T, Container, Compare>& y)
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -152,17 +171,21 @@ template <class T, class Container, class Compare>
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _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> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
@@ -181,14 +204,35 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
queue() : c() {} queue()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(const queue& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {} explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_STD::move(__c)) {} explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -214,20 +258,14 @@ public:
queue(container_type&& __c, const _Alloc& __a, queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {} : c(_VSTD::move(__c), __a) {}
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a, queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {} : c(_VSTD::move(__q.c), __a) {}
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
{
c = _STD::move(__q.c);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -248,12 +286,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);} void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));} void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args) void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);} {c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -261,8 +299,9 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(queue& __q) void swap(queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(c, __q.c); swap(c, __q.c);
} }
@@ -331,6 +370,7 @@ template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -359,7 +399,36 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp = value_compare()) priority_queue()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
is_nothrow_default_constructible<value_compare>::value)
: c(), comp() {}
_LIBCPP_INLINE_VISIBILITY
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
is_nothrow_move_constructible<value_compare>::value)
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(const priority_queue& __q)
{c = __q.c; comp = __q.comp; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp)
: c(), comp(__comp) {} : c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c); priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -375,8 +444,6 @@ public:
template <class _InputIter> template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l, priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c); const value_compare& __comp, container_type&& __c);
priority_queue(priority_queue&& __q);
priority_queue& operator=(priority_queue&& __q);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
explicit priority_queue(const _Alloc& __a, explicit priority_queue(const _Alloc& __a,
@@ -423,7 +490,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void pop(); void pop();
void swap(priority_queue& __q); void swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value);
}; };
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -433,7 +502,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
: c(__c), : c(__c),
comp(__comp) comp(__comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -442,10 +511,10 @@ template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c) container_type&& __c)
: c(_STD::move(__c)), : c(_VSTD::move(__c)),
comp(__comp) comp(__comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -458,7 +527,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
: c(__f, __l), : c(__f, __l),
comp(__comp) comp(__comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -471,7 +540,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
comp(__comp) comp(__comp)
{ {
c.insert(c.end(), __f, __l); c.insert(c.end(), __f, __l);
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -482,28 +551,11 @@ inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const value_compare& __comp,
container_type&& __c) container_type&& __c)
: c(_STD::move(__c)), : c(_VSTD::move(__c)),
comp(__comp) comp(__comp)
{ {
c.insert(c.end(), __f, __l); c.insert(c.end(), __f, __l);
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
: c(_STD::move(__q.c)),
comp(_STD::move(__q.comp))
{
}
template <class _Tp, class _Container, class _Compare>
priority_queue<_Tp, _Container, _Compare>&
priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
{
c = _STD::move(__q.c);
comp = _STD::move(__q.comp);
return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -541,7 +593,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
: c(__c, __a), : c(__c, __a),
comp(__comp) comp(__comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -554,7 +606,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
: c(__q.c, __a), : c(__q.c, __a),
comp(__q.comp) comp(__q.comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -567,10 +619,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
const _Alloc& __a, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*) _Alloc>::value>::type*)
: c(_STD::move(__c), __a), : c(_VSTD::move(__c), __a),
comp(__comp) comp(__comp)
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -580,10 +632,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*) _Alloc>::value>::type*)
: c(_STD::move(__q.c), __a), : c(_VSTD::move(__q.c), __a),
comp(_STD::move(__q.comp)) comp(_VSTD::move(__q.comp))
{ {
_STD::make_heap(c.begin(), c.end(), comp); _VSTD::make_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -594,7 +646,7 @@ void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{ {
c.push_back(__v); c.push_back(__v);
_STD::push_heap(c.begin(), c.end(), comp); _VSTD::push_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -604,8 +656,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{ {
c.push_back(_STD::move(__v)); c.push_back(_VSTD::move(__v));
_STD::push_heap(c.begin(), c.end(), comp); _VSTD::push_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -616,8 +668,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{ {
c.emplace_back(_STD::forward<_Args>(__args)...); c.emplace_back(_VSTD::forward<_Args>(__args)...);
_STD::push_heap(c.begin(), c.end(), comp); _VSTD::push_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
@@ -628,7 +680,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::pop() priority_queue<_Tp, _Container, _Compare>::pop()
{ {
_STD::pop_heap(c.begin(), c.end(), comp); _VSTD::pop_heap(c.begin(), c.end(), comp);
c.pop_back(); c.pop_back();
} }
@@ -636,8 +688,10 @@ template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(c, __q.c); swap(c, __q.c);
swap(comp, __q.comp); swap(comp, __q.comp);
} }
@@ -647,6 +701,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(priority_queue<_Tp, _Container, _Compare>& __x, swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y) priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -70,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits> #include <climits>
#include <type_traits> #include <type_traits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -88,6 +92,12 @@ struct __static_gcd<_Xp, 0>
static const intmax_t value = _Xp; static const intmax_t value = _Xp;
}; };
template <>
struct __static_gcd<0, 0>
{
static const intmax_t value = 1;
};
// __static_lcm // __static_lcm
template <intmax_t _Xp, intmax_t _Yp> template <intmax_t _Xp, intmax_t _Yp>
@@ -274,10 +284,19 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_multiply
= typename __ratio_multiply<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_multiply struct _LIBCPP_VISIBLE ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {}; : public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_divide struct __ratio_divide
{ {
@@ -292,10 +311,19 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_divide
= typename __ratio_divide<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_divide struct _LIBCPP_VISIBLE ratio_divide
: public __ratio_divide<_R1, _R2>::type {}; : public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_add struct __ratio_add
{ {
@@ -318,10 +346,19 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_add
= typename __ratio_add<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_add struct _LIBCPP_VISIBLE ratio_add
: public __ratio_add<_R1, _R2>::type {}; : public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_subtract struct __ratio_subtract
{ {
@@ -344,10 +381,19 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_subtract
= typename __ratio_subtract<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_subtract struct _LIBCPP_VISIBLE ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {}; : public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
// ratio_equal // ratio_equal
template <class _R1, class _R2> template <class _R1, class _R2>
@@ -368,27 +414,27 @@ struct __ratio_less1
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2; static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Q> template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0> struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
{ {
static const bool value = false; static const bool value = false;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2> template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2> struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
{ {
static const bool value = !_Odd; 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>
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0> struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
{ {
static const bool value = _Odd; 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> 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>, static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
ratio<_R2::den, _M2>, !_Odd>::value; ratio<_R2::den, _M2>, !_Odd>::value;

File diff suppressed because it is too large Load Diff

View File

@@ -49,24 +49,25 @@ public:
scoped_allocator_adaptor(); scoped_allocator_adaptor();
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc, scoped_allocator_adaptor(OuterA2&& outerAlloc,
const InnerAllocs&... innerAllocs); const InnerAllocs&... innerAllocs) noexcept;
scoped_allocator_adaptor(const scoped_allocator_adaptor& other); scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other); scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other); scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
~scoped_allocator_adaptor(); ~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator(); inner_allocator_type& inner_allocator() noexcept;
const inner_allocator_type& inner_allocator() const; const inner_allocator_type& inner_allocator() const noexcept;
outer_allocator_type& outer_allocator(); outer_allocator_type& outer_allocator() noexcept;
const outer_allocator_type& outer_allocator() const; const outer_allocator_type& outer_allocator() const noexcept;
pointer allocate(size_type n); pointer allocate(size_type n);
pointer allocate(size_type n, const_void_pointer hint); pointer allocate(size_type n, const_void_pointer hint);
void deallocate(pointer p, size_type n); void deallocate(pointer p, size_type n) noexcept;
size_type max_size() const; size_type max_size() const;
template <class T, class... Args> void construct(T* p, Args&& args); template <class T, class... Args> void construct(T* p, Args&& args);
@@ -83,18 +84,20 @@ public:
void construct(pair<T1, T2>* p, pair<U, V>&& x); void construct(pair<T1, T2>* p, pair<U, V>&& x);
template <class T> void destroy(T* p); template <class T> void destroy(T* p);
scoped_allocator_adaptor select_on_container_copy_construction() const; template <class T> void destroy(T* p) noexcept;
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
}; };
template <class OuterA1, class OuterA2, class... InnerAllocs> template <class OuterA1, class OuterA2, class... InnerAllocs>
bool bool
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b); const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
template <class OuterA1, class OuterA2, class... InnerAllocs> template <class OuterA1, class OuterA2, class... InnerAllocs>
bool bool
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b); const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
} // std } // std
@@ -103,7 +106,9 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
#include <__config> #include <__config>
#include <memory> #include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -182,7 +187,7 @@ private:
protected: protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {} __scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -190,8 +195,8 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc, __scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)), : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {} __inner_(__innerAllocs...) {}
template <class _OuterA2, template <class _OuterA2,
@@ -200,7 +205,7 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()), : outer_allocator_type(__other.outer_allocator()),
__inner_(__other.inner_allocator()) {} __inner_(__other.inner_allocator()) {}
@@ -210,9 +215,9 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())), : outer_allocator_type(_VSTD::move(__other.outer_allocator())),
__inner_(_STD::move(__other.inner_allocator())) {} __inner_(_VSTD::move(__other.inner_allocator())) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -220,27 +225,27 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o, __scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i) const inner_allocator_type& __i) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__o)), : outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
__inner_(__i) __inner_(__i)
{ {
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() {return __inner_;} inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const {return __inner_;} const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);} {return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);} {return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const select_on_container_copy_construction() const _NOEXCEPT
{ {
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
( (
@@ -263,15 +268,15 @@ protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type; typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {} __scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value is_constructible<outer_allocator_type, _OuterA2>::value
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc) __scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {} : outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -279,7 +284,7 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other) const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()) {} : outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2, template <class _OuterA2,
@@ -288,33 +293,33 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other) __scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())) {} : outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() inner_allocator_type& inner_allocator() _NOEXCEPT
{return static_cast<inner_allocator_type&>(*this);} {return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return static_cast<const inner_allocator_type&>(*this);} {return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);} {return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);} {return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type> scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const select_on_container_copy_construction() const _NOEXCEPT
{return scoped_allocator_adaptor<outer_allocator_type>( {return scoped_allocator_adaptor<outer_allocator_type>(
allocator_traits<outer_allocator_type>:: allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator()) select_on_container_copy_construction(outer_allocator())
);} );}
__scoped_allocator_storage(const outer_allocator_type& __o, __scoped_allocator_storage(const outer_allocator_type& __o,
const inner_allocator_type& __i); const inner_allocator_type& __i) _NOEXCEPT;
template <class...> friend class __scoped_allocator_storage; template <class...> friend class __scoped_allocator_storage;
}; };
@@ -343,7 +348,7 @@ struct __outermost
{ {
typedef _Alloc type; typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const {return __a;} type& operator()(type& __a) const _NOEXCEPT {return __a;}
}; };
template <class _Alloc> template <class _Alloc>
@@ -351,11 +356,11 @@ struct __outermost<_Alloc, true>
{ {
typedef typename remove_reference typedef typename remove_reference
< <
decltype(_STD::declval<_Alloc>().outer_allocator()) decltype(_VSTD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc; >::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type; typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const type& operator()(_Alloc& __a) const _NOEXCEPT
{return __outermost<_OuterAlloc>()(__a.outer_allocator());} {return __outermost<_OuterAlloc>()(__a.outer_allocator());}
}; };
@@ -403,15 +408,15 @@ public:
}; };
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() {} scoped_allocator_adaptor() _NOEXCEPT {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value is_constructible<outer_allocator_type, _OuterA2>::value
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc, scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {} : base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default; // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -419,7 +424,7 @@ public:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor( scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: base(__other) {} : base(__other) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -427,23 +432,23 @@ public:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor( scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_STD::move(__other)) {} : base(_VSTD::move(__other)) {}
// ~scoped_allocator_adaptor() = default; // ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() inner_allocator_type& inner_allocator() _NOEXCEPT
{return base::inner_allocator();} {return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return base::inner_allocator();} {return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() outer_allocator_type& outer_allocator() _NOEXCEPT
{return base::outer_allocator();} {return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return base::outer_allocator();} {return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -456,7 +461,7 @@ public:
allocate(outer_allocator(), __n, __hint);} allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n) void deallocate(pointer __p, size_type __n) _NOEXCEPT
{allocator_traits<outer_allocator_type>:: {allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);} deallocate(outer_allocator(), __p, __n);}
@@ -468,7 +473,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args) void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(), {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _STD::forward<_Args>(__args)...);} __p, _VSTD::forward<_Args>(__args)...);}
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p) void destroy(_Tp* __p)
@@ -479,7 +484,7 @@ public:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
{return base::select_on_container_copy_construction();} {return base::select_on_container_copy_construction();}
private: private:
@@ -490,8 +495,8 @@ private:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o, scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i) const inner_allocator_type& __i) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__o), __i) {} : base(_VSTD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args> template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -502,7 +507,7 @@ private:
( (
_OM()(outer_allocator()), _OM()(outer_allocator()),
__p, __p,
_STD::forward<_Args>(__args)... _VSTD::forward<_Args>(__args)...
); );
} }
@@ -517,7 +522,7 @@ private:
__p, __p,
allocator_arg, allocator_arg,
inner_allocator(), inner_allocator(),
_STD::forward<_Args>(__args)... _VSTD::forward<_Args>(__args)...
); );
} }
@@ -530,7 +535,7 @@ private:
( (
_OM()(outer_allocator()), _OM()(outer_allocator()),
__p, __p,
_STD::forward<_Args>(__args)..., _VSTD::forward<_Args>(__args)...,
inner_allocator() inner_allocator()
); );
} }
@@ -542,16 +547,16 @@ template <class _OuterA1, class _OuterA2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const scoped_allocator_adaptor<_OuterA1>& __a, operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
const scoped_allocator_adaptor<_OuterA2>& __b) const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
{ {
return __a.outer_allocator() == __b.outer_allocator(); return __a.outer_allocator() == __b.outer_allocator();
} }
template <class _OuterA1, class _OuterA2, class... _InnerAllocs> template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a, operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
{ {
return __a.outer_allocator() == __b.outer_allocator() && return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator(); __a.inner_allocator() == __b.inner_allocator();
@@ -561,7 +566,7 @@ template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a, operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
{ {
return !(__a == __b); return !(__a == __b);
} }

View File

@@ -42,7 +42,12 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
explicit set(const value_compare& comp = value_compare()); set()
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit set(const value_compare& comp);
set(const value_compare& comp, const allocator_type& a); set(const value_compare& comp, const allocator_type& a);
template <class InputIterator> template <class InputIterator>
set(InputIterator first, InputIterator last, set(InputIterator first, InputIterator last,
@@ -51,7 +56,10 @@ public:
set(InputIterator first, InputIterator last, const value_compare& comp, set(InputIterator first, InputIterator last, const value_compare& comp,
const allocator_type& a); const allocator_type& a);
set(const set& s); set(const set& s);
set(set&& s); set(set&& s)
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit set(const allocator_type& a); explicit set(const allocator_type& a);
set(const set& s, const allocator_type& a); set(const set& s, const allocator_type& a);
set(set&& s, const allocator_type& a); set(set&& s, const allocator_type& a);
@@ -61,29 +69,33 @@ public:
~set(); ~set();
set& operator=(const set& s); set& operator=(const set& s);
set& operator=(set&& s); set& operator=(set&& s)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
set& operator=(initializer_list<value_type> il); set& operator=(initializer_list<value_type> il);
// iterators: // iterators:
iterator begin(); iterator begin() noexcept;
const_iterator begin() const; const_iterator begin() const noexcept;
iterator end(); iterator end() noexcept;
const_iterator end() const; const_iterator end() const noexcept;
reverse_iterator rbegin(); reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const; const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend(); reverse_iterator rend() noexcept;
const_reverse_iterator rend() const; const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const; const_iterator cbegin() const noexcept;
const_iterator cend() const; const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const; const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const; const_reverse_iterator crend() const noexcept;
// capacity: // capacity:
bool empty() const; bool empty() const noexcept;
size_type size() const; size_type size() const noexcept;
size_type max_size() const; size_type max_size() const noexcept;
// modifiers: // modifiers:
template <class... Args> template <class... Args>
@@ -101,12 +113,16 @@ public:
iterator erase(const_iterator position); iterator erase(const_iterator position);
size_type erase(const key_type& k); size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last); iterator erase(const_iterator first, const_iterator last);
void clear(); void clear() noexcept;
void swap(set& s); void swap(set& s)
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers: // observers:
allocator_type get_allocator() const; allocator_type get_allocator() const noexcept;
key_compare key_comp() const; key_compare key_comp() const;
value_compare value_comp() const; value_compare value_comp() const;
@@ -155,7 +171,8 @@ operator<=(const set<Key, Compare, Allocator>& x,
// specialized algorithms: // specialized algorithms:
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
void void
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y); swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
template <class Key, class Compare = less<Key>, template <class Key, class Compare = less<Key>,
class Allocator = allocator<Key>> class Allocator = allocator<Key>>
@@ -181,7 +198,12 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
explicit multiset(const value_compare& comp = value_compare()); multiset()
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit multiset(const value_compare& comp);
multiset(const value_compare& comp, const allocator_type& a); multiset(const value_compare& comp, const allocator_type& a);
template <class InputIterator> template <class InputIterator>
multiset(InputIterator first, InputIterator last, multiset(InputIterator first, InputIterator last,
@@ -190,7 +212,10 @@ public:
multiset(InputIterator first, InputIterator last, multiset(InputIterator first, InputIterator last,
const value_compare& comp, const allocator_type& a); const value_compare& comp, const allocator_type& a);
multiset(const multiset& s); multiset(const multiset& s);
multiset(multiset&& s); multiset(multiset&& s)
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit multiset(const allocator_type& a); explicit multiset(const allocator_type& a);
multiset(const multiset& s, const allocator_type& a); multiset(const multiset& s, const allocator_type& a);
multiset(multiset&& s, const allocator_type& a); multiset(multiset&& s, const allocator_type& a);
@@ -200,29 +225,33 @@ public:
~multiset(); ~multiset();
multiset& operator=(const multiset& s); multiset& operator=(const multiset& s);
multiset& operator=(multiset&& s); multiset& operator=(multiset&& s)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
multiset& operator=(initializer_list<value_type> il); multiset& operator=(initializer_list<value_type> il);
// iterators: // iterators:
iterator begin(); iterator begin() noexcept;
const_iterator begin() const; const_iterator begin() const noexcept;
iterator end(); iterator end() noexcept;
const_iterator end() const; const_iterator end() const noexcept;
reverse_iterator rbegin(); reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const; const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend(); reverse_iterator rend() noexcept;
const_reverse_iterator rend() const; const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const; const_iterator cbegin() const noexcept;
const_iterator cend() const; const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const; const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const; const_reverse_iterator crend() const noexcept;
// capacity: // capacity:
bool empty() const; bool empty() const noexcept;
size_type size() const; size_type size() const noexcept;
size_type max_size() const; size_type max_size() const noexcept;
// modifiers: // modifiers:
template <class... Args> template <class... Args>
@@ -240,12 +269,16 @@ public:
iterator erase(const_iterator position); iterator erase(const_iterator position);
size_type erase(const key_type& k); size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last); iterator erase(const_iterator first, const_iterator last);
void clear(); void clear() noexcept;
void swap(multiset& s); void swap(multiset& s)
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers: // observers:
allocator_type get_allocator() const; allocator_type get_allocator() const noexcept;
key_compare key_comp() const; key_compare key_comp() const;
value_compare value_comp() const; value_compare value_comp() const;
@@ -294,7 +327,8 @@ operator<=(const multiset<Key, Compare, Allocator>& x,
// specialized algorithms: // specialized algorithms:
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
void void
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y); swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -304,7 +338,9 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
#include <__tree> #include <__tree>
#include <functional> #include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -336,11 +372,15 @@ public:
typedef typename __base::difference_type difference_type; typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator; typedef typename __base::const_iterator const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare()) explicit set(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {} : __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a) set(const value_compare& __comp, const allocator_type& __a)
@@ -370,10 +410,18 @@ public:
insert(__s.begin(), __s.end()); insert(__s.begin(), __s.end());
} }
_LIBCPP_INLINE_VISIBILITY
set& operator=(const set& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(set&& __s) set(set&& __s)
: __tree_(_STD::move(__s.__tree_)) {} _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -391,6 +439,7 @@ public:
set(set&& __s, const allocator_type& __a); set(set&& __s, const allocator_type& __a);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp) : __tree_(__comp)
@@ -412,60 +461,66 @@ public:
__tree_.__assign_unique(__il.begin(), __il.end()); __tree_.__assign_unique(__il.begin(), __il.end());
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s) set& operator=(set&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{ {
__tree_ = _STD::move(__s.__tree_); __tree_ = _VSTD::move(__s.__tree_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();} iterator begin() _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();} const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();} iterator end() _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();} const_iterator end() const _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());} reverse_iterator rbegin() _NOEXCEPT
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} const_reverse_iterator rbegin() const _NOEXCEPT
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());} reverse_iterator rend() _NOEXCEPT
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());} const_reverse_iterator rend() const _NOEXCEPT
{return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();} const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();} const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();} const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();} const_reverse_iterator crend() const _NOEXCEPT {return rend();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;} bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();} size_type size() const _NOEXCEPT {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();} size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers: // modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args) pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);} {return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args) iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);} {return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v) pair<iterator,bool> insert(const value_type& __v)
@@ -473,7 +528,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(value_type&& __v) pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_STD::move(__v));} {return __tree_.__insert_unique(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v) iterator insert(const_iterator __p, const value_type& __v)
@@ -481,7 +536,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v) iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _STD::move(__v));} {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -491,9 +546,11 @@ public:
__tree_.__insert_unique(__e, *__f); __tree_.__insert_unique(__e, *__f);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il) void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());} {insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);} iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -504,13 +561,14 @@ public:
iterator erase(const_iterator __f, const_iterator __l) iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);} {return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();} void clear() _NOEXCEPT {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(set& __s) {__tree_.swap(__s.__tree_);} void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
{__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();} allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();} key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -548,13 +606,13 @@ public:
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a) : __tree_(_VSTD::move(__s.__tree_), __a)
{ {
if (__a != __s.get_allocator()) if (__a != __s.get_allocator())
{ {
const_iterator __e = cend(); const_iterator __e = cend();
while (!__s.empty()) while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_)); insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
} }
} }
@@ -566,7 +624,7 @@ bool
operator==(const set<_Key, _Compare, _Allocator>& __x, operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y) const set<_Key, _Compare, _Allocator>& __y)
{ {
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin()); return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -575,7 +633,7 @@ bool
operator< (const set<_Key, _Compare, _Allocator>& __x, operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y) const set<_Key, _Compare, _Allocator>& __y)
{ {
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -620,6 +678,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(set<_Key, _Compare, _Allocator>& __x, swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y) set<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -652,12 +711,16 @@ public:
typedef typename __base::difference_type difference_type; typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator; typedef typename __base::const_iterator const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator; typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare()) explicit multiset(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {} : __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a) multiset(const value_compare& __comp, const allocator_type& __a)
@@ -688,10 +751,18 @@ public:
insert(__s.begin(), __s.end()); insert(__s.begin(), __s.end());
} }
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(const multiset& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s) multiset(multiset&& __s)
: __tree_(_STD::move(__s.__tree_)) {} _NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a) explicit multiset(const allocator_type& __a)
@@ -706,6 +777,7 @@ public:
multiset(multiset&& __s, const allocator_type& __a); multiset(multiset&& __s, const allocator_type& __a);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp) : __tree_(__comp)
@@ -727,60 +799,66 @@ public:
__tree_.__assign_multi(__il.begin(), __il.end()); __tree_.__assign_multi(__il.begin(), __il.end());
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s) multiset& operator=(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{ {
__tree_ = _STD::move(__s.__tree_); __tree_ = _VSTD::move(__s.__tree_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();} iterator begin() _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();} const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();} iterator end() _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();} const_iterator end() const _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());} reverse_iterator rbegin() _NOEXCEPT
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());} const_reverse_iterator rbegin() const _NOEXCEPT
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());} reverse_iterator rend() _NOEXCEPT
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());} const_reverse_iterator rend() const _NOEXCEPT
{return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();} const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();} const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();} const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();} const_reverse_iterator crend() const _NOEXCEPT {return rend();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;} bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();} size_type size() const _NOEXCEPT {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();} size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers: // modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args) iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);} {return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args) iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);} {return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v) iterator insert(const value_type& __v)
@@ -788,7 +866,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __v) iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));} {return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v) iterator insert(const_iterator __p, const value_type& __v)
@@ -796,7 +874,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v) iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));} {return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -806,9 +884,11 @@ public:
__tree_.__insert_multi(__e, *__f); __tree_.__insert_multi(__e, *__f);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il) void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());} {insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);} iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -818,13 +898,15 @@ public:
iterator erase(const_iterator __f, const_iterator __l) iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);} {return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();} void clear() _NOEXCEPT {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(multiset& __s) {__tree_.swap(__s.__tree_);} void swap(multiset& __s)
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
{__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();} allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();} key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -862,13 +944,13 @@ public:
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a) : __tree_(_VSTD::move(__s.__tree_), __a)
{ {
if (__a != __s.get_allocator()) if (__a != __s.get_allocator())
{ {
const_iterator __e = cend(); const_iterator __e = cend();
while (!__s.empty()) while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_)); insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
} }
} }
@@ -880,7 +962,7 @@ bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x, operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y) const multiset<_Key, _Compare, _Allocator>& __y)
{ {
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin()); return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -889,7 +971,7 @@ bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x, operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y) const multiset<_Key, _Compare, _Allocator>& __y)
{ {
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -933,6 +1015,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(multiset<_Key, _Compare, _Allocator>& __x, swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y) multiset<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -175,7 +175,11 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream> #include <istream>
#include <string> #include <string>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -261,7 +265,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&&
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase(); ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase(); ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase(); ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__str_ = _STD::move(__rhs.__str_); __str_ = _VSTD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp); this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout); this->setp(__p, __p + __eout);
@@ -284,7 +288,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase(); ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase(); ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__mode_ = __rhs.__mode_; __mode_ = __rhs.__mode_;
__str_ = _STD::move(__rhs.__str_); __str_ = _VSTD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp); this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout); this->setp(__p, __p + __eout);
@@ -314,7 +318,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
ptrdiff_t __lnout = this->pptr() - this->pbase(); ptrdiff_t __lnout = this->pptr() - this->pbase();
ptrdiff_t __leout = this->epptr() - this->pbase(); ptrdiff_t __leout = this->epptr() - this->pbase();
ptrdiff_t __lhm = this->__hm_ - this->pbase(); ptrdiff_t __lhm = this->__hm_ - this->pbase();
_STD::swap(__mode_, __rhs.__mode_); _VSTD::swap(__mode_, __rhs.__mode_);
__str_.swap(__rhs.__str_); __str_.swap(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __rninp, __p + __reinp); this->setg(__p, __p + __rninp, __p + __reinp);
@@ -451,7 +455,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
} }
__hm_ = _STD::max(this->pptr() + 1, __hm_); __hm_ = _VSTD::max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in) if (__mode_ & ios_base::in)
{ {
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
@@ -582,8 +586,8 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)), : basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -592,8 +596,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>& basic_istringstream<_CharT, _Traits, _Allocator>&
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
{ {
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -701,8 +705,8 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_STD::move(__rhs)), : basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -711,8 +715,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>& basic_ostringstream<_CharT, _Traits, _Allocator>&
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
{ {
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -820,8 +824,8 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_STD::move(__rhs)), : basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -830,8 +834,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>& basic_stringstream<_CharT, _Traits, _Allocator>&
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
{ {
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs)); basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }

View File

@@ -31,14 +31,21 @@ protected:
container_type c; container_type c;
public: public:
explicit stack(); stack() = default;
~stack() = default;
stack(const stack& q) = default;
stack(stack&& q) = default;
stack& operator=(const stack& q) = default;
stack& operator=(stack&& q) = default;
explicit stack(const container_type& c); explicit stack(const container_type& c);
explicit stack(container_type&& c); explicit stack(container_type&& c);
stack(stack&& s);
stack& operator=(stack&& s);
template <class Alloc> explicit stack(const Alloc& a); template <class Alloc> explicit stack(const Alloc& a);
template <class Alloc> stack(const container_type& c, const Alloc& a); template <class Alloc> stack(const container_type& c, const Alloc& a);
template <class Alloc> stack(container_type&& c, const Alloc& a); template <class Alloc> stack(container_type&& c, const Alloc& a);
template <class Alloc> stack(const stack& c, const Alloc& a);
template <class Alloc> stack(stack&& c, const Alloc& a); template <class Alloc> stack(stack&& c, const Alloc& a);
bool empty() const; bool empty() const;
@@ -51,7 +58,7 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(stack& c); void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
}; };
template <class T, class Container> template <class T, class Container>
@@ -68,7 +75,8 @@ template <class T, class Container>
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y); bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container> template <class T, class Container>
void swap(stack<T, Container>& x, stack<T, Container>& y); void swap(stack<T, Container>& x, stack<T, Container>& y)
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -77,17 +85,21 @@ template <class T, class Container>
#include <__config> #include <__config>
#include <deque> #include <deque>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _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> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
@@ -106,16 +118,35 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
stack() : c() {} stack()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(const stack& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {} explicit stack(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_STD::move(__c)) {} explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s) : c(_STD::move(__s.c)) {}
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -141,13 +172,13 @@ public:
stack(container_type&& __c, const _Alloc& __a, stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {} : c(_VSTD::move(__c), __a) {}
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a, stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_STD::move(__s.c), __a) {} : c(_VSTD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -163,12 +194,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);} void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));} void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args) void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);} {c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -176,8 +207,9 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(stack& __s) void swap(stack& __s)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{ {
using _STD::swap; using _VSTD::swap;
swap(c, __s.c); swap(c, __s.c);
} }
@@ -244,6 +276,7 @@ template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y) swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
{ {
public: public:
explicit xxx_error(const string& what_arg); explicit xxx_error(const string& what_arg);
explicit xxx_error(const char* what_arg); // extension explicit xxx_error(const char* what_arg);
virtual const char* what() const // returns what_arg virtual const char* what() const noexcept // returns what_arg
}; };
} // std } // std
@@ -46,7 +46,9 @@ public:
#include <exception> #include <exception>
#include <iosfwd> // for string forward decl #include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -60,12 +62,12 @@ public:
explicit logic_error(const string&); explicit logic_error(const string&);
explicit logic_error(const char*); explicit logic_error(const char*);
logic_error(const logic_error&) throw(); logic_error(const logic_error&) _NOEXCEPT;
logic_error& operator=(const logic_error&) throw(); logic_error& operator=(const logic_error&) _NOEXCEPT;
virtual ~logic_error() throw(); virtual ~logic_error() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI runtime_error class _LIBCPP_EXCEPTION_ABI runtime_error
@@ -77,12 +79,12 @@ public:
explicit runtime_error(const string&); explicit runtime_error(const string&);
explicit runtime_error(const char*); explicit runtime_error(const char*);
runtime_error(const runtime_error&) throw(); runtime_error(const runtime_error&) _NOEXCEPT;
runtime_error& operator=(const runtime_error&) throw(); runtime_error& operator=(const runtime_error&) _NOEXCEPT;
virtual ~runtime_error() throw(); virtual ~runtime_error() _NOEXCEPT;
virtual const char* what() const throw(); virtual const char* what() const _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI domain_error class _LIBCPP_EXCEPTION_ABI domain_error
@@ -92,7 +94,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
virtual ~domain_error() throw(); virtual ~domain_error() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI invalid_argument class _LIBCPP_EXCEPTION_ABI invalid_argument
@@ -102,7 +104,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
virtual ~invalid_argument() throw(); virtual ~invalid_argument() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI length_error class _LIBCPP_EXCEPTION_ABI length_error
@@ -112,7 +114,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
virtual ~length_error() throw(); virtual ~length_error() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI out_of_range class _LIBCPP_EXCEPTION_ABI out_of_range
@@ -122,7 +124,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
virtual ~out_of_range() throw(); virtual ~out_of_range() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI range_error class _LIBCPP_EXCEPTION_ABI range_error
@@ -132,7 +134,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
virtual ~range_error() throw(); virtual ~range_error() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI overflow_error class _LIBCPP_EXCEPTION_ABI overflow_error
@@ -142,7 +144,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
virtual ~overflow_error() throw(); virtual ~overflow_error() _NOEXCEPT;
}; };
class _LIBCPP_EXCEPTION_ABI underflow_error class _LIBCPP_EXCEPTION_ABI underflow_error
@@ -152,7 +154,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
virtual ~underflow_error() throw(); virtual ~underflow_error() _NOEXCEPT;
}; };
} // std } // std

View File

@@ -112,7 +112,9 @@ protected:
#include <iosfwd> #include <iosfwd>
#include <ios> #include <ios>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -399,13 +401,13 @@ template <class _CharT, class _Traits>
void void
basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
{ {
_STD::swap(__loc_, __sb.__loc_); _VSTD::swap(__loc_, __sb.__loc_);
_STD::swap(__binp_, __sb.__binp_); _VSTD::swap(__binp_, __sb.__binp_);
_STD::swap(__ninp_, __sb.__ninp_); _VSTD::swap(__ninp_, __sb.__ninp_);
_STD::swap(__einp_, __sb.__einp_); _VSTD::swap(__einp_, __sb.__einp_);
_STD::swap(__bout_, __sb.__bout_); _VSTD::swap(__bout_, __sb.__bout_);
_STD::swap(__nout_, __sb.__nout_); _VSTD::swap(__nout_, __sb.__nout_);
_STD::swap(__eout_, __sb.__eout_); _VSTD::swap(__eout_, __sb.__eout_);
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
ios_base::openmode __which) ios_base::openmode)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type 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)); return pos_type(off_type(-1));
} }
@@ -538,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
{ {
if (__nout_ < __eout_) if (__nout_ < __eout_)
*__nout_++ = *__s; *__nout_++ = *__s;
else if (overflow(*__s) == __eof) else if (overflow(traits_type::to_int_type(*__s)) == __eof)
break; break;
} }
return __i; return __i;
@@ -546,16 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type 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(); return traits_type::eof();
} }
extern template class basic_streambuf<char>; _LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>)
extern template class basic_streambuf<wchar_t>; _LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>)
extern template class basic_ios<char>; _LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>)
extern template class basic_ios<wchar_t>; _LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>)
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -131,7 +131,9 @@ private:
#include <ostream> #include <ostream>
#include <istream> #include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -150,7 +152,9 @@ public:
strstreambuf(const unsigned char* __gnext, streamsize __n); strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstreambuf(strstreambuf&& __rhs); strstreambuf(strstreambuf&& __rhs);
_LIBCPP_INLINE_VISIBILITY
strstreambuf& operator=(strstreambuf&& __rhs); strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -187,6 +191,43 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg); void __init(char* __gnext, streamsize __n, char* __pbeg);
}; };
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
__pfree_(__rhs.__pfree_)
{
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
}
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf&
strstreambuf::operator=(strstreambuf&& __rhs)
{
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
{
if (__pfree_)
__pfree_(eback());
else
delete [] eback();
}
streambuf::operator=(__rhs);
__strmode_ = __rhs.__strmode_;
__alsize_ = __rhs.__alsize_;
__palloc_ = __rhs.__palloc_;
__pfree_ = __rhs.__pfree_;
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
class _LIBCPP_VISIBLE istrstream class _LIBCPP_VISIBLE istrstream
: public istream : public istream
{ {
@@ -207,8 +248,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs) istrstream(istrstream&& __rhs)
: istream(_STD::move(__rhs)), : istream(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
istream::set_rdbuf(&__sb_); istream::set_rdbuf(&__sb_);
} }
@@ -216,8 +257,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs) istrstream& operator=(istrstream&& __rhs)
{ {
istream::operator=(_STD::move(__rhs)); istream::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -256,8 +297,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs) ostrstream(ostrstream&& __rhs)
: ostream(_STD::move(__rhs)), : ostream(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
ostream::set_rdbuf(&__sb_); ostream::set_rdbuf(&__sb_);
} }
@@ -265,8 +306,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs) ostrstream& operator=(ostrstream&& __rhs)
{ {
ostream::operator=(_STD::move(__rhs)); ostream::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -316,8 +357,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs) strstream(strstream&& __rhs)
: iostream(_STD::move(__rhs)), : iostream(_VSTD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_)) __sb_(_VSTD::move(__rhs.__sb_))
{ {
iostream::set_rdbuf(&__sb_); iostream::set_rdbuf(&__sb_);
} }
@@ -325,8 +366,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs) strstream& operator=(strstream&& __rhs)
{ {
iostream::operator=(_STD::move(__rhs)); iostream::operator=(_VSTD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_); __sb_ = _VSTD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@@ -0,0 +1,5 @@
#define atof sun_atof
#define strtod sun_strtod
#include_next "floatingpoint.h"
#undef atof
#undef strtod

View 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

View 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

View 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

View File

@@ -0,0 +1,116 @@
// -*- C++ -*-
//===--------------------- support/win32/locale_win32.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
// ctype mask table defined in msvcrt.dll
extern "C" unsigned short __declspec(dllimport) _ctype[];
#include "support/win32/support.h"
#include <memory>
#include <xlocinfo.h> // _locale_t
#define locale_t _locale_t
#define LC_COLLATE_MASK _M_COLLATE
#define LC_CTYPE_MASK _M_CTYPE
#define LC_MONETARY_MASK _M_MONETARY
#define LC_NUMERIC_MASK _M_NUMERIC
#define LC_TIME_MASK _M_TIME
#define LC_MESSAGES_MASK _M_MESSAGES
#define LC_ALL_MASK ( LC_COLLATE_MASK \
| LC_CTYPE_MASK \
| LC_MESSAGES_MASK \
| LC_MONETARY_MASK \
| LC_NUMERIC_MASK \
| LC_TIME_MASK )
#define freelocale _free_locale
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t base );
locale_t uselocale( locale_t newloc );
lconv *localeconv_l( locale_t loc );
size_t mbrlen_l( const char *__restrict__ s, size_t n,
mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t len, mbstate_t *__restrict__ ps, locale_t loc );
size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
locale_t loc);
size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
size_t n, mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
wint_t btowc_l( int c, locale_t loc );
int wctob_l( wint_t c, locale_t loc );
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
{
__locale_raii __current( uselocale(__l), uselocale );
return MB_CUR_MAX;
}
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
#include <stdio.h>
#define mbtowc_l _mbtowc_l
#define strtoll_l _strtoi64_l
#define strtoull_l _strtoui64_l
// FIXME: current msvcrt does not know about long double
#define strtold_l _strtod_l
#define islower_l _islower_l
#define isupper_l _isupper_l
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l
#define strxfrm_l _strxfrm_l
#define wcscoll_l _wcscoll_l
#define wcsxfrm_l _wcsxfrm_l
#define toupper_l _toupper_l
#define tolower_l _tolower_l
#define iswspace_l _iswspace_l
#define iswprint_l _iswprint_l
#define iswcntrl_l _iswcntrl_l
#define iswupper_l _iswupper_l
#define iswlower_l _iswlower_l
#define iswalpha_l _iswalpha_l
#define iswdigit_l _iswdigit_l
#define iswpunct_l _iswpunct_l
#define iswxdigit_l _iswxdigit_l
#define towupper_l _towupper_l
#define towlower_l _towlower_l
#define strftime_l _strftime_l
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
// not-so-pressing FIXME: use locale to determine blank characters
inline int isblank_l( int c, locale_t /*loc*/ )
{
return ( c == ' ' || c == '\t' );
}
inline int iswblank_l( wint_t c, locale_t /*loc*/ )
{
return ( c == L' ' || c == L'\t' );
}
#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

View 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

View File

@@ -0,0 +1,115 @@
// -*- C++ -*-
//===----------------------- support/win32/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
/*
Functions and constants used in libc++ that are missing from the Windows C library.
*/
#include <__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 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 );
#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

View File

@@ -20,24 +20,24 @@ namespace std
class error_category class error_category
{ {
public: public:
virtual ~error_category(); virtual ~error_category() noexcept;
error_category(const error_category&) = delete; error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete; error_category& operator=(const error_category&) = delete;
virtual const char* name() const = 0; virtual const char* name() const noexcept = 0;
virtual error_condition default_error_condition(int ev) const; virtual error_condition default_error_condition(int ev) const noexcept;
virtual bool equivalent(int code, const error_condition& condition) const; virtual bool equivalent(int code, const error_condition& condition) const noexcept;
virtual bool equivalent(const error_code& code, int condition) const; virtual bool equivalent(const error_code& code, int condition) const noexcept;
virtual string message(int ev) const = 0; virtual string message(int ev) const = 0;
bool operator==(const error_category& rhs) const; bool operator==(const error_category& rhs) const noexcept;
bool operator!=(const error_category& rhs) const; bool operator!=(const error_category& rhs) const noexcept;
bool operator<(const error_category& rhs) const; bool operator<(const error_category& rhs) const noexcept;
}; };
const error_category& generic_category(); const error_category& generic_category() noexcept;
const error_category& system_category(); const error_category& system_category() noexcept;
template <class T> struct is_error_code_enum template <class T> struct is_error_code_enum
: public false_type {}; : public false_type {};
@@ -49,27 +49,27 @@ class error_code
{ {
public: public:
// constructors: // constructors:
error_code(); error_code() noexcept;
error_code(int val, const error_category& cat); error_code(int val, const error_category& cat) noexcept;
template <class ErrorCodeEnum> template <class ErrorCodeEnum>
error_code(ErrorCodeEnum e); error_code(ErrorCodeEnum e) noexcept;
// modifiers: // modifiers:
void assign(int val, const error_category& cat); void assign(int val, const error_category& cat) noexcept;
template <class ErrorCodeEnum> template <class ErrorCodeEnum>
error_code& operator=(ErrorCodeEnum e); error_code& operator=(ErrorCodeEnum e) noexcept;
void clear(); void clear() noexcept;
// observers: // observers:
int value() const; int value() const noexcept;
const error_category& category() const; const error_category& category() const noexcept;
error_condition default_error_condition() const; error_condition default_error_condition() const noexcept;
string message() const; string message() const;
explicit operator bool() const; explicit operator bool() const noexcept;
}; };
// non-member functions: // non-member functions:
bool operator<(const error_code& lhs, const error_code& rhs); bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
template <class charT, class traits> template <class charT, class traits>
basic_ostream<charT,traits>& basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& os, const error_code& ec); operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
@@ -78,25 +78,25 @@ class error_condition
{ {
public: public:
// constructors: // constructors:
error_condition(); error_condition() noexcept;
error_condition(int val, const error_category& cat); error_condition(int val, const error_category& cat) noexcept;
template <class ErrorConditionEnum> template <class ErrorConditionEnum>
error_condition(ErrorConditionEnum e); error_condition(ErrorConditionEnum e) noexcept;
// modifiers: // modifiers:
void assign(int val, const error_category& cat); void assign(int val, const error_category& cat) noexcept;
template <class ErrorConditionEnum> template <class ErrorConditionEnum>
error_condition& operator=(ErrorConditionEnum e); error_condition& operator=(ErrorConditionEnum e) noexcept;
void clear(); void clear() noexcept;
// observers: // observers:
int value() const; int value() const noexcept;
const error_category& category() const; const error_category& category() const noexcept;
string message() const; string message() const noexcept;
explicit operator bool() const; explicit operator bool() const noexcept;
}; };
bool operator<(const error_condition& lhs, const error_condition& rhs); bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
class system_error class system_error
: public runtime_error : public runtime_error
@@ -109,8 +109,8 @@ public:
system_error(int ev, const error_category& ecat, const char* what_arg); system_error(int ev, const error_category& ecat, const char* what_arg);
system_error(int ev, const error_category& ecat); system_error(int ev, const error_category& ecat);
const error_code& code() const throw(); const error_code& code() const noexcept;
const char* what() const throw(); const char* what() const noexcept;
}; };
enum class errc enum class errc
@@ -198,18 +198,18 @@ enum class errc
template <> struct is_error_condition_enum<errc> template <> struct is_error_condition_enum<errc>
: true_type { } : true_type { }
error_code make_error_code(errc e); error_code make_error_code(errc e) noexcept;
error_condition make_error_condition(errc e); error_condition make_error_condition(errc e) noexcept;
// Comparison operators: // Comparison operators:
bool operator==(const error_code& lhs, const error_code& rhs); bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
bool operator==(const error_code& lhs, const error_condition& rhs); bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_code& rhs); bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_condition& rhs); bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_code& rhs); bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_condition& rhs); bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_code& rhs); bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_condition& rhs); bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
template <> struct hash<std::error_code>; template <> struct hash<std::error_code>;
@@ -223,7 +223,9 @@ template <> struct hash<std::error_code>;
#include <stdexcept> #include <stdexcept>
#include <__functional_base> #include <__functional_base>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -243,9 +245,8 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
// for them: // for them:
//enum class errc //enum class errc
struct errc _LIBCPP_DECLARE_STRONG_ENUM(errc)
{ {
enum _ {
address_family_not_supported = EAFNOSUPPORT, address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE, address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL, address_not_available = EADDRNOTAVAIL,
@@ -341,58 +342,52 @@ enum _ {
value_too_large = EOVERFLOW, value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE wrong_protocol_type = EPROTOTYPE
}; };
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <> template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc> struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { }; : true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <> template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_> struct _LIBCPP_VISIBLE is_error_condition_enum<errc::__lx>
: true_type { }; : true_type { };
#endif
class error_condition; class _LIBCPP_VISIBLE error_condition;
class error_code; class _LIBCPP_VISIBLE error_code;
// class error_category // class error_category
class __do_message; class _LIBCPP_HIDDEN __do_message;
class _LIBCPP_VISIBLE error_category class _LIBCPP_VISIBLE error_category
{ {
public: public:
virtual ~error_category(); virtual ~error_category() _NOEXCEPT;
error_category() _NOEXCEPT;
private: private:
error_category();
error_category(const error_category&);// = delete; error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete; error_category& operator=(const error_category&);// = delete;
public: public:
virtual const char* name() const = 0; virtual const char* name() const _NOEXCEPT = 0;
virtual error_condition default_error_condition(int __ev) const; virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
virtual bool equivalent(int __code, const error_condition& __condition) const; virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
virtual bool equivalent(const error_code& __code, int __condition) const; virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
virtual string message(int __ev) const = 0; virtual string message(int __ev) const = 0;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator==(const error_category& __rhs) const {return this == &__rhs;} bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);} bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const {return this < &__rhs;} bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
friend class __do_message; friend class _LIBCPP_HIDDEN __do_message;
}; };
class _LIBCPP_HIDDEN __do_message class _LIBCPP_HIDDEN __do_message
@@ -402,8 +397,8 @@ public:
virtual string message(int ev) const; virtual string message(int ev) const;
}; };
const error_category& generic_category(); const error_category& generic_category() _NOEXCEPT;
const error_category& system_category(); const error_category& system_category() _NOEXCEPT;
class _LIBCPP_VISIBLE error_condition class _LIBCPP_VISIBLE error_condition
{ {
@@ -411,66 +406,68 @@ class _LIBCPP_VISIBLE error_condition
const error_category* __cat_; const error_category* __cat_;
public: public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition() : __val_(0), __cat_(&generic_category()) {} error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition(int __val, const error_category& __cat) error_condition(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _E> template <class _Ep>
_LIBCPP_ALWAYS_INLINE _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);} {*this = make_error_condition(__e);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat) void assign(int __val, const error_category& __cat) _NOEXCEPT
{ {
__val_ = __val; __val_ = __val;
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _E> template <class _Ep>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_condition_enum<_E>::value, is_error_condition_enum<_Ep>::value,
error_condition& error_condition&
>::type >::type
operator=(_E __e) operator=(_Ep __e) _NOEXCEPT
{*this = make_error_condition(__e); return *this;} {*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void clear() void clear() _NOEXCEPT
{ {
__val_ = 0; __val_ = 0;
__cat_ = &generic_category(); __cat_ = &generic_category();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int value() const {return __val_;} int value() const _NOEXCEPT {return __val_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_category& category() const {return *__cat_;} const error_category& category() const _NOEXCEPT {return *__cat_;}
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
//explicit _LIBCPP_EXPLICIT
operator bool() const {return __val_ != 0;} operator bool() const _NOEXCEPT {return __val_ != 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
error_condition error_condition
make_error_condition(errc __e) make_error_condition(errc __e) _NOEXCEPT
{ {
return error_condition(static_cast<int>(__e), generic_category()); return error_condition(static_cast<int>(__e), generic_category());
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const error_condition& __x, const error_condition& __y) operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value(); || (__x.category() == __y.category() && __x.value() < __y.value());
} }
// error_code // error_code
@@ -481,83 +478,85 @@ class _LIBCPP_VISIBLE error_code
const error_category* __cat_; const error_category* __cat_;
public: public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code() : __val_(0), __cat_(&system_category()) {} error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code(int __val, const error_category& __cat) error_code(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _E> template <class _Ep>
_LIBCPP_ALWAYS_INLINE _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);} {*this = make_error_code(__e);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat) void assign(int __val, const error_category& __cat) _NOEXCEPT
{ {
__val_ = __val; __val_ = __val;
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _E> template <class _Ep>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_code_enum<_E>::value, is_error_code_enum<_Ep>::value,
error_code& error_code&
>::type >::type
operator=(_E __e) operator=(_Ep __e) _NOEXCEPT
{*this = make_error_code(__e); return *this;} {*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void clear() void clear() _NOEXCEPT
{ {
__val_ = 0; __val_ = 0;
__cat_ = &system_category(); __cat_ = &system_category();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int value() const {return __val_;} int value() const _NOEXCEPT {return __val_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_category& category() const {return *__cat_;} const error_category& category() const _NOEXCEPT {return *__cat_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition default_error_condition() const error_condition default_error_condition() const _NOEXCEPT
{return __cat_->default_error_condition(__val_);} {return __cat_->default_error_condition(__val_);}
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
//explicit _LIBCPP_EXPLICIT
operator bool() const {return __val_ != 0;} operator bool() const _NOEXCEPT {return __val_ != 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
error_code error_code
make_error_code(errc __e) make_error_code(errc __e) _NOEXCEPT
{ {
return error_code(static_cast<int>(__e), generic_category()); return error_code(static_cast<int>(__e), generic_category());
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const error_code& __x, const error_code& __y) operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() 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 inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_code& __x, const error_code& __y) operator==(const error_code& __x, const error_code& __y) _NOEXCEPT
{ {
return __x.category() == __y.category() && __x.value() == __y.value(); return __x.category() == __y.category() && __x.value() == __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_code& __x, const error_condition& __y) operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
{ {
return __x.category().equivalent(__x.value(), __y) return __x.category().equivalent(__x.value(), __y)
|| __y.category().equivalent(__x, __y.value()); || __y.category().equivalent(__x, __y.value());
@@ -565,40 +564,44 @@ operator==(const error_code& __x, const error_condition& __y)
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_condition& __x, const error_code& __y) operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
{ {
return __y == __x; return __y == __x;
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_condition& __x, const error_condition& __y) operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{ {
return __x.category() == __y.category() && __x.value() == __y.value(); return __x.category() == __y.category() && __x.value() == __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);} operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);} operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);} operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);} operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
template <> template <>
struct _LIBCPP_VISIBLE hash<error_code> struct _LIBCPP_VISIBLE hash<error_code>
: public unary_function<error_code, size_t> : public unary_function<error_code, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t operator()(const error_code& __ec) const size_t operator()(const error_code& __ec) const _NOEXCEPT
{ {
return static_cast<size_t>(__ec.value()); return static_cast<size_t>(__ec.value());
} }
@@ -617,10 +620,10 @@ public:
system_error(int __ev, const error_category& __ecat, const string& __what_arg); system_error(int __ev, const error_category& __ecat, const string& __what_arg);
system_error(int __ev, const error_category& __ecat, const char* __what_arg); system_error(int __ev, const error_category& __ecat, const char* __what_arg);
system_error(int __ev, const error_category& __ecat); system_error(int __ev, const error_category& __ecat);
~system_error() throw(); ~system_error() _NOEXCEPT;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_code& code() const throw() {return __ec_;} const error_code& code() const _NOEXCEPT {return __ec_;}
private: private:
static string __init(const error_code&, string); static string __init(const error_code&, string);

View File

@@ -22,6 +22,8 @@
#include <complex.h> #include <complex.h>
#include <math.h> #include <math.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_TGMATH_H #endif // _LIBCPP_TGMATH_H

Some files were not shown because too many files have changed in this diff Show More