Compare commits

...

459 Commits

Author SHA1 Message Date
Bill Wendling
699f9ca983 Creating release_30 branch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_30@142042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-15 01:58:33 +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
Howard Hinnant
469d419a17 Correction to set of overloaded pair constructors for C++0x
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:10:55 +00:00
Douglas Gregor
7ac6af7027 Qualify calls to std::next(), to avoid conflicts with
libraries/applications that define their own 'next' template.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130511 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 16:20:26 +00:00
Howard Hinnant
e14ea5835e http://llvm.org/bugs/show_bug.cgi?id=9765
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129910 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-21 14:29:59 +00:00
Howard Hinnant
75f7695c62 Think-o in poisson_distribution at mean == 10
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129520 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14 15:59:22 +00:00
Howard Hinnant
ef3b2e2e34 Fix bug in Sseq constraints found by Seth Cantrell
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129285 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 18:22:12 +00:00
Howard Hinnant
9dbeff919b http://llvm.org/bugs/show_bug.cgi?id=9672
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129266 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-11 02:18:41 +00:00
Howard Hinnant
8c1aa2c24d Changes to cerrno to protect against the case the ELAST is not defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 19:46:55 +00:00
Howard Hinnant
506b36487c time_get was missing the %F specifier. This change impacts the binary.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@129251 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-10 17:54:14 +00:00
Howard Hinnant
a02851e8a2 Chris Jefferson found a missing const (Bugzilla 9632)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128885 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-05 14:55:28 +00:00
Howard Hinnant
3e93e96dff Corrected tests for http://llvm.org/bugs/show_bug.cgi?id=9351
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-04 01:42:30 +00:00
Howard Hinnant
b8a03c763a ... And these wonderful tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128797 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-03 20:06:31 +00:00
Howard Hinnant
d615e47bea Chris Jefferson submitted this patch to fix http://llvm.org/bugs/show_bug.cgi?id=9351
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128796 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-03 20:05:29 +00:00
Howard Hinnant
154002bb5d Provide a more readable error message for <atomic> until it is implemented.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128636 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-31 16:39:39 +00:00
Howard Hinnant
41fb6e1432 Jonathan Sauer found a bug in the way ^ was handled
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128350 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 20:02:27 +00:00
Howard Hinnant
86e78d694c Jonathan Sauer updated is_base_of traits status
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@128349 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-26 19:58:42 +00:00
Nick Kledzik
770a3c5116 <rdar://problem/9073695> std::uncaught_exception() becomes true before evaluating the throw-expression rather than after
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127499 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-11 22:33:07 +00:00
Howard Hinnant
d0a2fbfe60 http://llvm.org/bugs/show_bug.cgi?id=9444
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127412 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 17:27:57 +00:00
Howard Hinnant
f9b8998795 I have to revert this recent fix to tuple conversions until clang implements cwg 1170. Without this fix pair and tuple don't convert properly. With it, associative containers get access errors when they shouldn't. cwg 1170 fixes the latter.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127411 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-10 17:27:30 +00:00
Howard Hinnant
6e5e7e78ee Corrected const-correctness on nullptr type_traits, and beefed up the test for nullptr_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127338 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 17:17:06 +00:00
Howard Hinnant
5885da34ce Walter Brown brought to my attention that type_traits was failing to correctly classify nullptr_t
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127334 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 15:10:51 +00:00
Howard Hinnant
80586729e4 Chris Jefferson found a defect in the C++0x working draft by trying to run libc++ against boost. I've submitted an issue to the LWG, and this commit attempts to implement the proposed resolution of that defect report. I'd point to the issue but it hasn't been put into the LWG list yet. The title of the issue will be: Stage 2 accumulate incompatibilty
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@127303 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-09 01:03:19 +00:00
Howard Hinnant
8dcad976e0 http://llvm.org/bugs/show_bug.cgi?id=9349 I introduced a bug with the last fix and Ryuta Suzuki has corrected it. And hopefully I committed Ryuta Suzuki's directions correctly this time.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126917 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03 01:59:23 +00:00
Howard Hinnant
542b0f0cf5 http://llvm.org/bugs/show_bug.cgi?id=9349 I have not personally tested this patch. Please let me know if it causes problems.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126846 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-02 17:29:46 +00:00
Howard Hinnant
fddf722f4e Chris Jefferson found this bug to pair/tuple introduced by a recent change to the draft that I missed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126743 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-01 14:27:55 +00:00
Howard Hinnant
171869e27c Fix copy_n to increment only n-1 times for an input iterator. This works much better with std::istream_iterator<int>(std::cin). Credit: Matan Nassau.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 20:55:39 +00:00
Howard Hinnant
df85e57f4a Fixed two problems found by Chris Jefferson: Made operator>> for char consistent with gcc. Opened an LWG issue on this one. 2) Renamed some private typedefs which are causing boost grief.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126576 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-27 18:02:02 +00:00
Howard Hinnant
e7c8da6f2d http://llvm.org/bugs/show_bug.cgi?id=9326
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126504 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 19:52:41 +00:00
Howard Hinnant
b2080c70d4 Chris Jefferson spotted a problem with messages_base::catalog while getting libc++ to work on boost. The standard says this type must be an int. But this type is the key returned by the OS facility catopen. On OS X the type returned by catopen is void*, which doesn't fit into an int on 64 bit platforms. Chris suggested using ptrdiff_t instead of void*. It still isn't compliant with the standard, but chances are that this change will fix what is ailing boost. Chris also supplied the algorithm for distinguishing high-order pointers from error conditions. Thanks Chris.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126462 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-25 00:51:08 +00:00
Howard Hinnant
5a245dbf52 Jean-Daniel Dupas fixes install directions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@126222 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-22 14:18:34 +00:00
Howard Hinnant
08774c5a22 Change install name to libc++.1.dylib
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@125626 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16 00:40:06 +00:00
Howard Hinnant
6cf5d8c3aa Chris Jefferson noted many places where function calls needed to be qualified (thanks Chris).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@125510 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 19:12:38 +00:00
Howard Hinnant
c4cbb5b6b7 Update testit to default to clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@125498 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-14 18:06:10 +00:00
Howard Hinnant
621ee222d9 fix stupid type-o
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@125311 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 21:34:42 +00:00
Howard Hinnant
31b8e617b6 Installed __has_feature(is_convertible_to) and __has_feature(is_base_of)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@125290 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-10 17:46:03 +00:00
Howard Hinnant
47a7cce01e Missing traits::to_int_type in fstream
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124727 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 17:37:16 +00:00
Howard Hinnant
2529d02b5d Qualify calls to addressof with std::. Bug 9106
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124726 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-02 17:36:20 +00:00
Howard Hinnant
211f0ee1be Bug 9096 - list::iterator not default constructible
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124508 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 23:46:28 +00:00
Howard Hinnant
80f9180729 minor corrections to test, and hook is_base_of up to clang intrinsic
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124502 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-28 20:00:37 +00:00
Douglas Gregor
9ca45e21b8 Eliminate extraneous {};
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124456 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 23:36:08 +00:00
Howard Hinnant
65451f1549 Updated getting started directions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124452 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 23:18:19 +00:00
Howard Hinnant
30bbc93088 updated buildit to work with recent clang updates
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124432 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 21:01:51 +00:00
Howard Hinnant
9a21a01946 clang found a missing return statement.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124431 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 21:01:11 +00:00
Howard Hinnant
99b2f7660d Make forward_list splice_after and merge work for lvalue lists
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124430 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 21:00:35 +00:00
Howard Hinnant
091c5ace78 Reverted previous fix to is_convertible as it caused more problems than it fixed. But this reverted fix will only matter for non-clang compilers. Installed __is_convertible_to for clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124429 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27 21:00:00 +00:00
Douglas Gregor
497ac97247 Inline namespaces are always available in Clang. Rely on that without
testing via __has_feature, since __has_feature for C++0x features no
longer evaluates true in C++98/03 mode.

Also, eliminate the redundant using directive. Inline namespaces make
their members visible in the enclosing namespace automatically.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124293 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 15:39:56 +00:00
Douglas Gregor
aab015a929 Teach move_iterator that rvalue references cannot bind to non-function
lvalues, nor can one take the address of an xvalue, by adding
appropriate static_cast's (in the first case) and a temporary (in the
second case).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124255 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 00:12:48 +00:00
Howard Hinnant
9f193f202f Add always_inline to string move constructors
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124252 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-26 00:06:59 +00:00
Douglas Gregor
5ea2e37c08 Remove an (incorrect) compiler workaround in the __mu function. The
workaround relied on rvalue references binding to non-function
lvalues, while the original formulation (with std::forward) does the
right thing.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124241 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 23:11:15 +00:00
Howard Hinnant
4ff9d3599c placeholder test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124193 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 16:32:04 +00:00
Howard Hinnant
56a85ca8bf tweak for readability (no functionality change)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124192 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 16:31:30 +00:00
Douglas Gregor
6c669943b3 An rvalue reference cannot bind to an lvalue, so static_cast the
result of the __tuple_leaf::get() call to an rvalue reference when
returning from tuple's get().


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124190 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 16:14:21 +00:00
Douglas Gregor
f9e1c7e367 Eliminate the C++0x-only is_convertible testing function that accepts
a cv-qualifier rvalue reference to the type, e.g.,

  template <class _Tp> char  __test(const volatile typename remove_reference<_Tp>::type&&);

The use of this function signature rather than the more
straightforward one used in C++98/03 mode, e.g.,

  template <class _Tp> char  __test(_Tp);

is broken in two ways:

  1) An rvalue reference cannot bind to lvalues, so is_convertible<X&,
  X&>::value would be false. This breaks two of the unique_ptr tests
  on Clang and GCC >= 4.5. Prior GCC's seem to have allowed rvalue
  references to bind to lvalues, allowing this bug to slip in.

  2) By adding cv-qualifiers to the type we're converting to, we get
  some incorrect "true" results for, e.g., is_convertible<const X&, X&>::value.





git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124166 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-25 01:15:41 +00:00
Howard Hinnant
f83417b823 Chandler Carruth changed >> to > > in several places.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124120 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-24 16:07:25 +00:00
Chandler Carruth
e76496ce46 Teach the Lit configuration to actually use the cxx0x setting when
constructing compile flags, and to link against the 'rt' library on
Linux for clock_gettime and friends.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@124052 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-23 01:05:20 +00:00
Howard Hinnant
5f5859c45b Add attribute to inlined member.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@123392 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-13 20:05:05 +00:00
Howard Hinnant
6fd4b669ca Fixing an ambiguity in variadics found by clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@123337 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-12 22:56:59 +00:00
Howard Hinnant
ac38bae75b fix guard
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@123269 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-11 20:02:45 +00:00
Howard Hinnant
52c4eb23e0 Two minor fixes: 1. Put integral_constant conversion to integral in even without constexpr support. 2. Add ios_base to <iosfwd>. The latter is being tracked by LWG 2026.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@123080 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-08 20:00:48 +00:00
Howard Hinnant
04240d90ef Reverting an old optimization that conflicts with the new allocator model, and causes some test casees to compile that shouldn't.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@122830 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 19:53:31 +00:00
Howard Hinnant
93c382bf45 Marshall Clow's fix for Bug 8421.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@122825 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-04 19:21:05 +00:00
Howard Hinnant
2d72b1e393 Effort to reduce the number of exported symbols
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@122057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-17 14:46:43 +00:00
Howard Hinnant
e48e36623b Reduced copying cost of tuple_cat from quadratic to linear.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121655 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-12 23:04:37 +00:00
Howard Hinnant
0e1493ec5e LWG 1385 [FCD] tuple_cat should be a single variadic signature (http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-active.html#1385). This issue is only in Ready status, meaning it is not official, but probably will be this March in Madrid. It was tentatively accepted in Batavia with the previso that Bill and I didn't have any problems implementing it. This is my part of that agreement.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121619 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-11 20:47:50 +00:00
Howard Hinnant
eee7698bac The implementation of the new definition of result_of (N3123) resulted in some test failures in [func.memfn] that I failed to previously notice. This corrects that mistake.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121600 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-11 00:05:19 +00:00
Michael J. Spencer
626916fc25 Add CMake build and fix major Linux blockers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121510 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 19:47:54 +00:00
Howard Hinnant
b8f787b188 Test adjustment for recent changes in allocator_traits
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121503 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 19:22:37 +00:00
Howard Hinnant
f190e97885 This got accidentally removed
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121502 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 19:22:00 +00:00
Howard Hinnant
31aaf55f4c N3158 Missing preconditions for default-constructed match_result objects
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121282 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 21:07:55 +00:00
Howard Hinnant
1b18a48e28 cleaning up...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121275 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 20:09:09 +00:00
Howard Hinnant
770d1c4ea7 After a long break to wait for the atomic spec to settle, this completes the library part of <atomic>. It currently won't even parse as it depends on the existence of the intrinsics specified at http://libcxx.llvm.org/atomic_design_a.html. Everything has been tested using fake intrinsics which have now been removed. As the intrinsics come online, the ATOMIC_* macros will need to be adjusted to reflect which operations are lock-free. These macros will probably need to be #ifdef'd for each supported platform.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121267 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 17:20:28 +00:00
Michael J. Spencer
c9f5d9fca6 test: Rename string_op+= to string_op_plus_equal. Windows git doesn't like it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121265 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-08 17:06:47 +00:00
Howard Hinnant
d2f6afbfab atomics ...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121204 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:24:41 +00:00
Howard Hinnant
57e5e87323 atomics ...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121203 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:24:09 +00:00
Howard Hinnant
f02417b600 atomics ...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 23:20:28 +00:00
Howard Hinnant
91e2f26fec Work on <atomic> continues. The file size is actually sane now...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121181 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-07 20:46:14 +00:00
Howard Hinnant
4777bf2799 Getting <atomic> warmed back up. We have a hopefully more stable spec now. And I believe the intrinsic spec at http://libcxx.llvm.org/atomic_design_a.html is still good.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 23:10:08 +00:00
Howard Hinnant
7a0248d2d7 Add a couple more std-qualifers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@121002 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-06 15:11:48 +00:00
Howard Hinnant
d42c4beeff oops, forgot std::
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120915 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 19:56:43 +00:00
Howard Hinnant
1f970ad73a Fix up uses of new/terminate/unexpected handlers to use the new getters.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120914 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-04 19:54:11 +00:00
Howard Hinnant
55ddb21dd4 Add typeinfo for char16_t, char32_t and nullptr.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120810 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-03 17:25:24 +00:00
Howard Hinnant
a445151f4a N3189 Observers for the three handler functions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120712 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-02 16:45:21 +00:00
Howard Hinnant
7de47902d0 Implemented N3194
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-30 20:23:32 +00:00
Howard Hinnant
ac417faebc Minor fixup in <ratio> and add optional support for shared_mutex and upgrade_mutex which must be opted into with #define _LIBCPP_SHARED_LOCK
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-28 19:41:07 +00:00
Howard Hinnant
d397d03651 Add template alias emulation to <ratio>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-24 17:05:06 +00:00
Howard Hinnant
c706565c88 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120064 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 22:13:07 +00:00
Howard Hinnant
6051e24e45 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:55:56 +00:00
Howard Hinnant
adaa6266fe Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:55:36 +00:00
Howard Hinnant
8771430346 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120054 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:47:09 +00:00
Howard Hinnant
46ab5def62 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120052 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:45:26 +00:00
Howard Hinnant
fa5043d878 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120050 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:41:07 +00:00
Howard Hinnant
83b6979fa2 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120047 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:29:54 +00:00
Howard Hinnant
59a5ddbbd1 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120046 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:27:28 +00:00
Howard Hinnant
afff5aacd6 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120045 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:26:48 +00:00
Howard Hinnant
17c3a81048 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120043 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:25:10 +00:00
Howard Hinnant
5711e4daf0 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120041 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:22:13 +00:00
Howard Hinnant
6587dfe980 Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120040 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 20:21:36 +00:00
Howard Hinnant
73d2f94f6b Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120036 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:52:19 +00:00
Howard Hinnant
091f2ab44f Update testsuite strucuture to latest draft
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 19:15:49 +00:00
Howard Hinnant
6689564040 N3188 - Revision to N3113: Async Launch Policies (CH 36)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@120027 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-23 18:33:54 +00:00
Howard Hinnant
f8f852138f N3191: C++ Timeout Specification
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119909 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 19:16:30 +00:00
Howard Hinnant
f048fe3a09 N3123
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119906 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-20 18:25:22 +00:00
Howard Hinnant
1468b668aa N3142. Many of these traits are just placeholders with medium quality emulation; waiting on compiler intrinsics to do it right.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119854 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 22:17:28 +00:00
Howard Hinnant
01feecb789 type_traits intrinsics design
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119776 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 01:48:13 +00:00
Howard Hinnant
9835d76169 type_traits intrinsics design
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119775 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-19 01:38:58 +00:00
Howard Hinnant
995676a98e LWG 1522
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119710 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:34:48 +00:00
Howard Hinnant
9650b6cce3 LWG 1439
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119703 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 17:01:36 +00:00
Howard Hinnant
2f6a627394 LWG 1339
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119699 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 16:13:03 +00:00
Howard Hinnant
278bf2d289 LWG 1432
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119611 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 01:47:02 +00:00
Howard Hinnant
47761071be LWG 1404
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119609 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-18 01:40:00 +00:00
Howard Hinnant
34d6b19721 LWG 1325
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119571 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:53:14 +00:00
Howard Hinnant
7b2cb48cc1 LWG 1323
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119560 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 21:11:40 +00:00
Howard Hinnant
cd2254b454 LWG 1191
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:52:17 +00:00
Howard Hinnant
86ed8aefb2 LWG 1118
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119541 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 19:22:43 +00:00
Howard Hinnant
e32b5e2f23 Update <string> to use allocator_traits.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119522 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-17 17:55:08 +00:00
Howard Hinnant
b64f8b07c1 license change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119395 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 22:09:02 +00:00
Chris Lattner
f38bc6efc5 libc++ is now dual licensed under both UIUC and MIT licenses.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119391 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:40:19 +00:00
Chris Lattner
662497edd2 add a credits file for libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119390 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:39:15 +00:00
Howard Hinnant
28dbbe0596 Dave Zarzycki showed how the efficiency of shared_ptr could be significantly
increased.  The following program is running 49% faster:

#include <iostream>
#include <memory>
#include <chrono>
#include <vector>
#include "chrono_io"

int main()
{
    typedef std::chrono::high_resolution_clock Clock;
    Clock::time_point t0 = Clock::now();
    {
        std::shared_ptr<int> p(new int (1));
        std::vector<std::shared_ptr<int> > v(1000000, p);
        v.insert(v.begin(), p);
        v.insert(v.begin(), p);
        v.insert(v.begin(), p);
        v.insert(v.begin(), p);
    }
    Clock::time_point t1 = Clock::now();
    std::cout << (t1-t0) << '\n';
}


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:33:17 +00:00
Howard Hinnant
726a76fb47 I have reverted all contributions made by Jesse Towner in revision 110724
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@119383 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-16 21:10:23 +00:00
Nick Kledzik
a8feecea67 update to use new linker option to re-export from libc++abi.dylb
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@117691 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 19:46:14 +00:00
Howard Hinnant
e87ad178cc Secure __next_prime from overflowing
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@117650 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-29 14:10:30 +00:00
Howard Hinnant
4e59948249 Fixed bug in random_shuffle to avoid swapping with self
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@117098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-22 15:26:39 +00:00
Howard Hinnant
bce9c3132d [atomics.types.address]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@117033 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-21 17:44:19 +00:00
Howard Hinnant
f26262dde0 Updated chart with weekly test results, and updated export files for chnages in <atomic>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116943 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-20 20:15:14 +00:00
Howard Hinnant
5bbe97ddaa atomic_schar, atomic_uchar, atomic_short, atomic_ushort, atomic_int, atomic_uint, atomic_long, atomic_ulong, atomic_llong, atomic_ullong, atomic_char16_t, atomic_char32_t and atomic_wchar_t.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116860 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 21:22:10 +00:00
Howard Hinnant
e738501eb3 atomic_char
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116813 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-19 16:51:18 +00:00
Howard Hinnant
21ef47f436 Changing <atomic> to follow Design A
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 20:39:07 +00:00
Howard Hinnant
be22ed405a Update atomic Design A spec with reference C++ implementations for the purpose of documeting the semantics of each atomic operation.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116713 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 16:40:13 +00:00
Howard Hinnant
f6fe084fd4 Update atomic Design A spec
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116707 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-18 16:02:24 +00:00
Howard Hinnant
0d5dff1897 Fix two test bugs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116515 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 21:08:32 +00:00
Howard Hinnant
b742dcdd52 Convert __thread_local_data to the singleton pattern and change export files...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116501 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 19:24:23 +00:00
Howard Hinnant
5306d68019 Convert __thread_local_data to the singleton pattern
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 19:18:04 +00:00
Howard Hinnant
8177207f3c Bug 7983 fixed by Bernhard Rosenkraenzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-14 17:11:39 +00:00
Nick Kledzik
f9734c831f temporarily use cc to link instead of clang to work around issue with -Xarch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116435 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 21:12:41 +00:00
Nick Kledzik
373a9d18d3 update export list for when building with clang++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116434 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 21:11:52 +00:00
Howard Hinnant
4d89249185 updated for weekly test results
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116425 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 20:24:31 +00:00
Howard Hinnant
3c143ad882 Patch by Marshall Clow to make the assignment operators of piecewise_constant_distribution and piecewise_linear_distribution exception safe.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116404 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-13 14:37:09 +00:00
Howard Hinnant
08f2969220 Updated atomic design docs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@116065 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-08 17:36:50 +00:00
Howard Hinnant
ffb9a4e235 Corrected an inconsistency with recent changes in tuple, and perfect forwarding within bind
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115930 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 18:03:23 +00:00
Howard Hinnant
251aaa1064 Relaxing timing test a bit to avoid spurious test failures under load
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115920 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 16:25:31 +00:00
Howard Hinnant
77868b9d9a Update atomic design A
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115913 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-07 14:18:37 +00:00
Howard Hinnant
086b718734 Updated <atomic> docs with three design options
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115791 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 16:15:10 +00:00
Howard Hinnant
e78d1f548b A compiler writer's guide to <atomic>, minor update
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115633 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 17:22:28 +00:00
Howard Hinnant
56f0d5be06 A compiler writer's guide to <atomic>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115629 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 16:44:40 +00:00
Howard Hinnant
6cac2c2c9c Make flag type configurable by the compiler
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115614 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 14:02:23 +00:00
Howard Hinnant
b4ac745466 Thanks Sebastian\!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115612 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-05 13:38:23 +00:00
Howard Hinnant
002f1d341b Filling out the infrastructure in <atomic>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-04 23:55:35 +00:00
Howard Hinnant
26994e383c __has_feature crutch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115540 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-04 19:01:30 +00:00
Howard Hinnant
611fdaf229 Still working on the basic design of <atomic>. I'm working towards a system by which the compiler only needs to define the strongest intrinsics it can. Weaker atomics in the library automatically try stronger and stronger variants, picking the weakest compiler intrinsic available. If no compiler intrinsics are available for a given operation, the library locks a mutex and does the job. Better documentation to follow...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-04 18:52:54 +00:00
Howard Hinnant
7c0c696afd Tweak to make clang blocks work with std::functional (very fragile)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115461 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-03 13:59:56 +00:00
Howard Hinnant
364f5965da Bug 7984 by Bernhard Rosenkraenzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 23:27:23 +00:00
Howard Hinnant
1348fba3e2 Bug 8254 by Bernhard Rosenkraenzer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115430 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-02 23:23:25 +00:00
Howard Hinnant
79101aec3a [atomics.flag] completed. Initialization is not working on clang and can't be made to work without defaulted default constructors.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115207 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 21:05:29 +00:00
Howard Hinnant
f701e25c49 Name change of intrinsics as suggested by Jeffrey Yasskin
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115145 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-30 14:04:35 +00:00
Howard Hinnant
767ae2b483 Contemplating this <atomic> reorganization...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115087 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 21:20:03 +00:00
Howard Hinnant
5b6af69387 updated per weekly tests
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115081 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 20:15:25 +00:00
Howard Hinnant
c260b06366 Didn't mean to commit that one
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115058 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 18:33:45 +00:00
Howard Hinnant
ed760f40b7 Wrestling with the slowly dawning realization that <atomic> isn't implementable on any compiler at my disposal...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@115054 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-29 18:13:54 +00:00
Howard Hinnant
0ce02245a9 fixing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114967 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 17:19:10 +00:00
Howard Hinnant
d1176e29b0 [atomics.order]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114966 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-28 17:13:38 +00:00
Howard Hinnant
8f73c63658 Getting started on <atomic>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114887 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 21:17:38 +00:00
Howard Hinnant
d05c6e646b Bugzilla 8231
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114851 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 18:09:23 +00:00
Howard Hinnant
e049cc5f75 Cleaning up some tuple code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114848 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-27 17:54:17 +00:00
Howard Hinnant
ee6ccd0e32 visibility-decoration sweep completed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114685 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 18:58:28 +00:00
Howard Hinnant
8d7a9557b7 visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114671 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 17:31:07 +00:00
Howard Hinnant
28c97e6ee1 visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114658 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 16:27:36 +00:00
Howard Hinnant
aef07cbffd visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114647 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-23 15:13:20 +00:00
Howard Hinnant
b9af2eae4a visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114559 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 18:02:38 +00:00
Howard Hinnant
828948148d visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114551 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 16:48:34 +00:00
Howard Hinnant
68a8e90b3d visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114545 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 15:29:08 +00:00
Howard Hinnant
8c6cbb24e8 visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114543 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-22 14:16:26 +00:00
Howard Hinnant
42a63a781f visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114496 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 22:55:27 +00:00
Howard Hinnant
422a53fd7a visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114486 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 21:28:23 +00:00
Howard Hinnant
333f50d30c visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114470 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 20:16:37 +00:00
Howard Hinnant
b0be42b2ce visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114465 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 18:58:51 +00:00
Howard Hinnant
99acc5008b visibility-decoration.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114451 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 17:32:39 +00:00
Howard Hinnant
c0de2e48ff Getting started on a visibility-decoration sweep.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114440 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-21 16:04:28 +00:00
Howard Hinnant
3975ebd4f5 Tweak clang support for char16_t/char32_t
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114129 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 23:27:26 +00:00
Howard Hinnant
049734ed85 Updated chart for weekly test results.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@114029 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 21:56:37 +00:00
Daniel Dunbar
611581b853 tests/lit: Split options into two groups, so we don't get driver warnings about
unused linker arguments for compile only tests.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:31:58 +00:00
Daniel Dunbar
26a43c25d7 tests: Remove some stray cleanup code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:18:37 +00:00
Daniel Dunbar
7e0c57b203 tests: Fixup lit config, which got garbled somehow...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:11:29 +00:00
Daniel Dunbar
f5eadcd8d5 tests: Sketch a lit config for running libc++ tests; currently expects libc++ to have been installed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 03:57:04 +00:00
Howard Hinnant
45f5717812 Cement ABI on clang for char16_t and char32_t. Also fixed some comments in <iterator>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 20:26:27 +00:00
Howard Hinnant
d2a9251977 Experimenting with a new forward fomulation (kudos Daniel Kruegler), updated insert iterators to work better with pproxies, and doubled the speed of __next_prime.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 01:43:27 +00:00
Howard Hinnant
a0f1dc9f46 Fix another const bug in function. Thanks to Daniel Krugler for finding this and the previous bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 15:33:21 +00:00
Howard Hinnant
fdc5a0f321 Fix const bug in function
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 15:09:37 +00:00
Nick Kledzik
c7e4d82bc0 <rdar://problem/8279559> [libstdcxx] use new linker options to make symbols non-weak
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113616 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:42:36 +00:00
Howard Hinnant
36cdf027d2 I am experimenting with putting visibility-default attributes on all struct/classes in libc++. This checkin decorates only basic_string and vector as an experiment, and for review by those in this audience that might know more about visibilty than I do. If I get no negative feedback on this procedure I will begin to decorate the entire library in this way.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113590 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 16:42:26 +00:00
Howard Hinnant
cb2deb2652 Yonggang Luo fixed gcc version checking for type_traits support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113487 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 13:58:34 +00:00
Howard Hinnant
e764f0b648 Updated by-chapter-summary with weekly test results, and fixed up some bad paths in some tests caused by aligning the test suite with N3126.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113403 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 20:31:42 +00:00
Howard Hinnant
745d473ac1 Hooked the following up to clang: is_class, is_enum, has_nothrow_copy_assign, has_trivial_destructor, has_virtual_destructor, is_pod. Implemented has_copy_assign.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113373 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 17:55:32 +00:00
Howard Hinnant
27031115bf has_nothrow_copy_assign hooked up to clang
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113364 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 16:39:18 +00:00
Howard Hinnant
99ad765261 has_trivial_copy_assign hooked up to clang (without workarounds). Filed http://llvm.org/bugs/show_bug.cgi?id=8109 to take care of several types which don't work yet. If there is some reason we don't want to handle these types in the compiler, I can handle most of them in the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113312 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 23:38:59 +00:00
Howard Hinnant
954b366317 Made a stab at has_copy_constructor. Got it mostly working for g++-4.0, but only works for scalar types on clang. Ultimately this needs a compiler-supported is_constructible which clang is missing, and won't be able to use until it gets variadic templates.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113304 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 23:11:28 +00:00
Howard Hinnant
aad0db393f has_nothrow_copy_constructor hooked up to clang. Filed http://llvm.org/bugs/show_bug.cgi?id=8107 to take care of several types which don't work yet. If there is some reason we don't want to handle these types in the compiler, I can handle most of them in the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113294 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 22:09:07 +00:00
Howard Hinnant
87eea6d801 has_trivial_copy_constructor hooked up to clang. Filed http://llvm.org/bugs/show_bug.cgi?id=8105 to take care of void, arrays of incomplete bounds and complete bounds which don't work yet. If there is some reason we don't want to handle these types in the compiler, I can handle them in the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113270 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 20:31:18 +00:00
Howard Hinnant
bb73d762b2 Made a stab at has_default_constructor. Got it mostly working for g++-4.0, but only works for scalar types on clang. Ultimately this needs a compiler-supported is_constructible which clang is missing, and won't be able to use until it gets variadic templates.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 17:47:31 +00:00
Howard Hinnant
6fd2e09b36 has_nothrow_default_constructor hooked up to clang. Filed http://llvm.org/bugs/show_bug.cgi?id=8101 to take care of void, arrays of incomplete types, and classes with virtual destructors which don't work yet. If there is some reasons we don't want to handle these types in the compiler, I can handle them in the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113217 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 17:15:17 +00:00
Howard Hinnant
2fd6d25bf1 has_trivial_default_constructor hooked up to clang. Filed http://llvm.org/bugs/show_bug.cgi?id=8097 to take care of void and arrays of incomplete types which don't work yet. If there is some reasons we don't want to handle these types in the compiler, I can handle them in the library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113205 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 15:53:26 +00:00
Howard Hinnant
1387038988 Working the type_traits area: Hooked up to clang's __is_union. Got has_trivial_copy_assign working.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113162 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-06 19:10:31 +00:00
Howard Hinnant
f6547cbf61 Updated current status.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113110 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 17:31:48 +00:00
Howard Hinnant
3991b553df sync with N3126
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113101 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 01:14:30 +00:00
Howard Hinnant
a2ccccce89 sync with N3126
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113100 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 01:10:45 +00:00
Howard Hinnant
9c2683d77c sync with N3126
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113099 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 01:06:34 +00:00
Howard Hinnant
e3e488eb61 sync with N3126
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113098 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 00:57:20 +00:00
Howard Hinnant
b02310e487 sync with N3126
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113097 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-05 00:49:04 +00:00
Howard Hinnant
bfd5530c06 Fix whitespace
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113089 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 23:46:48 +00:00
Howard Hinnant
73d21a4f07 Changed __config to react to all of clang's currently documented has_feature flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113086 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 23:28:19 +00:00
Daniel Dunbar
04acacadca Fix typos, noticed by Clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-04 03:15:51 +00:00
Howard Hinnant
171a9a7cc3 Configure libc++ to recognize and use inline namespaces for clang. Many, many thanks to Sebastian Redl for implementing it in clang, and to Daniel Dunbar for rattling my cage about it. This is huge for libc++. Thanks to you both\!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113026 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 23:03:25 +00:00
Howard Hinnant
e6e4d01553 [futures.atomic_future] and notify_all_at_thread_exit. This completes the header <future> and all of Chapter 30 (for C++0x enabled compilers).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113017 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 21:46:37 +00:00
Howard Hinnant
99be8237db [futures.shared_future]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112990 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 18:39:25 +00:00
Howard Hinnant
ae153b9855 Updated for weekly test results.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112737 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 20:33:41 +00:00
Howard Hinnant
54da338f59 [futures.task] and [futures.async]. Requires variadics and rvalue-ref support.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112500 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 18:46:21 +00:00
Howard Hinnant
7158e5c38b [futures.unique_future]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112423 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 14:20:30 +00:00
Howard Hinnant
f39daa8e5a [futures.promise]. Depends on rvalue-ref support to work 100%.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112388 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 21:01:06 +00:00
Howard Hinnant
47499b162a future continues ...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112284 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 20:10:19 +00:00
Howard Hinnant
98ccdeca3b Updated for weekly test results
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 19:45:31 +00:00
Howard Hinnant
a652172d86 Getting started on <future>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@112061 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 17:32:05 +00:00
Howard Hinnant
ef0036c5aa Corrected some int -> char narrowing conversions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111849 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 21:41:03 +00:00
Howard Hinnant
8e705bb5ad Accidentally changed a data file during the whitespace cleanup
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111845 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-23 21:23:21 +00:00
Howard Hinnant
d510977c4d Remove tabs
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111778 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 13:53:14 +00:00
Howard Hinnant
d2bb032075 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111769 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 01:04:38 +00:00
Howard Hinnant
c52f43e72d Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111767 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:59:46 +00:00
Howard Hinnant
f11ea14460 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111765 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:50:25 +00:00
Howard Hinnant
6e0a1f458e Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111764 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:47:54 +00:00
Howard Hinnant
bbd8086ee3 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111763 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:45:01 +00:00
Howard Hinnant
0e20cae1a5 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111762 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:42:21 +00:00
Howard Hinnant
22a74dcf50 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111761 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:39:25 +00:00
Howard Hinnant
cf6dcc35e1 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111760 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:31:12 +00:00
Howard Hinnant
712522cfd8 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111759 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:29:01 +00:00
Howard Hinnant
256813f4e7 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111758 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:26:48 +00:00
Howard Hinnant
74231bfbc0 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111757 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:22:24 +00:00
Howard Hinnant
aa20444a4f Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111756 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:20:12 +00:00
Howard Hinnant
6046aced82 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111755 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:15:28 +00:00
Howard Hinnant
eb564e76cc Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111753 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:08:10 +00:00
Howard Hinnant
16e6e1d72f Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111751 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:03:27 +00:00
Howard Hinnant
324bb03bb9 Fixing whitespace problems
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111750 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-22 00:02:43 +00:00
Howard Hinnant
92172b891f US 108, N3109
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111747 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 21:14:53 +00:00
Howard Hinnant
a785e4e469 DE 23
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111746 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 21:01:59 +00:00
Howard Hinnant
7a2523b201 US 117
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111745 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 20:58:44 +00:00
Howard Hinnant
98e5d97400 US 122, N3106
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111742 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-21 20:10:01 +00:00
Howard Hinnant
725528086c Installed allocator into std::function
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111672 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-20 19:36:46 +00:00
Howard Hinnant
e00e030f58 JP 3 & JP 4
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111547 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 19:20:10 +00:00
Howard Hinnant
e3263b4dbe GB 85, GB 87
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111546 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 19:15:54 +00:00
Howard Hinnant
2794e6cca5 DE 19
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111544 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 19:09:08 +00:00
Howard Hinnant
3c1ffbabc1 US 98, US 99
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111542 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 18:59:38 +00:00
Howard Hinnant
e92c3d74ce US 107
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111538 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 18:39:17 +00:00
Howard Hinnant
ba590bdc97 LWG 1278
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111532 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-19 17:40:04 +00:00
Howard Hinnant
4a23e1e060 Updated by-chapter chart with weekly test results. Also did some prototyping on result_of, but if-def'd out the prototyped part (which the LWG may or may not accept)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111389 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 18:52:04 +00:00
Howard Hinnant
a8d7759708 [re.alg.replace]. This finishes all of <regex>. That being said, <regex> is exceptionally difficult to thoroughly test. If anyone has the ability to test this, combined with the interest to do so, now would be a good time. :-)
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111333 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-18 00:13:08 +00:00
Howard Hinnant
262b779f1d [re.tokiter]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111278 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-17 20:42:03 +00:00
Howard Hinnant
a712c72499 [re.regiter]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111178 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-16 20:21:16 +00:00
Howard Hinnant
aa78f9cdb3 [re.alg.match]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111075 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 19:58:44 +00:00
Howard Hinnant
27405f91a8 Everything under [re.results]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111074 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-14 18:14:02 +00:00
Howard Hinnant
7026a17a48 Everything under [re.regex]
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@111024 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-13 18:11:23 +00:00
Howard Hinnant
878465043f Filling out regex tests...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110955 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-12 21:14:20 +00:00
Howard Hinnant
0e353f2363 Didn't mean to change lib/buildit on the last check in
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110834 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 18:11:36 +00:00
Howard Hinnant
d444470d6c now works with -fno-exceptions and -fno-rtti
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110828 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 17:04:31 +00:00
David Chisnall
81e68580b2 #ifdef around Solaris/Linux/Darwin-specific error codes and replace them with their BSD equivalents if they are not available.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110827 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 16:52:41 +00:00
David Chisnall
3e13d4f9c4 Include sys/endian.h on FreeBSD and use that to detect the byte order.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110824 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 16:27:20 +00:00
Howard Hinnant
b271eff4c6 Modified the definition of std::foward to address National Body Comment US 90
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@110805 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-11 14:05:55 +00:00
4567 changed files with 91424 additions and 22082 deletions

159
CMakeLists.txt Normal file
View File

@@ -0,0 +1,159 @@
# See www/CMake.html for instructions on how to build libcxx with CMake.
#===============================================================================
# Setup Project
#===============================================================================
project(libcxx CXX C)
cmake_minimum_required(VERSION 2.8)
set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION trunk-svn)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
)
# Require out of source build.
include(MacroEnsureOutOfSourceBuild)
MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
"${PROJECT_NAME} requires an out of source build. Please create a separate
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
#===============================================================================
# Setup CMake Options
#===============================================================================
# Define options.
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
option(LIBCXX_ENABLE_ASSERTIONS "Enable assertions independent of build mode." ON)
option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
#===============================================================================
# Configure System
#===============================================================================
# Get triples.
include(GetTriple)
get_host_triple(LIBCXX_HOST_TRIPLE
LIBCXX_HOST_ARCH
LIBCXX_HOST_VENDOR
LIBCXX_HOST_OS
)
set(LIBCXX_HOST_TRIPLE ${LIBCXX_HOST_TRIPLE} CACHE STRING "Host triple.")
get_target_triple(LIBCXX_TARGET_TRIPLE
LIBCXX_TARGET_ARCH
LIBCXX_TARGET_VENDOR
LIBCXX_TARGET_OS
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
# Configure compiler.
include(config-ix)
#===============================================================================
# Setup Compiler Flags
#===============================================================================
# Get required flags.
# On all systems the system c++ standard library headers need to be excluded.
if (MSVC)
# MSVC only has -X, which disables all default includes; including the crt.
# Thus, we do nothing and hope we don't accidentally include any of the C++
# headers.
else()
if (LIBCXX_HAS_NOSTDINCXX_FLAG)
set(LIBCXX_CXX_REQUIRED_FLAGS -nostdinc++)
endif()
if (LIBCXX_ENABLE_CXX0X AND LIBCXX_HAS_STDCXX0X_FLAG)
list(APPEND LIBCXX_CXX_REQUIRED_FLAGS -std=c++0x)
endif()
endif()
macro(append_if list condition var)
if (${condition})
list(APPEND ${list} ${var})
endif()
endmacro()
# Get warning flags
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif()
# Get feature flags.
# Exceptions
if (LIBCXX_ENABLE_EXCEPTIONS)
# Catches C++ exceptions only and tells the compiler to assume that extern C
# functions never throw a C++ exception.
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_EHSC_FLAG -EHsc)
else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_EXCEPTIONS)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHS_FLAG -EHs-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_EHA_FLAG -EHa-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_EXCEPTIONS_FLAG -fno-exceptions)
endif()
# RTTI
if (NOT LIBCXX_ENABLE_RTTI)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_NO_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_NO_GR_FLAG -GR-)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif()
# Assert
if (LLVM_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
endif()
# On Release builds cmake automatically defines NDEBUG, so we
# explicitly undefine it:
if (uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -UNDEBUG)
endif()
else()
if (NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE")
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif()
endif()
# This is the _ONLY_ place where add_definitions is called.
add_definitions(
${LIBCXX_CXX_REQUIRED_FLAGS}
${LIBCXX_CXX_WARNING_FLAGS}
${LIBCXX_CXX_FEATURE_FLAGS}
)
#===============================================================================
# Setup Source Code
#===============================================================================
include_directories(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...
add_subdirectory(lib)
#===============================================================================
# Setup Tests
#===============================================================================
add_subdirectory(test)

34
CREDITS.TXT Normal file
View File

@@ -0,0 +1,34 @@
This file is a partial list of people who have contributed to the LLVM/libc++
project. If you have contributed a patch or made some other contribution to
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD port and libcxxrt support.
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.

View File

@@ -1,10 +1,21 @@
==============================================================================
LLVM Release License
libc++ License
==============================================================================
The libc++ library is dual licensed under both the University of Illinois
"BSD-Like" license and the MIT license. As a user of this code you may choose
to use it under either license. As a contributor, you agree to allow your code
to be used under both.
Full text of the relevant licenses is included below.
==============================================================================
University of Illinois/NCSA
Open Source License
Copyright (c) 2007-2010 University of Illinois at Urbana-Champaign.
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
All rights reserved.
Developed by:
@@ -43,21 +54,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
SOFTWARE.
==============================================================================
The LLVM software contains code written by third parties. Such software will
have its own individual LICENSE.TXT file in the directory in which it appears.
This file will describe the copyrights, license, and restrictions which apply
to that code.
The disclaimer of warranty in the University of Illinois Open Source License
applies to all code in the LLVM Distribution, and nothing in any of the
other licenses gives permission to use the names of the LLVM Team or the
University of Illinois to endorse or promote products derived from this
Software.
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
The following pieces of software have additional or alternate copyrights,
licenses, and/or restrictions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
Program Directory
------- ---------
<none yet>
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -9,10 +9,19 @@ OBJROOT=.
SYMROOT=.
export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
help::
echo Use make install DSTROOT=<destination>
installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include
ditto $(SRCDIRS)/lib/buildit $(SRCROOT)/lib/buildit
ditto $(SRCDIRS)/lib $(SRCROOT)/lib
ditto $(SRCDIRS)/src $(SRCROOT)/src
ditto $(SRCDIRS)/Makefile $(SRCROOT)/Makefile
@@ -20,21 +29,40 @@ clean::
installhdrs::
mkdir -p $(DSTROOT)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(DSTROOT)/usr/lib
strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -0,0 +1,53 @@
# Define functions to get the host and target triple.
function(get_host_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_HOST_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_HOST_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Host triple: ${triple}")
endfunction()
function(get_target_triple out out_arch out_vendor out_os)
# Get the architecture.
set(arch ${CMAKE_SYSTEM_PROCESSOR})
if (arch STREQUAL "x86")
set(arch "i686")
endif()
# Get the vendor.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
set(vendor "apple")
else()
set(vendor "pc")
endif()
# Get os.
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(os "win32")
else()
string(TOLOWER ${CMAKE_SYSTEM_NAME} os)
endif()
set(triple "${arch}-${vendor}-${os}")
set(${out} ${triple} PARENT_SCOPE)
set(${out_arch} ${arch} PARENT_SCOPE)
set(${out_vendor} ${vendor} PARENT_SCOPE)
set(${out_os} ${os} PARENT_SCOPE)
message(STATUS "Target triple: ${triple}")
endfunction()

View File

@@ -0,0 +1,18 @@
# MACRO_ENSURE_OUT_OF_SOURCE_BUILD(<errorMessage>)
macro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD _errorMessage )
string( COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" _insource )
if( _insource )
message( SEND_ERROR "${_errorMessage}" )
message( FATAL_ERROR
"In-source builds are not allowed.
CMake would overwrite the makefiles distributed with Compiler-RT.
Please create a directory and run cmake from there, passing the path
to this source directory as the last argument.
This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
Please delete them."
)
endif( _insource )
endmacro( MACRO_ENSURE_OUT_OF_SOURCE_BUILD )

38
cmake/config-ix.cmake Normal file
View File

@@ -0,0 +1,38 @@
include(CheckLibraryExists)
include(CheckCXXCompilerFlag)
# Check compiler flags
check_cxx_compiler_flag(-std=c++0x LIBCXX_HAS_STDCXX0X_FLAG)
check_cxx_compiler_flag(-fPIC LIBCXX_HAS_FPIC_FLAG)
check_cxx_compiler_flag(-nodefaultlibs LIBCXX_HAS_NODEFAULTLIBS_FLAG)
check_cxx_compiler_flag(-nostdinc++ LIBCXX_HAS_NOSTDINCXX_FLAG)
check_cxx_compiler_flag(-Wall LIBCXX_HAS_WALL_FLAG)
check_cxx_compiler_flag(-W LIBCXX_HAS_W_FLAG)
check_cxx_compiler_flag(-Wno-unused-parameter LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG)
check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)
check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
# Check libraries
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features
if (LIBCXX_ENABLE_CXX0X)
if (LIBCXX_HAS_STDCXX0X_FLAG)
set(CMAKE_REQUIRED_DEFINITIONS -std=c++0x)
endif()
else()
set(LIBCXX_HAS_STDCXX0X_FLAG FALSE)
endif()

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,7 +21,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _C, bool _IsConst> class __bit_iterator;
template <class _C> class __bit_const_reference;
template <class _C>
template <class _Tp>
struct __has_storage_type
{
static const bool value = false;
};
template <class _C, bool = __has_storage_type<_C>::value>
class __bit_reference
{
typedef typename _C::__storage_type __storage_type;
@@ -38,11 +44,13 @@ class __bit_reference
friend class __bit_const_reference<_C>;
friend class __bit_iterator<_C, false>;
public:
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY bool operator ~() const {return !static_cast<bool>(*this);}
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY bool operator ~() const _NOEXCEPT
{return !static_cast<bool>(*this);}
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(bool __x)
__bit_reference& operator=(bool __x) _NOEXCEPT
{
if (__x)
*__seg_ |= __mask_;
@@ -50,22 +58,29 @@ public:
*__seg_ &= ~__mask_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(const __bit_reference& __x) {return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const
_LIBCPP_INLINE_VISIBILITY
__bit_reference& operator=(const __bit_reference& __x) _NOEXCEPT
{return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
{return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
};
template <class _C>
class __bit_reference<_C, false>
{
};
template <class _C, class _D>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@@ -75,7 +90,7 @@ swap(__bit_reference<_C> __x, __bit_reference<_D> __y)
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_C> __x, bool& __y)
swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@@ -85,7 +100,7 @@ swap(__bit_reference<_C> __x, bool& __y)
template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(bool& __x, __bit_reference<_C> __y)
swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
@@ -109,16 +124,18 @@ class __bit_const_reference
friend class __bit_iterator<_C, true>;
public:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(const __bit_reference<_C>& __x)
__bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
{return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(__storage_pointer __s, __storage_type __m) : __seg_(__s), __mask_(__m) {}
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
__bit_const_reference& operator=(const __bit_const_reference& __x);
};
@@ -136,25 +153,25 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
if (*__first.__seg_)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(*__first.__seg_)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(*__first.__seg_)));
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
@@ -170,11 +187,11 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = ~(*__first.__seg_ & __m);
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
__n -= __dn;
++__first.__seg_;
}
@@ -183,7 +200,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{
__storage_type __b = ~*__first.__seg_;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
// do last partial word
if (__n > 0)
@@ -191,7 +208,7 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = ~(*__first.__seg_ & __m);
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_STD::__ctz(__b)));
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
@@ -221,20 +238,20 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__r = _STD::__pop_count(*__first.__seg_ & __m);
__r = _VSTD::__pop_count(*__first.__seg_ & __m);
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
__r += _STD::__pop_count(*__first.__seg_);
__r += _VSTD::__pop_count(*__first.__seg_);
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__r += _STD::__pop_count(*__first.__seg_ & __m);
__r += _VSTD::__pop_count(*__first.__seg_ & __m);
}
return __r;
}
@@ -252,20 +269,20 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__r = _STD::__pop_count(~(*__first.__seg_ & __m));
__r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
__n -= __dn;
++__first.__seg_;
}
// do middle whole words
for (; __n >= __bits_per_word; ++__first.__seg_, __n -= __bits_per_word)
__r += _STD::__pop_count(~*__first.__seg_);
__r += _VSTD::__pop_count(~*__first.__seg_);
// do last partial word
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__r += _STD::__pop_count(~(*__first.__seg_ & __m));
__r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
}
return __r;
}
@@ -293,7 +310,7 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
*__first.__seg_ &= ~__m;
__n -= __dn;
@@ -301,7 +318,7 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_STD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -323,7 +340,7 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
if (__first.__ctz_ != 0)
{
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _STD::min(__clz_f, __n);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
*__first.__seg_ |= __m;
__n -= __dn;
@@ -331,7 +348,7 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_STD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -363,7 +380,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
{
_STD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
_VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
}
// copy
@@ -384,7 +401,7 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
if (__first.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
__storage_type __b = *__first.__seg_ & __m;
@@ -398,7 +415,7 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
// __first.__ctz_ == 0;
// do middle words
__storage_type __nw = __n / __bits_per_word;
_STD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
__result.__seg_ += __nw;
// do last word
@@ -431,12 +448,12 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
if (__first.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
*__result.__seg_ &= ~__m;
if (__result.__ctz_ > __first.__ctz_)
@@ -474,7 +491,7 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
{
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first.__seg_ & __m;
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
*__result.__seg_ &= ~__m;
*__result.__seg_ |= __b << __result.__ctz_;
@@ -520,7 +537,7 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
// do first word
if (__last.__ctz_ != 0)
{
difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
__n -= __dn;
unsigned __clz = __bits_per_word - __last.__ctz_;
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz);
@@ -537,7 +554,7 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
__storage_type __nw = __n / __bits_per_word;
__result.__seg_ -= __nw;
__last.__seg_ -= __nw;
_STD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last word
if (__n > 0)
@@ -567,13 +584,13 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
// do first word
if (__last.__ctz_ != 0)
{
difference_type __dn = _STD::min(static_cast<difference_type>(__last.__ctz_), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__last.__ctz_), __n);
__n -= __dn;
unsigned __clz_l = __bits_per_word - __last.__ctz_;
__storage_type __m = (~__storage_type(0) << (__last.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_l);
__storage_type __b = *__last.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __ddn = _STD::min(__dn, static_cast<difference_type>(__result.__ctz_));
__storage_type __ddn = _VSTD::min(__dn, static_cast<difference_type>(__result.__ctz_));
if (__ddn > 0)
{
__m = (~__storage_type(0) << (__result.__ctz_ - __ddn)) & (~__storage_type(0) >> __clz_r);
@@ -617,7 +634,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
__m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__result.__ctz_));
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m;
*__result.__seg_ |= __b >> (__bits_per_word - __result.__ctz_);
@@ -655,7 +672,7 @@ inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_C, false>
move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
return _STD::copy(__first, __last, __result);
return _VSTD::copy(__first, __last, __result);
}
// move_backward
@@ -665,17 +682,17 @@ inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_C, false>
move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{
return _STD::copy(__first, __last, __result);
return _VSTD::copy(__first, __last, __result);
}
// swap_ranges
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_aligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
{
typedef __bit_iterator<_C1, false> _I1;
typedef __bit_iterator<__C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -686,7 +703,7 @@ __swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, fa
if (__first.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
__storage_type __b1 = *__first.__seg_ & __m;
@@ -720,12 +737,12 @@ __swap_ranges_aligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, fa
return __result;
}
template <class _C1, class _C2>
__bit_iterator<_C2, false>
__swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1, false> __last,
__bit_iterator<_C2, false> __result)
template <class __C1, class __C2>
__bit_iterator<__C2, false>
__swap_ranges_unaligned(__bit_iterator<__C1, false> __first, __bit_iterator<__C1, false> __last,
__bit_iterator<__C2, false> __result)
{
typedef __bit_iterator<_C1, false> _I1;
typedef __bit_iterator<__C1, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
@@ -736,13 +753,13 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
if (__first.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b1 = *__first.__seg_ & __m;
*__first.__seg_ &= ~__m;
unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
__storage_type __b2 = *__result.__seg_ & __m;
*__result.__seg_ &= ~__m;
@@ -797,7 +814,7 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b1 = *__first.__seg_ & __m;
*__first.__seg_ &= ~__m;
__storage_type __dn = _STD::min<__storage_type>(__n, __clz_r);
__storage_type __dn = _VSTD::min<__storage_type>(__n, __clz_r);
__m = (~__storage_type(0) << __result.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
__storage_type __b2 = *__result.__seg_ & __m;
*__result.__seg_ &= ~__m;
@@ -820,11 +837,11 @@ __swap_ranges_unaligned(__bit_iterator<_C1, false> __first, __bit_iterator<_C1,
return __result;
}
template <class _C1, class _C2>
template <class __C1, class __C2>
inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_C2, false>
swap_ranges(__bit_iterator<_C1, false> __first1, __bit_iterator<_C1, false> __last1,
__bit_iterator<_C2, false> __first2)
__bit_iterator<__C2, false>
swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __last1,
__bit_iterator<__C2, false> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __swap_ranges_aligned(__first1, __last1, __first2);
@@ -871,13 +888,13 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
if (__d1 <= __bit_array<_C>::capacity())
{
__bit_array<_C> __b(__d1);
_STD::copy(__first, __middle, __b.begin());
_STD::copy(__b.begin(), __b.end(), _STD::copy(__middle, __last, __first));
_VSTD::copy(__first, __middle, __b.begin());
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
break;
}
else
{
__bit_iterator<_C, false> __mp = _STD::swap_ranges(__first, __middle, __middle);
__bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__first = __middle;
__middle = __mp;
__d2 -= __d1;
@@ -888,14 +905,14 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
if (__d2 <= __bit_array<_C>::capacity())
{
__bit_array<_C> __b(__d2);
_STD::copy(__middle, __last, __b.begin());
_STD::copy_backward(__b.begin(), __b.end(), _STD::copy_backward(__first, __middle, __last));
_VSTD::copy(__middle, __last, __b.begin());
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
break;
}
else
{
__bit_iterator<_C, false> __mp = __first + __d2;
_STD::swap_ranges(__first, __mp, __middle);
_VSTD::swap_ranges(__first, __mp, __middle);
__first = __mp;
__d1 -= __d2;
}
@@ -922,12 +939,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
if (__first1.__ctz_ != 0)
{
unsigned __clz_f = __bits_per_word - __first1.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz_f), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz_f), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = *__first1.__seg_ & __m;
unsigned __clz_r = __bits_per_word - __first2.__ctz_;
__storage_type __ddn = _STD::min<__storage_type>(__dn, __clz_r);
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
if (__first2.__ctz_ > __first1.__ctz_)
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
@@ -966,7 +983,7 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
{
__m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = *__first1.__seg_ & __m;
__storage_type __dn = _STD::min(__n, static_cast<difference_type>(__clz_r));
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__clz_r));
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __dn));
if ((*__first2.__seg_ & __m) != (__b << __first2.__ctz_))
return false;
@@ -1000,7 +1017,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
if (__first1.__ctz_ != 0)
{
unsigned __clz = __bits_per_word - __first1.__ctz_;
difference_type __dn = _STD::min(static_cast<difference_type>(__clz), __n);
difference_type __dn = _VSTD::min(static_cast<difference_type>(__clz), __n);
__n -= __dn;
__storage_type __m = (~__storage_type(0) << __first1.__ctz_) & (~__storage_type(0) >> (__clz - __dn));
if ((*__first2.__seg_ & __m) != (*__first1.__seg_ & __m))
@@ -1028,6 +1045,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
}
template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{
@@ -1056,12 +1074,14 @@ private:
unsigned __ctz_;
public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() {}
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY __bit_iterator(const __bit_iterator<_C, false>& __it)
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return reference(__seg_, __storage_type(1) << __ctz_);}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
{return reference(__seg_, __storage_type(1) << __ctz_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator++()
{
@@ -1074,14 +1094,14 @@ public:
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator++(int)
{
__bit_iterator __tmp = *this;
++(*this);
return __tmp;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator--()
{
if (__ctz_ != 0)
@@ -1093,14 +1113,14 @@ public:
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator--(int)
{
__bit_iterator __tmp = *this;
--(*this);
return __tmp;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator+=(difference_type __n)
{
if (__n >= 0)
@@ -1112,19 +1132,19 @@ public:
__ctz_ = static_cast<unsigned>((__n + __ctz_) % __bits_per_word);
return *this;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator& operator-=(difference_type __n)
{
return *this += -__n;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator+(difference_type __n) const
{
__bit_iterator __t(*this);
__t += __n;
return __t;
}
_LIBCPP_INLINE_VISIBILITY __bit_iterator operator-(difference_type __n) const
{
__bit_iterator __t(*this);
@@ -1161,7 +1181,8 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(__storage_pointer __s, unsigned __ctz) : __seg_(__s), __ctz_(__ctz) {}
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
: __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__)
friend typename _C::__self;
@@ -1192,15 +1213,15 @@ private:
template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
__bit_iterator<_D, _IC> __last,
__bit_iterator<_D, false> __result);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_aligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> __swap_ranges_unaligned(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class _C1, class _C2>friend __bit_iterator<_C2, false> swap_ranges(__bit_iterator<_C1, false>,
__bit_iterator<_C1, false>,
__bit_iterator<_C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_unaligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
__bit_iterator<_D, false>,
__bit_iterator<_D, false>);

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -13,7 +13,7 @@
#pragma GCC system_header
#define _LIBCPP_VERSION 1000
#define _LIBCPP_VERSION 1001
#define _LIBCPP_ABI_VERSION 1
@@ -26,15 +26,35 @@
#if __LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#endif
#endif
#endif // __LITTLE_ENDIAN__
#endif // __LITTLE_ENDIAN__
#ifdef __BIG_ENDIAN__
#if __BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif
#endif
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#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) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
@@ -44,10 +64,10 @@
# elif __BYTE_ORDER == __BIG_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# else
# else // __BYTE_ORDER == __BIG_ENDIAN
# error unable to determine endian
# endif
#endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
@@ -56,10 +76,10 @@
#if _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else
#else // _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif
#endif // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
@@ -71,64 +91,137 @@
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#if defined(__clang__)
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
typedef __char16_t char16_t;
typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#define _LIBCPP_NO_EXCEPTIONS
#endif
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_STRONG_USING
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#else
#if __has_feature(cxx_rvalue_references)
#define _LIBCPP_MOVE
#if !(__has_feature(cxx_rtti))
#define _LIBCPP_NO_RTTI
#endif
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if !(__has_feature(cxx_deleted_functions))
#if __has_feature(cxx_attributes)
# define _ATTRIBUTE(x) [[x]]
#else
# define _ATTRIBUTE(x) __attribute__ ((x))
#endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // !(__has_feature(cxx_deleted_functions))
#if !(__has_feature(cxx_lambdas))
#define _LIBCPP_HAS_NO_LAMBDAS
#endif
#if !(__has_feature(cxx_nullptr))
#define _LIBCPP_HAS_NO_NULLPTR
#endif
#if !(__has_feature(cxx_rvalue_references))
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__has_feature(cxx_static_assert))
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if !(__has_feature(cxx_auto_type))
#define _LIBCPP_HAS_NO_AUTO_TYPE
#endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#if !(__has_feature(cxx_trailing_return))
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#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
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// end defined(__clang__)
#elif defined(__GNUC__)
#define _ATTRIBUTE(x) __attribute__((x))
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
#endif
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__
@@ -140,11 +233,16 @@
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else
#else // __GXX_EXPERIMENTAL_CXX0X__
#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 3
#define _LIBCPP_MOVE
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
@@ -158,24 +256,18 @@
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR
#endif
#endif
#endif // __GXX_EXPERIMENTAL_CXX0X__
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_USING
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _STD std
#else
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
namespace _LIBCPP_NAMESPACE {
@@ -183,12 +275,12 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#endif
#endif // defined(__GNUC__)
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
#endif
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
@@ -199,10 +291,46 @@ template <unsigned> struct __static_assert_check {};
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
#endif
#endif // _LIBCPP_HAS_NO_STATIC_ASSERT
#ifdef _LIBCPP_HAS_NO_DECLTYPE
#define decltype(x) __typeof__(x)
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define constexpr const
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
#if __APPLE__ || __FreeBSD__ || _WIN32
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#if __APPLE__ || __FreeBSD__
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if __APPLE__ || __FreeBSD__
#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

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* _C = static_cast<_Cont*>(__c_);
return _C->__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* _C = static_cast<_Cont*>(__c_);
return _C->__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* _C = static_cast<_Cont*>(__c_);
return _C->__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* _C = static_cast<_Cont*>(__c_);
return _C->__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

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,21 +21,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct unary_function
struct _LIBCPP_VISIBLE unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct binary_function
struct _LIBCPP_VISIBLE binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct hash;
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp>
struct __has_result_type
@@ -281,171 +281,65 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
// __invoke
// first bullet
// bullets 1 and 2
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
// bullets 3 and 4
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (*_VSTD::forward<_A0>(__a0)).*__f;
}
// second bullet
// bullet 5
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _F, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
auto
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
struct __invoke_return
{
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type;
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -456,21 +350,22 @@ private:
public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
// access
_LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
// invoke
template <class... _ArgTypes>
typename __invoke_return<type&, _ArgTypes...>::type
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
};
@@ -482,7 +377,7 @@ template <class _Tp> struct __is_reference_wrapper
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
ref(_Tp& __t)
ref(_Tp& __t) _NOEXCEPT
{
return reference_wrapper<_Tp>(__t);
}
@@ -490,7 +385,7 @@ ref(_Tp& __t)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t)
ref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return ref(__t.get());
}
@@ -498,7 +393,7 @@ ref(reference_wrapper<_Tp> __t)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
cref(const _Tp& __t)
cref(const _Tp& __t) _NOEXCEPT
{
return reference_wrapper<const _Tp>(__t);
}
@@ -506,15 +401,25 @@ cref(const _Tp& __t)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t)
cref(reference_wrapper<_Tp> __t) _NOEXCEPT
{
return cref(__t.get());
}
#ifdef _LIBCPP_MOVE
template <class _Tp> void ref(const _Tp&& __t);// = delete; // LWG 688
template <class _Tp> void cref(const _Tp&& __t);// = delete; // LWG 688
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t) = delete;
template <class _Tp> void cref(const _Tp&& __t) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -235,84 +235,84 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// __invoke
// __ref_return0
//
//
// template <class _Tp, bool _HasResultType>
// struct ________ref_return0 // _HasResultType is true
// {
// typedef typename _Tp::result_type type;
// };
//
//
// template <class _Tp>
// struct ________ref_return0<_Tp, false>
// {
// typedef void type;
// };
//
//
// template <class _Tp, bool _IsClass>
// struct ____ref_return0 // _IsClass is true
// : public ________ref_return0<_Tp, __has_result_type<typename remove_cv<_Tp>::type>::value>
// {
// };
//
//
// template <class _Tp, bool _HasResultType>
// struct ______ref_return0 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return0<_Tp, false> // pointer to member data
// {
// typedef void type;
// };
//
//
// template <class _Tp>
// struct ____ref_return0<_Tp, false>
// : public ______ref_return0<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value>
// {
// };
//
//
// template <class _Tp>
// struct __ref_return0
// : public ____ref_return0<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value>
// {
// };
//
//
// __ref_return1
//
//
// template <class _Tp, bool _IsClass, class _A0>
// struct ____ref_return1 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0>
// struct ______ref_return1 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp, class _A0, bool>
// struct __ref_return1_member_data1;
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data1<_R _C::*, _A0, true>
// {
// typedef typename __apply_cv<_A0, _R>::type& type;
// };
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data1<_R _C::*, _A0, false>
// {
// static _A0 __a;
// typedef typename __apply_cv<decltype(*__a), _R>::type& type;
// };
//
//
// template <class _Tp, class _A0>
// struct __ref_return1_member_data;
//
//
// template <class _R, class _C, class _A0>
// struct __ref_return1_member_data<_R _C::*, _A0>
// : public __ref_return1_member_data1<_R _C::*, _A0,
@@ -320,90 +320,90 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// typename remove_cv<typename remove_reference<_A0>::type>::type>::value>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct ______ref_return1<_Tp, false, _A0> // pointer to member data
// : public __ref_return1_member_data<typename remove_cv<_Tp>::type, _A0>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct ____ref_return1<_Tp, false, _A0>
// : public ______ref_return1<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0>
// {
// };
//
//
// template <class _Tp, class _A0>
// struct __ref_return1
// : public ____ref_return1<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value, _A0>
// {
// };
//
//
// __ref_return2
//
//
// template <class _Tp, bool _IsClass, class _A0, class _A1>
// struct ____ref_return2 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0, _A1)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0, class _A1>
// struct ______ref_return2 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return2<_Tp, false, class _A0, class _A1> // pointer to member data
// {
// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
// " to member data with too many arguments.");
// };
//
//
// template <class _Tp, class _A0, class _A1>
// struct ____ref_return2<_Tp, false, _A0, _A1>
// : public ______ref_return2<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1>
// {
// };
//
//
// template <class _Tp, class _A0, class _A1>
// struct __ref_return2
// : public ____ref_return2<typename remove_reference<_Tp>::type,
// is_class<typename remove_reference<_Tp>::type>::value, _A0, _A1>
// {
// };
//
//
// __ref_return3
//
//
// template <class _Tp, bool _IsClass, class _A0, class _A1, class _A2>
// struct ____ref_return3 // _IsClass is true
// {
// typedef typename result_of<_Tp(_A0, _A1, _A2)>::type type;
// };
//
//
// template <class _Tp, bool _HasResultType, class _A0, class _A1, class _A2>
// struct ______ref_return3 // _HasResultType is true
// {
// typedef typename __callable_type<_Tp>::result_type type;
// };
//
//
// template <class _Tp>
// struct ______ref_return3<_Tp, false, class _A0, class _A1, class _A2> // pointer to member data
// {
// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
// " to member data with too many arguments.");
// };
//
//
// template <class _Tp, class _A0, class _A1, class _A2>
// struct ____ref_return3<_Tp, false, _A0, _A1, _A2>
// : public ______ref_return3<typename remove_cv<_Tp>::type,
// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1, _A2>
// {
// };
//
//
// template <class _Tp, class _A0, class _A1, class _A2>
// struct __ref_return3
// : public ____ref_return3<typename remove_reference<_Tp>::type,
@@ -411,7 +411,6 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// {
// };
// first bullet
template <class _R, class _T, class _T1>
@@ -843,7 +842,7 @@ struct __4th_helper
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
@@ -874,7 +873,7 @@ __invoke(_R _T::* __f, _T1& __t1)
template <class _F>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F()>::type
decltype(declval<_F>()())
__invoke(_F __f)
{
return __f();
@@ -882,7 +881,7 @@ __invoke(_F __f)
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0)>::type
decltype(declval<_F>()(declval<_A0&>()))
__invoke(_F __f, _A0& __a0)
{
return __f(__a0);
@@ -890,7 +889,7 @@ __invoke(_F __f, _A0& __a0)
template <class _F, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0, _A1)>::type
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
__invoke(_F __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
@@ -898,7 +897,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1)
template <class _F, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0, _A1, _A2)>::type
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
@@ -911,7 +910,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f();
// }
//
//
// template <class _R, class _F, class _A0>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
@@ -923,7 +922,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0);
// }
//
//
// template <class _R, class _F, class _A0, class _A1>
// inline _LIBCPP_INLINE_VISIBILITY
// _R
@@ -931,7 +930,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0, __a1);
// }
//
//
// template <class _R, class _F, class _A0, class _A1, class _A2>
// inline _LIBCPP_INLINE_VISIBILITY
// _R
@@ -960,13 +959,13 @@ struct __invoke_return
template <class _F>
struct __invoke_return<_F, false>
{
typedef decltype(__invoke(_STD::declval<_F>())) type;
typedef decltype(__invoke(_VSTD::declval<_F>())) type;
};
template <class _Tp, class _A0>
struct __invoke_return0
{
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>())) type;
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type;
};
template <class _R, class _T, class _A0>
@@ -984,20 +983,20 @@ struct __invoke_return0<_R _T::*, _A0*>
template <class _Tp, class _A0, class _A1>
struct __invoke_return1
{
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
_STD::declval<_A1>())) type;
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
_VSTD::declval<_A1>())) type;
};
template <class _Tp, class _A0, class _A1, class _A2>
struct __invoke_return2
{
typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_A0>(),
_STD::declval<_A1>(),
_STD::declval<_A2>())) type;
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
_VSTD::declval<_A1>(),
_VSTD::declval<_A2>())) type;
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -1016,6 +1015,7 @@ public:
// invoke
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&>::type
operator() () const
{
@@ -1023,6 +1023,7 @@ public:
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type&, _A0>::type
operator() (_A0& __a0) const
{
@@ -1030,6 +1031,7 @@ public:
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type&, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
@@ -1037,6 +1039,7 @@ public:
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type&, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
@@ -1081,4 +1084,4 @@ cref(reference_wrapper<_Tp> __t)
return cref(__t.get());
}
#endif
#endif // _LIBCPP_FUNCTIONAL_BASE_03

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -19,7 +19,11 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#include <xlocale.h>
#if _WIN32
# include <support/win32/locale_win32.h>
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
#pragma GCC system_header
@@ -27,10 +31,10 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class locale;
template <class _Facet> bool has_facet(const locale&) throw();
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet> const _Facet& use_facet(const locale&);
class locale
class _LIBCPP_VISIBLE locale
{
public:
// types:
@@ -49,18 +53,19 @@ public:
all = collate | ctype | monetary | numeric | time | messages;
// construct/copy/destroy:
locale() throw();
locale(const locale&) throw();
locale() _NOEXCEPT;
locale(const locale&) _NOEXCEPT;
explicit locale(const char*);
explicit locale(const string&);
locale(const locale&, const char*, category);
locale(const locale&, const string&, category);
template <class _Facet> locale(const locale&, _Facet*);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
locale(const locale&, const locale&, category);
~locale() throw();
~locale();
const locale& operator=(const locale&) throw();
const locale& operator=(const locale&) _NOEXCEPT;
template <class _Facet> locale combine(const locale&) const;
@@ -85,14 +90,15 @@ private:
bool has_facet(id&) const;
const facet* use_facet(id&) const;
template <class _Facet> friend bool has_facet(const locale&) throw();
template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet> friend const _Facet& use_facet(const locale&);
};
class locale::facet
class _LIBCPP_VISIBLE locale::facet
: public __shared_count
{
protected:
_LIBCPP_INLINE_VISIBILITY
explicit facet(size_t __refs = 0)
: __shared_count(static_cast<long>(__refs)-1) {}
@@ -101,17 +107,17 @@ protected:
// facet(const facet&) = delete; // effectively done in __shared_count
// void operator=(const facet&) = delete;
private:
virtual void __on_zero_shared();
virtual void __on_zero_shared() _NOEXCEPT;
};
class locale::id
class _LIBCPP_VISIBLE locale::id
{
once_flag __flag_;
int32_t __id_;
static int32_t __next_id;
public:
id() {}
_LIBCPP_INLINE_VISIBILITY id() {}
private:
void __init();
void operator=(const id&); // = delete;
@@ -134,15 +140,17 @@ template <class _Facet>
locale
locale::combine(const locale& __other) const
{
if (!_STD::has_facet<_Facet>(__other))
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!_VSTD::has_facet<_Facet>(__other))
throw runtime_error("locale::combine: locale missing facet");
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
#endif // _LIBCPP_NO_EXCEPTIONS
return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
}
template <class _Facet>
inline _LIBCPP_INLINE_VISIBILITY
bool
has_facet(const locale& __l) throw()
has_facet(const locale& __l) _NOEXCEPT
{
return __l.has_facet(_Facet::id);
}
@@ -158,27 +166,31 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class collate
class _LIBCPP_VISIBLE collate
: public locale::facet
{
public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit collate(size_t __refs = 0)
: locale::facet(__refs) {}
_LIBCPP_INLINE_VISIBILITY
int compare(const char_type* __lo1, const char_type* __hi1,
const char_type* __lo2, const char_type* __hi2) const
{
return do_compare(__lo1, __hi1, __lo2, __hi2);
}
_LIBCPP_INLINE_VISIBILITY
string_type transform(const char_type* __lo, const char_type* __hi) const
{
return do_transform(__lo, __hi);
}
_LIBCPP_INLINE_VISIBILITY
long hash(const char_type* __lo, const char_type* __hi) const
{
return do_hash(__lo, __hi);
@@ -219,29 +231,29 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
template <class _CharT>
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;
const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t mask = size_t(0xF) << (sr + 4);
for(const char_type* p = lo; p != hi; ++p)
size_t __h = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p)
{
h = (h << 4) + *p;
size_t g = h & mask;
h ^= g | (g >> sr);
__h = (__h << 4) + *__p;
size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr);
}
return static_cast<long>(h);
return static_cast<long>(__h);
}
extern template class collate<char>;
extern template class collate<wchar_t>;
extern template class _LIBCPP_VISIBLE collate<char>;
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
// template <class CharT> class collate_byname;
template <class _CharT> class collate_byname;
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <>
class collate_byname<char>
class _LIBCPP_VISIBLE collate_byname<char>
: public collate<char>
{
locale_t __l;
@@ -260,7 +272,7 @@ protected:
};
template <>
class collate_byname<wchar_t>
class _LIBCPP_VISIBLE collate_byname<wchar_t>
: public collate<wchar_t>
{
locale_t __l;
@@ -284,29 +296,18 @@ bool
locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
const basic_string<_CharT, _Traits, _Allocator>& __y) const
{
return _STD::use_facet<_STD::collate<_CharT> >(*this).compare(
return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare(
__x.data(), __x.data() + __x.size(),
__y.data(), __y.data() + __y.size()) < 0;
}
// template <class charT> class ctype
class ctype_base {
class _LIBCPP_VISIBLE ctype_base
{
public:
typedef __uint32_t 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__ */
#if __GLIBC__
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
@@ -317,23 +318,63 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
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;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
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 graph = alnum | punct;
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class ctype;
template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <>
class ctype<wchar_t>
class _LIBCPP_VISIBLE ctype<wchar_t>
: public locale::facet,
public ctype_base
{
public:
typedef wchar_t char_type;
_LIBCPP_ALWAYS_INLINE
explicit ctype(size_t __refs = 0)
: locale::facet(__refs) {}
@@ -429,7 +470,7 @@ protected:
};
template <>
class ctype<char>
class _LIBCPP_VISIBLE ctype<char>
: public locale::facet, public ctype_base
{
const mask* __tab_;
@@ -526,8 +567,12 @@ public:
#else
static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif
const mask* table() const throw() {return __tab_;}
static const mask* classic_table() throw();
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
protected:
~ctype();
@@ -543,10 +588,10 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <>
class ctype_byname<char>
class _LIBCPP_VISIBLE ctype_byname<char>
: public ctype<char>
{
locale_t __l;
@@ -564,7 +609,7 @@ protected:
};
template <>
class ctype_byname<wchar_t>
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
: public ctype<wchar_t>
{
locale_t __l;
@@ -695,7 +740,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base
class codecvt_base
class _LIBCPP_VISIBLE codecvt_base
{
public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -704,12 +749,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
class codecvt<char, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -746,13 +791,13 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int encoding() const throw()
int encoding() const _NOEXCEPT
{
return do_encoding();
}
_LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw()
bool always_noconv() const _NOEXCEPT
{
return do_always_noconv();
}
@@ -764,7 +809,7 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int max_length() const throw()
int max_length() const _NOEXCEPT
{
return do_max_length();
}
@@ -786,16 +831,16 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw();
virtual bool do_always_noconv() const throw();
virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw();
virtual int do_max_length() const _NOEXCEPT;
};
// template <> class codecvt<wchar_t, char, mbstate_t>
template <>
class codecvt<wchar_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -831,13 +876,13 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int encoding() const throw()
int encoding() const _NOEXCEPT
{
return do_encoding();
}
_LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw()
bool always_noconv() const _NOEXCEPT
{
return do_always_noconv();
}
@@ -849,7 +894,7 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int max_length() const throw()
int max_length() const _NOEXCEPT
{
return do_max_length();
}
@@ -869,16 +914,16 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw();
virtual bool do_always_noconv() const throw();
virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw();
virtual int do_max_length() const _NOEXCEPT;
};
// template <> class codecvt<char16_t, char, mbstate_t>
template <>
class codecvt<char16_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -915,13 +960,13 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int encoding() const throw()
int encoding() const _NOEXCEPT
{
return do_encoding();
}
_LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw()
bool always_noconv() const _NOEXCEPT
{
return do_always_noconv();
}
@@ -933,7 +978,7 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int max_length() const throw()
int max_length() const _NOEXCEPT
{
return do_max_length();
}
@@ -955,16 +1000,16 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw();
virtual bool do_always_noconv() const throw();
virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw();
virtual int do_max_length() const _NOEXCEPT;
};
// template <> class codecvt<char32_t, char, mbstate_t>
template <>
class codecvt<char32_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1001,13 +1046,13 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int encoding() const throw()
int encoding() const _NOEXCEPT
{
return do_encoding();
}
_LIBCPP_ALWAYS_INLINE
bool always_noconv() const throw()
bool always_noconv() const _NOEXCEPT
{
return do_always_noconv();
}
@@ -1019,7 +1064,7 @@ public:
}
_LIBCPP_ALWAYS_INLINE
int max_length() const throw()
int max_length() const _NOEXCEPT
{
return do_max_length();
}
@@ -1041,21 +1086,23 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const throw();
virtual bool do_always_noconv() const throw();
virtual int do_encoding() const _NOEXCEPT;
virtual bool do_always_noconv() const _NOEXCEPT;
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const throw();
virtual int do_max_length() const _NOEXCEPT;
};
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class codecvt_byname
class _LIBCPP_VISIBLE codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
protected:
@@ -1072,7 +1119,7 @@ extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class codecvt_byname<char16_t, char, mbstate_t>;
extern template class codecvt_byname<char32_t, char, mbstate_t>;
void __throw_runtime_error(const char*);
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _N>
struct __narrow_to_utf8
@@ -1256,10 +1303,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class numpunct;
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <>
class numpunct<char>
class _LIBCPP_VISIBLE numpunct<char>
: public locale::facet
{
public:
@@ -1290,7 +1337,7 @@ protected:
};
template <>
class numpunct<wchar_t>
class _LIBCPP_VISIBLE numpunct<wchar_t>
: public locale::facet
{
public:
@@ -1322,10 +1369,10 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class numpunct_byname;
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <>
class numpunct_byname<char>
class _LIBCPP_VISIBLE numpunct_byname<char>
: public numpunct<char>
{
public:
@@ -1343,7 +1390,7 @@ private:
};
template <>
class numpunct_byname<wchar_t>
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
: public numpunct<wchar_t>
{
public:

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,13 +18,24 @@
#pragma GCC system_header
#ifdef _LIBCPP_SHARED_LOCK
namespace ting {
template <class _Mutex> class shared_lock;
template <class _Mutex> class upgrade_lock;
}
#endif // _LIBCPP_SHARED_LOCK
_LIBCPP_BEGIN_NAMESPACE_STD
class mutex
class _LIBCPP_VISIBLE mutex
{
pthread_mutex_t __m_;
public:
_LIBCPP_INLINE_VISIBILITY
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
~mutex();
@@ -38,12 +49,12 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
native_handle_type native_handle() {return &__m_;}
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
};
struct defer_lock_t {};
struct try_to_lock_t {};
struct adopt_lock_t {};
struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {};
//constexpr
extern const
@@ -58,7 +69,7 @@ extern const
adopt_lock_t adopt_lock;
template <class _Mutex>
class lock_guard
class _LIBCPP_VISIBLE lock_guard
{
public:
typedef _Mutex mutex_type;
@@ -67,10 +78,13 @@ private:
mutex_type& __m_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit lock_guard(mutex_type& __m)
: __m_(__m) {__m_.lock();}
_LIBCPP_INLINE_VISIBILITY
lock_guard(mutex_type& __m, adopt_lock_t)
: __m_(__m) {}
_LIBCPP_INLINE_VISIBILITY
~lock_guard() {__m_.unlock();}
private:
@@ -79,7 +93,7 @@ private:
};
template <class _Mutex>
class unique_lock
class _LIBCPP_VISIBLE unique_lock
{
public:
typedef _Mutex mutex_type;
@@ -89,21 +103,29 @@ private:
bool __owns_;
public:
_LIBCPP_INLINE_VISIBILITY
unique_lock() : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t)
: __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t)
: __m_(&__m), __owns_(__m.try_lock()) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, adopt_lock_t)
: __m_(&__m), __owns_(true) {}
template <class _Clock, class _Duration>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
_LIBCPP_INLINE_VISIBILITY
~unique_lock()
{
if (__owns_)
@@ -115,10 +137,12 @@ private:
unique_lock& operator=(unique_lock const&); // = delete;
public:
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u)
: __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u)
{
if (__owns_)
@@ -129,7 +153,29 @@ public:
__u.__owns_ = false;
return *this;
}
#endif
#ifdef _LIBCPP_SHARED_LOCK
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
#endif // _LIBCPP_SHARED_LOCK
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void lock();
bool try_lock();
@@ -141,11 +187,13 @@ public:
void unlock();
_LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u)
{
_STD::swap(__m_, __u.__m_);
_STD::swap(__owns_, __u.__owns_);
_VSTD::swap(__m_, __u.__m_);
_VSTD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
mutex_type* release()
{
mutex_type* __m = __m_;
@@ -154,9 +202,12 @@ public:
return __m;
}
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;}
};
@@ -221,11 +272,11 @@ unique_lock<_Mutex>::unlock()
}
template <class _Mutex>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
struct cv_status
struct _LIBCPP_VISIBLE cv_status
{
enum _ {
no_timeout,
@@ -234,15 +285,16 @@ struct cv_status
_ __v_;
cv_status(_ __v) : __v_(__v) {}
operator int() const {return __v_;}
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
};
class condition_variable
class _LIBCPP_VISIBLE condition_variable
{
pthread_cond_t __cv_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
~condition_variable();
@@ -286,7 +338,7 @@ public:
_Predicate __pred);
typedef pthread_cond_t* native_handle_type;
native_handle_type native_handle() {return &__cv_;}
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
@@ -294,7 +346,7 @@ private:
};
template <class _To, class _Rep, class _Period>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
chrono::__is_duration<_To>::value,
@@ -362,22 +414,22 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
system_clock::time_point __s_now = system_clock::now();
monotonic_clock::time_point __c_now = monotonic_clock::now();
system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
return monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Rep, class _Period, class _Predicate>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
_STD::move(__pred));
return wait_until(__lk, chrono::steady_clock::now() + __d,
_VSTD::move(__pred));
}
_LIBCPP_END_NAMESPACE_STD

View File

@@ -26,7 +26,7 @@ private:
__split_buffer(const __split_buffer&);
__split_buffer& operator=(const __split_buffer&);
public:
typedef _Tp value_type;
typedef _Tp value_type;
typedef _Allocator allocator_type;
typedef typename remove_reference<allocator_type>::type __alloc_rr;
typedef allocator_traits<__alloc_rr> __alloc_traits;
@@ -47,29 +47,36 @@ public:
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
__split_buffer();
__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
explicit __split_buffer(__alloc_rr& __a);
explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
#ifdef _LIBCPP_MOVE
__split_buffer(__split_buffer&& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
__split_buffer& operator=(__split_buffer&& __c);
#endif
__split_buffer& operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;}
_LIBCPP_INLINE_VISIBILITY iterator end() {return __end_;}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __end_;}
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;}
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
@@ -82,25 +89,23 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
void reserve(size_type __n);
void shrink_to_fit();
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
void push_back(const_reference __x);
#ifdef _LIBCPP_MOVE
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
#endif
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _InputIter>
typename enable_if
<
@@ -118,38 +123,51 @@ public:
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
void __destruct_at_end(pointer __new_last, false_type);
void __destruct_at_end(pointer __new_last, true_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x);
void swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value);
bool __invariants() const;
private:
void __move_assign_alloc(const __split_buffer& __c, true_type)
_LIBCPP_INLINE_VISIBILITY
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());
}
void __move_assign_alloc(const __split_buffer& __c, false_type)
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
{}
};
@@ -184,35 +202,18 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), value_type());
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
++this->__end_;
--__n;
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -220,36 +221,18 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
__alloc_rr& __a = this->__alloc();
do
{
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), __x);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
++this->__end_;
--__n;
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _InputIter>
typename enable_if
@@ -266,14 +249,14 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
if (__end_ == __end_cap())
{
size_type __old_cap = __end_cap() - __first_;
size_type __new_cap = _STD::max<size_type>(2 * __old_cap, 8);
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8);
__split_buffer __buf(__new_cap, 0, __a);
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
__alloc_traits::construct(__buf.__alloc(),
_STD::__to_raw_pointer(__buf.__end_), _STD::move(*__p));
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p));
swap(__buf);
}
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_;
}
}
@@ -290,7 +273,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
__alloc_rr& __a = this->__alloc();
for (; __first != __last; ++__first)
{
__alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
++this->__end_;
}
}
@@ -315,7 +298,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type)
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last < __end_)
__alloc_traits::destroy(__alloc(), --__end_);
@@ -324,7 +307,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_typ
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type)
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
{
__end_ = __new_last;
}
@@ -341,6 +324,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{
}
@@ -367,14 +351,15 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
__alloc_traits::deallocate(__alloc(), __first_, capacity());
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
: __first_(_STD::move(__c.__first_)),
__begin_(_STD::move(__c.__begin_)),
__end_(_STD::move(__c.__end_)),
__end_cap_(_STD::move(__c.__end_cap_))
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __first_(_VSTD::move(__c.__first_)),
__begin_(_VSTD::move(__c.__begin_)),
__end_(_VSTD::move(__c.__end_)),
__end_cap_(_VSTD::move(__c.__end_cap_))
{
__c.__first_ = nullptr;
__c.__begin_ = nullptr;
@@ -411,6 +396,9 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value)
{
clear();
shrink_to_fit();
@@ -425,16 +413,18 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{
_STD::swap(__first_, __x.__first_);
_STD::swap(__begin_, __x.__begin_);
_STD::swap(__end_, __x.__end_);
_STD::swap(__end_cap(), __x.__end_cap());
_VSTD::swap(__first_, __x.__first_);
_VSTD::swap(__begin_, __x.__begin_);
_VSTD::swap(__end_, __x.__end_);
_VSTD::swap(__end_cap(), __x.__end_cap());
__swap_alloc(__alloc(), __x.__alloc());
}
@@ -447,37 +437,37 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::shrink_to_fit()
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
{
if (capacity() > size())
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
__split_buffer<value_type, __alloc_rr&> __t(size(), 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
__t.__end_ = __t.__begin_ + (__end_ - __begin_);
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
}
@@ -491,7 +481,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
{
difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2;
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d;
}
else
@@ -500,17 +490,17 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __x);
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x);
--__begin_;
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
@@ -522,7 +512,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
{
difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2;
__begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d;
}
else
@@ -531,18 +521,18 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1),
_STD::move(__x));
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1),
_VSTD::move(__x));
--__begin_;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
@@ -555,7 +545,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
@@ -564,17 +554,17 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __x);
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x);
++__end_;
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
void
@@ -586,7 +576,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
@@ -595,17 +585,19 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
_STD::move(__x));
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_VSTD::move(__x));
++__end_;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -617,7 +609,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2;
__end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d;
}
else
@@ -626,18 +618,30 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_STD::swap(__first_, __t.__first_);
_STD::swap(__begin_, __t.__begin_);
_STD::swap(__end_, __t.__end_);
_STD::swap(__end_cap(), __t.__end_cap());
_VSTD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap());
}
}
__alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
_STD::forward<_Args>(__args)...);
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_),
_VSTD::forward<_Args>(__args)...);
++__end_;
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -64,7 +64,9 @@ public:
}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
_LIBCPP_INLINE_VISIBILITY
bool operator==(__sso_allocator& __a) const {return &buf_ == &__a.buf_;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(__sso_allocator& __a) const {return &buf_ != &__a.buf_;}
};

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
char __extbuf[__limit];
int __nread = max(1, __encoding_);
int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
char __c = getc(__file_);
@@ -120,7 +120,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
&__1buf, &__1buf + 1, __inxt);
switch (__r)
{
case _STD::codecvt_base::ok:
case _VSTD::codecvt_base::ok:
break;
case codecvt_base::partial:
__st_ = __sv_st;
@@ -136,11 +136,11 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
break;
case codecvt_base::error:
return traits_type::eof();
case _STD::codecvt_base::noconv:
case _VSTD::codecvt_base::noconv:
__1buf = static_cast<char_type>(__extbuf[0]);
break;
}
} while (__r == _STD::codecvt_base::partial);
} while (__r == _VSTD::codecvt_base::partial);
}
if (!__consume)
{
@@ -166,9 +166,9 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
{
case _STD::codecvt_base::ok:
case _VSTD::codecvt_base::ok:
break;
case _STD::codecvt_base::noconv:
case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__c);
__enxt = __extbuf + 1;
break;

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,50 +21,96 @@
#include <__tuple_03>
#else
#else // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class tuple_size;
template <size_t _Ip, class _Tp> class tuple_element;
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <class ..._Tp> class tuple;
template <class _T1, class _T2> class pair;
template <class _Tp, size_t _Size> struct array;
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
: public tuple_size<_Tp> {};
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
{
public:
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
{
public:
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
{
public:
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<const pair<_T1, _T2> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<const array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(tuple<_Tp...>&);
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
get(const tuple<_Tp...>&);
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&);
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&);
get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&
get(array<_Tp, _Size>&);
get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
const _Tp&
get(const array<_Tp, _Size>&);
get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
// __make_tuple_indices
@@ -97,7 +143,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class tuple_element<_Ip, __tuple_types<>>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -105,29 +151,34 @@ public:
};
template <class _Hp, class ..._Tp>
class tuple_element<0, __tuple_types<_Hp, _Tp...>>
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
{
public:
typedef _Hp type;
};
template <size_t _Ip, class _Hp, class ..._Tp>
class tuple_element<_Ip, __tuple_types<_Hp, _Tp...>>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
{
public:
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...>>::type type;
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
};
template <class ..._Tp>
class tuple_size<__tuple_types<_Tp...>>
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
// __make_tuple_types
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
struct __make_tuple_types_imp;
@@ -136,7 +187,7 @@ struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename remove_reference<_Tp>::type _Tpr;
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
typename conditional<is_reference<_Tp>::value,
typename conditional<is_lvalue_reference<_Tp>::value,
typename tuple_element<_Sp, _Tpr>::type&,
typename tuple_element<_Sp, _Tpr>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
@@ -155,45 +206,19 @@ struct __make_tuple_types
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
};
// __make_assignable_types
template <class _Tuple, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp;
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename __make_assignable_types_imp<__tuple_types<_Types...,
typename remove_reference<typename tuple_element<_Sp, _Tp>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
};
template <class ..._Types, class _Tp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
{
typedef __tuple_types<_Types...> type;
};
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
struct __make_assignable_types
{
static_assert(_Sp <= _Ep, "__make_assignable_types input error");
typedef typename __make_assignable_types_imp<__tuple_types<>, typename remove_reference<_Tp>::type, _Sp, _Ep>::type type;
};
// __tuple_convertible
template <bool, class _Tp, class _Up>
struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...>>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_convertible<_Tp0, _Up0>::value &&
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
is_constructible<_Up0, _Tp0>::value &&
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
@@ -210,6 +235,19 @@ struct __tuple_convertible<_Tp, _Up, true, true>
// __tuple_assignable
template <bool, class _Tp, class _Up>
struct __tuple_assignable_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_assignable<_Up0&, _Tp0>::value &&
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_assignable
@@ -217,9 +255,9 @@ struct __tuple_assignable
template <class _Tp, class _Up>
struct __tuple_assignable<_Tp, _Up, true, true>
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_assignable_types<_Up>::type>
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -17,9 +17,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class tuple_size;
template <size_t _Ip, class _Tp> class tuple_element;
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
_LIBCPP_END_NAMESPACE_STD
#endif
#endif // _LIBCPP___TUPLE_03

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -16,84 +16,85 @@
namespace std
{
template <class T, size_t N >
template <class T, size_t N >
struct array
{
// types:
typedef T & reference;
typedef const T & const_reference;
typedef implementation defined iterator;
typedef implementation defined const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
{
// types:
typedef T & reference;
typedef const T & const_reference;
typedef implementation defined iterator;
typedef implementation defined const_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef T value_type;
typedef T* pointer;
typedef const T* const_pointer;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// No explicit construct/copy/destroy for aggregate type
void fill(const T& u);
void swap(array& a);
// No explicit construct/copy/destroy for aggregate type
void fill(const T& u);
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>())));
// iterators:
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
// iterators:
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const;
const_iterator cend() const;
const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity:
constexpr size_type size() const;
constexpr size_type max_size() const;
bool empty() const;
// capacity:
constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept;
bool empty() const noexcept;
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
reference front();
const_reference front() const;
reference back();
const_reference back() const;
reference front();
const_reference front() const;
reference back();
const_reference back() const;
T* data();
const T* data() const;
T* data() noexcept;
const T* data() const noexcept;
};
template <class T, size_t N>
bool operator==(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator!=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator==(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator!=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator<=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y);
template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&);
template <int I, class T, size_t N> const T& get(const array<T, N>&);
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
} // std
@@ -114,66 +115,86 @@ template <int I, class T, size_t N> const T& get(const array<T, N>&);
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct array
template <class _Tp, size_t _Size>
struct _LIBCPP_VISIBLE array
{
// types:
typedef array __self;
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
value_type __elems_[_Size > 0 ? _Size : 1];
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) {_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a) {_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_VSTD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators:
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);}
// iterators:
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
// capacity:
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
_LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
// capacity:
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
reference at(size_type __n);
const_reference at(size_type __n) const;
reference at(size_type __n);
const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[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 value_type* data() {return __elems_;}
_LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
_LIBCPP_INLINE_VISIBILITY
value_type* data() _NOEXCEPT {return __elems_;}
_LIBCPP_INLINE_VISIBILITY
const value_type* data() const _NOEXCEPT {return __elems_;}
};
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
typename array<_Tp, _Size>::reference
array<_Tp, _Size>::at(size_type __n)
{
@@ -186,7 +207,7 @@ array<_Tp, _Size>::at(size_type __n)
return __elems_[__n];
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
@@ -199,15 +220,15 @@ array<_Tp, _Size>::at(size_type __n) const
return __elems_[__n];
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -215,15 +236,15 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__x == __y);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -231,7 +252,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return __y < __x;
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -239,7 +260,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__y < __x);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
@@ -247,29 +268,36 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
return !(__x < __y);
}
template <class _Tp, size_t _Size>
template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
void
typename enable_if
<
__is_swappable<_Tp>::value,
void
>::type
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{
__x.swap(__y);
}
template <class _Tp, size_t _Size>
class tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class tuple_size<const array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class tuple_element<_Ip, array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class tuple_element<_Ip, const array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
@@ -278,7 +306,7 @@ public:
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&
get(array<_Tp, _Size>& __a)
get(array<_Tp, _Size>& __a) _NOEXCEPT
{
return __a[_Ip];
}
@@ -286,11 +314,23 @@ get(array<_Tp, _Size>& __a)
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
const _Tp&
get(const array<_Tp, _Size>& __a)
get(const array<_Tp, _Size>& __a) _NOEXCEPT
{
return __a[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT
{
return _VSTD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ARRAY

1513
include/atomic Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -27,20 +27,23 @@ public:
class reference
{
friend class bitset;
reference();
reference() noexcept;
public:
~reference();
reference& operator=(bool x); // for b[i] = x;
reference& operator=(const reference&); // for b[i] = b[j];
bool operator~() const; // flips the bit
operator bool() const; // for x = b[i];
reference& flip(); // for b[i].flip();
~reference() noexcept;
reference& operator=(bool x) noexcept; // for b[i] = x;
reference& operator=(const reference&) noexcept; // for b[i] = b[j];
bool operator~() const noexcept; // flips the bit
operator bool() const noexcept; // for x = b[i];
reference& flip() noexcept; // for b[i].flip();
};
// 23.3.5.1 constructors:
constexpr bitset();
constexpr bitset(unsigned long long val);
explicit bitset( const char* str );
constexpr bitset() noexcept;
constexpr bitset(unsigned long long val) noexcept;
template <class charT>
explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
charT zero = charT('0'), charT one = charT('1'));
template<class charT, class traits, class Allocator>
explicit bitset(const basic_string<charT,traits,Allocator>& str,
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
@@ -49,17 +52,17 @@ public:
charT zero = charT('0'), charT one = charT('1'));
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& rhs);
bitset& operator|=(const bitset& rhs);
bitset& operator^=(const bitset& rhs);
bitset& operator<<=(size_t pos);
bitset& operator>>=(size_t pos);
bitset& set();
bitset& operator&=(const bitset& rhs) noexcept;
bitset& operator|=(const bitset& rhs) noexcept;
bitset& operator^=(const bitset& rhs) noexcept;
bitset& operator<<=(size_t pos) noexcept;
bitset& operator>>=(size_t pos) noexcept;
bitset& set() noexcept;
bitset& set(size_t pos, bool val = true);
bitset& reset();
bitset& reset() noexcept;
bitset& reset(size_t pos);
bitset operator~() const;
bitset& flip();
bitset operator~() const noexcept;
bitset& flip() noexcept;
bitset& flip(size_t pos);
// element access:
@@ -74,27 +77,27 @@ public:
template <class charT>
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
size_t count() const;
constexpr size_t size() const;
bool operator==(const bitset& rhs) const;
bool operator!=(const bitset& rhs) const;
size_t count() const noexcept;
constexpr size_t size() const noexcept;
bool operator==(const bitset& rhs) const noexcept;
bool operator!=(const bitset& rhs) const noexcept;
bool test(size_t pos) const;
bool all() const;
bool any() const;
bool none() const;
bitset operator<<(size_t pos) const;
bitset operator>>(size_t pos) const;
bool all() const noexcept;
bool any() const noexcept;
bool none() const noexcept;
bitset operator<<(size_t pos) const noexcept;
bitset operator>>(size_t pos) const noexcept;
};
// 23.3.5.3 bitset operators:
template <size_t N>
bitset<N> operator&(const bitset<N>&, const bitset<N>&);
bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N>
bitset<N> operator|(const bitset<N>&, const bitset<N>&);
bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept;
template <size_t N>
bitset<N> operator^(const bitset<N>&, const bitset<N>&);
bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept;
template <class charT, class traits, size_t N>
basic_istream<charT, traits>&
@@ -126,6 +129,15 @@ template <size_t N> struct hash<std::bitset<N>>;
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
class __bitset;
template <size_t _N_words, size_t _Size>
struct __has_storage_type<__bitset<_N_words, _Size> >
{
static const bool value = true;
};
template <size_t _N_words, size_t _Size>
class __bitset
{
@@ -152,34 +164,34 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long __v);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v);
void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip();
void flip() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
bool all() const;
bool any() const;
size_t __hash_code() const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
size_t __hash_code() const _NOEXCEPT;
private:
void __init(unsigned long long __v, false_type);
void __init(unsigned long long __v, true_type);
void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT;
unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
@@ -190,9 +202,9 @@ private:
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset()
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
{
_STD::fill_n(__first_, _N_words, __storage_type(0));
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
}
template <size_t _N_words, size_t _Size>
@@ -202,8 +214,8 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
__t[__i] = static_cast<__storage_type>(__v);
_STD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
_STD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
_VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
_VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
__storage_type(0));
}
@@ -213,12 +225,12 @@ void
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
{
__first_[0] = __v;
_STD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<_N_words, _Size>::__bitset(unsigned long long __v)
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
{
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
}
@@ -226,7 +238,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v)
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] &= __v.__first_[__i];
@@ -235,7 +247,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v)
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] |= __v.__first_[__i];
@@ -244,7 +256,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v)
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] ^= __v.__first_[__i];
@@ -252,7 +264,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
template <size_t _N_words, size_t _Size>
void
__bitset<_N_words, _Size>::flip()
__bitset<_N_words, _Size>::flip() _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@@ -274,7 +286,7 @@ unsigned long
__bitset<_N_words, _Size>::to_ulong(false_type) const
{
const_iterator __e = __make_iter(_Size);
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ulong overflow error");
@@ -297,7 +309,7 @@ unsigned long long
__bitset<_N_words, _Size>::to_ullong(false_type) const
{
const_iterator __e = __make_iter(_Size);
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ullong overflow error");
@@ -335,7 +347,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
template <size_t _N_words, size_t _Size>
bool
__bitset<_N_words, _Size>::all() const
__bitset<_N_words, _Size>::all() const _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@@ -355,7 +367,7 @@ __bitset<_N_words, _Size>::all() const
template <size_t _N_words, size_t _Size>
bool
__bitset<_N_words, _Size>::any() const
__bitset<_N_words, _Size>::any() const _NOEXCEPT
{
// do middle whole words
size_type __n = _Size;
@@ -376,7 +388,7 @@ __bitset<_N_words, _Size>::any() const
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
__bitset<_N_words, _Size>::__hash_code() const
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{
size_t __h = 0;
for (size_type __i = 0; __i < _N_words; ++__i)
@@ -410,43 +422,43 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long __v);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v);
void operator&=(const __bitset& __v) _NOEXCEPT;
void operator|=(const __bitset& __v) _NOEXCEPT;
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip();
void flip() _NOEXCEPT;
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
bool all() const;
bool any() const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
size_t __hash_code() const;
size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset()
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
{
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
__bitset<1, _Size>::__bitset(unsigned long long __v)
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
{
}
@@ -454,7 +466,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator&=(const __bitset& __v)
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
__first_ &= __v.__first_;
}
@@ -462,7 +474,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator|=(const __bitset& __v)
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
__first_ |= __v.__first_;
}
@@ -470,7 +482,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::operator^=(const __bitset& __v)
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
__first_ ^= __v.__first_;
}
@@ -478,7 +490,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<1, _Size>::flip()
__bitset<1, _Size>::flip() _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
__first_ = ~__first_;
@@ -504,7 +516,7 @@ __bitset<1, _Size>::to_ullong() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
__bitset<1, _Size>::all() const
__bitset<1, _Size>::all() const _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return !(~__first_ & __m);
@@ -513,7 +525,7 @@ __bitset<1, _Size>::all() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
__bitset<1, _Size>::any() const
__bitset<1, _Size>::any() const _NOEXCEPT
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return __first_ & __m;
@@ -522,7 +534,7 @@ __bitset<1, _Size>::any() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
__bitset<1, _Size>::__hash_code() const
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
{
return __first_;
}
@@ -551,40 +563,40 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset();
explicit __bitset(unsigned long long);
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t)
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY void flip() {}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY bool all() const {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const {return false;}
_LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset()
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
__bitset<0, 0>::__bitset(unsigned long long)
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
}
@@ -592,107 +604,110 @@ template <size_t _Size> class bitset;
template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size>
class bitset
class _LIBCPP_VISIBLE bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
typedef __bitset<__n_words, _Size> base;
public:
public:
typedef typename base::reference reference;
typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
explicit bitset(const char* __str);
template<class _CharT, class _Traits, class _Allocator>
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
template<class _CharT, class _Traits, class _Allocator>
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n =
(basic_string<_CharT,_Traits,_Allocator>::npos),
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs);
bitset& operator|=(const bitset& __rhs);
bitset& operator^=(const bitset& __rhs);
bitset& operator<<=(size_t __pos);
bitset& operator>>=(size_t __pos);
bitset& set();
bitset& set(size_t __pos, bool __val = true);
bitset& reset();
bitset& reset(size_t __pos);
bitset operator~() const;
bitset& flip();
bitset& flip(size_t __pos);
// 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos) _NOEXCEPT;
bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true);
bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos);
bitset operator~() const _NOEXCEPT;
bitset& flip() _NOEXCEPT;
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 reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT>
_CharT __one = _CharT('1')) const;
template <class _CharT>
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
_CharT __one = _CharT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
size_t count() const;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
bool operator==(const bitset& __rhs) const;
bool operator!=(const bitset& __rhs) const;
bool test(size_t __pos) const;
bool all() const;
bool any() const;
_LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
bitset operator<<(size_t __pos) const;
bitset operator>>(size_t __pos) const;
char __one = '1') const;
size_t count() const _NOEXCEPT;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
bitset operator<<(size_t __pos) const _NOEXCEPT;
bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
size_t __hash_code() const {return base::__hash_code();}
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();}
friend struct hash<bitset>;
};
template <size_t _Size>
bitset<_Size>::bitset(const char* __str)
template<class _CharT>
bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one)
{
size_t __rlen = strlen(__str);
size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != '0' && __str[__i] != '1')
if (__str[__i] != __zero && __str[__i] != __one)
#ifndef _LIBCPP_NO_EXCEPTIONS
throw invalid_argument("bitset string ctor has invalid argument");
#else
assert(!"bitset string ctor has invalid argument");
#endif
size_t _M = _STD::min(__rlen, _Size);
size_t _M = _VSTD::min(__rlen, _Size);
size_t __i = 0;
for (; __i < _M; ++__i)
{
switch (__str[_M - 1 - __i])
{
case '0':
_CharT __c = __str[_M - 1 - __i];
if (__c == __zero)
(*this)[__i] = false;
break;
case '1':
else
(*this)[__i] = true;
break;
}
}
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
}
template <size_t _Size>
template<class _CharT, class _Traits, class _Allocator>
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
template<class _CharT, class _Traits, class _Allocator>
bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __n,
_CharT __zero, _CharT __one)
{
@@ -702,7 +717,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else
assert(!"bitset string pos out of range");
#endif
size_t __rlen = _STD::min(__n, __str.size() - __pos);
size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -710,7 +725,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else
assert(!"bitset string ctor has invalid argument");
#endif
size_t _M = _STD::min(__rlen, _Size);
size_t _M = _VSTD::min(__rlen, _Size);
size_t __i = 0;
for (; __i < _M; ++__i)
{
@@ -720,13 +735,13 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
else
(*this)[__i] = true;
}
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs)
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{
base::operator&=(__rhs);
return *this;
@@ -735,7 +750,7 @@ bitset<_Size>::operator&=(const bitset& __rhs)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs)
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{
base::operator|=(__rhs);
return *this;
@@ -744,7 +759,7 @@ bitset<_Size>::operator|=(const bitset& __rhs)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs)
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{
base::operator^=(__rhs);
return *this;
@@ -752,30 +767,30 @@ bitset<_Size>::operator^=(const bitset& __rhs)
template <size_t _Size>
bitset<_Size>&
bitset<_Size>::operator<<=(size_t __pos)
bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT
{
__pos = _STD::min(__pos, _Size);
_STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
_STD::fill_n(base::__make_iter(0), __pos, false);
__pos = _VSTD::min(__pos, _Size);
_VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
_VSTD::fill_n(base::__make_iter(0), __pos, false);
return *this;
}
template <size_t _Size>
bitset<_Size>&
bitset<_Size>::operator>>=(size_t __pos)
bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
{
__pos = _STD::min(__pos, _Size);
_STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
_STD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
__pos = _VSTD::min(__pos, _Size);
_VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
_VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
return *this;
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::set()
bitset<_Size>::set() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, true);
_VSTD::fill_n(base::__make_iter(0), _Size, true);
return *this;
}
@@ -796,9 +811,9 @@ bitset<_Size>::set(size_t __pos, bool __val)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::reset()
bitset<_Size>::reset() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, false);
_VSTD::fill_n(base::__make_iter(0), _Size, false);
return *this;
}
@@ -819,7 +834,7 @@ bitset<_Size>::reset(size_t __pos)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator~() const
bitset<_Size>::operator~() const _NOEXCEPT
{
bitset __x(*this);
__x.flip();
@@ -829,7 +844,7 @@ bitset<_Size>::operator~() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::flip()
bitset<_Size>::flip() _NOEXCEPT
{
base::flip();
return *this;
@@ -867,7 +882,7 @@ bitset<_Size>::to_ullong() const
}
template <size_t _Size>
template <class _CharT, class _Traits, class _Allocator>
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@@ -881,7 +896,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
template <class _CharT, class _Traits>
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
@@ -890,7 +905,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
template <class _CharT>
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
@@ -909,23 +924,23 @@ bitset<_Size>::to_string(char __zero, char __one) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
size_t
bitset<_Size>::count() const
bitset<_Size>::count() const _NOEXCEPT
{
return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true));
return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true));
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::operator==(const bitset& __rhs) const
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{
return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::operator!=(const bitset& __rhs) const
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{
return !(*this == __rhs);
}
@@ -946,7 +961,7 @@ bitset<_Size>::test(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::all() const
bitset<_Size>::all() const _NOEXCEPT
{
return base::all();
}
@@ -954,7 +969,7 @@ bitset<_Size>::all() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bool
bitset<_Size>::any() const
bitset<_Size>::any() const _NOEXCEPT
{
return base::any();
}
@@ -962,7 +977,7 @@ bitset<_Size>::any() const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{
bitset __r = *this;
__r <<= __pos;
@@ -972,7 +987,7 @@ bitset<_Size>::operator<<(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{
bitset __r = *this;
__r >>= __pos;
@@ -982,7 +997,7 @@ bitset<_Size>::operator>>(size_t __pos) const
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r &= __y;
@@ -992,7 +1007,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r |= __y;
@@ -1002,7 +1017,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
{
bitset<_Size> __r = __x;
__r ^= __y;
@@ -1010,13 +1025,22 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
}
template <size_t _Size>
struct hash<bitset<_Size> >
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
size_t operator()(const bitset<_Size>& __bs) const
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT
{return __bs.__hash_code();}
};
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_BITSET

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -30,28 +30,362 @@ Macros:
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2;
#undef ELAST
#else
const int __elast1 = 104;
const int __elast2 = 105;
#endif
#ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#else
#else // defined(EOWNERDEAD)
#define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD)
#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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -223,26 +223,26 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_monotonic = false;
static const bool is_steady = false;
static time_point now();
static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t);
static time_point now() noexcept;
static time_t to_time_t (const time_point& __t) noexcept;
static time_point from_time_t(time_t __t) noexcept;
};
class monotonic_clock
class steady_clock
{
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<monotonic_clock, duration> time_point;
static const bool is_monotonic = true;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true;
static time_point now();
static time_point now() noexcept;
};
typedef monotonic_clock high_resolution_clock;
typedef steady_clock high_resolution_clock;
} // chrono
@@ -262,7 +262,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
{
template <class _Rep, class _Period = ratio<1> > class duration;
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
template <class _Tp>
struct __is_duration : false_type {};
@@ -282,7 +282,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct common_type<chrono::duration<_Rep1, _Period1>, chrono::duration<_Rep2, _Period2> >
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
{
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
typename __ratio_gcd<_Period1, _Period2>::type> type;
@@ -357,10 +358,11 @@ duration_cast(const duration<_Rep, _Period>& __fd)
return __duration_cast<duration<_Rep, _Period>, _ToDuration>()(__fd);
}
template <class _Rep> struct treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct duration_values
struct _LIBCPP_VISIBLE duration_values
{
public:
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
@@ -371,7 +373,7 @@ public:
// duration
template <class _Rep, class _Period>
class duration
class _LIBCPP_VISIBLE duration
{
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
@@ -405,7 +407,7 @@ public:
(ratio_divide<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value)
>::type* = 0)
: __rep_(_STD::chrono::duration_cast<duration>(__d).count()) {}
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
// observer
@@ -667,7 +669,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
//////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration>
class time_point
class _LIBCPP_VISIBLE time_point
{
static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration");
@@ -711,7 +713,8 @@ public:
} // chrono
template <class _Clock, class _Duration1, class _Duration2>
struct common_type<chrono::time_point<_Clock, _Duration1>, chrono::time_point<_Clock, _Duration2> >
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
{
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
@@ -723,7 +726,7 @@ inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, _ToDuration>
time_point_cast(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>(_STD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
// time_point ==
@@ -833,33 +836,33 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
/////////////////////// clocks ///////////////////////////
//////////////////////////////////////////////////////////
class system_clock
class _LIBCPP_VISIBLE system_clock
{
public:
typedef microseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_monotonic = false;
static const bool is_steady = false;
static time_point now();
static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t);
static time_point now() _NOEXCEPT;
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
static time_point from_time_t(time_t __t) _NOEXCEPT;
};
class monotonic_clock
class _LIBCPP_VISIBLE steady_clock
{
public:
typedef nanoseconds duration;
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<monotonic_clock, duration> time_point;
static const bool is_monotonic = true;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true;
static time_point now();
static time_point now() _NOEXCEPT;
};
typedef monotonic_clock high_resolution_clock;
typedef steady_clock high_resolution_clock;
} // chrono

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -177,7 +177,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf8
class _LIBCPP_VISIBLE codecvt_utf8
: public __codecvt_utf8<_Elem>
{
public:
@@ -185,6 +185,7 @@ public:
explicit codecvt_utf8(size_t __refs = 0)
: __codecvt_utf8<_Elem>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf8() {}
};
@@ -404,7 +405,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf16
class _LIBCPP_VISIBLE codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian>
{
public:
@@ -412,6 +413,7 @@ public:
explicit codecvt_utf16(size_t __refs = 0)
: __codecvt_utf16<_Elem, _Mode & little_endian>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf16() {}
};
@@ -526,7 +528,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class codecvt_utf8_utf16
class _LIBCPP_VISIBLE codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem>
{
public:
@@ -534,6 +536,7 @@ public:
explicit codecvt_utf8_utf16(size_t __refs = 0)
: __codecvt_utf8_utf16<_Elem>(__refs, _Maxcode, _Mode) {}
_LIBCPP_ALWAYS_INLINE
~codecvt_utf8_utf16() {}
};

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -49,89 +49,89 @@ public:
template<>
class complex<float>
{
public:
typedef float value_type;
{
public:
typedef float value_type;
constexpr complex(float re = 0.0f, float im = 0.0f);
explicit constexpr complex(const complex<double>&);
explicit constexpr complex(const complex<long double>&);
constexpr complex(float re = 0.0f, float im = 0.0f);
explicit constexpr complex(const complex<double>&);
explicit constexpr complex(const complex<long double>&);
constexpr float real() const;
constexpr float real() const;
void real(float);
constexpr float imag() const;
constexpr float imag() const;
void imag(float);
complex<float>& operator= (float);
complex<float>& operator+=(float);
complex<float>& operator-=(float);
complex<float>& operator*=(float);
complex<float>& operator/=(float);
complex<float>& operator= (float);
complex<float>& operator+=(float);
complex<float>& operator-=(float);
complex<float>& operator*=(float);
complex<float>& operator/=(float);
complex<float>& operator=(const complex<float>&);
template<class X> complex<float>& operator= (const complex<X>&);
template<class X> complex<float>& operator+=(const complex<X>&);
template<class X> complex<float>& operator-=(const complex<X>&);
template<class X> complex<float>& operator*=(const complex<X>&);
template<class X> complex<float>& operator/=(const complex<X>&);
complex<float>& operator=(const complex<float>&);
template<class X> complex<float>& operator= (const complex<X>&);
template<class X> complex<float>& operator+=(const complex<X>&);
template<class X> complex<float>& operator-=(const complex<X>&);
template<class X> complex<float>& operator*=(const complex<X>&);
template<class X> complex<float>& operator/=(const complex<X>&);
};
template<>
class complex<double>
{
public:
typedef double value_type;
{
public:
typedef double value_type;
constexpr complex(double re = 0.0, double im = 0.0);
constexpr complex(const complex<float>&);
explicit constexpr complex(const complex<long double>&);
constexpr complex(double re = 0.0, double im = 0.0);
constexpr complex(const complex<float>&);
explicit constexpr complex(const complex<long double>&);
constexpr double real() const;
constexpr double real() const;
void real(double);
constexpr double imag() const;
constexpr double imag() const;
void imag(double);
complex<double>& operator= (double);
complex<double>& operator+=(double);
complex<double>& operator-=(double);
complex<double>& operator*=(double);
complex<double>& operator/=(double);
complex<double>& operator=(const complex<double>&);
complex<double>& operator= (double);
complex<double>& operator+=(double);
complex<double>& operator-=(double);
complex<double>& operator*=(double);
complex<double>& operator/=(double);
complex<double>& operator=(const complex<double>&);
template<class X> complex<double>& operator= (const complex<X>&);
template<class X> complex<double>& operator+=(const complex<X>&);
template<class X> complex<double>& operator-=(const complex<X>&);
template<class X> complex<double>& operator*=(const complex<X>&);
template<class X> complex<double>& operator/=(const complex<X>&);
};
template<class X> complex<double>& operator= (const complex<X>&);
template<class X> complex<double>& operator+=(const complex<X>&);
template<class X> complex<double>& operator-=(const complex<X>&);
template<class X> complex<double>& operator*=(const complex<X>&);
template<class X> complex<double>& operator/=(const complex<X>&);
};
template<>
class complex<long double>
{
public:
typedef long double value_type;
{
public:
typedef long double value_type;
constexpr complex(long double re = 0.0L, long double im = 0.0L);
constexpr complex(const complex<float>&);
constexpr complex(const complex<double>&);
constexpr complex(long double re = 0.0L, long double im = 0.0L);
constexpr complex(const complex<float>&);
constexpr complex(const complex<double>&);
constexpr long double real() const;
constexpr long double real() const;
void real(long double);
constexpr long double imag() const;
constexpr long double imag() const;
void imag(long double);
complex<long double>& operator=(const complex<long double>&);
complex<long double>& operator= (long double);
complex<long double>& operator+=(long double);
complex<long double>& operator-=(long double);
complex<long double>& operator*=(long double);
complex<long double>& operator/=(long double);
complex<long double>& operator=(const complex<long double>&);
complex<long double>& operator= (long double);
complex<long double>& operator+=(long double);
complex<long double>& operator-=(long double);
complex<long double>& operator*=(long double);
complex<long double>& operator/=(long double);
template<class X> complex<long double>& operator= (const complex<X>&);
template<class X> complex<long double>& operator+=(const complex<X>&);
template<class X> complex<long double>& operator-=(const complex<X>&);
template<class X> complex<long double>& operator*=(const complex<X>&);
template<class X> complex<long double>& operator/=(const complex<X>&);
template<class X> complex<long double>& operator= (const complex<X>&);
template<class X> complex<long double>& operator+=(const complex<X>&);
template<class X> complex<long double>& operator-=(const complex<X>&);
template<class X> complex<long double>& operator*=(const complex<X>&);
template<class X> complex<long double>& operator/=(const complex<X>&);
};
// 26.3.6 operators:
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
template<Integral T> double norm(T);
float norm(float);
template<class T> complex<T> conj(const complex<T>&);
long double conj(long double);
double conj(double);
template<Integral T> double conj(T);
float conj(float);
template<class T> complex<T> conj(const complex<T>&);
complex<long double> conj(long double);
complex<double> conj(double);
template<Integral T> complex<double> conj(T);
complex<float> conj(float);
template<class T> complex<T> proj(const complex<T>&);
long double proj(long double);
double proj(double);
template<Integral T> double proj(T);
float proj(float);
template<class T> complex<T> proj(const complex<T>&);
complex<long double> proj(long double);
complex<double> proj(double);
template<Integral T> complex<double> proj(T);
complex<float> proj(float);
template<class T> complex<T> polar(const T&, const T& = 0);
@@ -253,13 +253,13 @@ template<class T, class charT, class traits>
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class complex;
template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp>
class complex
class _LIBCPP_VISIBLE complex
{
public:
typedef _Tp value_type;
@@ -316,16 +316,16 @@ public:
}
};
template<> class complex<double>;
template<> class complex<long double>;
template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_VISIBLE complex<long double>;
template<>
class complex<float>
{
class _LIBCPP_VISIBLE complex<float>
{
float __re_;
float __im_;
public:
typedef float value_type;
public:
typedef float value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {}
@@ -375,12 +375,12 @@ public:
};
template<>
class complex<double>
{
class _LIBCPP_VISIBLE complex<double>
{
double __re_;
double __im_;
public:
typedef double value_type;
public:
typedef double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {}
@@ -427,15 +427,15 @@ public:
*this = *this / __c;
return *this;
}
};
};
template<>
class complex<long double>
{
class _LIBCPP_VISIBLE complex<long double>
{
long double __re_;
long double __im_;
public:
typedef long double value_type;
public:
typedef long double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {}
@@ -781,20 +781,6 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
return !(__x == __y);
}
/*
Move to <istream>
template<class T, class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>&, complex<T>&);
Move to <ostream>
template<class T, class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
*/
// 26.3.7 values:
// real
@@ -994,17 +980,17 @@ conj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
long double
complex<long double>
conj(long double __re)
{
return __re;
return complex<long double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
double
complex<double>
conj(double __re)
{
return __re;
return complex<double>(__re);
}
template<class _Tp>
@@ -1012,18 +998,18 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
double
complex<double>
>::type
conj(_Tp __re)
{
return __re;
return complex<double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
float
complex<float>
conj(float __re)
{
return __re;
return complex<float>(__re);
}
// proj
@@ -1040,21 +1026,21 @@ proj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
long double
complex<long double>
proj(long double __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<long double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
double
complex<double>
proj(double __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<double>(__re);
}
template<class _Tp>
@@ -1062,20 +1048,20 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
double
complex<double>
>::type
proj(_Tp __re)
{
return __re;
return complex<double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
float
complex<float>
proj(float __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<float>(__re);
}
// polar
@@ -1187,7 +1173,7 @@ complex<typename __promote<_Tp, _Up>::type>
pow(const complex<_Tp>& __x, const complex<_Up>& __y)
{
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y));
return _VSTD::pow(result_type(__x), result_type(__y));
}
template<class _Tp, class _Up>
@@ -1200,7 +1186,7 @@ typename enable_if
pow(const complex<_Tp>& __x, const _Up& __y)
{
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y));
return _VSTD::pow(result_type(__x), result_type(__y));
}
template<class _Tp, class _Up>
@@ -1213,7 +1199,7 @@ typename enable_if
pow(const _Tp& __x, const complex<_Up>& __y)
{
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y));
return _VSTD::pow(result_type(__x), result_type(__y));
}
// asinh

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,11 +22,11 @@
#include <ccomplex>
#else
#else // __cplusplus
#include_next <complex.h>
#endif
#endif // __cplusplus
#pragma GCC system_header

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -61,6 +61,8 @@ public:
native_handle_type native_handle();
};
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
class condition_variable_any
{
public:
@@ -113,7 +115,7 @@ public:
_LIBCPP_BEGIN_NAMESPACE_STD
class condition_variable_any
class _LIBCPP_VISIBLE condition_variable_any
{
condition_variable __cv_;
shared_ptr<mutex> __mut_;
@@ -151,11 +153,11 @@ public:
_Predicate __pred);
};
inline
inline _LIBCPP_INLINE_VISIBILITY
condition_variable_any::condition_variable_any()
: __mut_(make_shared<mutex>()) {}
inline
inline _LIBCPP_INLINE_VISIBILITY
void
condition_variable_any::notify_one()
{
@@ -163,7 +165,7 @@ condition_variable_any::notify_one()
__cv_.notify_one();
}
inline
inline _LIBCPP_INLINE_VISIBILITY
void
condition_variable_any::notify_all()
{
@@ -190,7 +192,7 @@ condition_variable_any::wait(_Lock& __lock)
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
{
@@ -212,7 +214,7 @@ condition_variable_any::wait_until(_Lock& __lock,
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
condition_variable_any::wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
@@ -225,25 +227,28 @@ condition_variable_any::wait_until(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period>
inline
inline _LIBCPP_INLINE_VISIBILITY
cv_status
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d)
{
return wait_until(__lock, chrono::monotonic_clock::now() + __d);
return wait_until(__lock, chrono::steady_clock::now() + __d);
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lock, chrono::monotonic_clock::now() + __d,
_STD::move(__pred));
return wait_until(__lock, chrono::steady_clock::now() + __d,
_VSTD::move(__pred));
}
_LIBCPP_VISIBLE
void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk);
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CONDITION_VARIABLE

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -25,7 +25,7 @@ Macros:
SIGINT
SIGSEGV
SIGTERM
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@ Macros:
void va_copy(va_list dest, va_list src); // C99
void va_end(va_list ap);
void va_start(va_list ap, parmN);
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,7 +18,7 @@ Macros:
offsetof(type,member-designator)
NULL
namespace std
{
@@ -39,7 +39,7 @@ Types:
#define __need_NULL
#define __need_ptrdiff_t
#define __need_size_t
#endif
#endif // __GLIBC__
#include <stddef.h>
@@ -54,7 +54,7 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct nullptr_t
struct _LIBCPP_VISIBLE nullptr_t
{
void* _;
@@ -65,11 +65,11 @@ struct nullptr_t
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
@@ -78,54 +78,23 @@ struct nullptr_t
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
template <typename _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;}
template <typename _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;}
};
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _STD::__get_nullptr_t()
#define nullptr _VSTD::__get_nullptr_t()
#else
typedef decltype(nullptr) nullptr_t;
#endif
#endif // _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_CSTDDEF

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,7 +21,7 @@ Macros:
MB_CUR_MAX
NULL
RAND_MAX
namespace std
{
@@ -66,7 +66,7 @@ long labs( long j);
long long llabs(long long j); // C99
div_t div( int numer, int denom);
ldiv_t div( long numer, long denom);
lldiv_t div(long long numer, long long denom); // C++0X
lldiv_t div(long long numer, long long denom); // C++0X
ldiv_t ldiv( long numer, long denom);
lldiv_t lldiv(long long numer, long long denom); // C99
int mblen(const char* s, size_t n);

View File

@@ -17,7 +17,7 @@
Macros:
NULL
namespace std
{
@@ -78,23 +78,26 @@ using ::strcoll;
using ::strxfrm;
using ::memchr;
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
using ::strchr;
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
using ::strcspn;
using ::strpbrk;
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
using ::strrchr;
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
using ::strspn;
using ::strstr;
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY void* memchr( void* __s, int __c, size_t __n) {return ::memchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY char* strstr( char* __s1, const char* __s2) {return ::strstr(__s1, __s2);}
#endif
using ::strtok;
using ::memset;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -18,7 +18,7 @@ Macros:
NULL
CLOCKS_PER_SEC
namespace std
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,7 +20,7 @@ Macros:
WCHAR_MAX
WCHAR_MIN
WEOF
namespace std
{
@@ -49,7 +49,7 @@ wint_t fputwc(wchar_t c, FILE* stream);
int fputws(const wchar_t* restrict s, FILE* restrict stream);
int fwide(FILE* stream, int mode);
wint_t getwc(FILE* stream);
wint_t getwchar();
wint_t getwchar();
wint_t putwc(wchar_t c, FILE* stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE* stream);
@@ -92,10 +92,10 @@ wint_t btowc(int c);
int wctob(wint_t c);
int mbsinit(const mbstate_t* ps);
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
mbstate_t* restrict ps);
mbstate_t* restrict ps);
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
mbstate_t* restrict ps);
@@ -106,6 +106,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#if _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32
#pragma GCC system_header

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -17,7 +17,7 @@
Macros:
WEOF
namespace std
{
@@ -66,7 +66,7 @@ using ::wctype_t;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
#undef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
#else
#else // iswalnum
using ::iswalnum;
#endif
@@ -74,7 +74,7 @@ using ::iswalnum;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
#undef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
#else
#else // iswalpha
using ::iswalpha;
#endif
@@ -82,7 +82,7 @@ using ::iswalpha;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
#undef iswblank
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
#else
#else // iswblank
using ::iswblank;
#endif
@@ -90,7 +90,7 @@ using ::iswblank;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
#undef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
#else
#else // iswcntrl
using ::iswcntrl;
#endif
@@ -98,7 +98,7 @@ using ::iswcntrl;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
#undef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
#else
#else // iswdigit
using ::iswdigit;
#endif
@@ -106,7 +106,7 @@ using ::iswdigit;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
#undef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
#else
#else // iswgraph
using ::iswgraph;
#endif
@@ -114,7 +114,7 @@ using ::iswgraph;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
#undef iswlower
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
#else
#else // iswlower
using ::iswlower;
#endif
@@ -122,7 +122,7 @@ using ::iswlower;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
#undef iswprint
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
#else
#else // iswprint
using ::iswprint;
#endif
@@ -130,7 +130,7 @@ using ::iswprint;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
#undef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
#else
#else // iswpunct
using ::iswpunct;
#endif
@@ -138,7 +138,7 @@ using ::iswpunct;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
#undef iswspace
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
#else
#else // iswspace
using ::iswspace;
#endif
@@ -146,7 +146,7 @@ using ::iswspace;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
#undef iswupper
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
#else
#else // iswupper
using ::iswupper;
#endif
@@ -154,7 +154,7 @@ using ::iswupper;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
#undef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
#else
#else // iswxdigit
using ::iswxdigit;
#endif
@@ -162,7 +162,7 @@ using ::iswxdigit;
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
#undef iswctype
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
#else
#else // iswctype
using ::iswctype;
#endif
@@ -170,7 +170,7 @@ using ::iswctype;
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
#undef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
#else
#else // wctype
using ::wctype;
#endif
@@ -178,7 +178,7 @@ using ::wctype;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
#undef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
#else
#else // towlower
using ::towlower;
#endif
@@ -186,7 +186,7 @@ using ::towlower;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
#undef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
#else
#else // towupper
using ::towupper;
#endif
@@ -194,7 +194,7 @@ using ::towupper;
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
#undef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
#else
#else // towctrans
using ::towctrans;
#endif
@@ -202,7 +202,7 @@ using ::towctrans;
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
#undef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
#else
#else // wctrans
using ::wctrans;
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,54 +20,56 @@ namespace std
class exception
{
public:
exception() throw();
exception(const exception&) throw();
exception& operator=(const exception&) throw();
virtual ~exception() throw();
virtual const char* what() const throw();
exception() noexcept;
exception(const exception&) noexcept;
exception& operator=(const exception&) noexcept;
virtual ~exception() noexcept;
virtual const char* what() const noexcept;
};
class bad_exception
: public exception
{
public:
bad_exception() throw();
bad_exception(const bad_exception&) throw();
bad_exception& operator=(const bad_exception&) throw();
virtual ~bad_exception() throw();
virtual const char* what() const throw();
bad_exception() noexcept;
bad_exception(const bad_exception&) noexcept;
bad_exception& operator=(const bad_exception&) noexcept;
virtual ~bad_exception() noexcept;
virtual const char* what() const noexcept;
};
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f ) throw();
void unexpected [[noreturn]] ();
unexpected_handler set_unexpected(unexpected_handler f ) noexcept;
unexpected_handler get_unexpected() noexcept;
[[noreturn]] void unexpected();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) throw();
void terminate [[noreturn]] ();
terminate_handler set_terminate(terminate_handler f ) noexcept;
terminate_handler get_terminate() noexcept;
[[noreturn]] void terminate() noexcept;
bool uncaught_exception() throw();
bool uncaught_exception() noexcept;
typedef unspecified exception_ptr;
exception_ptr current_exception();
exception_ptr current_exception() noexcept;
void rethrow_exception [[noreturn]] (exception_ptr p);
template<class E> exception_ptr make_exception_ptr(E e);
template<class E> exception_ptr make_exception_ptr(E e) noexcept;
class nested_exception
{
public:
nested_exception() throw();
nested_exception(const nested_exception&) throw() = default;
nested_exception& operator=(const nested_exception&) throw() = default;
nested_exception() noexcept;
nested_exception(const nested_exception&) noexcept = default;
nested_exception& operator=(const nested_exception&) noexcept = default;
virtual ~nested_exception() = default;
// access functions
void rethrow_nested [[noreturn]] () const;
exception_ptr nested_ptr() const;
[[noreturn]] void rethrow_nested() const;
exception_ptr nested_ptr() const noexcept;
};
template <class T> void throw_with_nested [[noreturn]] (T&& t);
template <class T> [[noreturn]] void throw_with_nested(T&& t);
template <class E> void rethrow_if_nested(const E& e);
} // std
@@ -86,61 +88,67 @@ namespace std // purposefully not using versioning namespace
class _LIBCPP_EXCEPTION_ABI exception
{
public:
_LIBCPP_INLINE_VISIBILITY exception() throw() {}
virtual ~exception() throw();
virtual const char* what() const throw();
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {}
virtual ~exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI bad_exception
: public exception
{
public:
_LIBCPP_INLINE_VISIBILITY bad_exception() throw() {}
virtual ~bad_exception() throw();
virtual const char* what() const throw();
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {}
virtual ~bad_exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
_LIBCPP_VISIBLE void unexpected();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
_LIBCPP_VISIBLE bool uncaught_exception() throw();
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
class exception_ptr;
exception_ptr current_exception();
void rethrow_exception(exception_ptr); // noreturn
exception_ptr current_exception() _NOEXCEPT;
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
class exception_ptr
class _LIBCPP_VISIBLE exception_ptr
{
void* __ptr_;
public:
exception_ptr() : __ptr_() {}
exception_ptr(nullptr_t) : __ptr_() {}
exception_ptr(const exception_ptr&);
exception_ptr& operator=(const exception_ptr&);
~exception_ptr();
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool() const {return __ptr_ != nullptr;}
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
friend bool operator==(const exception_ptr& __x, const exception_ptr& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return !(__x == __y);}
friend exception_ptr current_exception();
friend void rethrow_exception(exception_ptr); // noreturn
friend exception_ptr current_exception() _NOEXCEPT;
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
};
template<class _E>
exception_ptr
make_exception_ptr(_E __e)
make_exception_ptr(_E __e) _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
throw __e;
@@ -149,6 +157,7 @@ make_exception_ptr(_E __e)
{
return current_exception();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
// nested_exception
@@ -157,14 +166,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception
{
exception_ptr __ptr_;
public:
nested_exception();
// nested_exception(const nested_exception&) throw() = default;
// nested_exception& operator=(const nested_exception&) throw() = default;
virtual ~nested_exception();
nested_exception() _NOEXCEPT;
// nested_exception(const nested_exception&) noexcept = default;
// nested_exception& operator=(const nested_exception&) noexcept = default;
virtual ~nested_exception() _NOEXCEPT;
// access functions
void rethrow_nested /*[[noreturn]]*/ () const;
exception_ptr nested_ptr() const {return __ptr_;}
_ATTRIBUTE(noreturn) void rethrow_nested() const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
};
template <class _Tp>
@@ -172,43 +181,49 @@ struct __nested
: public _Tp,
public nested_exception
{
explicit __nested(const _Tp& __t) : _Tp(__t) {}
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
template <class _Tp>
void
#ifdef _LIBCPP_MOVE
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
_ATTRIBUTE(noreturn)
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
is_class<typename remove_reference<_Tp>::type>::value &&
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0)
#else
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested (_Tp& __t, typename enable_if<
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
>::type* = 0)
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
#ifndef _LIBCPP_NO_EXCEPTIONS
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
#endif
}
template <class _Tp>
void
#ifdef _LIBCPP_MOVE
throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
_ATTRIBUTE(noreturn)
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
!is_class<typename remove_reference<_Tp>::type>::value ||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0)
#else
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested (_Tp& __t, typename enable_if<
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
>::type* = 0)
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
throw _STD::forward<_Tp>(__t);
#ifndef _LIBCPP_NO_EXCEPTIONS
throw _VSTD::forward<_Tp>(__t);
#endif
}
template <class _E>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_E>::value
@@ -220,7 +235,7 @@ rethrow_if_nested(const _E& __e, typename enable_if<
}
template <class _E>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_E>::value

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

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -203,8 +203,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <functional>
#include <stdexcept>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header
@@ -217,11 +220,13 @@ class __hash_map_hasher
: private _Hash
{
public:
__hash_map_hasher() : _Hash() {}
__hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
@@ -231,11 +236,13 @@ class __hash_map_hasher<_Tp, _Hash, false>
{
_Hash __hash_;
public:
__hash_map_hasher() : __hash_() {}
__hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return __hash_(__x);}
};
@@ -245,16 +252,20 @@ class __hash_map_equal
: private _Pred
{
public:
__hash_map_equal() : _Pred() {}
__hash_map_equal(const _Pred& __p) : _Pred(__p) {}
const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
bool operator()(const typename _Tp::first_type& __x,
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
};
@@ -264,15 +275,19 @@ class __hash_map_equal<_Tp, _Pred, false>
{
_Pred __pred_;
public:
__hash_map_equal() : __pred_() {}
__hash_map_equal(const _Pred& __p) : __pred_(__p) {}
const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return __pred_(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return __pred_(__x, __y);}
@@ -298,13 +313,15 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
__second_constructed(false)
{}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -312,7 +329,8 @@ public:
{
__x.__value_constructed = false;
}
#else
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -320,21 +338,22 @@ public:
{
const_cast<bool&>(__x.__value_constructed) = false;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class _HashIterator>
class __hash_map_iterator
class _LIBCPP_VISIBLE __hash_map_iterator
{
_HashIterator __i_;
@@ -354,14 +373,15 @@ public:
#endif
pointer;
__hash_map_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
reference operator*() const {return *operator->();}
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
__hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator operator++(int)
{
__hash_map_iterator __t(*this);
@@ -369,20 +389,22 @@ public:
return __t;
}
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
};
template <class _HashIterator>
class __hash_map_const_iterator
class _LIBCPP_VISIBLE __hash_map_const_iterator
{
_HashIterator __i_;
@@ -402,17 +424,23 @@ public:
#endif
pointer;
__hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator operator++(int)
{
__hash_map_const_iterator __t(*this);
@@ -420,25 +448,28 @@ public:
return __t;
}
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class hash_map
class _LIBCPP_VISIBLE hash_map
{
public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -480,7 +511,7 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
hash_map() {__table_.rehash(193);}
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
hash_map(size_type __n, const hasher& __hf,
@@ -499,52 +530,79 @@ public:
const allocator_type& __a);
hash_map(const hash_map& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
mapped_type& operator[](const key_type& __k);
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
private:
@@ -614,16 +672,16 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
return _VSTD::move(__h);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -646,7 +704,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -674,7 +732,7 @@ operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -684,12 +742,13 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class hash_multimap
class _LIBCPP_VISIBLE hash_multimap
{
public:
// types
typedef _Key key_type;
typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher;
typedef _Pred key_equal;
typedef _Alloc allocator_type;
@@ -729,6 +788,7 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multimap() {__table_.rehash(193);}
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -748,49 +808,76 @@ public:
const allocator_type& __a);
hash_multimap(const hash_multimap& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -853,7 +940,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -863,7 +950,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -885,9 +972,9 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
{
_EqRng __xeq = __x.equal_range(__i->first);
_EqRng __yeq = __y.equal_range(__i->first);
if (_STD::distance(__xeq.first, __xeq.second) !=
_STD::distance(__yeq.first, __yeq.second) ||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
if (_VSTD::distance(__xeq.first, __xeq.second) !=
_VSTD::distance(__yeq.first, __yeq.second) ||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false;
__i = __xeq.second;
}
@@ -895,7 +982,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -196,16 +196,19 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config>
#include <__hash_table>
#include <functional>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx {
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 hash_set
class _LIBCPP_VISIBLE hash_set
{
public:
// types
@@ -231,6 +234,7 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_set() {__table_.rehash(193);}
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -248,47 +252,74 @@ public:
const allocator_type& __a);
hash_set(const hash_set& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -350,7 +381,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -360,7 +391,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -388,7 +419,7 @@ operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -398,7 +429,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_multiset
class _LIBCPP_VISIBLE hash_multiset
{
public:
// types
@@ -424,6 +455,7 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multiset() {__table_.rehash(193);}
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -441,46 +473,73 @@ public:
const key_equal& __eql, const allocator_type& __a);
hash_multiset(const hash_multiset& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -543,7 +602,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -553,7 +612,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -575,9 +634,9 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
{
_EqRng __xeq = __x.equal_range(*__i);
_EqRng __yeq = __y.equal_range(*__i);
if (_STD::distance(__xeq.first, __xeq.second) !=
_STD::distance(__yeq.first, __yeq.second) ||
!_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
if (_VSTD::distance(__xeq.first, __xeq.second) !=
_VSTD::distance(__yeq.first, __yeq.second) ||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false;
__i = __xeq.second;
}
@@ -585,7 +644,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -122,7 +122,7 @@ public:
void close();
};
template <class charT, class traits>
template <class charT, class traits>
void
swap(basic_ofstream<charT, traits>& x, basic_ofstream<charT, traits>& y);
@@ -176,7 +176,7 @@ typedef basic_fstream<wchar_t> wfstream;
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_filebuf
class _LIBCPP_VISIBLE basic_filebuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -189,13 +189,13 @@ public:
// 27.9.1.2 Constructors/destructor:
basic_filebuf();
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_filebuf(basic_filebuf&& __rhs);
#endif
virtual ~basic_filebuf();
// 27.9.1.3 Assign/swap:
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_filebuf& operator=(basic_filebuf&& __rhs);
#endif
void swap(basic_filebuf& __rhs);
@@ -260,7 +260,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
setbuf(0, 4096);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
@@ -333,7 +333,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
swap(__rhs);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
@@ -341,14 +341,14 @@ basic_filebuf<_CharT, _Traits>::~basic_filebuf()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
close();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (__owns_eb_)
delete [] __extbuf_;
if (__owns_ib_)
@@ -362,9 +362,9 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
basic_streambuf<char_type, traits_type>::swap(__rhs);
if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
{
_STD::swap(__extbuf_, __rhs.__extbuf_);
_STD::swap(__extbufnext_, __rhs.__extbufnext_);
_STD::swap(__extbufend_, __rhs.__extbufend_);
_VSTD::swap(__extbuf_, __rhs.__extbuf_);
_VSTD::swap(__extbufnext_, __rhs.__extbufnext_);
_VSTD::swap(__extbufend_, __rhs.__extbufend_);
}
else
{
@@ -387,17 +387,17 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
__rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
__rhs.__extbufend_ = __rhs.__extbuf_ + __le;
}
_STD::swap(__ebs_, __rhs.__ebs_);
_STD::swap(__intbuf_, __rhs.__intbuf_);
_STD::swap(__ibs_, __rhs.__ibs_);
_STD::swap(__file_, __rhs.__file_);
_STD::swap(__cv_, __rhs.__cv_);
_STD::swap(__st_, __rhs.__st_);
_STD::swap(__om_, __rhs.__om_);
_STD::swap(__cm_, __rhs.__cm_);
_STD::swap(__owns_eb_, __rhs.__owns_eb_);
_STD::swap(__owns_ib_, __rhs.__owns_ib_);
_STD::swap(__always_noconv_, __rhs.__always_noconv_);
_VSTD::swap(__ebs_, __rhs.__ebs_);
_VSTD::swap(__intbuf_, __rhs.__intbuf_);
_VSTD::swap(__ibs_, __rhs.__ibs_);
_VSTD::swap(__file_, __rhs.__file_);
_VSTD::swap(__cv_, __rhs.__cv_);
_VSTD::swap(__st_, __rhs.__st_);
_VSTD::swap(__om_, __rhs.__om_);
_VSTD::swap(__cm_, __rhs.__cm_);
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
_VSTD::swap(__owns_ib_, __rhs.__owns_ib_);
_VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
if (this->eback() == (char_type*)__rhs.__extbuf_min_)
{
ptrdiff_t __n = this->gptr() - this->eback();
@@ -579,7 +579,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
this->setg(this->eback(),
this->eback() + __unget_sz,
this->eback() + __unget_sz + __nmemb);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
}
else
@@ -587,7 +587,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;
@@ -602,18 +602,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
else if (__inext != this->eback() + __unget_sz)
{
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
}
}
}
else
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
if (this->eback() == &__1buf)
this->setg(0, 0, 0);
return __c;
@@ -957,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream
template <class _CharT, class _Traits>
class basic_ifstream
class _LIBCPP_VISIBLE basic_ifstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -970,11 +970,11 @@ public:
basic_ifstream();
explicit basic_ifstream(const char* __s, ios_base::openmode __mode = ios_base::in);
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_ifstream(basic_ifstream&& __rhs);
#endif
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_ifstream& operator=(basic_ifstream&& __rhs);
#endif
void swap(basic_ifstream& __rhs);
@@ -1014,13 +1014,13 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
this->setstate(ios_base::failbit);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
: basic_istream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1030,12 +1030,12 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>&
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
{
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1102,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream
template <class _CharT, class _Traits>
class basic_ofstream
class _LIBCPP_VISIBLE basic_ofstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -1115,11 +1115,11 @@ public:
basic_ofstream();
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_ofstream(basic_ofstream&& __rhs);
#endif
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_ofstream& operator=(basic_ofstream&& __rhs);
#endif
void swap(basic_ofstream& __rhs);
@@ -1159,13 +1159,13 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
this->setstate(ios_base::failbit);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
: basic_ostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1175,12 +1175,12 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>&
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
{
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1247,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream
template <class _CharT, class _Traits>
class basic_fstream
class _LIBCPP_VISIBLE basic_fstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -1260,11 +1260,11 @@ public:
basic_fstream();
explicit basic_fstream(const char* __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_fstream(basic_fstream&& __rhs);
#endif
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_fstream& operator=(basic_fstream&& __rhs);
#endif
void swap(basic_fstream& __rhs);
@@ -1304,13 +1304,13 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
this->setstate(ios_base::failbit);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
: basic_iostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1320,12 +1320,12 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>&
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
{
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -29,15 +29,15 @@ public:
typedef const E* iterator;
typedef const E* const_iterator;
initializer_list();
initializer_list() noexcept;
size_t size() const;
const E* begin() const;
const E* end() const;
size_t size() const noexcept;
const E* begin() const noexcept;
const E* end() const noexcept;
};
template<class E> const E* begin(initializer_list<E> il);
template<class E> const E* end(initializer_list<E> il);
template<class E> const E* begin(initializer_list<E> il) noexcept;
template<class E> const E* end(initializer_list<E> il) noexcept;
} // std
@@ -51,14 +51,16 @@ template<class E> const E* end(initializer_list<E> il);
namespace std // purposefully not versioned
{
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _E>
class initializer_list
class _LIBCPP_VISIBLE initializer_list
{
const _E* __begin_;
size_t __size_;
_LIBCPP_ALWAYS_INLINE
initializer_list(const _E* __b, size_t __s)
initializer_list(const _E* __b, size_t __s) _NOEXCEPT
: __begin_(__b),
__size_(__s)
{}
@@ -71,17 +73,17 @@ public:
typedef const _E* iterator;
typedef const _E* const_iterator;
_LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;}
_LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;}
_LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;}
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
_LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;}
};
template<class _E>
inline _LIBCPP_INLINE_VISIBILITY
const _E*
begin(initializer_list<_E> __il)
begin(initializer_list<_E> __il) _NOEXCEPT
{
return __il.begin();
}
@@ -89,11 +91,13 @@ begin(initializer_list<_E> __il)
template<class _E>
inline _LIBCPP_INLINE_VISIBILITY
const _E*
end(initializer_list<_E> __il)
end(initializer_list<_E> __il) _NOEXCEPT
{
return __il.end();
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
} // std
#endif // _LIBCPP_INITIALIZER_LIST

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -43,10 +43,12 @@ class __iom_t1
{
ios_base::fmtflags __mask_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t1(ios_base::fmtflags __m) : __mask_(__m) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t1& __x)
{
@@ -56,6 +58,7 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t1& __x)
{
@@ -77,10 +80,12 @@ class __iom_t2
{
ios_base::fmtflags __mask_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t2(ios_base::fmtflags __m) : __mask_(__m) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t2& __x)
{
@@ -90,6 +95,7 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t2& __x)
{
@@ -111,10 +117,12 @@ class __iom_t3
{
int __base_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t3(int __b) : __base_(__b) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t3& __x)
{
@@ -127,6 +135,7 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t3& __x)
{
@@ -152,10 +161,12 @@ class __iom_t4
{
_CharT __fill_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t4(_CharT __c) : __fill_(__c) {}
template <class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t4& __x)
{
@@ -178,10 +189,12 @@ class __iom_t5
{
int __n_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t5(int __n) : __n_(__n) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t5& __x)
{
@@ -191,6 +204,7 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t5& __x)
{
@@ -212,10 +226,12 @@ class __iom_t6
{
int __n_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __iom_t6(int __n) : __n_(__n) {}
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t6& __x)
{
@@ -225,6 +241,7 @@ public:
template <class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t6& __x)
{
@@ -254,6 +271,7 @@ class __iom_t7
_MoneyT& __mon_;
bool __intl_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
@@ -270,7 +288,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
@@ -287,7 +305,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __is;
}
@@ -313,6 +331,7 @@ class __iom_t8
const _MoneyT& __mon_;
bool __intl_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
@@ -329,7 +348,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -345,7 +364,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -371,6 +390,7 @@ class __iom_t9
tm* __tm_;
const _CharT* __fmt_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
@@ -387,7 +407,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
@@ -405,7 +425,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
{
__is.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __is;
}
@@ -431,6 +451,7 @@ class __iom_t10
const tm* __tm_;
const _CharT* __fmt_;
public:
_LIBCPP_INLINE_VISIBILITY
__iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
@@ -447,7 +468,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -464,7 +485,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -222,7 +222,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize;
class ios_base
class _LIBCPP_VISIBLE ios_base
{
public:
class failure;
@@ -266,22 +266,22 @@ public:
enum seekdir {beg, cur, end};
typedef seekdir seek_dir;
typedef _STD::streamoff streamoff;
typedef _STD::streampos streampos;
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
class Init;
// 27.5.2.2 fmtflags state:
fmtflags flags() const;
fmtflags flags(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl);
fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
void unsetf(fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
_LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
_LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
_LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
streamsize precision() const;
streamsize precision(streamsize __prec);
streamsize width() const;
streamsize width(streamsize __wide);
_LIBCPP_INLINE_VISIBILITY streamsize precision() const;
_LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
_LIBCPP_INLINE_VISIBILITY streamsize width() const;
_LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
// 27.5.2.3 locales:
locale imbue(const locale& __loc);
@@ -307,22 +307,23 @@ private:
public:
static bool sync_with_stdio(bool __sync = true);
iostate rdstate() const;
_LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
void clear(iostate __state = goodbit);
void setstate(iostate __state);
bool good() const;
bool eof() const;
bool fail() const;
bool bad() const;
_LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
iostate exceptions() const;
void exceptions(iostate __except);
_LIBCPP_INLINE_VISIBILITY bool good() const;
_LIBCPP_INLINE_VISIBILITY bool eof() const;
_LIBCPP_INLINE_VISIBILITY bool fail() const;
_LIBCPP_INLINE_VISIBILITY bool bad() const;
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
void __set_badbit_and_consider_rethrow();
void __set_failbit_and_consider_rethrow();
protected:
_LIBCPP_INLINE_VISIBILITY
ios_base() {// purposefully does no initialization
}
@@ -370,7 +371,7 @@ private:
};
//enum class io_errc
struct io_errc
struct _LIBCPP_VISIBLE io_errc
{
enum _ {
stream = 1
@@ -381,9 +382,12 @@ enum _ {
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
};
template <> struct is_error_code_enum<io_errc> : public true_type { };
template <> struct is_error_code_enum<io_errc::_> : public true_type { };
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
_LIBCPP_VISIBLE
const error_category& iostream_category();
inline _LIBCPP_INLINE_VISIBILITY
@@ -400,16 +404,16 @@ make_error_condition(io_errc __e)
return error_condition(static_cast<int>(__e), iostream_category());
}
class ios_base::failure
class _LIBCPP_EXCEPTION_ABI ios_base::failure
: public system_error
{
public:
{
public:
explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
virtual ~failure() throw();
};
class ios_base::Init
class _LIBCPP_VISIBLE ios_base::Init
{
public:
Init();
@@ -556,7 +560,7 @@ ios_base::exceptions(iostate __except)
}
template <class _CharT, class _Traits>
class basic_ios
class _LIBCPP_VISIBLE basic_ios
: public ios_base
{
public:
@@ -583,36 +587,52 @@ public:
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
// 27.5.4.1 Constructor/destructor:
_LIBCPP_INLINE_VISIBILITY
explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
virtual ~basic_ios();
// 27.5.4.2 Members:
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie() const;
_LIBCPP_INLINE_VISIBILITY
basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf() const;
_LIBCPP_INLINE_VISIBILITY
basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
basic_ios& copyfmt(const basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
char_type fill() const;
_LIBCPP_INLINE_VISIBILITY
char_type fill(char_type __ch);
_LIBCPP_INLINE_VISIBILITY
locale imbue(const locale& __loc);
_LIBCPP_INLINE_VISIBILITY
char narrow(char_type __c, char __dfault) const;
_LIBCPP_INLINE_VISIBILITY
char_type widen(char __c) const;
protected:
_LIBCPP_ALWAYS_INLINE
basic_ios() {// purposefully does no initialization
}
_LIBCPP_INLINE_VISIBILITY
void init(basic_streambuf<char_type, traits_type>* __sb);
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios& __rhs);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_ALWAYS_INLINE
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private:
basic_ostream<char_type, traits_type>* __tie_;
@@ -756,8 +776,8 @@ void
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
{
ios_base::swap(__rhs);
_STD::swap(__tie_, __rhs.__tie_);
_STD::swap(__fill_, __rhs.__fill_);
_VSTD::swap(__tie_, __rhs.__tie_);
_VSTD::swap(__fill_, __rhs.__fill_);
}
template <class _CharT, class _Traits>

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,6 +20,7 @@ namespace std
template<class charT> struct char_traits;
template<class T> class allocator;
class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf;
@@ -92,32 +93,49 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _CharT> struct char_traits;
template<class _Tp> class allocator;
class ios_base;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ios;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
class basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> > class istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> > class ostreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE ostreambuf_iterator;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
@@ -152,19 +170,20 @@ typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class _State> class fpos;
template <class _State> class _LIBCPP_VISIBLE fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef fpos<mbstate_t> u16streampos;
typedef fpos<mbstate_t> u32streampos;
#endif
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
typedef long long streamoff; // for char_traits in <string>
template <class _CharT, // for <stdexcept>
class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class basic_string;
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -88,7 +88,7 @@ public:
typedef typename iterator_traits<Iterator>::difference_type difference_type;
typedef typename iterator_traits<Iterator>::reference reference;
typedef typename iterator_traits<Iterator>::pointer pointer;
reverse_iterator();
explicit reverse_iterator(Iterator x);
template <class U> reverse_iterator(const reverse_iterator<U>& u);
@@ -151,7 +151,7 @@ public:
typedef void pointer;
explicit back_insert_iterator(Container& x);
back_insert_iterator& operator=(typename Container::const_reference value);
back_insert_iterator& operator=(const typename Container::value_type& value);
back_insert_iterator& operator*();
back_insert_iterator& operator++();
back_insert_iterator operator++(int);
@@ -172,7 +172,7 @@ public:
typedef void pointer;
explicit front_insert_iterator(Container& x);
front_insert_iterator& operator=(typename Container::const_reference value);
front_insert_iterator& operator=(const typename Container::value_type& value);
front_insert_iterator& operator*();
front_insert_iterator& operator++();
front_insert_iterator operator++(int);
@@ -194,7 +194,7 @@ public:
typedef void pointer;
insert_iterator(Container& x, typename Container::iterator i);
insert_iterator& operator=(typename Container::const_reference value);
insert_iterator& operator=(const typename Container::value_type& value);
insert_iterator& operator*();
insert_iterator& operator++();
insert_iterator& operator++(int);
@@ -325,11 +325,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
_LIBCPP_BEGIN_NAMESPACE_STD
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
struct _LIBCPP_VISIBLE input_iterator_tag {};
struct _LIBCPP_VISIBLE output_iterator_tag {};
struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
@@ -372,11 +372,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct iterator_traits
struct _LIBCPP_VISIBLE iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct iterator_traits<_Tp*>
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@@ -407,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct iterator
struct _LIBCPP_VISIBLE iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@@ -482,29 +482,29 @@ distance(_InputIter __first, _InputIter __last)
}
template <class _ForwardIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIter
next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{
advance(__x, __n);
_VSTD::advance(__x, __n);
return __x;
}
template <class _BidiretionalIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_BidiretionalIter
prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{
advance(__x, -__n);
_VSTD::advance(__x, -__n);
return __x;
}
template <class _Iter>
class reverse_iterator
class _LIBCPP_VISIBLE reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@@ -520,7 +520,7 @@ public:
typedef typename iterator_traits<_Iter>::difference_type difference_type;
typedef typename iterator_traits<_Iter>::reference reference;
typedef typename iterator_traits<_Iter>::pointer pointer;
_LIBCPP_INLINE_VISIBILITY reverse_iterator() : current() {}
_LIBCPP_INLINE_VISIBILITY explicit reverse_iterator(_Iter __x) : __t(__x), current(__x) {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY reverse_iterator(const reverse_iterator<_Up>& __u)
@@ -611,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class back_insert_iterator
class _LIBCPP_VISIBLE back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -624,12 +624,12 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_back(__value); return *this;}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_back(_STD::move(__value)); return *this;}
#endif
{container->push_back(_VSTD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;}
@@ -644,7 +644,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class front_insert_iterator
class _LIBCPP_VISIBLE front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -657,12 +657,12 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_front(__value); return *this;}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_front(_STD::move(__value)); return *this;}
#endif
{container->push_front(_VSTD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;}
@@ -677,7 +677,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class insert_iterator
class _LIBCPP_VISIBLE insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -692,12 +692,12 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
{iter = container->insert(iter, __value); ++iter; return *this;}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
{iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;}
#endif
{iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;}
@@ -713,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class istream_iterator
class _LIBCPP_VISIBLE istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@@ -752,7 +752,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class ostream_iterator
class _LIBCPP_VISIBLE ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -781,7 +781,7 @@ public:
};
template<class _CharT, class _Traits>
class istreambuf_iterator
class _LIBCPP_VISIBLE istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@@ -806,6 +806,7 @@ private:
_LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
};
_LIBCPP_INLINE_VISIBILITY
void __test_for_eof()
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
@@ -820,7 +821,7 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
@@ -852,7 +853,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class ostreambuf_iterator
class _LIBCPP_VISIBLE ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -880,7 +881,7 @@ public:
};
template <class _Iter>
class move_iterator
class _LIBCPP_VISIBLE move_iterator
{
private:
_Iter __i;
@@ -890,19 +891,24 @@ public:
typedef typename iterator_traits<iterator_type>::value_type value_type;
typedef typename iterator_traits<iterator_type>::difference_type difference_type;
typedef typename iterator_traits<iterator_type>::pointer pointer;
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typedef value_type&& reference;
#else
typedef typename iterator_traits<iterator_type>::reference reference;
#endif
_LIBCPP_INLINE_VISIBILITY move_iterator() : __i() {}
_LIBCPP_INLINE_VISIBILITY explicit move_iterator(_Iter __x) : __i(__x) {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
return static_cast<reference>(*__i);
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
typename iterator_traits<iterator_type>::reference __ref = *__i;
return &__ref;
}
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
{move_iterator __tmp(*this); ++__i; return __tmp;}
@@ -918,7 +924,9 @@ public:
_LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{return __i[__n];}
{
return static_cast<reference>(__i[__n]);
}
};
template <class _Iter1, class _Iter2>
@@ -999,35 +1007,35 @@ template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2>
bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter>
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&);
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
template <class _I, class _O> _O copy(_I, _I, _O);
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
@@ -1037,7 +1045,7 @@ template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1055,33 +1063,108 @@ public:
private:
iterator_type __i;
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,
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0)
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int)
{__wrap_iter __tmp(*this); ++__i; return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() {--__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int)
{__wrap_iter __tmp(*this); --__i; return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const
{return __wrap_iter(__i + __n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n)
{__i += __n; return *this;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const
{return __wrap_iter(__i - __n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n)
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{return __i[__n];}
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
: __i(__u.base())
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__iterator_copy(this, &__u);
#endif
}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
__wrap_iter(const __wrap_iter& __x)
: __i(__x.base())
{
__get_db()->__iterator_copy(this, &__x);
}
_LIBCPP_INLINE_VISIBILITY
__wrap_iter& operator=(const __wrap_iter& __x)
{
if (this != &__x)
{
__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:
_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 _CharT, class _Traits, class _Alloc> friend class basic_string;
@@ -1090,42 +1173,42 @@ private:
template <class _Iter1, class _Iter2>
friend
bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
friend
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1>
friend
__wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&);
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
template <class _I, class _O> friend _O copy(_I, _I, _O);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
@@ -1136,7 +1219,7 @@ private:
friend
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1145,56 +1228,68 @@ private:
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() == __y.base();
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() < __y.base();
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __x.base() != __y.base();
return !(__x == __y);
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __x.base() > __y.base();
return __y < __x;
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __x.base() >= __y.base();
return !(__x < __y);
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __x.base() <= __y.base();
return !(__y < __x);
}
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to subtract incompatible iterators");
#endif
return __x.base() - __y.base();
}
@@ -1202,9 +1297,10 @@ template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter>
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
@@ -1260,7 +1356,7 @@ private:
iterator_type __i;
__debug_iter* __next;
__container_type* __cont;
public:
_LIBCPP_INLINE_VISIBILITY __debug_iter() : __next(0), __cont(0) {}
_LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter& __x)
@@ -1297,7 +1393,7 @@ private:
void __remove_owner();
static void __remove_all(__container_type* __c);
static void swap(__container_type* __x, __container_type* __y);
_LIBCPP_INLINE_VISIBILITY bool __is_deref() const
{return __is_deref(__is_random_access_iterator<iterator_type>());}
bool __is_deref(false_type) const;
@@ -1327,37 +1423,37 @@ private:
friend
bool
operator==(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator!=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
typename __debug_iter<_Cp, _Iter1>::difference_type
operator-(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1>
friend
__debug_iter<_Cp, _Iter1>
@@ -1376,7 +1472,7 @@ __debug_iter<_Container, _Iter>::operator=(const __debug_iter& __x)
}
return *this;
}
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::__set_owner(const __container_type* __c)
@@ -1615,10 +1711,10 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#endif // _LIBCPP_DEBUG
#if defined(_LIBCPP_MOVE) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(_C& __c) -> decltype(__c.begin())
{
@@ -1626,7 +1722,7 @@ begin(_C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(const _C& __c) -> decltype(__c.begin())
{
@@ -1634,7 +1730,7 @@ begin(const _C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(_C& __c) -> decltype(__c.end())
{
@@ -1642,17 +1738,17 @@ end(_C& __c) -> decltype(__c.end())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(const _C& __c) -> decltype(__c.end())
{
return __c.end();
}
#else
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
begin(_C& __c)
{
@@ -1660,7 +1756,7 @@ begin(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
begin(const _C& __c)
{
@@ -1668,7 +1764,7 @@ begin(const _C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
end(_C& __c)
{
@@ -1676,17 +1772,17 @@ end(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
end(const _C& __c)
{
return __c.end();
}
#endif
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
begin(_T (&__array)[_N])
{
@@ -1694,7 +1790,7 @@ begin(_T (&__array)[_N])
}
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
end(_T (&__array)[_N])
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,9 +22,9 @@ class numeric_limits
{
public:
static const bool is_specialized = false;
static T min() throw();
static T max() throw();
static T lowest() throw();
static T min() noexcept;
static T max() noexcept;
static T lowest() noexcept;
static const int digits = 0;
static const int digits10 = 0;
@@ -33,8 +33,8 @@ public:
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 0;
static T epsilon() throw();
static T round_error() throw();
static T epsilon() noexcept;
static T round_error() noexcept;
static const int min_exponent = 0;
static const int min_exponent10 = 0;
@@ -46,10 +46,10 @@ public:
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
static T infinity() throw();
static T quiet_NaN() throw();
static T signaling_NaN() throw();
static T denorm_min() throw();
static T infinity() noexcept;
static T quiet_NaN() noexcept;
static T signaling_NaN() noexcept;
static T denorm_min() noexcept;
static const bool is_iec559 = false;
static const bool is_bounded = false;
@@ -132,9 +132,9 @@ protected:
typedef _Tp type;
static const bool is_specialized = false;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return type();}
static const int digits = 0;
static const int digits10 = 0;
@@ -143,8 +143,8 @@ protected:
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = 0;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type();}
static const int min_exponent = 0;
static const int min_exponent10 = 0;
@@ -156,10 +156,10 @@ protected:
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type();}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type();}
static const bool is_iec559 = false;
static const bool is_bounded = false;
@@ -196,15 +196,15 @@ protected:
static const int max_digits10 = 0;
static const type __min = __libcpp_compute_min<type, digits, is_signed>::value;
static const type __max = is_signed ? type(type(~0) ^ __min) : type(~0);
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
static const int min_exponent = 0;
static const int min_exponent10 = 0;
@@ -216,10 +216,10 @@ protected:
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
static const bool is_iec559 = false;
static const bool is_bounded = true;
@@ -248,15 +248,15 @@ protected:
static const int max_digits10 = 0;
static const type __min = false;
static const type __max = true;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __min;}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __max;}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return min();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __min;}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __max;}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return min();}
static const bool is_integer = true;
static const bool is_exact = true;
static const int radix = 2;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return type(0);}
static const int min_exponent = 0;
static const int min_exponent10 = 0;
@@ -268,10 +268,10 @@ protected:
static const bool has_signaling_NaN = false;
static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return type(0);}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return type(0);}
static const bool is_iec559 = false;
static const bool is_bounded = true;
@@ -294,15 +294,15 @@ protected:
static const int digits = __FLT_MANT_DIG__;
static const int digits10 = __FLT_DIG__;
static const int max_digits10 = 2+(digits * 30103)/100000;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __FLT_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __FLT_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __FLT_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __FLT_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __FLT_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5F;}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __FLT_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5F;}
static const int min_exponent = __FLT_MIN_EXP__;
static const int min_exponent10 = __FLT_MIN_10_EXP__;
@@ -314,10 +314,10 @@ protected:
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_valf();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanf("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansf("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __FLT_DENORM_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_valf();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanf("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansf("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __FLT_DENORM_MIN__;}
static const bool is_iec559 = true;
static const bool is_bounded = true;
@@ -340,15 +340,15 @@ protected:
static const int digits = __DBL_MANT_DIG__;
static const int digits10 = __DBL_DIG__;
static const int max_digits10 = 2+(digits * 30103)/100000;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __DBL_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __DBL_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __DBL_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __DBL_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __DBL_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __DBL_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
static const int min_exponent = __DBL_MIN_EXP__;
static const int min_exponent10 = __DBL_MIN_10_EXP__;
@@ -360,10 +360,10 @@ protected:
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_val();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nan("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nans("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __DBL_DENORM_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_val();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nan("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nans("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __DBL_DENORM_MIN__;}
static const bool is_iec559 = true;
static const bool is_bounded = true;
@@ -386,15 +386,15 @@ protected:
static const int digits = __LDBL_MANT_DIG__;
static const int digits10 = __LDBL_DIG__;
static const int max_digits10 = 2+(digits * 30103)/100000;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __LDBL_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __LDBL_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return -max();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __LDBL_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __LDBL_MAX__;}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return -max();}
static const bool is_integer = false;
static const bool is_exact = false;
static const int radix = __FLT_RADIX__;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __LDBL_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return 0.5;}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __LDBL_EPSILON__;}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return 0.5;}
static const int min_exponent = __LDBL_MIN_EXP__;
static const int min_exponent10 = __LDBL_MIN_10_EXP__;
@@ -406,10 +406,10 @@ protected:
static const bool has_signaling_NaN = true;
static const float_denorm_style has_denorm = denorm_present;
static const bool has_denorm_loss = false;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __builtin_huge_vall();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __builtin_nanl("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __builtin_nansl("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __LDBL_DENORM_MIN__;}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __builtin_huge_vall();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __builtin_nanl("");}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
#if (defined(__ppc__) || defined(__ppc64__))
static const bool is_iec559 = false;
@@ -425,16 +425,16 @@ protected:
};
template <class _Tp>
class numeric_limits
class _LIBCPP_VISIBLE numeric_limits
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
{
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
typedef typename __base::type type;
public:
static const bool is_specialized = __base::is_specialized;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
static const int digits = __base::digits;
static const int digits10 = __base::digits10;
@@ -443,8 +443,8 @@ public:
static const bool is_integer = __base::is_integer;
static const bool is_exact = __base::is_exact;
static const int radix = __base::radix;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
static const int min_exponent = __base::min_exponent;
static const int min_exponent10 = __base::min_exponent10;
@@ -456,10 +456,10 @@ public:
static const bool has_signaling_NaN = __base::has_signaling_NaN;
static const float_denorm_style has_denorm = __base::has_denorm;
static const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
static const bool is_iec559 = __base::is_iec559;
static const bool is_bounded = __base::is_bounded;
@@ -471,16 +471,16 @@ public:
};
template <class _Tp>
class numeric_limits<const _Tp>
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
typedef _Tp type;
public:
static const bool is_specialized = __base::is_specialized;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
static const int digits = __base::digits;
static const int digits10 = __base::digits10;
@@ -489,8 +489,8 @@ public:
static const bool is_integer = __base::is_integer;
static const bool is_exact = __base::is_exact;
static const int radix = __base::radix;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
static const int min_exponent = __base::min_exponent;
static const int min_exponent10 = __base::min_exponent10;
@@ -502,10 +502,10 @@ public:
static const bool has_signaling_NaN = __base::has_signaling_NaN;
static const float_denorm_style has_denorm = __base::has_denorm;
static const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
static const bool is_iec559 = __base::is_iec559;
static const bool is_bounded = __base::is_bounded;
@@ -517,16 +517,16 @@ public:
};
template <class _Tp>
class numeric_limits<volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
typedef _Tp type;
public:
static const bool is_specialized = __base::is_specialized;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
static const int digits = __base::digits;
static const int digits10 = __base::digits10;
@@ -535,8 +535,8 @@ public:
static const bool is_integer = __base::is_integer;
static const bool is_exact = __base::is_exact;
static const int radix = __base::radix;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
static const int min_exponent = __base::min_exponent;
static const int min_exponent10 = __base::min_exponent10;
@@ -548,10 +548,10 @@ public:
static const bool has_signaling_NaN = __base::has_signaling_NaN;
static const float_denorm_style has_denorm = __base::has_denorm;
static const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
static const bool is_iec559 = __base::is_iec559;
static const bool is_bounded = __base::is_bounded;
@@ -563,16 +563,16 @@ public:
};
template <class _Tp>
class numeric_limits<const volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
typedef _Tp type;
public:
static const bool is_specialized = __base::is_specialized;
_LIBCPP_INLINE_VISIBILITY static type min() throw() {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() throw() {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() throw() {return __base::lowest();}
_LIBCPP_INLINE_VISIBILITY static type min() _NOEXCEPT {return __base::min();}
_LIBCPP_INLINE_VISIBILITY static type max() _NOEXCEPT {return __base::max();}
_LIBCPP_INLINE_VISIBILITY static type lowest() _NOEXCEPT {return __base::lowest();}
static const int digits = __base::digits;
static const int digits10 = __base::digits10;
@@ -581,8 +581,8 @@ public:
static const bool is_integer = __base::is_integer;
static const bool is_exact = __base::is_exact;
static const int radix = __base::radix;
_LIBCPP_INLINE_VISIBILITY static type epsilon() throw() {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() throw() {return __base::round_error();}
_LIBCPP_INLINE_VISIBILITY static type epsilon() _NOEXCEPT {return __base::epsilon();}
_LIBCPP_INLINE_VISIBILITY static type round_error() _NOEXCEPT {return __base::round_error();}
static const int min_exponent = __base::min_exponent;
static const int min_exponent10 = __base::min_exponent10;
@@ -594,10 +594,10 @@ public:
static const bool has_signaling_NaN = __base::has_signaling_NaN;
static const float_denorm_style has_denorm = __base::has_denorm;
static const bool has_denorm_loss = __base::has_denorm_loss;
_LIBCPP_INLINE_VISIBILITY static type infinity() throw() {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() throw() {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() throw() {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() throw() {return __base::denorm_min();}
_LIBCPP_INLINE_VISIBILITY static type infinity() _NOEXCEPT {return __base::infinity();}
_LIBCPP_INLINE_VISIBILITY static type quiet_NaN() _NOEXCEPT {return __base::quiet_NaN();}
_LIBCPP_INLINE_VISIBILITY static type signaling_NaN() _NOEXCEPT {return __base::signaling_NaN();}
_LIBCPP_INLINE_VISIBILITY static type denorm_min() _NOEXCEPT {return __base::denorm_min();}
static const bool is_iec559 = __base::is_iec559;
static const bool is_bounded = __base::is_bounded;

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

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -175,12 +175,15 @@ template<class Callable, class ...Args>
#include <__config>
#include <__mutex_base>
#include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#pragma GCC system_header
_LIBCPP_BEGIN_NAMESPACE_STD
class recursive_mutex
class _LIBCPP_VISIBLE recursive_mutex
{
pthread_mutex_t __m_;
@@ -198,10 +201,11 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return &__m_;}
};
class timed_mutex
class _LIBCPP_VISIBLE timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -218,8 +222,9 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -242,7 +247,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
return false;
}
class recursive_timed_mutex
class _LIBCPP_VISIBLE recursive_timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -260,8 +265,9 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -330,7 +336,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
return __r;
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1>
void
@@ -361,9 +367,9 @@ lock(_L0& __l0, _L1& __l1)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1, class ..._L2>
template <class _L0, class _L1, class _L2, class ..._L3>
void
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
while (true)
{
@@ -372,7 +378,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 0:
{
unique_lock<_L0> __u0(__l0);
__i = try_lock(__l1, __l2...);
__i = try_lock(__l1, __l2, __l3...);
if (__i == -1)
{
__u0.release();
@@ -385,35 +391,35 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 1:
{
unique_lock<_L1> __u1(__l1);
__i = try_lock(__l2..., __l0);
__i = try_lock(__l2, __l3..., __l0);
if (__i == -1)
{
__u1.release();
return;
}
}
if (__i == sizeof...(_L2))
if (__i == sizeof...(_L3) + 1)
__i = 0;
else
__i += 2;
sched_yield();
break;
default:
__lock_first(__i - 2, __l2..., __l0, __l1);
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
return;
}
}
}
template <class _L0, class _L1, class ..._L2>
inline
template <class _L0, class _L1, class _L2, class ..._L3>
inline _LIBCPP_INLINE_VISIBILITY
void
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
__lock_first(0, __l0, __l1, __l2...);
__lock_first(0, __l0, __l1, __l2, __l3...);
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
struct once_flag;
@@ -422,15 +428,16 @@ struct once_flag;
template<class _Callable, class... _Args>
void call_once(once_flag&, _Callable&&, _Args&&...);
#else
#else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable>
void call_once(once_flag&, _Callable);
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
struct once_flag
struct _LIBCPP_VISIBLE once_flag
{
_LIBCPP_INLINE_VISIBILITY
// constexpr
once_flag() {}
@@ -444,30 +451,68 @@ private:
template<class _Callable, class... _Args>
friend
void call_once(once_flag&, _Callable&&, _Args&&...);
#else
#else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable>
friend
void call_once(once_flag&, _Callable);
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifdef _LIBCPP_MOVE
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
}
};
#else
template <class _F>
class __call_once_param
{
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
__f_();
}
};
#endif
template <class _F>
void
__call_once_proxy(void* __vp)
@@ -487,15 +532,14 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{
typedef decltype(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...)) _G;
__call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
std::forward<_Args>(__args)...));
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
}
}
#else
#else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable>
inline _LIBCPP_INLINE_VISIBILITY
@@ -509,7 +553,7 @@ call_once(once_flag& __flag, _Callable __func)
}
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,34 +21,34 @@ class bad_alloc
: public exception
{
public:
bad_alloc() throw();
bad_alloc(const bad_alloc&) throw();
bad_alloc& operator=(const bad_alloc&) throw();
virtual ~bad_alloc() throw();
virtual const char* what() const throw();
bad_alloc() noexcept;
bad_alloc(const bad_alloc&) noexcept;
bad_alloc& operator=(const bad_alloc&) noexcept;
virtual const char* what() const noexcept;
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler(new_handler new_p) throw();
new_handler set_new_handler(new_handler new_p) noexcept;
new_handler get_new_handler() noexcept;
} // std
void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable
void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable
void operator delete(void* ptr) throw(); // replaceable
void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable
void* operator new(std::size_t size); // replaceable
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete(void* ptr) noexcept; // replaceable
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable
void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable
void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable
void operator delete[](void* ptr) throw(); // replaceable
void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable
void* operator new[](std::size_t size); // replaceable
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable
void operator delete[](void* ptr) noexcept; // replaceable
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable
void* operator new (std::size_t size, void* ptr) throw();
void* operator new[](std::size_t size, void* ptr) throw();
void operator delete (void* ptr, void*) throw();
void operator delete[](void* ptr, void*) throw();
void* operator new (std::size_t size, void* ptr) noexcept;
void* operator new[](std::size_t size, void* ptr) noexcept;
void operator delete (void* ptr, void*) noexcept;
void operator delete[](void* ptr, void*) noexcept;
*/
@@ -65,42 +65,51 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception
{
public:
bad_alloc() throw();
virtual ~bad_alloc() throw();
virtual const char* what() const throw();
bad_alloc() _NOEXCEPT;
virtual ~bad_alloc() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI bad_array_new_length
: public bad_alloc
{
public:
bad_array_new_length() throw();
virtual ~bad_array_new_length() throw();
virtual const char* what() const throw();
bad_array_new_length() _NOEXCEPT;
virtual ~bad_array_new_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
void __throw_bad_alloc(); // not in C++ spec
struct nothrow_t {};
struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
} // std
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete(void*) throw();
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void* operator new(std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc);
_LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete[](void*) throw();
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {}
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
#endif // _LIBCPP_NEW

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -138,7 +138,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_ostream
class _LIBCPP_VISIBLE basic_ostream
: virtual public basic_ios<_CharT, _Traits>
{
public:
@@ -153,12 +153,14 @@ public:
explicit basic_ostream(basic_streambuf<char_type, traits_type>* __sb);
virtual ~basic_ostream();
protected:
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream(basic_ostream&& __rhs);
#endif
// 27.7.2.3 Assign/swap
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs);
#endif
void swap(basic_ostream& __rhs);
@@ -203,7 +205,7 @@ protected:
};
template <class _CharT, class _Traits>
class basic_ostream<_CharT, _Traits>::sentry
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
{
bool __ok_;
basic_ostream<_CharT, _Traits>& __os_;
@@ -242,7 +244,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (__os_.rdbuf()->pubsync() == -1)
__os_.setstate(ios_base::badbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -250,7 +252,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
catch (...)
{
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
}
@@ -261,7 +263,7 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
this->init(__sb);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
@@ -279,7 +281,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::~basic_ostream()
@@ -328,7 +330,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -337,7 +339,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef ostreambuf_iterator<_CharT, _Traits> _O;
_I __i(__sb);
@@ -358,7 +360,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
{
this->__set_failbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
else
this->setstate(ios_base::badbit);
@@ -369,7 +371,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -380,7 +382,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -395,7 +397,7 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -406,7 +408,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -425,7 +427,7 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -436,7 +438,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -451,7 +453,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -462,7 +464,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -481,7 +483,7 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -492,7 +494,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -507,7 +509,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -518,7 +520,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -533,7 +535,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -544,7 +546,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -559,7 +561,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -570,7 +572,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -585,7 +587,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -596,7 +598,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -611,7 +613,7 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -622,7 +624,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -637,7 +639,7 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -648,7 +650,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -663,7 +665,7 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -674,7 +676,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -689,7 +691,7 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -700,7 +702,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -715,7 +717,7 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -726,7 +728,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -747,7 +749,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -758,7 +760,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -780,7 +782,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -791,7 +793,7 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -812,7 +814,7 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -823,7 +825,7 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -844,7 +846,7 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -855,7 +857,7 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -876,7 +878,7 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -887,7 +889,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -909,7 +911,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -920,7 +922,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -955,7 +957,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -966,7 +968,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -988,7 +990,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -999,7 +1001,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1021,7 +1023,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -1032,7 +1034,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1054,7 +1056,7 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -1065,7 +1067,7 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __s(*this);
if (__s)
{
@@ -1081,7 +1083,7 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -1092,7 +1094,7 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this);
if (__sen && __n)
{
@@ -1114,7 +1116,7 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -1125,7 +1127,7 @@ basic_ostream<_CharT, _Traits>::flush()
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
if (this->rdbuf())
{
sentry __s(*this);
@@ -1141,7 +1143,7 @@ basic_ostream<_CharT, _Traits>::flush()
{
this->__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return *this;
}
@@ -1206,7 +1208,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
return __os;
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Stream, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1222,7 +1224,7 @@ operator<<(_Stream&& __os, const _Tp& __x)
return __os;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
@@ -1232,7 +1234,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
@@ -1254,7 +1256,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
{
__os.__set_badbit_and_consider_rethrow();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
return __os;
}
@@ -1276,7 +1278,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -31,21 +31,28 @@ protected:
container_type c;
public:
queue();
queue() = default;
~queue() = default;
queue(const queue& q) = default;
queue(queue&& q) = default;
queue& operator=(const queue& q) = default;
queue& operator=(queue&& q) = default;
explicit queue(const container_type& c);
explicit queue(container_type&& c);
queue(queue&& q);
explicit queue(container_type&& c)
template <class Alloc>
explicit queue(const Alloc& a);
template <class Alloc>
queue(const container_type& c, const Alloc& a);
template <class Alloc>
queue(container_type&& c, const Alloc& a);
template <class Alloc>
queue(const queue& q, const Alloc& a);
template <class Alloc>
queue(queue&& q, const Alloc& a);
queue& operator=(queue&& q);
bool empty() const;
size_type size() const;
@@ -59,7 +66,7 @@ public:
template <class... Args> void emplace(Args&&... args);
void pop();
void swap(queue& q);
void swap(queue& q) noexcept(noexcept(swap(c, q.c)));
};
template <class T, class Container>
@@ -81,7 +88,8 @@ template <class T, class Container>
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
template <class T, class Container>
void swap(queue<T, Container>& x, queue<T, Container>& y);
void swap(queue<T, Container>& x, queue<T, Container>& y)
noexcept(noexcept(x.swap(y)));
template <class T, class Container = vector<T>,
class Compare = less<typename Container::value_type>>
@@ -99,7 +107,16 @@ protected:
Compare comp;
public:
explicit priority_queue(const Compare& comp = Compare());
priority_queue() = default;
~priority_queue() = default;
priority_queue(const priority_queue& q) = default;
priority_queue(priority_queue&& q) = default;
priority_queue& operator=(const priority_queue& q) = default;
priority_queue& operator=(priority_queue&& q) = default;
explicit priority_queue(const Compare& comp);
priority_queue(const Compare& comp, const container_type& c);
explicit priority_queue(const Compare& comp, container_type&& c);
template <class InputIterator>
@@ -111,8 +128,6 @@ public:
template <class InputIterator>
priority_queue(InputIterator first, InputIterator last,
const Compare& comp, container_type&& c);
priority_queue(priority_queue&& q);
priority_queue& operator=(priority_queue&& q);
template <class Alloc>
explicit priority_queue(const Alloc& a);
template <class Alloc>
@@ -123,6 +138,8 @@ public:
template <class Alloc>
priority_queue(const Compare& comp, container_type&& c,
const Alloc& a);
template <class Alloc>
priority_queue(const priority_queue& q, const Alloc& a);
template <class Alloc>
priority_queue(priority_queue&& q, const Alloc& a);
@@ -135,12 +152,14 @@ public:
template <class... Args> void emplace(Args&&... args);
void pop();
void swap(priority_queue& q);
void swap(priority_queue& q)
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
};
template <class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x,
priority_queue<T, Container, Compare>& y);
priority_queue<T, Container, Compare>& y)
noexcept(noexcept(x.swap(y)));
} // std
@@ -167,7 +186,7 @@ bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class queue
class _LIBCPP_VISIBLE queue
{
public:
typedef _Container container_type;
@@ -180,82 +199,123 @@ protected:
container_type c;
public:
queue() : c() {}
_LIBCPP_INLINE_VISIBILITY
queue()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(const queue& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
#ifdef _LIBCPP_MOVE
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__q.c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {}
: c(_VSTD::move(__q.c), __a) {}
queue& operator=(queue&& __q)
{
c = _STD::move(__q.c);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference front() {return c.front();}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return c.front();}
_LIBCPP_INLINE_VISIBILITY
reference back() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifdef _LIBCPP_MOVE
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_front();}
_LIBCPP_INLINE_VISIBILITY
void swap(queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(c, __q.c);
}
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
};
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -263,7 +323,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -271,7 +331,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -279,7 +339,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -287,7 +347,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -295,7 +355,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -303,22 +363,23 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
struct uses_allocator<queue<_Tp, _Container>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};
template <class _Tp, class _Container = vector<_Tp>,
class _Compare = less<typename _Container::value_type> >
class priority_queue
class _LIBCPP_VISIBLE priority_queue
{
public:
typedef _Container container_type;
@@ -333,10 +394,40 @@ protected:
value_compare comp;
public:
explicit priority_queue(const value_compare& __comp = value_compare())
_LIBCPP_INLINE_VISIBILITY
priority_queue()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
is_nothrow_default_constructible<value_compare>::value)
: c(), comp() {}
_LIBCPP_INLINE_VISIBILITY
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
is_nothrow_move_constructible<value_compare>::value)
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(const priority_queue& __q)
{c = __q.c; comp = __q.comp; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp)
: c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
explicit priority_queue(const value_compare& __comp, container_type&& __c);
#endif
template <class _InputIter>
@@ -345,13 +436,11 @@ public:
template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c);
priority_queue(priority_queue&& __q);
priority_queue& operator=(priority_queue&& __q);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
explicit priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -369,7 +458,7 @@ public:
priority_queue(const priority_queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
priority_queue(const value_compare& __comp, container_type&& __c,
const _Alloc& __a,
@@ -379,60 +468,67 @@ public:
priority_queue(priority_queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.front();}
void push(const value_type& __v);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void push(value_type&& __v);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> void emplace(_Args&&... __args);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void pop();
void swap(priority_queue& __q);
void swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value);
};
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
const container_type& __c)
: c(__c),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
: c(_VSTD::move(__c)),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp)
: c(__f, __l),
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 _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
const container_type& __c)
@@ -440,46 +536,29 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
comp(__comp)
{
c.insert(c.end(), __f, __l);
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
: c(_VSTD::move(__c)),
comp(__comp)
{
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
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
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
@@ -489,7 +568,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -501,7 +580,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const container_type& __c,
const _Alloc& __a,
@@ -510,12 +589,12 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
: c(__c, __a),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -523,103 +602,108 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
: c(__q.c, __a),
comp(__q.comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
: c(_STD::move(__c), __a),
: c(_VSTD::move(__c), __a),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
: c(_STD::move(__q.c), __a),
comp(_STD::move(__q.comp))
: c(_VSTD::move(__q.c), __a),
comp(_VSTD::move(__q.comp))
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{
c.push_back(__v);
_STD::push_heap(c.begin(), c.end(), comp);
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{
c.push_back(_STD::move(__v));
_STD::push_heap(c.begin(), c.end(), comp);
c.push_back(_VSTD::move(__v));
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{
c.emplace_back(_STD::forward<_Args>(__args)...);
_STD::push_heap(c.begin(), c.end(), comp);
c.emplace_back(_VSTD::forward<_Args>(__args)...);
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::pop()
{
_STD::pop_heap(c.begin(), c.end(), comp);
_VSTD::pop_heap(c.begin(), c.end(), comp);
c.pop_back();
}
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(c, __q.c);
swap(comp, __q.comp);
}
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -23,13 +23,14 @@ class ratio
public:
static const intmax_t num;
static const intmax_t den;
typedef ratio<num, den> type;
};
// ratio arithmetic
template <class R1, class R2> struct ratio_add;
template <class R1, class R2> struct ratio_subtract;
template <class R1, class R2> struct ratio_multiply;
template <class R1, class R2> struct ratio_divide;
template <class R1, class R2> using ratio_add = ...;
template <class R1, class R2> using ratio_subtract = ...;
template <class R1, class R2> using ratio_multiply = ...;
template <class R1, class R2> using ratio_divide = ...;
// ratio comparison
template <class R1, class R2> struct ratio_equal;
@@ -220,7 +221,7 @@ public:
};
template <intmax_t _Num, intmax_t _Den = 1>
class ratio
class _LIBCPP_VISIBLE ratio
{
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
static_assert(_Den != 0, "ratio divide by 0");
@@ -260,7 +261,7 @@ typedef ratio< 1000000000000000LL, 1LL> peta;
typedef ratio<1000000000000000000LL, 1LL> exa;
template <class _R1, class _R2>
struct ratio_multiply
struct __ratio_multiply
{
private:
static const intmax_t __gcd_n1_d2 = __static_gcd<_R1::num, _R2::den>::value;
@@ -273,8 +274,21 @@ public:
>::type type;
};
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_multiply
= typename __ratio_multiply<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct ratio_divide
struct _LIBCPP_VISIBLE ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct __ratio_divide
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -287,8 +301,21 @@ public:
>::type type;
};
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_divide
= typename __ratio_divide<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct ratio_add
struct _LIBCPP_VISIBLE ratio_divide
: public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct __ratio_add
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -309,8 +336,21 @@ public:
>::type type;
};
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_add
= typename __ratio_add<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct ratio_subtract
struct _LIBCPP_VISIBLE ratio_add
: public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct __ratio_subtract
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
@@ -331,15 +371,28 @@ public:
>::type type;
};
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_subtract
= typename __ratio_subtract<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
// ratio_equal
template <class _R1, class _R2>
struct ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
struct _LIBCPP_VISIBLE ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
template <class _R1, class _R2>
struct ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
struct _LIBCPP_VISIBLE ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
// ratio_less
@@ -397,19 +450,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
};
template <class _R1, class _R2>
struct ratio_less
struct _LIBCPP_VISIBLE ratio_less
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct ratio_less_equal
struct _LIBCPP_VISIBLE ratio_less_equal
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct ratio_greater
struct _LIBCPP_VISIBLE ratio_greater
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct ratio_greater_equal
struct _LIBCPP_VISIBLE ratio_greater_equal
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>

File diff suppressed because it is too large Load Diff

576
include/scoped_allocator Normal file
View File

@@ -0,0 +1,576 @@
// -*- C++ -*-
//===-------------------------- scoped_allocator --------------------------===//
//
// 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_SCOPED_ALLOCATOR
#define _LIBCPP_SCOPED_ALLOCATOR
/*
scoped_allocator synopsis
namespace std
{
template <class OuterAlloc, class... InnerAllocs>
class scoped_allocator_adaptor : public OuterAlloc
{
typedef allocator_traits<OuterAlloc> OuterTraits; // exposition only
scoped_allocator_adaptor<InnerAllocs...> inner; // exposition only
public:
typedef OuterAlloc outer_allocator_type;
typedef see below inner_allocator_type;
typedef typename OuterTraits::value_type value_type;
typedef typename OuterTraits::size_type size_type;
typedef typename OuterTraits::difference_type difference_type;
typedef typename OuterTraits::pointer pointer;
typedef typename OuterTraits::const_pointer const_pointer;
typedef typename OuterTraits::void_pointer void_pointer;
typedef typename OuterTraits::const_void_pointer const_void_pointer;
typedef see below propagate_on_container_copy_assignment;
typedef see below propagate_on_container_move_assignment;
typedef see below propagate_on_container_swap;
template <class Tp>
struct rebind
{
typedef scoped_allocator_adaptor<
OuterTraits::template rebind_alloc<Tp>, InnerAllocs...> other;
};
scoped_allocator_adaptor();
template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc,
const InnerAllocs&... innerAllocs) noexcept;
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept;
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept;
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator() noexcept;
const inner_allocator_type& inner_allocator() const noexcept;
outer_allocator_type& outer_allocator() noexcept;
const outer_allocator_type& outer_allocator() const noexcept;
pointer allocate(size_type n);
pointer allocate(size_type n, const_void_pointer hint);
void deallocate(pointer p, size_type n) noexcept;
size_type max_size() const;
template <class T, class... Args> void construct(T* p, Args&& args);
template <class T1, class T2, class... Args1, class... Args2>
void construct(pair<T1, T2>* p, piecewise_construct t, tuple<Args1...> x,
tuple<Args2...> y);
template <class T1, class T2>
void construct(pair<T1, T2>* p);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, U&& x, V&& y);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, const pair<U, V>& x);
template <class T1, class T2, class U, class V>
void construct(pair<T1, T2>* p, pair<U, V>&& x);
template <class T> void destroy(T* p);
template <class T> void destroy(T* p) noexcept;
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
};
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
template <class OuterA1, class OuterA2, class... InnerAllocs>
bool
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept;
} // std
*/
#include <__config>
#include <memory>
#pragma GCC system_header
_LIBCPP_BEGIN_NAMESPACE_STD
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
// scoped_allocator_adaptor
template <class ..._Allocs>
class scoped_allocator_adaptor;
template <class ..._Allocs> struct __get_poc_copy_assignment;
template <class _A0>
struct __get_poc_copy_assignment<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_copy_assignment::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_copy_assignment<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_copy_assignment::value ||
__get_poc_copy_assignment<_Allocs...>::value;
};
template <class ..._Allocs> struct __get_poc_move_assignment;
template <class _A0>
struct __get_poc_move_assignment<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_move_assignment::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_move_assignment<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_move_assignment::value ||
__get_poc_move_assignment<_Allocs...>::value;
};
template <class ..._Allocs> struct __get_poc_swap;
template <class _A0>
struct __get_poc_swap<_A0>
{
static const bool value = allocator_traits<_A0>::
propagate_on_container_swap::value;
};
template <class _A0, class ..._Allocs>
struct __get_poc_swap<_A0, _Allocs...>
{
static const bool value =
allocator_traits<_A0>::propagate_on_container_swap::value ||
__get_poc_swap<_Allocs...>::value;
};
template <class ..._Allocs>
class __scoped_allocator_storage;
template <class _OuterAlloc, class... _InnerAllocs>
class __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
: public _OuterAlloc
{
typedef _OuterAlloc outer_allocator_type;
protected:
typedef scoped_allocator_adaptor<_InnerAllocs...> inner_allocator_type;
private:
inner_allocator_type __inner_;
protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()),
__inner_(__other.inner_allocator()) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: outer_allocator_type(_VSTD::move(__other.outer_allocator())),
__inner_(_VSTD::move(__other.inner_allocator())) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const _NOEXCEPT
{
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
(
allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator()),
allocator_traits<inner_allocator_type>::
select_on_container_copy_construction(inner_allocator())
);
}
template <class...> friend class __scoped_allocator_storage;
};
template <class _OuterAlloc>
class __scoped_allocator_storage<_OuterAlloc>
: public _OuterAlloc
{
typedef _OuterAlloc outer_allocator_type;
protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT
: outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT
{return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const _NOEXCEPT
{return scoped_allocator_adaptor<outer_allocator_type>(
allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator())
);}
__scoped_allocator_storage(const outer_allocator_type& __o,
const inner_allocator_type& __i) _NOEXCEPT;
template <class...> friend class __scoped_allocator_storage;
};
// __outermost
template <class _Alloc>
decltype(declval<_Alloc>().outer_allocator(), true_type())
__has_outer_allocator_test(_Alloc&& __a);
template <class _Alloc>
false_type
__has_outer_allocator_test(const volatile _Alloc& __a);
template <class _Alloc>
struct __has_outer_allocator
: public common_type
<
decltype(__has_outer_allocator_test(declval<_Alloc&>()))
>::type
{
};
template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
struct __outermost
{
typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const _NOEXCEPT {return __a;}
};
template <class _Alloc>
struct __outermost<_Alloc, true>
{
typedef typename remove_reference
<
decltype(_VSTD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const _NOEXCEPT
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
typedef allocator_traits<_OuterAlloc> _OuterTraits;
public:
typedef _OuterAlloc outer_allocator_type;
typedef typename base::inner_allocator_type inner_allocator_type;
typedef typename _OuterTraits::size_type size_type;
typedef typename _OuterTraits::difference_type difference_type;
typedef typename _OuterTraits::pointer pointer;
typedef typename _OuterTraits::const_pointer const_pointer;
typedef typename _OuterTraits::void_pointer void_pointer;
typedef typename _OuterTraits::const_void_pointer const_void_pointer;
typedef integral_constant
<
bool,
__get_poc_copy_assignment<outer_allocator_type,
_InnerAllocs...>::value
> propagate_on_container_copy_assignment;
typedef integral_constant
<
bool,
__get_poc_move_assignment<outer_allocator_type,
_InnerAllocs...>::value
> propagate_on_container_move_assignment;
typedef integral_constant
<
bool,
__get_poc_swap<outer_allocator_type, _InnerAllocs...>::value
> propagate_on_container_swap;
template <class _Tp>
struct rebind
{
typedef scoped_allocator_adaptor
<
typename _OuterTraits::template rebind_alloc<_Tp>, _InnerAllocs...
> other;
};
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() _NOEXCEPT {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT
: base(__other) {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_VSTD::move(__other)) {}
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n);}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n, const_void_pointer __hint)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n) _NOEXCEPT
{allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _VSTD::forward<_Args>(__args)...);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::
destroy(_OM()(outer_allocator()), __p);
}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT
{return base::select_on_container_copy_construction();}
private:
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
: base(_VSTD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
_VSTD::forward<_Args>(__args)...
);
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
allocator_arg,
inner_allocator(),
_VSTD::forward<_Args>(__args)...
);
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
allocator_traits<typename _OM::type>::construct
(
_OM()(outer_allocator()),
__p,
_VSTD::forward<_Args>(__args)...,
inner_allocator()
);
}
template <class...> friend class __scoped_allocator_storage;
};
template <class _OuterA1, class _OuterA2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT
{
return __a.outer_allocator() == __b.outer_allocator();
}
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT
{
return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator();
}
template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT
{
return !(__a == __b);
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SCOPED_ALLOCATOR

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -42,7 +42,12 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
explicit set(const value_compare& comp = value_compare());
set()
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit set(const value_compare& comp);
set(const value_compare& comp, const allocator_type& a);
template <class InputIterator>
set(InputIterator first, InputIterator last,
@@ -51,7 +56,10 @@ public:
set(InputIterator first, InputIterator last, const value_compare& comp,
const allocator_type& a);
set(const set& s);
set(set&& s);
set(set&& s)
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit set(const allocator_type& a);
set(const set& s, const allocator_type& a);
set(set&& s, const allocator_type& a);
@@ -61,29 +69,33 @@ public:
~set();
set& operator=(const set& s);
set& operator=(set&& s);
set& operator=(set&& s)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
set& operator=(initializer_list<value_type> il);
// iterators:
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const;
const_iterator cend() const;
const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity:
bool empty() const;
size_type size() const;
size_type max_size() const;
bool empty() const noexcept;
size_type size() const noexcept;
size_type max_size() const noexcept;
// modifiers:
template <class... Args>
@@ -101,12 +113,16 @@ public:
iterator erase(const_iterator position);
size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last);
void clear();
void clear() noexcept;
void swap(set& s);
void swap(set& s)
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers:
allocator_type get_allocator() const;
allocator_type get_allocator() const noexcept;
key_compare key_comp() const;
value_compare value_comp() const;
@@ -155,8 +171,8 @@ operator<=(const set<Key, Compare, Allocator>& x,
// specialized algorithms:
template <class Key, class Compare, class Allocator>
void
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y);
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
template <class Key, class Compare = less<Key>,
class Allocator = allocator<Key>>
@@ -182,7 +198,12 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
explicit multiset(const value_compare& comp = value_compare());
multiset()
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit multiset(const value_compare& comp);
multiset(const value_compare& comp, const allocator_type& a);
template <class InputIterator>
multiset(InputIterator first, InputIterator last,
@@ -191,7 +212,10 @@ public:
multiset(InputIterator first, InputIterator last,
const value_compare& comp, const allocator_type& a);
multiset(const multiset& s);
multiset(multiset&& s);
multiset(multiset&& s)
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit multiset(const allocator_type& a);
multiset(const multiset& s, const allocator_type& a);
multiset(multiset&& s, const allocator_type& a);
@@ -201,29 +225,33 @@ public:
~multiset();
multiset& operator=(const multiset& s);
multiset& operator=(multiset&& s);
multiset& operator=(multiset&& s)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
multiset& operator=(initializer_list<value_type> il);
// iterators:
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
iterator begin() noexcept;
const_iterator begin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
reverse_iterator rbegin();
const_reverse_iterator rbegin() const;
reverse_iterator rend();
const_reverse_iterator rend() const;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_iterator cbegin() const;
const_iterator cend() const;
const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const;
const_iterator cbegin() const noexcept;
const_iterator cend() const noexcept;
const_reverse_iterator crbegin() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity:
bool empty() const;
size_type size() const;
size_type max_size() const;
bool empty() const noexcept;
size_type size() const noexcept;
size_type max_size() const noexcept;
// modifiers:
template <class... Args>
@@ -241,12 +269,16 @@ public:
iterator erase(const_iterator position);
size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last);
void clear();
void clear() noexcept;
void swap(multiset& s);
void swap(multiset& s)
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers:
allocator_type get_allocator() const;
allocator_type get_allocator() const noexcept;
key_compare key_comp() const;
value_compare value_comp() const;
@@ -295,7 +327,8 @@ operator<=(const multiset<Key, Compare, Allocator>& x,
// specialized algorithms:
template <class Key, class Compare, class Allocator>
void
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y);
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
noexcept(noexcept(x.swap(y)));
} // std
@@ -311,7 +344,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class set
class _LIBCPP_VISIBLE set
{
public:
// types:
@@ -337,14 +370,21 @@ public:
typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -353,6 +393,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -360,36 +401,51 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
{
insert(__s.begin(), __s.end());
}
#ifdef _LIBCPP_MOVE
set(set&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif
_LIBCPP_INLINE_VISIBILITY
set& operator=(const set& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set(set&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit set(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
insert(__s.begin(), __s.end());
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
set(set&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -397,138 +453,189 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__s.__tree_);
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator begin() {return __tree_.begin();}
const_iterator begin() const {return __tree_.begin();}
iterator end() {return __tree_.end();}
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return __tree_.end();}
reverse_iterator rbegin() {return reverse_iterator(end());}
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
reverse_iterator rend() {return reverse_iterator(begin());}
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() _NOEXCEPT
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT
{return const_reverse_iterator(begin());}
const_iterator cbegin() const {return begin();}
const_iterator cend() const {return end();}
const_reverse_iterator crbegin() const {return rbegin();}
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
bool empty() const {return __tree_.size() == 0;}
size_type size() const {return __tree_.size();}
size_type max_size() const {return __tree_.max_size();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const _NOEXCEPT {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers:
#ifdef _LIBCPP_MOVE
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
#endif
{return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v)
{return __tree_.__insert_unique(__v);}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_STD::move(__v));}
#endif
{return __tree_.__insert_unique(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p, __v);}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _STD::move(__v));}
#endif
{return __tree_.__insert_unique(__p, _VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_unique(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k)
{return __tree_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
void swap(set& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value)
{__tree_.swap(__s.__tree_);}
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
};
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a)
: __tree_(_VSTD::move(__s.__tree_), __a)
{
if (__a != __s.get_allocator())
{
const_iterator __e = cend();
while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
}
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
{
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>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -537,7 +644,7 @@ operator!=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -546,7 +653,7 @@ operator> (const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -555,7 +662,7 @@ operator>=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -565,18 +672,18 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
// specialized algorithms:
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class multiset
class _LIBCPP_VISIBLE multiset
{
public:
// types:
@@ -602,15 +709,22 @@ public:
typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -619,6 +733,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a)
@@ -626,6 +741,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s)
: __tree_(__s.__tree_.value_comp(),
__alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
@@ -633,27 +749,41 @@ public:
insert(__s.begin(), __s.end());
}
#ifdef _LIBCPP_MOVE
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(const multiset& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
insert(__s.begin(), __s.end());
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
multiset(multiset&& __s, const allocator_type& __a);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -661,137 +791,189 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__s.__tree_);
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator begin() {return __tree_.begin();}
const_iterator begin() const {return __tree_.begin();}
iterator end() {return __tree_.end();}
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return __tree_.end();}
reverse_iterator rbegin() {return reverse_iterator(end());}
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
reverse_iterator rend() {return reverse_iterator(begin());}
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() _NOEXCEPT
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT
{return const_reverse_iterator(begin());}
const_iterator cbegin() const {return begin();}
const_iterator cend() const {return end();}
const_reverse_iterator crbegin() const {return rbegin();}
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
bool empty() const {return __tree_.size() == 0;}
size_type size() const {return __tree_.size();}
size_type max_size() const {return __tree_.max_size();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const _NOEXCEPT {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers:
#ifdef _LIBCPP_MOVE
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif
{return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v)
{return __tree_.__insert_multi(__v);}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif
{return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p, __v);}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif
{return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_multi(__e, *__f);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();}
void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
void swap(multiset& __s)
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
{__tree_.swap(__s.__tree_);}
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
};
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a)
: __tree_(_VSTD::move(__s.__tree_), __a)
{
if (__a != __s.get_allocator())
{
const_iterator __e = cend();
while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
}
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
{
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>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -800,7 +982,7 @@ operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -809,7 +991,7 @@ operator> (const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -818,7 +1000,7 @@ operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -827,15 +1009,15 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SET

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -182,7 +182,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
template <class _CharT, class _Traits, class _Allocator>
class basic_stringbuf
class _LIBCPP_VISIBLE basic_stringbuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -206,12 +206,12 @@ public:
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
explicit basic_stringbuf(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_stringbuf(basic_stringbuf&& __rhs);
#endif
// 27.8.1.2 Assign and swap:
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
#endif
void swap(basic_stringbuf& __rhs);
@@ -250,7 +250,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type&
str(__s);
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
@@ -261,7 +261,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&&
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__str_ = _STD::move(__rhs.__str_);
__str_ = _VSTD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout);
@@ -284,7 +284,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__mode_ = __rhs.__mode_;
__str_ = _STD::move(__rhs.__str_);
__str_ = _VSTD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout);
@@ -298,7 +298,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
void
@@ -314,7 +314,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
ptrdiff_t __lnout = this->pptr() - this->pbase();
ptrdiff_t __leout = this->epptr() - this->pbase();
ptrdiff_t __lhm = this->__hm_ - this->pbase();
_STD::swap(__mode_, __rhs.__mode_);
_VSTD::swap(__mode_, __rhs.__mode_);
__str_.swap(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __rninp, __p + __reinp);
@@ -434,7 +434,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
ptrdiff_t __nout = this->pptr() - this->pbase();
ptrdiff_t __hm = __hm_ - this->pbase();
__str_.push_back(char_type());
@@ -449,9 +449,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
{
return traits_type::eof();
}
#endif
#endif // _LIBCPP_NO_EXCEPTIONS
}
__hm_ = max(this->pptr() + 1, __hm_);
__hm_ = _VSTD::max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in)
{
char_type* __p = const_cast<char_type*>(__str_.data());
@@ -525,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_istringstream
class _LIBCPP_VISIBLE basic_istringstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -546,12 +546,12 @@ public:
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
explicit basic_istringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_istringstream(basic_istringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_istringstream& operator=(basic_istringstream&& __rhs);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void swap(basic_istringstream& __rhs);
// 27.8.2.3 Members:
@@ -577,13 +577,13 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
{
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -592,12 +592,12 @@ template <class _CharT, class _Traits, class _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>&
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
{
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -644,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_ostringstream
class _LIBCPP_VISIBLE basic_ostringstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -665,12 +665,12 @@ public:
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
explicit basic_ostringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::out);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_ostringstream(basic_ostringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void swap(basic_ostringstream& __rhs);
// 27.8.2.3 Members:
@@ -696,13 +696,13 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
{
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -711,12 +711,12 @@ template <class _CharT, class _Traits, class _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>&
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
{
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -763,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_stringstream
class _LIBCPP_VISIBLE basic_stringstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -784,12 +784,12 @@ public:
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
explicit basic_stringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_stringstream(basic_stringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_stringstream& operator=(basic_stringstream&& __rhs);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void swap(basic_stringstream& __rhs);
// 27.8.2.3 Members:
@@ -815,13 +815,13 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
{
}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -830,12 +830,12 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>&
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
{
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -31,14 +31,21 @@ protected:
container_type c;
public:
explicit stack();
stack() = default;
~stack() = default;
stack(const stack& q) = default;
stack(stack&& q) = default;
stack& operator=(const stack& q) = default;
stack& operator=(stack&& q) = default;
explicit stack(const container_type& c);
explicit stack(container_type&& c);
stack(stack&& s);
stack& operator=(stack&& s);
template <class Alloc> explicit stack(const Alloc& a);
template <class Alloc> stack(const container_type& c, const Alloc& a);
template <class Alloc> stack(container_type&& c, const Alloc& a);
template <class Alloc> stack(const stack& c, const Alloc& a);
template <class Alloc> stack(stack&& c, const Alloc& a);
bool empty() const;
@@ -51,7 +58,7 @@ public:
template <class... Args> void emplace(Args&&... args);
void pop();
void swap(stack& c);
void swap(stack& c) noexcept(noexcept(swap(c, q.c)));
};
template <class T, class Container>
@@ -68,7 +75,8 @@ template <class T, class Container>
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container>
void swap(stack<T, Container>& x, stack<T, Container>& y);
void swap(stack<T, Container>& x, stack<T, Container>& y)
noexcept(noexcept(x.swap(y)));
} // std
@@ -92,7 +100,7 @@ bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class stack
class _LIBCPP_VISIBLE stack
{
public:
typedef _Container container_type;
@@ -105,57 +113,99 @@ protected:
container_type c;
public:
stack() : c() {}
_LIBCPP_INLINE_VISIBILITY
stack()
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(const stack& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {}
#ifdef _LIBCPP_MOVE
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
stack(stack&& __s) : c(_STD::move(__s.c)) {}
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit stack(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__s.c, __a) {}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__s.c), __a) {}
#endif
: c(_VSTD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference top() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifdef _LIBCPP_MOVE
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
template <class... _Args> void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_back();}
_LIBCPP_INLINE_VISIBILITY
void swap(stack& __s)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(c, __s.c);
}
@@ -163,7 +213,7 @@ public:
friend
bool
operator==(const stack<T1, _C1>& __x, const stack<T1, _C1>& __y);
template <class T1, class _C1>
friend
bool
@@ -171,7 +221,7 @@ public:
};
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -179,7 +229,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -187,7 +237,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -195,7 +245,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -203,7 +253,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -211,7 +261,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -219,15 +269,16 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
template <class _Tp, class _Container, class _Alloc>
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
{
public:
explicit xxx_error(const string& what_arg);
explicit xxx_error(const char* what_arg); // extension
explicit xxx_error(const char* what_arg);
virtual const char* what() const // returns what_arg
virtual const char* what() const noexcept // returns what_arg
};
} // std
@@ -60,12 +60,12 @@ public:
explicit logic_error(const string&);
explicit logic_error(const char*);
logic_error(const logic_error&) throw();
logic_error& operator=(const logic_error&) throw();
logic_error(const logic_error&) _NOEXCEPT;
logic_error& operator=(const logic_error&) _NOEXCEPT;
virtual ~logic_error() throw();
virtual ~logic_error() _NOEXCEPT;
virtual const char* what() const throw();
virtual const char* what() const _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI runtime_error
@@ -77,12 +77,12 @@ public:
explicit runtime_error(const string&);
explicit runtime_error(const char*);
runtime_error(const runtime_error&) throw();
runtime_error& operator=(const runtime_error&) throw();
runtime_error(const runtime_error&) _NOEXCEPT;
runtime_error& operator=(const runtime_error&) _NOEXCEPT;
virtual ~runtime_error() throw();
virtual ~runtime_error() _NOEXCEPT;
virtual const char* what() const throw();
virtual const char* what() const _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI domain_error
@@ -92,7 +92,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
virtual ~domain_error() throw();
virtual ~domain_error() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI invalid_argument
@@ -102,7 +102,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
virtual ~invalid_argument() throw();
virtual ~invalid_argument() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI length_error
@@ -112,7 +112,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
virtual ~length_error() throw();
virtual ~length_error() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI out_of_range
@@ -122,7 +122,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
virtual ~out_of_range() throw();
virtual ~out_of_range() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI range_error
@@ -132,7 +132,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
virtual ~range_error() throw();
virtual ~range_error() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI overflow_error
@@ -142,7 +142,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
virtual ~overflow_error() throw();
virtual ~overflow_error() _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI underflow_error
@@ -152,10 +152,9 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
virtual ~underflow_error() throw();
virtual ~underflow_error() _NOEXCEPT;
};
} // std
#endif // _LIBCPP_STDEXCEPT

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -117,7 +117,7 @@ protected:
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_streambuf
class _LIBCPP_VISIBLE basic_streambuf
{
public:
// types:
@@ -399,13 +399,13 @@ template <class _CharT, class _Traits>
void
basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
{
_STD::swap(__loc_, __sb.__loc_);
_STD::swap(__binp_, __sb.__binp_);
_STD::swap(__ninp_, __sb.__ninp_);
_STD::swap(__einp_, __sb.__einp_);
_STD::swap(__bout_, __sb.__bout_);
_STD::swap(__nout_, __sb.__nout_);
_STD::swap(__eout_, __sb.__eout_);
_VSTD::swap(__loc_, __sb.__loc_);
_VSTD::swap(__binp_, __sb.__binp_);
_VSTD::swap(__ninp_, __sb.__ninp_);
_VSTD::swap(__einp_, __sb.__einp_);
_VSTD::swap(__bout_, __sb.__bout_);
_VSTD::swap(__nout_, __sb.__nout_);
_VSTD::swap(__eout_, __sb.__eout_);
}
template <class _CharT, class _Traits>
@@ -557,7 +557,6 @@ extern template class basic_streambuf<wchar_t>;
extern template class basic_ios<char>;
extern template class basic_ios<wchar_t>;
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STEAMBUF

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -135,7 +135,7 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
class strstreambuf
class _LIBCPP_VISIBLE strstreambuf
: public streambuf
{
public:
@@ -149,10 +149,12 @@ public:
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstreambuf(strstreambuf&& __rhs);
_LIBCPP_INLINE_VISIBILITY
strstreambuf& operator=(strstreambuf&& __rhs);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
virtual ~strstreambuf();
@@ -187,95 +189,150 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
class istrstream
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
__pfree_(__rhs.__pfree_)
{
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
}
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf&
strstreambuf::operator=(strstreambuf&& __rhs)
{
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
{
if (__pfree_)
__pfree_(eback());
else
delete [] eback();
}
streambuf::operator=(__rhs);
__strmode_ = __rhs.__strmode_;
__alsize_ = __rhs.__alsize_;
__palloc_ = __rhs.__palloc_;
__pfree_ = __rhs.__pfree_;
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
class _LIBCPP_VISIBLE istrstream
: public istream
{
public:
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(const char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(const char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs)
: istream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: istream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
istream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs)
{
istream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
istream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
virtual ~istrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(istrstream& __rhs)
{
istream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
char *str() {return __sb_.str();}
private:
strstreambuf __sb_;
};
class ostrstream
class _LIBCPP_VISIBLE ostrstream
: public ostream
{
public:
_LIBCPP_INLINE_VISIBILITY
ostrstream()
: ostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
: ostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs)
: ostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: ostream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
ostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs)
{
ostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
ostream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
virtual ~ostrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(ostrstream& __rhs)
{
ostream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
private:
strstreambuf __sb_; // exposition only
};
class strstream
class _LIBCPP_VISIBLE strstream
: public iostream
{
public:
@@ -286,31 +343,36 @@ public:
typedef char_traits<char>::off_type off_type;
// constructors/destructor
_LIBCPP_INLINE_VISIBILITY
strstream()
: iostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
: iostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs)
: iostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: iostream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
iostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs)
{
iostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
iostream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
virtual ~strstream();
_LIBCPP_INLINE_VISIBILITY
void swap(strstream& __rhs)
{
iostream::swap(__rhs);
@@ -318,9 +380,13 @@ public:
}
// Members:
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
private:

View File

@@ -0,0 +1,110 @@
// -*- 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' );
}
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

@@ -0,0 +1,31 @@
// -*- 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 <wchar.h> // mbstate_t
#include <stdio.h> // _snwprintf
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
int vasprintf( char **sptr, const char *__restrict__ fmt , va_list ap );
int asprintf(char **sptr, const char *__restrict__ fmt, ...);
size_t mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nmc, size_t len, mbstate_t *__restrict__ ps );
size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps );
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -20,24 +20,24 @@ namespace std
class error_category
{
public:
virtual ~error_category();
virtual ~error_category() noexcept;
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete;
virtual const char* name() const = 0;
virtual error_condition default_error_condition(int ev) const;
virtual bool equivalent(int code, const error_condition& condition) const;
virtual bool equivalent(const error_code& code, int condition) const;
virtual const char* name() const noexcept = 0;
virtual error_condition default_error_condition(int ev) const noexcept;
virtual bool equivalent(int code, const error_condition& condition) const noexcept;
virtual bool equivalent(const error_code& code, int condition) const noexcept;
virtual string message(int ev) const = 0;
bool operator==(const error_category& rhs) const;
bool operator!=(const error_category& rhs) const;
bool operator<(const error_category& rhs) const;
bool operator==(const error_category& rhs) const noexcept;
bool operator!=(const error_category& rhs) const noexcept;
bool operator<(const error_category& rhs) const noexcept;
};
const error_category& generic_category();
const error_category& system_category();
const error_category& generic_category() noexcept;
const error_category& system_category() noexcept;
template <class T> struct is_error_code_enum
: public false_type {};
@@ -49,27 +49,27 @@ class error_code
{
public:
// constructors:
error_code();
error_code(int val, const error_category& cat);
error_code() noexcept;
error_code(int val, const error_category& cat) noexcept;
template <class ErrorCodeEnum>
error_code(ErrorCodeEnum e);
error_code(ErrorCodeEnum e) noexcept;
// modifiers:
void assign(int val, const error_category& cat);
void assign(int val, const error_category& cat) noexcept;
template <class ErrorCodeEnum>
error_code& operator=(ErrorCodeEnum e);
void clear();
error_code& operator=(ErrorCodeEnum e) noexcept;
void clear() noexcept;
// observers:
int value() const;
const error_category& category() const;
error_condition default_error_condition() const;
int value() const noexcept;
const error_category& category() const noexcept;
error_condition default_error_condition() const noexcept;
string message() const;
explicit operator bool() const;
explicit operator bool() const noexcept;
};
// non-member functions:
bool operator<(const error_code& lhs, const error_code& rhs);
bool operator<(const error_code& lhs, const error_code& rhs) noexcept;
template <class charT, class traits>
basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
@@ -78,25 +78,25 @@ class error_condition
{
public:
// constructors:
error_condition();
error_condition(int val, const error_category& cat);
error_condition() noexcept;
error_condition(int val, const error_category& cat) noexcept;
template <class ErrorConditionEnum>
error_condition(ErrorConditionEnum e);
error_condition(ErrorConditionEnum e) noexcept;
// modifiers:
void assign(int val, const error_category& cat);
void assign(int val, const error_category& cat) noexcept;
template <class ErrorConditionEnum>
error_condition& operator=(ErrorConditionEnum e);
void clear();
error_condition& operator=(ErrorConditionEnum e) noexcept;
void clear() noexcept;
// observers:
int value() const;
const error_category& category() const;
string message() const;
explicit operator bool() const;
int value() const noexcept;
const error_category& category() const noexcept;
string message() const noexcept;
explicit operator bool() const noexcept;
};
bool operator<(const error_condition& lhs, const error_condition& rhs);
bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept;
class system_error
: public runtime_error
@@ -109,8 +109,8 @@ public:
system_error(int ev, const error_category& ecat, const char* what_arg);
system_error(int ev, const error_category& ecat);
const error_code& code() const throw();
const char* what() const throw();
const error_code& code() const noexcept;
const char* what() const noexcept;
};
enum class errc
@@ -198,18 +198,18 @@ enum class errc
template <> struct is_error_condition_enum<errc>
: true_type { }
error_code make_error_code(errc e);
error_condition make_error_condition(errc e);
error_code make_error_code(errc e) noexcept;
error_condition make_error_condition(errc e) noexcept;
// Comparison operators:
bool operator==(const error_code& lhs, const error_code& rhs);
bool operator==(const error_code& lhs, const error_condition& rhs);
bool operator==(const error_condition& lhs, const error_code& rhs);
bool operator==(const error_condition& lhs, const error_condition& rhs);
bool operator!=(const error_code& lhs, const error_code& rhs);
bool operator!=(const error_code& lhs, const error_condition& rhs);
bool operator!=(const error_condition& lhs, const error_code& rhs);
bool operator!=(const error_condition& lhs, const error_condition& rhs);
bool operator==(const error_code& lhs, const error_code& rhs) noexcept;
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept;
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept;
template <> struct hash<std::error_code>;
@@ -229,14 +229,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum
template <class _Tp> struct is_error_code_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_code_enum
: public false_type {};
// is_error_condition_enum
template <class _Tp> struct is_error_condition_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_condition_enum
: public false_type {};
// Some error codes are not present on all platforms, so we provide equivalents
// for them:
//enum class errc
struct errc
{
@@ -281,18 +286,30 @@ enum _ {
no_child_process = ECHILD,
no_link = ENOLINK,
no_lock_available = ENOLCK,
#ifdef ENODATA
no_message_available = ENODATA,
#else
no_message_available = ENOMSG,
#endif
no_message = ENOMSG,
no_protocol_option = ENOPROTOOPT,
no_space_on_device = ENOSPC,
#ifdef ENOSR
no_stream_resources = ENOSR,
#else
no_stream_resources = ENOMEM,
#endif
no_such_device_or_address = ENXIO,
no_such_device = ENODEV,
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
not_a_socket = ENOTSOCK,
#ifdef ENOSTR
not_a_stream = ENOSTR,
#else
not_a_stream = EINVAL,
#endif
not_connected = ENOTCONN,
not_enough_memory = ENOMEM,
not_supported = ENOTSUP,
@@ -310,7 +327,11 @@ enum _ {
resource_unavailable_try_again = EAGAIN,
result_out_of_range = ERANGE,
state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
stream_timeout = ETIME,
#else
stream_timeout = ETIMEDOUT,
#endif
text_file_busy = ETXTBSY,
timed_out = ETIMEDOUT,
too_many_files_open_in_system = ENFILE,
@@ -323,15 +344,19 @@ enum _ {
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <> struct is_error_condition_enum<errc>
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { };
template <> struct is_error_condition_enum<errc::_>
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { };
class error_condition;
@@ -341,31 +366,31 @@ class error_code;
class __do_message;
class error_category
class _LIBCPP_VISIBLE error_category
{
public:
virtual ~error_category();
virtual ~error_category() _NOEXCEPT;
private:
error_category();
error_category() _NOEXCEPT;
error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete;
public:
virtual const char* name() const = 0;
virtual error_condition default_error_condition(int __ev) const;
virtual bool equivalent(int __code, const error_condition& __condition) const;
virtual bool equivalent(const error_code& __code, int __condition) const;
virtual const char* name() const _NOEXCEPT = 0;
virtual error_condition default_error_condition(int __ev) const _NOEXCEPT;
virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT;
virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT;
virtual string message(int __ev) const = 0;
_LIBCPP_ALWAYS_INLINE
bool operator==(const error_category& __rhs) const {return this == &__rhs;}
bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;}
_LIBCPP_ALWAYS_INLINE
bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);}
bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);}
_LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const {return this < &__rhs;}
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
friend class __do_message;
};
@@ -377,28 +402,30 @@ public:
virtual string message(int ev) const;
};
const error_category& generic_category();
const error_category& system_category();
const error_category& generic_category() _NOEXCEPT;
const error_category& system_category() _NOEXCEPT;
class error_condition
class _LIBCPP_VISIBLE error_condition
{
int __val_;
const error_category* __cat_;
public:
_LIBCPP_ALWAYS_INLINE
error_condition() : __val_(0), __cat_(&generic_category()) {}
error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {}
_LIBCPP_ALWAYS_INLINE
error_condition(int __val, const error_category& __cat)
error_condition(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
template <class _E>
_LIBCPP_ALWAYS_INLINE
error_condition(_E __e, typename enable_if<is_error_condition_enum<_E>::value>::type* = 0)
error_condition(_E __e,
typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_condition(__e);}
_LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat)
void assign(int __val, const error_category& __cat) _NOEXCEPT
{
__val_ = __val;
__cat_ = &__cat;
@@ -411,38 +438,38 @@ public:
is_error_condition_enum<_E>::value,
error_condition&
>::type
operator=(_E __e)
operator=(_E __e) _NOEXCEPT
{*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
void clear()
void clear() _NOEXCEPT
{
__val_ = 0;
__cat_ = &generic_category();
}
_LIBCPP_ALWAYS_INLINE
int value() const {return __val_;}
int value() const _NOEXCEPT {return __val_;}
_LIBCPP_ALWAYS_INLINE
const error_category& category() const {return *__cat_;}
const error_category& category() const _NOEXCEPT {return *__cat_;}
string message() const;
_LIBCPP_ALWAYS_INLINE
//explicit
operator bool() const {return __val_ != 0;}
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
error_condition
make_error_condition(errc __e)
make_error_condition(errc __e) _NOEXCEPT
{
return error_condition(static_cast<int>(__e), generic_category());
}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const error_condition& __x, const error_condition& __y)
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{
return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value();
@@ -450,25 +477,27 @@ operator<(const error_condition& __x, const error_condition& __y)
// error_code
class error_code
class _LIBCPP_VISIBLE error_code
{
int __val_;
const error_category* __cat_;
public:
_LIBCPP_ALWAYS_INLINE
error_code() : __val_(0), __cat_(&system_category()) {}
error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {}
_LIBCPP_ALWAYS_INLINE
error_code(int __val, const error_category& __cat)
error_code(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
template <class _E>
_LIBCPP_ALWAYS_INLINE
error_code(_E __e, typename enable_if<is_error_code_enum<_E>::value>::type* = 0)
error_code(_E __e,
typename enable_if<is_error_code_enum<_E>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_code(__e);}
_LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat)
void assign(int __val, const error_category& __cat) _NOEXCEPT
{
__val_ = __val;
__cat_ = &__cat;
@@ -481,43 +510,43 @@ public:
is_error_code_enum<_E>::value,
error_code&
>::type
operator=(_E __e)
operator=(_E __e) _NOEXCEPT
{*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
void clear()
void clear() _NOEXCEPT
{
__val_ = 0;
__cat_ = &system_category();
}
_LIBCPP_ALWAYS_INLINE
int value() const {return __val_;}
int value() const _NOEXCEPT {return __val_;}
_LIBCPP_ALWAYS_INLINE
const error_category& category() const {return *__cat_;}
const error_category& category() const _NOEXCEPT {return *__cat_;}
_LIBCPP_ALWAYS_INLINE
error_condition default_error_condition() const
error_condition default_error_condition() const _NOEXCEPT
{return __cat_->default_error_condition(__val_);}
string message() const;
_LIBCPP_ALWAYS_INLINE
//explicit
operator bool() const {return __val_ != 0;}
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
error_code
make_error_code(errc __e)
make_error_code(errc __e) _NOEXCEPT
{
return error_code(static_cast<int>(__e), generic_category());
}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const error_code& __x, const error_code& __y)
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{
return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value();
@@ -525,14 +554,14 @@ operator<(const error_code& __x, const error_code& __y)
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_code& __x, const error_code& __y)
operator==(const error_code& __x, const error_code& __y) _NOEXCEPT
{
return __x.category() == __y.category() && __x.value() == __y.value();
}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_code& __x, const error_condition& __y)
operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
{
return __x.category().equivalent(__x.value(), __y)
|| __y.category().equivalent(__x, __y.value());
@@ -540,39 +569,44 @@ operator==(const error_code& __x, const error_condition& __y)
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_condition& __x, const error_code& __y)
operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT
{
return __y == __x;
}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const error_condition& __x, const error_condition& __y)
operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{
return __x.category() == __y.category() && __x.value() == __y.value();
}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);}
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);}
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);}
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
template <>
struct hash<error_code>
struct _LIBCPP_VISIBLE hash<error_code>
: public unary_function<error_code, size_t>
{
size_t operator()(const error_code& __ec) const
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const error_code& __ec) const _NOEXCEPT
{
return static_cast<size_t>(__ec.value());
}
@@ -580,7 +614,7 @@ struct hash<error_code>
// system_error
class system_error
class _LIBCPP_VISIBLE system_error
: public runtime_error
{
error_code __ec_;
@@ -591,10 +625,10 @@ public:
system_error(int __ev, const error_category& __ecat, const string& __what_arg);
system_error(int __ev, const error_category& __ecat, const char* __what_arg);
system_error(int __ev, const error_category& __ecat);
~system_error() throw();
~system_error() _NOEXCEPT;
_LIBCPP_ALWAYS_INLINE
const error_code& code() const throw() {return __ec_;}
const error_code& code() const _NOEXCEPT {return __ec_;}
private:
static string __init(const error_code&, string);

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -15,7 +15,7 @@
thread synopsis
#define __STDCPP_THREADS __cplusplus
#define __STDCPP_THREADS__ __cplusplus
namespace std
{
@@ -95,14 +95,82 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <pthread.h>
#pragma GCC system_header
#define __STDCPP_THREADS __cplusplus
#define __STDCPP_THREADS__ __cplusplus
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
class __thread_specific_ptr
{
pthread_key_t __key_;
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
static void __at_thread_exit(void*);
public:
typedef _Tp* pointer;
__thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
_LIBCPP_INLINE_VISIBILITY
pointer operator*() const {return *get();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return get();}
pointer release();
void reset(pointer __p = nullptr);
};
template <class _Tp>
void
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
{
delete static_cast<pointer>(__p);
}
template <class _Tp>
__thread_specific_ptr<_Tp>::__thread_specific_ptr()
{
int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
if (__ec)
throw system_error(error_code(__ec, system_category()),
"__thread_specific_ptr construction failed");
}
template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{
pthread_key_delete(__key_);
}
template <class _Tp>
typename __thread_specific_ptr<_Tp>::pointer
__thread_specific_ptr<_Tp>::release()
{
pointer __p = get();
pthread_setspecific(__key_, 0);
return __p;
}
template <class _Tp>
void
__thread_specific_ptr<_Tp>::reset(pointer __p)
{
pointer __p_old = get();
pthread_setspecific(__key_, __p);
delete __p_old;
}
class thread;
class __thread_id;
@@ -113,7 +181,7 @@ __thread_id get_id();
} // this_thread
class __thread_id
class _LIBCPP_VISIBLE __thread_id
{
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
// NULL is the no-thread value on Darwin. Someone needs to check
@@ -121,40 +189,50 @@ class __thread_id
pthread_t __id_;
public:
_LIBCPP_INLINE_VISIBILITY
__thread_id() : __id_(0) {}
friend bool operator==(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(__thread_id __x, __thread_id __y)
{return __x.__id_ == __y.__id_;}
friend bool operator!=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(__thread_id __x, __thread_id __y)
{return !(__x == __y);}
friend bool operator< (__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator< (__thread_id __x, __thread_id __y)
{return __x.__id_ < __y.__id_;}
friend bool operator<=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator<=(__thread_id __x, __thread_id __y)
{return !(__y < __x);}
friend bool operator> (__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator> (__thread_id __x, __thread_id __y)
{return __y < __x ;}
friend bool operator>=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator>=(__thread_id __x, __thread_id __y)
{return !(__x < __y);}
template<class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
{return __os << __id.__id_;}
private:
_LIBCPP_INLINE_VISIBILITY
__thread_id(pthread_t __id) : __id_(__id) {}
friend __thread_id this_thread::get_id();
friend class thread;
friend class _LIBCPP_VISIBLE thread;
};
template<class _Tp> struct hash;
template<>
struct hash<__thread_id>
struct _LIBCPP_VISIBLE hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(__thread_id __v) const
{
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
@@ -165,7 +243,7 @@ struct hash<__thread_id>
namespace this_thread
{
inline
inline _LIBCPP_INLINE_VISIBILITY
__thread_id
get_id()
{
@@ -174,21 +252,17 @@ get_id()
} // this_thread
class thread
class _LIBCPP_VISIBLE thread
{
pthread_t __t_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
thread(const thread&) = delete;
thread& operator=(const thread&) = delete;
#else
thread(const thread&);
thread& operator=(const thread&);
#endif
public:
typedef __thread_id id;
typedef pthread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
thread() : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
@@ -198,46 +272,81 @@ public:
>::type
>
explicit thread(_F&& __f, _Args&&... __args);
#else
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F> explicit thread(_F __f);
#endif
~thread();
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
thread& operator=(thread&& __t);
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool joinable() const {return __t_ != 0;}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
id get_id() const {return __t_;}
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return __t_;}
static unsigned hardware_concurrency();
};
class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
__thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
}
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
(*__p)();
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__threaad_execute(*__p, _Index());
return nullptr;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
class
>
thread::thread(_F&& __f, _Args&&... __args)
{
typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
std::forward<_Args>(__args)...)));
typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
_VSTD::unique_ptr<_G> __p(new _G(__decay_copy(_VSTD::forward<_F>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0)
__p.release();
@@ -245,7 +354,17 @@ thread::thread(_F&& __f, _Args&&... __args)
__throw_system_error(__ec, "thread constructor failed");
}
#else
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
(*__p)();
return nullptr;
}
template <class _F>
thread::thread(_F __f)
@@ -258,11 +377,11 @@ thread::thread(_F __f)
__throw_system_error(__ec, "thread constructor failed");
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
#ifdef _LIBCPP_MOVE
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline
inline _LIBCPP_INLINE_VISIBILITY
thread&
thread::operator=(thread&& __t)
{
@@ -273,12 +392,11 @@ thread::operator=(thread&& __t)
return *this;
}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline
inline _LIBCPP_INLINE_VISIBILITY
void swap(thread& __x, thread& __y) {__x.swap(__y);}
namespace this_thread
{
@@ -308,15 +426,15 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
}
template <class _Duration>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
{
using namespace chrono;
sleep_for(__t - monotonic_clock::now());
sleep_for(__t - steady_clock::now());
}
inline
inline _LIBCPP_INLINE_VISIBILITY
void yield() {sched_yield();}
} // this_thread

View File

@@ -25,7 +25,7 @@ public:
template <class... U>
explicit tuple(U&&...);
tuple(const tuple&) = default;
tuple(tuple&&);
tuple(tuple&&) = default;
template <class... U>
tuple(const tuple<U...>&);
template <class... U>
@@ -56,7 +56,8 @@ public:
tuple(allocator_arg_t, const Alloc& a, pair<U1, U2>&&);
tuple& operator=(const tuple&);
tuple& operator=(tuple&&);
tuple&
operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable<T>::value ...));
template <class... U>
tuple& operator=(const tuple<U...>&);
template <class... U>
@@ -66,18 +67,16 @@ public:
template <class U1, class U2>
tuple& operator=(pair<U1, U2>&&); //iffsizeof...(T) == 2
void swap(tuple&);
void swap(tuple&) noexcept(AND(swap(declval<T&>(), declval<T&>())...));
};
const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...);
template <class... T> tuple<T&...> tie(T&...);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept;
template <class... T> tuple<T&...> tie(T&...) noexcept;
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
@@ -85,8 +84,15 @@ template <intsize_t I, class T> class tuple_element; // undefined
template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
// 20.4.1.5, element access:
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type& get(tuple<T...>&);
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type const& get(const tuple<T...>&);
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept;
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type const&
get(const tuple<T...>&) noexcept;
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
get(tuple<T...>&&) noexcept;
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
@@ -100,13 +106,8 @@ template <class... Types, class Alloc>
struct uses_allocator<tuple<Types...>, Alloc>;
template <class... Types>
void swap(tuple<Types...>& x, tuple<Types...>& y);
template <class InputIterator>
InputIterator begin(const std::tuple<InputIterator, InputIterator>& t);
template <class InputIterator>
InputIterator end(const std::tuple<InputIterator, InputIterator>& t);
void
swap(tuple<Types...>& x, tuple<Types...>& y) noexcept(noexcept(x.swap(y)));
} // std
@@ -127,13 +128,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// tuple_size
template <class ..._Tp>
class tuple_size<tuple<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class ..._Tp>
class tuple_size<const tuple<_Tp...>>
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -141,17 +136,10 @@ class tuple_size<const tuple<_Tp...>>
// tuple_element
template <size_t _Ip, class ..._Tp>
class tuple_element<_Ip, tuple<_Tp...>>
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
{
public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
};
template <size_t _Ip, class ..._Tp>
class tuple_element<_Ip, const tuple<_Tp...>>
{
public:
typedef const typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
};
// __tuple_leaf
@@ -160,8 +148,9 @@ template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
inline
inline _LIBCPP_INLINE_VISIBILITY
void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Hp>::value)
{
swap(__x.get(), __y.get());
}
@@ -198,24 +187,27 @@ public:
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
template <class _Tp>
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: value(_STD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
>::value),
>::value) ||
(is_rvalue_reference<_Hp>::value &&
!is_lvalue_reference<_Tp>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
: value(_STD::forward<_Tp>(__t))
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
@@ -229,7 +221,7 @@ public:
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
: value(allocator_arg_t(), __a, _STD::forward<_Tp>(__t))
: value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
@@ -243,7 +235,7 @@ public:
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: value(_STD::forward<_Tp>(__t), __a)
: value(_VSTD::forward<_Tp>(__t), __a)
{static_assert(!is_lvalue_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
@@ -254,6 +246,10 @@ public:
>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
__tuple_leaf(const __tuple_leaf& __t)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
@@ -264,14 +260,14 @@ public:
__tuple_leaf&
operator=(_Tp&& __t)
{
value = _STD::forward<_Tp>(__t);
value = _VSTD::forward<_Tp>(__t);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
int swap(__tuple_leaf& __t)
int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
{
_STD::swap(*this, __t);
_VSTD::swap(*this, __t);
return 0;
}
@@ -302,25 +298,26 @@ public:
__tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
: _Hp(__a) {}
template <class _Tp>
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: _Hp(_STD::forward<_Tp>(__t)) {}
: _Hp(_VSTD::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
: _Hp(_STD::forward<_Tp>(__t)) {}
: _Hp(_VSTD::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
: _Hp(allocator_arg_t(), __a, _STD::forward<_Tp>(__t)) {}
: _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: _Hp(_STD::forward<_Tp>(__t), __a) {}
: _Hp(_VSTD::forward<_Tp>(__t), __a) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
@@ -332,13 +329,15 @@ public:
__tuple_leaf&
operator=(_Tp&& __t)
{
_Hp::operator=(_STD::forward<_Tp>(__t));
_Hp::operator=(_VSTD::forward<_Tp>(__t));
return *this;
}
_LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t)
_LIBCPP_INLINE_VISIBILITY
int
swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value)
{
_STD::swap(*this, __t);
_VSTD::swap(*this, __t);
return 0;
}
@@ -346,7 +345,23 @@ public:
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp> void __swallow(_Tp&&...) {}
template <class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
void __swallow(_Tp&&...) {}
template <bool ...> struct __all;
template <>
struct __all<>
{
static const bool value = true;
};
template <bool _B0, bool ... _B>
struct __all<_B0, _B...>
{
static const bool value = _B0 && __all<_B...>::value;
};
// __tuple_impl
@@ -358,82 +373,92 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
{
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
_Up&&... __u) :
__tuple_leaf<_Uf, _Tf>(_STD::forward<_Up>(__u))...,
__tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
__tuple_leaf<_Ul, _Tl>()...
{}
template <class _Alloc, size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(allocator_arg_t, const _Alloc& __a,
__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
_Up&&... __u) :
__tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a,
_STD::forward<_Up>(__u))...,
_VSTD::forward<_Up>(__u))...,
__tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)...
{}
template <class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(_Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
{}
template <class _Alloc, class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
{}
template <class _Tuple>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__tuple_assignable<_Tuple, tuple<_Tp...>>::value,
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_impl&
>::type
operator=(_Tuple&& __t)
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...);
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
{
__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
}
};
template <class ..._Tp>
class tuple
class _LIBCPP_VISIBLE tuple
{
typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
base base_;
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit tuple(const _Tp& ... __t)
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
@@ -443,6 +468,7 @@ public:
) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
@@ -466,13 +492,14 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
_STD::forward<_Up>(__u)...) {}
_VSTD::forward<_Up>(__u)...) {}
template <class _Alloc, class ..._Up,
class = typename enable_if
@@ -488,13 +515,14 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
_STD::forward<_Up>(__u)...) {}
_VSTD::forward<_Up>(__u)...) {}
template <class _Tuple,
class = typename enable_if
@@ -502,8 +530,9 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(_Tuple&& __t)
: base_(_STD::forward<_Tuple>(__t)) {}
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
class = typename enable_if
@@ -511,8 +540,9 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: base_(allocator_arg_t(), __a, _STD::forward<_Tuple>(__t)) {}
: base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
template <class _Tuple,
class = typename enable_if
@@ -520,61 +550,86 @@ public:
__tuple_assignable<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple&
operator=(_Tuple&& __t)
{
base_.operator=(_STD::forward<_Tuple>(__t));
base_.operator=(_VSTD::forward<_Tuple>(__t));
return *this;
}
void swap(tuple& __t) {base_.swap(__t.base_);}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
{base_.swap(__t.base_);}
};
template <>
class tuple<>
class _LIBCPP_VISIBLE tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
tuple() {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
template <class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(array<_U, 0>) {}
template <class _Alloc, class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
void swap(tuple&) {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) _NOEXCEPT {}
};
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) {__t.swap(__u);}
typename enable_if
<
__all<__is_swappable<_Tp>::value...>::value,
void
>::type
swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
{__t.swap(__u);}
// get
template <size_t _Ip, class ..._Tp>
inline
typename tuple_element<_Ip, tuple<_Tp...>>::type&
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
// tie
template <class ..._Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&...>
tie(_Tp&... __t)
{
@@ -584,10 +639,8 @@ tie(_Tp&... __t)
template <class _Up>
struct __ignore_t
{
__ignore_t() {}
template <class _Tp>
__ignore_t(_Tp&&) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
const __ignore_t& operator=(_Tp&&) const {return *this;}
};
@@ -602,7 +655,7 @@ struct ___make_tuple_return
};
template <class _Tp>
struct ___make_tuple_return<reference_wrapper<_Tp>>
struct ___make_tuple_return<reference_wrapper<_Tp> >
{
typedef _Tp& type;
};
@@ -614,17 +667,26 @@ struct __make_tuple_return
};
template <class... _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
tuple<typename __make_tuple_return<_Tp>::type...>
make_tuple(_Tp&&... __t)
{
return tuple<typename __make_tuple_return<_Tp>::type...>(_STD::forward<_Tp>(__t)...);
return tuple<typename __make_tuple_return<_Tp>::type...>(_VSTD::forward<_Tp>(__t)...);
}
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
forward_as_tuple(_Tp&&... __t)
{
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
}
template <size_t _I>
struct __tuple_equal
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y);
@@ -635,6 +697,7 @@ template <>
struct __tuple_equal<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return true;
@@ -642,7 +705,7 @@ struct __tuple_equal<0>
};
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -650,7 +713,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -661,6 +724,7 @@ template <size_t _I>
struct __tuple_less
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_less<_I-1>()(__x, __y) ||
@@ -672,6 +736,7 @@ template <>
struct __tuple_less<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return false;
@@ -679,7 +744,7 @@ struct __tuple_less<0>
};
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -687,7 +752,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -695,7 +760,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -703,7 +768,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -712,106 +777,158 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
// tuple_cat
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
template <class _Tp, class _Up> struct __tuple_cat_type;
template <class ..._Ttypes, class ..._Utypes>
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
{
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
typedef tuple<_Ttypes..., _Utypes...> type;
};
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
struct __tuple_cat_return_1
{
};
template <class ..._Types, class _Tuple0>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
{
typedef typename __tuple_cat_type<tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
type;
};
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
typename __tuple_cat_type<
tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
>::type,
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
_Tuple1, _Tuples...>
{
};
template <class ..._Tuples> struct __tuple_cat_return;
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
_Tuples...>
{
};
template <>
struct __tuple_cat_return<>
{
typedef tuple<> type;
};
inline _LIBCPP_INLINE_VISIBILITY
tuple<>
tuple_cat()
{
return tuple<>();
}
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref_imp;
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
template <class ..._Types, size_t ..._I0, class _Tuple0>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
}
typedef typename remove_reference<_Tuple0>::type _T0;
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0, _T0>::type>::type&&...> type;
};
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
_Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0,
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
typename __make_tuple_indices<tuple_size<typename
remove_reference<_Tuple1>::type>::value>::type,
_Tuple1, _Tuples...>
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
};
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref
: public __tuple_cat_return_ref_imp<tuple<>,
typename __make_tuple_indices<
tuple_size<typename remove_reference<_Tuple0>::type>::value
>::type, _Tuple0, _Tuples...>
{
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
}
};
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
{
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
template <class ..._Types, size_t ..._I0, size_t ..._J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class _Tuple0>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
{
return _VSTD::forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
}
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
template <class _Tuple0, class _Tuple1, class ..._Tuples>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef typename remove_reference<_Tuple1>::type _T1;
return __tuple_cat<
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
(_VSTD::forward_as_tuple(
_VSTD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
),
_VSTD::forward<_Tuple1>(__t1),
_VSTD::forward<_Tuples>(__tpls)...);
}
};
template <class _Tuple0, class... _Tuples>
inline _LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
typedef typename remove_reference<_Tuple0>::type _T0;
return __tuple_cat<tuple<>, __tuple_indices<>,
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
(tuple<>(), _VSTD::forward<_Tuple0>(__t0),
_VSTD::forward<_Tuples>(__tpls)...);
}
template <class ..._Tp, class _Alloc>
struct uses_allocator<tuple<_Tp...>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<tuple<_Tp...>, _Alloc>
: true_type {};
template <class _InputIterator>
inline
_InputIterator
begin(const std::tuple<_InputIterator, _InputIterator>& __t)
{
return get<0>(__t);
}
template <class _InputIterator>
inline
_InputIterator
end(const std::tuple<_InputIterator, _InputIterator>& __t)
{
return get<1>(__t);
}
template <class _T1, class _T2>
template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
pair<_T1, _T2>::pair(piecewise_construct_t,
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
__tuple_indices<_I1...>, __tuple_indices<_I2...>)
: first(_STD::forward<_Args1>(get<_I1>( __first_args))...),
second(_STD::forward<_Args2>(get<_I2>(__second_args))...)
: first(_VSTD::forward<_Args1>(get<_I1>( __first_args))...),
second(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
{
}
#endif
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,24 +21,24 @@ namespace std
class type_index
{
public:
type_index(const type_info& rhs);
type_index(const type_info& rhs) noexcept;
bool operator==(const type_index& rhs) const;
bool operator!=(const type_index& rhs) const;
bool operator< (const type_index& rhs) const;
bool operator<=(const type_index& rhs) const;
bool operator> (const type_index& rhs) const;
bool operator>=(const type_index& rhs) const;
bool operator==(const type_index& rhs) const noexcept;
bool operator!=(const type_index& rhs) const noexcept;
bool operator< (const type_index& rhs) const noexcept;
bool operator<=(const type_index& rhs) const noexcept;
bool operator> (const type_index& rhs) const noexcept;
bool operator>=(const type_index& rhs) const noexcept;
size_t hash_code() const;
const char* name() const;
size_t hash_code() const noexcept;
const char* name() const noexcept;
};
template <>
struct hash<type_index>
: public unary_function<type_index, size_t>
{
size_t operator()(type_index index) const;
size_t operator()(type_index index) const noexcept;
};
} // std
@@ -53,30 +53,47 @@ struct hash<type_index>
_LIBCPP_BEGIN_NAMESPACE_STD
class type_index
class _LIBCPP_VISIBLE type_index
{
const type_info* __t_;
public:
type_index(const type_info& __y) : __t_(&__y) {}
_LIBCPP_INLINE_VISIBILITY
type_index(const type_info& __y) _NOEXCEPT : __t_(&__y) {}
bool operator==(const type_index& __y) const {return *__t_ == *__y.__t_;}
bool operator!=(const type_index& __y) const {return *__t_ != *__y.__t_;}
bool operator< (const type_index& __y) const {return __t_->before(*__y.__t_);}
bool operator<=(const type_index& __y) const {return !__y.__t_->before(*__t_);}
bool operator> (const type_index& __y) const {return __y.__t_->before(*__t_);}
bool operator>=(const type_index& __y) const {return !__t_->before(*__y.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_index& __y) const _NOEXCEPT
{return *__t_ == *__y.__t_;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_index& __y) const _NOEXCEPT
{return *__t_ != *__y.__t_;}
_LIBCPP_INLINE_VISIBILITY
bool operator< (const type_index& __y) const _NOEXCEPT
{return __t_->before(*__y.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator<=(const type_index& __y) const _NOEXCEPT
{return !__y.__t_->before(*__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator> (const type_index& __y) const _NOEXCEPT
{return __y.__t_->before(*__t_);}
_LIBCPP_INLINE_VISIBILITY
bool operator>=(const type_index& __y) const _NOEXCEPT
{return !__t_->before(*__y.__t_);}
size_t hash_code() const {return __t_->hash_code();}
const char* name() const {return __t_->name();}
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const _NOEXCEPT {return __t_->hash_code();}
_LIBCPP_INLINE_VISIBILITY
const char* name() const _NOEXCEPT {return __t_->name();}
};
template <class _Tp> struct hash;
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <>
struct hash<type_index>
struct _LIBCPP_VISIBLE hash<type_index>
: public unary_function<type_index, size_t>
{
size_t operator()(type_index __index) const {return __index.hash_code();}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(type_index __index) const _NOEXCEPT
{return __index.hash_code();}
};
_LIBCPP_END_NAMESPACE_STD

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,14 +21,14 @@ class type_info
{
public:
virtual ~type_info();
bool operator==(const type_info& rhs) const;
bool operator!=(const type_info& rhs) const;
bool before(const type_info& rhs) const;
size_t hash_code() const throw();
const char* name() const;
bool operator==(const type_info& rhs) const noexcept;
bool operator!=(const type_info& rhs) const noexcept;
bool before(const type_info& rhs) const noexcept;
size_t hash_code() const noexcept;
const char* name() const noexcept;
type_info(const type_info& rhs) = delete;
type_info& operator=(const type_info& rhs) = delete;
};
@@ -37,20 +37,20 @@ class bad_cast
: public exception
{
public:
bad_cast() throw();
bad_cast(const bad_cast&) throw();
bad_cast& operator=(const bad_cast&) throw();
virtual const char* what() const throw();
bad_cast() noexcept;
bad_cast(const bad_cast&) noexcept;
bad_cast& operator=(const bad_cast&) noexcept;
virtual const char* what() const noexcept;
};
class bad_typeid
: public exception
{
public:
bad_typeid() throw();
bad_typeid(const bad_typeid&) throw();
bad_typeid& operator=(const bad_typeid&) throw();
virtual const char* what() const throw();
bad_typeid() noexcept;
bad_typeid(const bad_typeid&) noexcept;
bad_typeid& operator=(const bad_typeid&) noexcept;
virtual const char* what() const noexcept;
};
} // std
@@ -63,58 +63,60 @@ public:
#pragma GCC system_header
namespace std // purposefully not using versioning namespace
{
class _LIBCPP_EXCEPTION_ABI type_info
class _LIBCPP_EXCEPTION_ABI type_info
{
type_info& operator=(const type_info&);
type_info(const type_info&);
protected:
const char* __type_name;
_LIBCPP_INLINE_VISIBILITY
explicit type_info(const char* __n)
: __type_name(__n) {}
public:
virtual ~type_info();
const char* name() const {return __type_name;}
_LIBCPP_INLINE_VISIBILITY
const char* name() const _NOEXCEPT {return __type_name;}
bool before(const type_info& __arg) const
_LIBCPP_INLINE_VISIBILITY
bool before(const type_info& __arg) const _NOEXCEPT
{return __type_name < __arg.__type_name;}
size_t hash_code() const throw()
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const _NOEXCEPT
{return *reinterpret_cast<const size_t*>(&__type_name);}
bool operator==(const type_info& __arg) const
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_info& __arg) const _NOEXCEPT
{return __type_name == __arg.__type_name;}
bool operator!=(const type_info& __arg) const
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_info& __arg) const _NOEXCEPT
{return !operator==(__arg);}
};
class _LIBCPP_EXCEPTION_ABI bad_cast
: public exception
: public exception
{
public:
bad_cast() throw();
virtual ~bad_cast() throw();
virtual const char* what() const throw();
bad_cast() _NOEXCEPT;
virtual ~bad_cast() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
class _LIBCPP_EXCEPTION_ABI bad_typeid
: public exception
: public exception
{
public:
bad_typeid() throw();
virtual ~bad_typeid() throw();
virtual const char* what() const throw();
bad_typeid() _NOEXCEPT;
virtual ~bad_typeid() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
} // std
#endif // __LIBCPP_TYPEINFO

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