Compare commits

...

522 Commits

Author SHA1 Message Date
Bill Wendling
db2b81bf90 Creating the libcxx release 3.3 branch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_33@181278 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07 00:25:14 +00:00
Howard Hinnant
8c23819220 Expose accidentally removed __compressed_pair constructor taking piecewise_construct_t. This fixes http://llvm.org/bugs/show_bug.cgi?id=15918 .
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@181217 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-06 16:58:36 +00:00
Howard Hinnant
74f4da7219 Stephan Tolksdorf: fixes the issue in the <atomic> header and adds corresponding tests. I've used macros to fall back to a user-provided default constructor if _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS (though I suspect that there won't be many users defining that macro).
The tests use placement new to check that atomic values get properly zero-initialized. I had to modify the atomic_is_lock_free test, because default initialization of an object of const type 'const A' (aka 'const atomic<int>') requires a user-provided default constructor.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180945 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02 20:18:43 +00:00
Joerg Sonnenberger
e58bc12f2a The push/pop variant of pragma GCC diagnostic is only supported by Clang
and GCC 4.6 and newer, so protect accordingly.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180943 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02 19:34:26 +00:00
Joerg Sonnenberger
34cb066fa2 Make it possible to provide special (linker) flags for the thread tests.
Use it to build & link against libpthread on NetBSD for tests iff they
are testing the thread interface.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180942 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02 19:21:36 +00:00
Joerg Sonnenberger
63d8f7e341 Add explicit casts to unsigned char before calling ctype functions.
Fixes the value range on platforms with signed char.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180940 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-02 19:17:48 +00:00
Howard Hinnant
15467189c3 This patch introduces an alternative layout for basic_string which when the string is short, the data pointer will be word-aligned. It can be activated with -D_LIBCPP_ALTERNATE_STRING_LAYOUT. These two different layouts (the default and _LIBCPP_ALTERNATE_STRING_LAYOUT) are not ABI compatible with each other. Once one is chosen for a given platform, it is disruptive to change it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180811 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-30 21:44:48 +00:00
Joerg Sonnenberger
867deb8e06 Add entry for myself.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180728 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29 19:55:32 +00:00
Joerg Sonnenberger
155f06018e Use protected version of the malloc attribute in case source wants to
define malloc as macro.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180727 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-29 19:52:08 +00:00
Joerg Sonnenberger
a9b94f1337 GCC doesn't support __has_attribute.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180683 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 20:51:42 +00:00
Joerg Sonnenberger
912438c272 Use static_cast.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180680 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 19:13:31 +00:00
Joerg Sonnenberger
d3b5b6b9f4 Use reinterpret_casts directly in place of C-style casts.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180679 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 19:12:36 +00:00
Joerg Sonnenberger
006ab1e213 Only use Clang pragma when compiling with clang.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180678 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-27 19:10:15 +00:00
Joerg Sonnenberger
df4182153c Fix typos.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180598 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-26 09:40:18 +00:00
Howard Hinnant
a5f0e6c5c1 İsmail Dönmez: Change to mktemp template to make it compatible with Linux.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180267 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-25 16:08:55 +00:00
Howard Hinnant
05e7d24b3d default_delete needs a static_assert against void types. I had previously thought that sizeof(void) would take care of this. I was wrong.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180213 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-24 19:44:26 +00:00
Joerg Sonnenberger
c5e6aa5f5c Avoid bash specific functionality to work with any POSIX shell
implementing $(( )).


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180139 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 19:53:24 +00:00
Bob Wilson
f9e75aef34 Change makefile comment to refer to libc++ instead of libcpp.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180135 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 19:26:55 +00:00
Bob Wilson
9493e27c0f PR15820: Use tar instead of rsync to install the headers.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180132 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 18:51:51 +00:00
Bob Wilson
c52fb8d7bf PR12597: Remove "chown -R root:wheel" from the makefile.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180122 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 17:30:35 +00:00
Howard Hinnant
9c2ce95063 Zero-initialize all mbstate_t in the codecvt tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180108 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-23 14:09:35 +00:00
Howard Hinnant
08dd25303e Modest performance improvement for std::string's operator==.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180072 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 23:55:13 +00:00
Howard Hinnant
5544f7e0c7 Somehow aligned_union got dropped through the cracks. This adds it. Did a drive-by fix of alignment_of while I was in the neighborhood.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@180036 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-22 19:37:49 +00:00
Howard Hinnant
b4e67cfd42 After years of telling people: 'If you ever find any of my code that self-move-assigns, send me a bug report.' Somebody finally took me up on it. vector::erase(begin(), begin()) does a self-move-assign of every element in the vector, leaving all of those elements in an unspecified state. I checked the other containers for this same bug and did not find it. Added test case.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179760 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-18 15:02:57 +00:00
Howard Hinnant
2062f37772 I believe this finishes up debug mode for list. The testing is a little weak, but I believe all of the functionality is there. Certainly enough for people to checkout and start beating up on.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179632 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-16 21:42:36 +00:00
Howard Hinnant
61fe0ac9b3 Added extra space to end of EXTRA_FLAGS in buildit. This fixes http://llvm.org/bugs/show_bug.cgi?id=15761
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179609 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-16 17:34:20 +00:00
Howard Hinnant
4313ec3975 addressof misbehaving for type with an implicit conversion operator to char&. This fixes http://llvm.org/bugs/show_bug.cgi?id=15754
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179608 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-16 17:27:56 +00:00
Howard Hinnant
ae57a1ab1d Numeric parsing was getting the wrong answer when faced with very long inputs. This fixes both http://llvm.org/bugs/show_bug.cgi?id=15751 and http://llvm.org/bugs/show_bug.cgi?id=15740
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179556 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-15 20:40:06 +00:00
Howard Hinnant
993248935c Accidentally disallowed explicit tuple conversions when all elements of the tuple can be explicitly converted.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179467 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-14 00:01:13 +00:00
Howard Hinnant
4f67100219 Set failbit when strtold sets errno to ERANGE when parsing floating point values.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-13 18:19:25 +00:00
Howard Hinnant
a5733b3ad3 Ruben Van Boxem: Turn islower_l and isupper_l into functions (instead of macros) on Windows only to quell a warning during libc++ building.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179408 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-12 20:22:57 +00:00
Howard Hinnant
0795931dee Change <cwchar> and <cstring> to look out for flags which may or may not be set by the C headers <wchar.h> and <string.h> indicating C support for the C++-altered wcschr, wcspbrk, wcsrchr, wcsstr, wmemchr, strchr, strpbrk, strrchr, memchr, and strstr. This was already done in <cstring> for other platforms using other flags, so just had to add one more flag to the list there.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@179041 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-08 18:59:28 +00:00
Howard Hinnant
6dcaf3ee1a Fix bug in __libcpp_db::__iterator_copy. Add debug test for swaping lists.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178892 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 17:58:52 +00:00
Howard Hinnant
e1e96cb840 More list debug mode tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178873 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 15:04:10 +00:00
Howard Hinnant
79a35570a5 More work on debug mode for list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178819 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-05 00:18:49 +00:00
Howard Hinnant
128f7bf4fa Somehow search_n never got tested, so of course it had a bug in it. This fixes http://llvm.org/bugs/show_bug.cgi?id=15667.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178764 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-04 15:40:48 +00:00
Howard Hinnant
c5e8961a35 Fix stupid but harmless type-o. Fixes http://llvm.org/bugs/show_bug.cgi?id=15657.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178691 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 20:29:45 +00:00
Howard Hinnant
4aa8b06e67 The move / swap members were not correctly taking all of the possible states of the basic_stringbuf into account. Just rewrote these members. Test included. This fixes http://llvm.org/bugs/show_bug.cgi?id=15659.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178690 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-03 20:21:29 +00:00
Howard Hinnant
cf31d3864e Reference: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077133.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178581 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 22:14:51 +00:00
Howard Hinnant
b777d6a4b2 The cmake script is failing to copy cxxabi.h to the right place because it was generating to destination path like so /include// and dstdir can legally be blank from my interpretation of the script, and this would then generate a path like libcxx/include// which is illegal.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178579 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 21:33:01 +00:00
Howard Hinnant
11a50ac497 Richard Smith: It was pointed out to me off-list that libc++'s non-compiler-builtin
implementation of std::is_polymorphic does this:

template <class _Tp> struct __is_polymorphic1 : public _Tp {};

... and that g++ rejects this if _Tp has an inaccessible virtual destructor
(because __is_polymorphic1<_Tp> would have a deleted virtual destructor
overriding _Tp's non-deleted destructor). Clang was failing to reject this;
I've fixed that in r178563, but that causes libc++'s corresponding test
case to fail with both clang and gcc when using the fallback
implementation. The fallback code also incorrectly rejects final types.

The attached patch fixes the fallback implementation of is_polymorphic; we
now use dynamic_cast's detection of polymorphic class types rather than
trying to determine if adding a virtual function makes the type larger:

  enable_if<sizeof((_Tp*)dynamic_cast<const volatile
void*>(declval<_Tp*>())) != 0, ...>

Two things of note here:
* the (_Tp*) cast is necessary to work around bugs in Clang and g++ where
we otherwise don't instantiate the dynamic_cast (filed as PR15656)
* the 'const volatile' is here to treat is_polymorphic<cv T> as true for a
polymorphic class type T -- my reading of the standard suggests this is
incorrect, but it matches our builtin __is_polymorphic and gcc


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178576 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 21:25:06 +00:00
Howard Hinnant
d4c96a6c89 Some debug test cases for list.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178565 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 19:53:32 +00:00
Howard Hinnant
f6bdda044c Reference: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077132.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178545 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 15:48:56 +00:00
Howard Hinnant
a1985ebbc8 Reference: http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130325/077131.html
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-04-02 15:46:31 +00:00
Howard Hinnant
9d00ed5d87 Test case was forming the wrong limits when size_t != unsigned long.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178370 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 21:22:22 +00:00
Howard Hinnant
fc2f021bdd Bruce Mitchener, Jr.: Port to emscripten. Fixes http://llvm.org/bugs/show_bug.cgi?id=15624.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178354 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 18:27:28 +00:00
Howard Hinnant
8b25c00ef1 The 3rd test in shrink_to_fit.pass.cpp can't possibly pass if exceptions are disabled, so #ifdef'ing out the test.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178350 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-29 17:20:04 +00:00
Howard Hinnant
302fa82a1c I believe debug mode for vector<T> (T != bool) is complete. If anyone sees anything more they would like to see on it, please let me know. Debug mode is activated by compiling with -D_LIBCPP_DEBUG2=1. Eventually _LIBCPP_DEBUG2 will be renamed to just _LIBCPP_DEBUG.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178288 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 20:35:29 +00:00
Howard Hinnant
db4d478ff4 Fix a few warnings/errors for compiling with -fno-exceptions.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178267 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 18:56:26 +00:00
Howard Hinnant
742fecbd2a Second try at r178075. The llvm breakage has been fixed by r178240.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178253 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 17:44:32 +00:00
Howard Hinnant
2c0d3edf68 Add missing #ifndef _LIBCPP_NO_EXCEPTIONS around throw in include/thread.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178237 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-28 15:00:04 +00:00
Daniel Dunbar
34d36f39b0 Revert r178075, "Tighten up the iterator requirements ...", it breaks LLVM
bootstrap with libc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178116 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-27 04:10:25 +00:00
Howard Hinnant
32d40f5f44 Tighten up the iterator requirements for the vector member templates. This is especially important for the constructors so that is_constructible<vector<T>, I, I> gives the right answer when T can not be constructed from *I. Test case included for this latter point.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178075 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 21:40:54 +00:00
Howard Hinnant
02d5e18917 Another vector debug mode test, and a static test on Allocator::value_type. This partially addresses http://llvm.org/bugs/show_bug.cgi?id=15576.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178064 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 19:04:56 +00:00
Howard Hinnant
d1c0082675 More vector debug tests.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178033 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 15:45:56 +00:00
Marshall Clow
c3a9b81e67 Fixed race conditions in thread tests; exposed by UBSan
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178029 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 15:28:33 +00:00
Howard Hinnant
3fbd1dfb24 Simply debug mode tests per Dmitri Gribenko's suggestion.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178026 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 14:28:25 +00:00
Howard Hinnant
d9cdb2dcfd Need one more swap overload for swapping two lvalue vector<bool>::reference's.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@178016 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-26 13:48:57 +00:00
Howard Hinnant
782da33d1c Added debug tests for indexing, pop_back and both forms of erase. Added an improved error message for erasing a single element with end().
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177929 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 22:12:26 +00:00
Howard Hinnant
c1ca2e1e8b Remove some erroneous code I was using to debug debug mode.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177908 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 20:46:07 +00:00
Howard Hinnant
295891fdc2 Debug mode tests for vector::front and back.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177904 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 20:31:25 +00:00
Howard Hinnant
0d01eb54e7 More vector::iterator debug mode tests. Run by adding to OPTIONS -D_LIBCPP_DEBUG2=1.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177897 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 20:03:19 +00:00
Howard Hinnant
f5f4684e71 Debug mode: learning to crawl. I need to set up some tests that actually test that the debug mode is working, but that won't cause problems when debug mode isn't on. This is my first prototype of such a test. It should call std::terminate() because it's comparing iterators from different containers. And std::terminate() is rigged up to exit normally. If debug mode fails, and doesn't call terminate, then the program asserts. The test is a no-op if _LIBCPP_DEBUG2 is not defined or is defined to be 0.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177892 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-25 19:29:35 +00:00
Howard Hinnant
ae7bf9daac Marshall Clow found some divide-by-zero warnings with UBSan in rand's binomial_distribution test. This eliminates the divide-by-zeros and describes in comments the numerical difficulties the test is having. Each of the problematic tests are exploring edge cases of the distribution.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177826 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-23 19:29:45 +00:00
Howard Hinnant
9976b5511a This is a start at making the libc++ test suite friendlier to the -fnoexceptions flag. Although this is not a complete solution, it does reduce the number of test failures on OS X from 467 to 128 on OS X when -fno-exceptions is enabled, and does not impact the number of failures at all when -fno-exceptions is not enabled. The bulk of this code was donated anonymously.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177824 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-23 17:27:16 +00:00
Howard Hinnant
06d8bf6ce2 Test cleanup with respect to use of deprecated tmpnam function. Also Windows port for these tests to use _tempnam. The bulk of this patch was donated anonymously. I've tested it on OS X and accept responsibility for it. If I've broken anyone's platform by switching from tmpnam to mktemp for the generation of temporary file names, just let me know. Should be easy to fix in test/support/platform_support.h
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177755 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-22 20:05:40 +00:00
Marshall Clow
9b145da078 Fix buffer read overflow in money_get::do_get(). Found by UBSan
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177694 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-22 02:14:40 +00:00
Marshall Clow
04bd79b23a Fix undefined behavior in syntax_option_type::operator~ and match_flag_type::operator./a.out Found by UBSan
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177693 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-22 02:13:55 +00:00
Marshall Clow
bdea27ba8f Fix bug in test; found by AddressSanitizer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177464 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-20 00:01:48 +00:00
Howard Hinnant
b74309e3ad Marshall Clow found this memory problem in strstream using -fsanitize=address on the test suite.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177452 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 22:16:57 +00:00
Howard Hinnant
903439f735 This is an optimization which produces improved launching time. There should be no functionality change. Clients should see no ABI differences.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-19 21:34:48 +00:00
Marshall Clow
c19fe86743 Fix bug in test; found by AddressSanitizer
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177355 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 23:39:36 +00:00
Marshall Clow
53e2763966 Removed raw references to __sun__, __FreeBSD__, __GLIBC__ and __linux__; now just check to see if they are defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177310 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 19:34:07 +00:00
Marshall Clow
dab9b2eb32 Removed raw references to _MSC_VER; now just check to see if it is defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177304 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 18:20:48 +00:00
Marshall Clow
dece7fe670 Removed raw references to __APPLE__; now just check to see if it is defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177297 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 17:45:34 +00:00
Marshall Clow
a22d2addb1 Removed raw references to _WIN32; now just check to see if it is defined.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177291 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-18 17:04:29 +00:00
Howard Hinnant
e33c2d1926 This should be nothing but a load-time optimization. I'm trying to reduce load time initializers and this is a big one. No visible functionality change intended.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177212 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-16 00:17:53 +00:00
Marshall Clow
e47bc9bc4f Updated link to Marshall's instructions
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177099 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 19:00:34 +00:00
Howard Hinnant
c7cbe502db Some forward-looking and optimistic documentation.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@177093 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-14 18:37:48 +00:00
Howard Hinnant
c789025a5a This SO question: http://stackoverflow.com/questions/15344402/how-can-i-read-a-0xff-in-a-file-with-libc-istream-iterator/15347225#15347225 highlighted the lack of a cast in the implementation of std::cin. Added. I unfortunately don't have a test case to add to the suite since this bug only shows itself when using std::cin. The current testsuite setup does not have a way a good way to test std::cin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176822 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-11 19:53:48 +00:00
Howard Hinnant
6319f1462d Parsing floating point numbers with very long precision was broken, and this patch fixes it. This fixes http://llvm.org/bugs/show_bug.cgi?id=15445.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176711 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-08 19:06:24 +00:00
Howard Hinnant
23fb972520 Albert Wong: definition for regex_traits<_CharT>::__regex_word.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176640 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 19:38:08 +00:00
Howard Hinnant
707f318787 Change _LIBCPP_TYPE_VIS to use __type_visibility__(default) instead of __visibility__(default) when available. This change makes just the type_info visible so that types like vectors and strings can be used as exception objects across dylib boundaries even when hidden visibility is specified globally (at the command line), and yet this allows clients to hide the member functions of things like vector and string (with global visibility commands).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176639 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-07 19:25:03 +00:00
Howard Hinnant
83eade6abb No functionality change at this time. I've split _LIBCPP_VISIBLE up into two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176593 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 23:30:19 +00:00
Howard Hinnant
cc7bdae931 Have basic_istream::read call sgetn intead of sbumpc individual characters. This addresses http://llvm.org/bugs/show_bug.cgi?id=15427.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176573 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 19:27:56 +00:00
Howard Hinnant
3101474720 Correct silly type-o. Thanks Richard.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176568 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 18:16:12 +00:00
Howard Hinnant
11a31d0583 The bitset(unsigned long long) constructor was broken by the constexpr additions only on 32 bit platforms. Fixed. This addresses http://llvm.org/bugs/show_bug.cgi?id=15444.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176559 91177308-0d34-0410-b5e6-96231b3b80d8
2013-03-06 17:30:26 +00:00
Howard Hinnant
fae54b9c14 Michael van der Westhuizen: correction to the libcxx build instructions when built with libcxxrt on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176093 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-26 16:27:55 +00:00
Howard Hinnant
4a0e74fff8 Alexey Samsonov: #ifdefs out undefined function in static build of libc++ w/o RTTI.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@176026 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-25 15:50:36 +00:00
Howard Hinnant
0560f786fe Constrain bind operator()() to not exist if the call is not valid. Fixes http://llvm.org/bugs/show_bug.cgi?id=15295.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@175774 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-21 18:16:55 +00:00
David Chisnall
76aa2ef017 Fix a bug in mutex_try_to_lock. This was previously trying to unlock a mutex that it didn't own, causing an assertion failure in mutex.cpp. The issue was that the unique_lock went out of scope, releasing the lock on m, then m.unlock() was called on an already-unlocked mutex.
This change removes the spurious m.unlock() call.  

If this test was previously passing for anyone with assertions enabled, then they should investigate bugs in their pthread implementation, as pthread_unlock() should not return 0 if the mutex is currently unlocked.



git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@175506 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-19 11:28:45 +00:00
Howard Hinnant
0dee9cd5ad Bruce Mitchener: Minor typo fixes.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@175274 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-15 15:37:50 +00:00
Daniel Dunbar
3bc6a98c3e [tests] Add support for a link_flags lit parameter.
- This is useful for testing with custom ABI libraries.
 - Patch by Michael van der Westhuizen.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174997 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-12 19:28:51 +00:00
Daniel Dunbar
6b875ef374 [tests] Another batch of timeout increases.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174902 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-11 21:04:34 +00:00
Howard Hinnant
af4d161908 Michael van der Westhuizen: Update instructions for building on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174733 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:10:36 +00:00
Howard Hinnant
af69f47e86 Add Michael van der Westhuizen to CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174732 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:08:06 +00:00
Howard Hinnant
b85dea35b0 Michael van der Westhuizen: update to CMake.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174731 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 19:04:53 +00:00
Daniel Dunbar
8eba41324c [tests] Another batch of timeout increases.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174726 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 18:26:55 +00:00
Daniel Dunbar
1608b64881 [tests] Add back stdc macros I accidentally refactored out.
- Patch by Michael van der Westhuizen:
--
r174404 accidentally removed stdc format, limit and constant macros from the Linux test runner logic.  This small patch re-adds the macros.

Making this change fixes the following tests on Linux:
 - depr/depr.c.headers/inttypes_h.pass.cpp
 - depr/depr.c.headers/stdint_h.pass.cpp
 - input.output/file.streams/c.files/cinttypes.pass.cpp
 - language.support/cstdint/cstdint.syn/cstdint.pass.cpp
--

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174722 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 17:41:28 +00:00
Daniel Dunbar
fe14b970ac [tests] Increase a bunch of wait limits.
- Basically I just ran the thread tests many many times on a busy machine and
   bumped the timeouts whenever I hit a test failure.

 - This is obviously subpar, but is the best I can do without the tests being
   rewritten to not depend on arbitrary timeouts.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174721 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-08 17:41:19 +00:00
Marshall Clow
5920cfc403 Change the 'result_type' from unsigned to 'uint_fast32_t'. This eliminates truncation warnings on Linux
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174669 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 22:12:02 +00:00
Marshall Clow
b18165e704 Belt and suspenders when calling sysconf
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174642 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 18:48:09 +00:00
Marshall Clow
d854ce6bfa Another libc++ warning suppression on Linux; no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174637 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 17:37:58 +00:00
Marshall Clow
9ae96d0f21 More libc++ warning suppression on Linux; no functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174636 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 17:20:56 +00:00
Howard Hinnant
635bbbb6d1 Revert accidental check-in. These changes are probably good, but premature at this point.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174625 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:31:44 +00:00
Howard Hinnant
46c49d19aa Michael van der Westhuizen: The attached patch add support for building against libc++abi and libcxxrt to CMake builds of libc++.
Usage (with the appropriate CC and CXX environment variables) is:
$ cmake -DLIBCXX_CXX_ABI=libcxxabi '-DLIBCXX_LIBCXXABI_INCLUDE_PATHS=/home/michael/libcxxabi/include' ../libcxx
and:
$ cmake -DLIBCXX_CXX_ABI=libcxxrt '-DLIBCXX_LIBCXXRT_INCLUDE_PATHS=/home/michael/libcxxrt/src' ../libcxx

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174623 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 15:27:39 +00:00
Marshall Clow
88c3190d6c Clean up some warnings for Linux build; No functionality change
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174611 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 14:22:51 +00:00
Daniel Dunbar
6afc7ad3eb [build/Darwin] Use the correct libc++abi reexport list.
- This updates the build script to match the change originally in r149634, so
   that we re-export symbols from libc++abi appropriately.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174563 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 00:24:19 +00:00
Daniel Dunbar
fd329a445e [build] Detabify.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174562 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-07 00:24:17 +00:00
Howard Hinnant
b73568dc24 Marcin Zalewski: Change the name of a template parameter in __copy_backward from _InputIterator to _BidirectionalIterator to better document the intent of the algorithm.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174544 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 21:03:39 +00:00
Howard Hinnant
66a48c5ad5 Give a lot more timing latitude to some of the timing tests. Busy buildbots are hitting the timing limits too often.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174539 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 20:25:56 +00:00
Daniel Dunbar
7fa0ca75e5 [tests] Infer the cxx_under_test (as clang++).
- This is a reasonable default, and makes testing just work with no required
   parameters.

 - Add notes on all of the inferred or default values.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174538 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 20:24:23 +00:00
Daniel Dunbar
88dec1ef5c [tests] Change test default to run against locally built library.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174528 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 17:47:08 +00:00
Daniel Dunbar
6b8b9922f0 [tests] Enable use_system_lib support on Linux.
- Patch by Michael van der Westhuizen.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174527 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 17:45:53 +00:00
Daniel Dunbar
cedb7fcc10 [tests] One last batch of XFAILs, for tests using new symbols added to libc++.
- As of this commit, the test suite should now fully pass on both darwin11 and
   darwin12 when testing against either a locally built libc++ or the system libc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174478 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 00:59:06 +00:00
Daniel Dunbar
a38e2c9d1a [build] Create the link for the final library install name in the lib dir.
- Otherwise, we never were actually linking against the right library when
   building the test applications.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174470 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 00:04:54 +00:00
Daniel Dunbar
5f4841fb83 [tests] Accept XFAIL arguments that match any part of a feature.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174469 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-06 00:04:52 +00:00
Daniel Dunbar
43807c2fba [tests] XFAIL some locale tests that don't seem to work on any Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174459 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:51:20 +00:00
Daniel Dunbar
4cceb7a5e8 [tests] If no explicit target triple is given, try to infer it.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174454 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:28:03 +00:00
Daniel Dunbar
8b9eee35d8 [tests] Mark another stream input expected failure (with system libc++).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174453 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:21:52 +00:00
Daniel Dunbar
548d392d5d [tests] Mark another stream input expected failure (with system libc++).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174452 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:10:28 +00:00
Daniel Dunbar
c8e1889601 [tests] Mark some string.conversions expected failures (with system libc++).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174451 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:10:27 +00:00
Daniel Dunbar
edfb05351e [tests] XFAIL a few things that require libc (?) support missing on Darwin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174450 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 22:10:25 +00:00
Daniel Dunbar
aac8dd8331 [tests] Mark some istream.unformatted expected failures (with system libc++).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174444 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 21:43:32 +00:00
Daniel Dunbar
a5b51964c1 [tests] Add an available feature that combines the triple and use_system_lib.
- This is so that we can easily write XFAIL markers for tests that are known
    to fail with versions of libc++ as were shipped with a particular triple.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 21:43:30 +00:00
Daniel Dunbar
81d1ef7a3f [tests] Add support for REQUIRES and XFAIL lines in libc++ tests.
- We parse up to the first non-empty non-comment (C++ style) line, otherwise
   the format and semantics match what is used for LLVM/Clang tests.

 - For now, the only interesting thing to test against is a user supplied
   target_triple test parameter.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174440 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 21:03:25 +00:00
Daniel Dunbar
cccf25579a [tests] Add a 'use_system_lib' parameter.
- This controls whether to execute against the locally built library or
   not. The default is currently True which maps to what was already being done
   by default.

 - I'd appreciate it if someone can implement the proper handling of this flag
   on linux, I no longer remember the details of its .so handling.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@174404 91177308-0d34-0410-b5e6-96231b3b80d8
2013-02-05 18:03:49 +00:00
Howard Hinnant
54e2fff2e1 Saleem Abdulrasool: If errno is defined as volatile int, the qualifier differences can cause
template typename deductions on swap<> (used in string.cpp).  Use
decltype(errno) to replicate the type and qualifier information for holding the
errno value.  Because errno is expected to be assignable, there is no need to
use typename std::remove_const<decltype(errno)>::type to hold the value.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@173172 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 17:26:08 +00:00
Howard Hinnant
e0f0bfb5e6 Saleem Abdulrasool: __terminate_handler and __unexpected_handler are defined but not used when
building against libsupc++ as the functions for which they are used are provided
by libsupc++.  Simply preprocess them away when building against libsupc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@173165 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 14:48:10 +00:00
Howard Hinnant
7173a501bb Saleem Abdulrasool: Ensure that __GLIBCXX__ is defined when building with libsupc++.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@173164 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-22 14:44:06 +00:00
Howard Hinnant
7b9d6a8d40 Implement the ATOMIC_*_LOCK_FREE macros.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@173084 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 20:39:41 +00:00
Howard Hinnant
78f0de22db Donated anonymously: This enables GCC 4.8.0 to build libc++.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@173060 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-21 17:26:55 +00:00
Howard Hinnant
5ce391e336 Make a few tests optimization-proof. These tests were failing under -O3 because the optimizer was eliminating the call to new.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172631 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-16 17:56:06 +00:00
Howard Hinnant
0b93963db7 Optimize basic_ostream::write by having it call sputn instead of sputc.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172542 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-15 17:22:03 +00:00
Howard Hinnant
b05a55675f Make <cmath> classification macros work with integral types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172461 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 20:56:22 +00:00
Howard Hinnant
1b031c947f Fix a race in the construction of future. This fixes http://llvm.org/bugs/show_bug.cgi?id=14934.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172456 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 20:01:24 +00:00
Howard Hinnant
3e3ae9ec41 Fix string conversions functions to throw out_of_range properly. Fixes http://llvm.org/bugs/show_bug.cgi?id=14919.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172447 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 18:59:43 +00:00
Howard Hinnant
b4ebb0e415 Michael van der Westhuizen: Improve support for testing on Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14892.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172436 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 17:12:54 +00:00
Howard Hinnant
750039f50c Michael van der Westhuizen: Patches for Linux. Fixes http://llvm.org/bugs/show_bug.cgi?id=14648.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172435 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-14 17:07:27 +00:00
Howard Hinnant
f619e230cc Fix exception safety bug in vector::push_back
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@172250 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-11 20:36:59 +00:00
Marshall Clow
304c31b355 Made test output iterators have value_type of 'void'; matches ones in library
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171980 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-09 17:20:02 +00:00
Marshall Clow
83e2c4d877 Move common header files into a 'support' directory; make 'testit' include -I to that directory; rename 'iterators.h' to 'iterator_test.h'; remove hard-coded paths to include files from more than 350 source files
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171594 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-05 03:21:01 +00:00
Howard Hinnant
6ae47055f9 atomic_bool was missing (just a typedef to atomic<bool>).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171498 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 18:58:50 +00:00
Marshall Clow
8226d0b7c5 ...and then there was one. Only one copy of 'iterators.h' in the test tree for libc++
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171479 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-04 18:24:04 +00:00
Marshall Clow
239e341c94 Removed another copy of 'iterators.h' files in libcxx/test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171456 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03 03:57:56 +00:00
Marshall Clow
ba1920fe4b Removed several more different 'iterators.h' files in libcxx/test
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171452 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03 02:29:29 +00:00
Marshall Clow
002a984948 Removed 7 (of 8) different 'iterators.h' files in test/localization
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171443 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-03 01:45:09 +00:00
Howard Hinnant
159b9ba4ce Updating CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171347 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-01 16:09:11 +00:00
NAKAMURA Takumi
0e0bc1cfe8 Update the copyright coredits -- Happy new year 2013!
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171342 91177308-0d34-0410-b5e6-96231b3b80d8
2013-01-01 10:00:19 +00:00
Howard Hinnant
352bd3a273 Klaas de Vries: Fix bug in libc++'s std::string::find_first_not_of.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171321 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 20:09:48 +00:00
Michael J. Spencer
db8a030bd3 [CMake] Fix c++ abi library configuration on Linux.
You can now configure from the command line using:
-DLIBCXX_CXX_ABI=libsupc++
-DLIBCXX_LIBSUPCXX_INCLUDE_PATHS="path;path

Also documents how to build on Linux.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171316 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 19:34:21 +00:00
Chandler Carruth
ed9f69d342 Don't mark variadic functions as always inline -- they cannot in fact be
inlined.

Patch by Saleem Abdulrasool, reviewed by Michael Spencer and Richard Smith.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171276 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 06:09:54 +00:00
Chandler Carruth
bbda4db0d5 Add a simple .arcconfig to make using the 'arc' commandline tool and the
phabricator code review site easier with libc++.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171275 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-31 05:59:45 +00:00
Howard Hinnant
d1a7479763 Remove test for eof from istreambuf_iterator constructors. It is no longer necessary and potentially violates the constructor's noexcept spec.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171232 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-29 17:45:42 +00:00
Howard Hinnant
21772ec063 Saleem Abdulrasool: GCC complains about the template functions as potentially not being able to be
inlined.  These do not need to be always-inlined for ABI stability because they are not exported beyond this source due to the unnamed namespace.
Also simplified use of the Wmissing-field-initializers pragma as was done for clang.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171202 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-28 18:15:01 +00:00
Howard Hinnant
2328902ab1 Saleem Abdulrasool: Add entry to CREDITS.TXT.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171174 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 23:26:52 +00:00
Howard Hinnant
5f767b7b28 Saleem Abdulrasool: cleanup a few more compile warnings emitted by GCC.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171173 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 23:24:31 +00:00
Howard Hinnant
bf68bdc4ed Saleem Abdulrasool: avoid hardcoding buffer lengths.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171169 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 21:17:53 +00:00
Howard Hinnant
0aa900e94f Saleem Abdulrasool: Silence warning and reduce unnecessary code in hash.cpp.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171167 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 18:59:05 +00:00
Howard Hinnant
c6e54b964f Saleem Abdulrasool: This just rounds up a few compile warnings emitted by GCC (4.7.2).
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@171165 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-27 18:46:00 +00:00
Chad Rosier
27c836ff3a Remove redundant inits. Patch by Eitan Adler.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170967 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-22 00:12:05 +00:00
Howard Hinnant
3793a7d202 Test case for http://llvm.org/bugs/show_bug.cgi?id=14670.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170706 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 16:50:07 +00:00
Howard Hinnant
ee717d8c44 Hyeon-Bin Jeong: readsome() need to reset gcount to zero. This fixes http://llvm.org/bugs/show_bug.cgi?id=14670.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170703 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 15:40:28 +00:00
Richard Smith
b2f2b68143 Implement std::is_base_of for the case where we don't have a compiler
intrinsic. This relies upon the fact that overload resolution does not check
access and ambiguity for a derived-to-base conversion. This passes all
is_base_of tests in the test suite.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170662 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-20 04:20:28 +00:00
Marshall Clow
a46482e8bb Added static_assert to std::get<N>(std::array) calls to catch "out of bounds" calls
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170435 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-18 16:46:30 +00:00
Howard Hinnant
3d4f92c08a Updated CREDITS.TXT
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170062 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-13 00:51:59 +00:00
Howard Hinnant
0a69fa14d2 Zhang Xiongpang: Add definitions for const data members. Fixes http://llvm.org/bugs/show_bug.cgi?id=14585.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@170026 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-12 21:14:28 +00:00
Howard Hinnant
7fa77a701f Modify testit to use the local headers and lib. Thanks go to Jeffrey Yasskin.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@169686 91177308-0d34-0410-b5e6-96231b3b80d8
2012-12-09 00:12:14 +00:00
Michael J. Spencer
a358fbe504 [CMake] Add support for selecting which c++ abi library to use.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@169036 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-30 21:02:29 +00:00
Richard Smith
53008d8b0c Remove 'noreturn' attribute from friend declaration. This attribute will be
inherited from the previous out-of-class declaration, and attributes on friend
function declarations are ill-formed in C++11.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168853 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-29 04:30:50 +00:00
Daniel Dunbar
af01e708aa tests/lit: Change test default parameters to assume local build.
- Also, support overriding them with lit parameters.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168749 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 23:56:28 +00:00
Howard Hinnant
b0895ff8ae Fix type-o.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168715 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 18:52:32 +00:00
Howard Hinnant
641f6c1f65 Remove by-chapter breakdown of what is implemented. The chart is now obsolete.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168713 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-27 18:35:09 +00:00
Howard Hinnant
8a9c5ea750 Dimitry Andric: When using libc++ headers on FreeBSD, in combination with -std=c++98,
-ansi or -std=c++03, the long long type is not supported.  So in this
case, several functions and types, like lldiv_t, strtoll(), are not
declared.

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@168610 91177308-0d34-0410-b5e6-96231b3b80d8
2012-11-26 21:18:17 +00:00
Howard Hinnant
984f10fdc0 istreambuf_iterator increment should call sbumpc instead of snextc. Patch
by Kimball Thurston.  This fixes http://llvm.org/bugs/show_bug.cgi?id=14358.

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

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

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

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

    struct foo
    {
        operator int&();
    };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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


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


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


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

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


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

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



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

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

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

Yay!



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



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



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



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

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



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

Howard: Please review.



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


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

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

Summary of tests on FreeBSD:


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

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

More fixes to follow...



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



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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Addresses <rdar://problem/9658274>.


git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133656 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 22:17:44 +00:00
Howard Hinnant
f5d76a7afc Add instructions for -U__STRICT_ANSI__ for Mac OS 10.6
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133616 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22 12:13:55 +00:00
Howard Hinnant
7604fea08c More fixes: One of my fixes to type_traits earlier today was incorrect, so that is reverted. Recently clang appears to have tightened up its definition of is_convertible and that has caused some failures in [unordered_][multi]map. I've switched to using is_constructible to restablish the desired functionality in [unordered_][multi]map. Specifically, inserting rvalues of move-only types for the keys.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133402 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-19 21:45:00 +00:00
Howard Hinnant
d4b957820c Miscellaneous minor fixes in <type_traits>
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133401 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-19 19:12:59 +00:00
Howard Hinnant
2b1b2d40d7 Provide names for template and function parameters in forward declarations. The purpose is to aid automated documentation tools.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@133008 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-14 19:58:17 +00:00
1010 changed files with 26462 additions and 13890 deletions

4
.arcconfig Normal file
View File

@@ -0,0 +1,4 @@
{
"project_id" : "libcxx",
"conduit_uri" : "http://llvm-reviews.chandlerc.com/"
}

View File

@@ -39,6 +39,14 @@ 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)
set(CXXABIS none libcxxabi libcxxrt libsupc++)
if (NOT DEFINED LIBCXX_CXX_ABI)
set(LIBCXX_CXX_ABI "none")
endif()
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
"Specify C++ ABI library to use." FORCE)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS "";${CXXABIS})
#===============================================================================
# Configure System
#===============================================================================
@@ -58,6 +66,91 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
)
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
#===============================================================================
# Add an ABI library if appropriate
#===============================================================================
#
# _setup_abi: Set up the build to use an ABI library
#
# Parameters:
# abidefines: A list of defines needed to compile libc++ with the ABI library
# abilibs : A list of libraries to link against
# abifiles : A list of files (which may be relative paths) to copy into the
# libc++ build tree for the build. These files will also be
# installed alongside the libc++ headers.
# abidirs : A list of relative paths to create under an include directory
# in the libc++ build directory.
#
macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
set(${abipathvar} "${${abipathvar}}"
CACHE STRINGS
"Paths to ABI include directories separate by ';'."
)
set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
set(LIBCXX_ABILIB_FILES ${abifiles})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
foreach(_d ${abidirs})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
endforeach()
set(LIBCXX_ABILIB_FILE_PATHS)
foreach(fpath ${LIBCXX_ABILIB_FILES})
set(found FALSE)
foreach(incpath ${${abipathvar}})
if (EXISTS "${incpath}/${fpath}")
set(found TRUE)
get_filename_component(dstdir ${fpath} PATH)
get_filename_component(ifile ${fpath} NAME)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${incpath}/${fpath}"
"${CMAKE_BINARY_DIR}/include/${dstdir}"
MAIN_DEPENDENCY "${incpath}/${fpath}"
)
list(APPEND LIBCXX_CXX_ABI_DEPS
"${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
)
endif()
endforeach()
if (NOT found)
message(FATAL_ERROR "Failed to find ${fpath}")
endif()
endforeach()
add_custom_target(abilib_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
set(LIBCXX_CXX_ABI_DEPS abilib_headers)
include_directories("${CMAKE_BINARY_DIR}/include")
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
)
endmacro()
if ("${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
set(_LIBSUPCXX_INCLUDE_FILES
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
)
setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS" "-D__GLIBCXX__"
"supc++" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
"c++abi" "cxxabi.h;cxa_demangle.h" ""
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
)
elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
message(FATAL_ERROR
"Currently libsupc++, libcxxabi, libcxxrt and none are "
"supported for c++ abi."
)
endif ()
# Configure compiler.
include(config-ix)
@@ -87,17 +180,17 @@ macro(append_if list condition var)
endmacro()
# Get warning flags
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif()
# Get feature flags.
@@ -119,7 +212,8 @@ if (NOT LIBCXX_ENABLE_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif()
# Assert
if (LLVM_ENABLE_ASSERTIONS)
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
if (LIBCXX_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
@@ -134,6 +228,10 @@ else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif()
endif()
# Static library
if (NOT LIBCXX_ENABLE_SHARED)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
endif()
# This is the _ONLY_ place where add_definitions is called.
add_definitions(

View File

@@ -8,15 +8,96 @@ 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: Saleem Abdulrasool
E: compnerd@compnerd.org
D: Minor patches and Linux fixes.
N: Dimitry Andric
E: dimitry@andric.com
D: Visibility fixes, minor FreeBSD portability patches.
N: Holger Arnold
E: holgerar@gmail.com
D: Minor fix.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com
D: Minor patches and bug fixes.
N: Google Inc.
D: Copyright owner and contributor of the CityHash algorithm
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
N: Hyeon-bin Jeong
E: tuhertz@gmail.com
D: Minor patches and bug fixes.
N: Argyrios Kyrtzidis
E: kyrtzidis@apple.com
D: Bug fixes.
N: Bruce Mitchener, Jr.
E: bruce.mitchener@gmail.com
D: Emscripten-related changes.
N: Michel Morin
E: mimomorin@gmail.com
D: Minor patches to is_convertible.
N: Andrew Morrow
E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: Jonathan Sauer
D: Minor patches, mostly related to constexpr
N: Craig Silverstein
E: csilvers@google.com
D: Implemented Cityhash as the string hash function on 64-bit machines
N: Richard Smith
D: Minor patches.
N: Joerg Sonnenberger
E: joerg@NetBSD.org
D: NetBSD port.
N: Stephan Tolksdorf
E: st@quanttec.com
D: Minor <atomic> fix
N: Michael van der Westhuizen
E: r1mikey at gmail dot com
N: Klaas de Vries
E: klaas at klaasgaaf dot nl
D: Minor bug fix.
N: Zhang Xiongpang
E: zhangxiongpang@gmail.com
D: Minor patches and bug fixes.
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com
D: Linux fixes.

View File

@@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
University of Illinois/NCSA
Open Source License
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
All rights reserved.
@@ -55,7 +55,7 @@ SOFTWARE.
==============================================================================
Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
Copyright (c) 2009-2013 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@@ -1,5 +1,5 @@
##
# libcpp Makefile
# libc++ Makefile
##
SRCDIRS = .
@@ -14,6 +14,12 @@ ifeq (,$(RC_INDIGO))
else
INSTALL_PREFIX="$(SDKROOT)"
endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders install
help::
@echo "Use make install DSTROOT=<destination>"
installsrc:: $(SRCROOT)
@@ -24,21 +30,23 @@ installsrc:: $(SRCROOT)
clean::
installhdrs::
# The installheaders target is used by clang's runtime/libcxx makefile.
installheaders::
mkdir -p $(HEADER_DIR)/c++/v1/ext
(cd $(SRCDIRS)/include && tar cf - --exclude=support .) | \
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
chmod 755 $(HEADER_DIR)/c++/v1
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/include
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
install::
cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \
$(SYMROOT)/usr/lib/libc++.1.dylib
mkdir -p $(INSTALL_DIR)/usr/lib
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \
$(SYMROOT)/usr/lib/libc++.1.dylib
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib

File diff suppressed because it is too large Load Diff

View File

@@ -11,9 +11,15 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header
#endif
#define _LIBCPP_VERSION 1000
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1
@@ -45,13 +51,38 @@
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# ifndef __LONG_LONG_SUPPORTED
# define _LIBCPP_HAS_NO_LONG_LONG
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
|| (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#ifdef __linux__
# if defined(__GNUC__) && _GNUC_VER >= 403
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif
#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif
#endif // __sun__
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -65,32 +96,91 @@
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
#ifdef _WIN32
// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS
# define _LIBCPP_TYPE_VIS
#endif
#if _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_INLINE_VISIBILITY
# ifdef _MSC_VER
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# ifdef _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
#endif // _WIN32
#ifndef __has_attribute
#define __has_attribute(__x) 0
#endif
#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#endif
#ifndef _LIBCPP_FUNC_VIS
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
#endif
#ifndef _LIBCPP_TYPE_VIS
# if __has_attribute(type_visibility)
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
# else
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
# endif
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__)
#if __has_feature(cxx_alignas)
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
@@ -112,17 +202,23 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI
#endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
#if __has_feature(cxx_attributes)
# define _ATTRIBUTE(x) [[x]]
# define _LIBCPP_NORETURN [[noreturn]]
#else
# define _ATTRIBUTE(x) __attribute__ ((x))
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@@ -146,6 +242,9 @@ typedef __char32_t char32_t;
#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
@@ -157,20 +256,33 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#if __has_feature(is_base_of)
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
#endif
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if defined(__FreeBSD__) && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
@@ -179,11 +291,26 @@ namespace std {
# define _NOEXCEPT_(x)
#endif
// end defined(__clang__)
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#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 {
}
}
#elif defined(__GNUC__)
#define _ATTRIBUTE(x) __attribute__((x))
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
@@ -213,24 +340,25 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NULLPTR
#endif
@@ -238,7 +366,7 @@ namespace std {
#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 {
@@ -246,7 +374,29 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#endif // defined(__GNUC__)
#elif defined(_MSC_VER)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
namespace std {
}
#endif // __clang__ || __GNUC___ || _MSC_VER
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
@@ -269,11 +419,79 @@ template <unsigned> struct __static_assert_check {};
#endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define constexpr const
#define _LIBCPP_CONSTEXPR
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_DEFAULT {}
#else
#define _LIBCPP_DEFAULT = default;
#endif
#ifdef __GNUC__
#define _NOALIAS __attribute__((__malloc__))
#else
#define _NOALIAS
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
#if __has_feature(cxx_explicit_conversions)
# define _LIBCPP_EXPLICIT explicit
#else
# define _LIBCPP_EXPLICIT
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
__lx __v_; \
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#ifdef __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
#if defined(__APPLE__) || defined(__FreeBSD__)
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#ifdef _LIBCPP_DEBUG2
# if _LIBCPP_DEBUG2 == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG2 == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
# endif
#endif
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG

193
include/__debug Normal file
View File

@@ -0,0 +1,193 @@
// -*- 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>
# ifndef _LIBCPP_ASSERT
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
# endif
#endif
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS __c_node;
struct _LIBCPP_TYPE_VIS __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_TYPE_VIS __c_node
{
void* __c_;
__c_node* __next_;
__i_node** beg_;
__i_node** end_;
__i_node** cap_;
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__c_node(void* __c, __c_node* __next)
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
virtual ~__c_node();
virtual bool __dereferenceable(const void*) const = 0;
virtual bool __decrementable(const void*) const = 0;
virtual bool __addable(const void*, ptrdiff_t) const = 0;
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
void __add(__i_node* __i);
_LIBCPP_HIDDEN void __remove(__i_node* __i);
};
template <class _Cont>
struct _C_node
: public __c_node
{
_C_node(void* __c, __c_node* __n)
: __c_node(__c, __n) {}
virtual bool __dereferenceable(const void*) const;
virtual bool __decrementable(const void*) const;
virtual bool __addable(const void*, ptrdiff_t) const;
virtual bool __subscriptable(const void*, ptrdiff_t) const;
};
template <class _Cont>
bool
_C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__dereferenceable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__decrementable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__addable(__j, __n);
}
template <class _Cont>
bool
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__subscriptable(__j, __n);
}
class _LIBCPP_TYPE_VIS __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_FUNC_VIS __libcpp_db* __get_db();
};
_LIBCPP_FUNC_VIS __libcpp_db* __get_db();
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD
#endif
#endif // _LIBCPP_DEBUG_H

File diff suppressed because it is too large Load Diff

View File

@@ -16,38 +16,47 @@
#include <typeinfo>
#include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct _LIBCPP_VISIBLE unary_function
struct _LIBCPP_TYPE_VIS unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_VISIBLE binary_function
struct _LIBCPP_TYPE_VIS binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp> struct _LIBCPP_TYPE_VIS hash;
template <class _Tp>
struct __has_result_type
{
private:
struct __two {char _; char __;};
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
@@ -60,11 +69,11 @@ template <class _Tp>
struct __derives_from_unary_function
{
private:
struct __two {char _; char __;};
struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _A, class _R>
static unary_function<_A, _R>
__test(const volatile unary_function<_A, _R>*);
template <class _Ap, class _Rp>
static unary_function<_Ap, _Rp>
__test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -74,11 +83,11 @@ template <class _Tp>
struct __derives_from_binary_function
{
private:
struct __two {char _; char __;};
struct __two {char __lx; char __lxx;};
static __two __test(...);
template <class _A1, class _A2, class _R>
static binary_function<_A1, _A2, _R>
__test(const volatile binary_function<_A1, _A2, _R>*);
template <class _A1, class _A2, class _Rp>
static binary_function<_A1, _A2, _Rp>
__test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -129,217 +138,217 @@ struct __weak_result_type
// 0 argument case
template <class _R>
struct __weak_result_type<_R ()>
template <class _Rp>
struct __weak_result_type<_Rp ()>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R>
struct __weak_result_type<_R (&)()>
template <class _Rp>
struct __weak_result_type<_Rp (&)()>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R>
struct __weak_result_type<_R (*)()>
template <class _Rp>
struct __weak_result_type<_Rp (*)()>
{
typedef _R result_type;
typedef _Rp result_type;
};
// 1 argument case
template <class _R, class _A1>
struct __weak_result_type<_R (_A1)>
: public unary_function<_A1, _R>
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _R, class _A1>
struct __weak_result_type<_R (&)(_A1)>
: public unary_function<_A1, _R>
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (&)(_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _R, class _A1>
struct __weak_result_type<_R (*)(_A1)>
: public unary_function<_A1, _R>
template <class _Rp, class _A1>
struct __weak_result_type<_Rp (*)(_A1)>
: public unary_function<_A1, _Rp>
{
};
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)()>
: public unary_function<_C*, _R>
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)()>
: public unary_function<_Cp*, _Rp>
{
};
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() const>
: public unary_function<const _C*, _R>
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const>
: public unary_function<const _Cp*, _Rp>
{
};
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() volatile>
: public unary_function<volatile _C*, _R>
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() volatile>
: public unary_function<volatile _Cp*, _Rp>
{
};
template <class _R, class _C>
struct __weak_result_type<_R (_C::*)() const volatile>
: public unary_function<const volatile _C*, _R>
template <class _Rp, class _Cp>
struct __weak_result_type<_Rp (_Cp::*)() const volatile>
: public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (_A1, _A2)>
: public binary_function<_A1, _A2, _R>
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _R>
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _R, class _A1, class _A2>
struct __weak_result_type<_R (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _R>
template <class _Rp, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1)>
: public binary_function<_C*, _A1, _R>
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)>
: public binary_function<_Cp*, _A1, _Rp>
{
};
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const>
: public binary_function<const _C*, _A1, _R>
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
: public binary_function<const _Cp*, _A1, _Rp>
{
};
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) volatile>
: public binary_function<volatile _C*, _A1, _R>
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
: public binary_function<volatile _Cp*, _A1, _Rp>
{
};
template <class _R, class _C, class _A1>
struct __weak_result_type<_R (_C::*)(_A1) const volatile>
: public binary_function<const volatile _C*, _A1, _R>
template <class _Rp, class _Cp, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
: public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
{
typedef _R result_type;
typedef _Rp result_type;
};
template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{
typedef _R result_type;
typedef _Rp result_type;
};
// __invoke
// bullets 1 and 2
template <class _F, class _A0, class ..._Args>
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...))
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_STD::forward<_A0>(__a0).*__f)(_STD::forward<_Args>(__args)...);
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _F, class _A0, class ..._Args>
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...))
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{
return ((*_STD::forward<_A0>(__a0)).*__f)(_STD::forward<_Args>(__args)...);
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
}
// bullets 3 and 4
template <class _F, class _A0>
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype(_STD::forward<_A0>(__a0).*__f)
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
{
return _STD::forward<_A0>(__a0).*__f;
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _F, class _A0>
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _A0&& __a0)
-> decltype((*_STD::forward<_A0>(__a0)).*__f)
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
return (*_STD::forward<_A0>(__a0)).*__f;
return (*_VSTD::forward<_A0>(__a0)).*__f;
}
// bullet 5
template <class _F, class ..._Args>
template <class _Fp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_F&& __f, _Args&& ...__args)
-> decltype(_STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...))
__invoke(_Fp&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
{
return _STD::forward<_F>(__f)(_STD::forward<_Args>(__args)...);
return _VSTD::forward<_Fp>(__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 _LIBCPP_VISIBLE reference_wrapper
class _LIBCPP_TYPE_VIS reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -365,7 +374,7 @@ public:
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
};
@@ -409,13 +418,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t) = delete;
template <class _Tp> void cref(const _Tp&& __t) = delete;
template <class _Tp> void ref(const _Tp&&) = delete;
template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&& __t);// = delete;
template <class _Tp> void ref(const _Tp&&);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

View File

@@ -18,12 +18,16 @@
#include <algorithm>
#include <cmath>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_VISIBLE
size_t __next_prime(size_t);
_LIBCPP_FUNC_VIS
size_t __next_prime(size_t __n);
template <class _NodePtr>
struct __hash_node_base
@@ -54,14 +58,36 @@ struct __hash_node
value_type __value_;
};
template <class, class, class, class> class __hash_table;
template <class> class __hash_const_iterator;
template <class> class __hash_map_iterator;
template <class> class __hash_map_const_iterator;
template <class, class, class, class, class> class _LIBCPP_VISIBLE unordered_map;
inline _LIBCPP_INLINE_VISIBILITY
bool
__is_power2(size_t __bc)
{
return __bc > 2 && !(__bc & (__bc - 1));
}
inline _LIBCPP_INLINE_VISIBILITY
size_t
__constrain_hash(size_t __h, size_t __bc)
{
return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
}
inline _LIBCPP_INLINE_VISIBILITY
size_t
__next_pow2(size_t __n)
{
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class _HashIterator> class _LIBCPP_TYPE_VIS __hash_map_iterator;
template <class _HashIterator> class _LIBCPP_TYPE_VIS __hash_map_const_iterator;
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
class _LIBCPP_TYPE_VIS unordered_map;
template <class _NodePtr>
class _LIBCPP_VISIBLE __hash_iterator
class _LIBCPP_TYPE_VIS __hash_iterator
{
typedef _NodePtr __node_pointer;
@@ -85,7 +111,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
pointer operator->() const {return _VSTD::addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
@@ -116,14 +142,14 @@ private:
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_multimap;
};
template <class _ConstNodePtr>
class _LIBCPP_VISIBLE __hash_const_iterator
class _LIBCPP_TYPE_VIS __hash_const_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -163,7 +189,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
pointer operator->() const {return _VSTD::addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
@@ -194,15 +220,15 @@ private:
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_multimap;
};
template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS __hash_const_local_iterator;
template <class _NodePtr>
class _LIBCPP_VISIBLE __hash_local_iterator
class _LIBCPP_TYPE_VIS __hash_local_iterator
{
typedef _NodePtr __node_pointer;
@@ -235,7 +261,7 @@ public:
__hash_local_iterator& operator++()
{
__node_ = __node_->__next_;
if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -268,12 +294,12 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_iterator;
};
template <class _ConstNodePtr>
class _LIBCPP_VISIBLE __hash_const_local_iterator
class _LIBCPP_TYPE_VIS __hash_const_local_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -325,7 +351,7 @@ public:
__hash_const_local_iterator& operator++()
{
__node_ = __node_->__next_;
if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -358,7 +384,7 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator;
};
template <class _Alloc>
@@ -387,7 +413,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __data_(_STD::move(__x.__data_))
: __data_(_VSTD::move(__x.__data_))
{
__x.size() = 0;
}
@@ -411,7 +437,7 @@ public:
}
};
template <class> class __hash_map_node_destructor;
template <class _Alloc> class __hash_map_node_destructor;
template <class _Alloc>
class __hash_node_destructor
@@ -431,16 +457,17 @@ public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na) _NOEXCEPT
explicit __hash_node_destructor(allocator_type& __na,
bool __constructed = false) _NOEXCEPT
: __na_(__na),
__value_constructed(false)
__value_constructed(__constructed)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) _NOEXCEPT
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -469,7 +496,6 @@ public:
public:
// Create __node
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef typename __node::__first_node __first_node;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -480,6 +506,7 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef __hash_node_base<__node_pointer> __first_node;
private:
@@ -598,15 +625,15 @@ public:
pair<iterator, bool> __insert_unique(const value_type& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P>
pair<iterator, bool> __insert_unique(_P&& __x);
template <class _Pp>
pair<iterator, bool> __insert_unique(_Pp&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P>
iterator __insert_multi(_P&& __x);
template <class _P>
iterator __insert_multi(const_iterator __p, _P&& __x);
template <class _Pp>
iterator __insert_multi(_Pp&& __x);
template <class _Pp>
iterator __insert_multi(const_iterator __p, _Pp&& __x);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator __insert_multi(const value_type& __x);
iterator __insert_multi(const_iterator __p, const value_type& __x);
@@ -631,15 +658,15 @@ public:
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
{return hash_function()(__k) % bucket_count();}
{return __constrain_hash(hash_function()(__k), bucket_count());}
template <class _Key>
iterator find(const _Key& __x);
template <class _Key>
const_iterator find(const _Key& __x) const;
typedef __hash_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __hash_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
iterator erase(const_iterator __p);
iterator erase(const_iterator __first, const_iterator __last);
@@ -687,7 +714,7 @@ public:
return __bc != 0 ? (float)size() / __bc : 0.f;
}
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf) _NOEXCEPT
{max_load_factor() = _STD::max(__mlf, load_factor());}
{max_load_factor() = _VSTD::max(__mlf, load_factor());}
_LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
{return local_iterator(__bucket_list_[__n], __n, bucket_count());}
@@ -717,7 +744,7 @@ private:
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
void __copy_assign_alloc(const __hash_table&, false_type) {}
void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type)
@@ -740,43 +767,43 @@ private:
is_nothrow_move_assignable<__node_allocator>::value)
{
__bucket_list_.get_deleter().__alloc() =
_STD::move(__u.__bucket_list_.get_deleter().__alloc());
__node_alloc() = _STD::move(__u.__node_alloc());
_VSTD::move(__u.__bucket_list_.get_deleter().__alloc());
__node_alloc() = _VSTD::move(__u.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
template <class _A>
template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y)
__swap_alloc(_Ap& __x, _Ap& __y)
_NOEXCEPT_(
!allocator_traits<_A>::propagate_on_container_swap::value ||
__is_nothrow_swappable<_A>::value)
!allocator_traits<_Ap>::propagate_on_container_swap::value ||
__is_nothrow_swappable<_Ap>::value)
{
__swap_alloc(__x, __y,
integral_constant<bool,
allocator_traits<_A>::propagate_on_container_swap::value
allocator_traits<_Ap>::propagate_on_container_swap::value
>());
}
template <class _A>
template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<_A>::value)
__swap_alloc(_Ap& __x, _Ap& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<_Ap>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
template <class _A>
template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {}
__swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
void __deallocate(__node_pointer __np) _NOEXCEPT;
__node_pointer __detach() _NOEXCEPT;
@@ -858,15 +885,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
is_nothrow_move_constructible<__first_node>::value &&
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(_STD::move(__u.__bucket_list_)),
__p1_(_STD::move(__u.__p1_)),
__p2_(_STD::move(__u.__p2_)),
__p3_(_STD::move(__u.__p3_))
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
__p1_(_VSTD::move(__u.__p1_)),
__p2_(_VSTD::move(__u.__p2_)),
__p3_(_VSTD::move(__u.__p3_))
{
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -877,8 +904,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
__p1_(__node_allocator(__a)),
__p2_(0, _STD::move(__u.hash_function())),
__p3_(_STD::move(__u.__p3_))
__p2_(0, _VSTD::move(__u.hash_function())),
__p3_(_VSTD::move(__u.__p3_))
{
if (__a == allocator_type(__u.__node_alloc()))
{
@@ -889,8 +916,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
{
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
size() = __u.size();
__u.size() = 0;
}
@@ -944,7 +971,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
while (__np != nullptr)
{
__node_pointer __next = __np->__next_;
__node_traits::destroy(__na, _STD::addressof(__np->__value_));
__node_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_traits::deallocate(__na, __np, 1);
__np = __next;
}
@@ -980,14 +1007,14 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__u.__bucket_list_.get_deleter().size() = 0;
__move_assign_alloc(__u);
size() = __u.size();
hash_function() = _STD::move(__u.hash_function());
hash_function() = _VSTD::move(__u.hash_function());
max_load_factor() = __u.max_load_factor();
key_eq() = _STD::move(__u.key_eq());
key_eq() = _VSTD::move(__u.key_eq());
__p1_.first().__next_ = __u.__p1_.first().__next_;
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -1002,8 +1029,8 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__move_assign(__u, true_type());
else
{
hash_function() = _STD::move(__u.hash_function());
key_eq() = _STD::move(__u.key_eq());
hash_function() = _VSTD::move(__u.hash_function());
key_eq() = _VSTD::move(__u.key_eq());
max_load_factor() = __u.max_load_factor();
if (bucket_count() != 0)
{
@@ -1015,7 +1042,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
const_iterator __i = __u.begin();
while (__cache != nullptr && __u.size() != 0)
{
__cache->__value_ = _STD::move(__u.remove(__i++)->__value_);
__cache->__value_ = _VSTD::move(__u.remove(__i++)->__value_);
__node_pointer __next = __cache->__next_;
__node_insert_multi(__cache);
__cache = __next;
@@ -1034,7 +1061,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
while (__u.size() != 0)
{
__node_holder __h =
__construct_node(_STD::move(__u.remove(__i++)->__value_));
__construct_node(_VSTD::move(__u.remove(__i++)->__value_));
__node_insert_multi(__h.get());
__h.release();
}
@@ -1167,7 +1194,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::clear() _NOEXCEPT
__deallocate(__p1_.first().__next_);
__p1_.first().__next_ = nullptr;
size_type __bc = bucket_count();
for (size_type __i; __i < __bc; ++__i)
for (size_type __i = 0; __i < __bc; ++__i)
__bucket_list_[__i] = nullptr;
size() = 0;
}
@@ -1184,12 +1211,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
size_t __chash;
if (__bc != 0)
{
__chash = __nd->__hash_ % __bc;
__chash = __constrain_hash(__nd->__hash_, __bc);
__ndptr = __bucket_list_[__chash];
if (__ndptr != nullptr)
{
for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
__ndptr->__hash_ % __bc == __chash;
__constrain_hash(__ndptr->__hash_, __bc) == __chash;
__ndptr = __ndptr->__next_)
{
if (key_eq()(__ndptr->__value_, __nd->__value_))
@@ -1200,22 +1227,22 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
{
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
rehash(_STD::max<size_type>(2 * __bc + 1,
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
__chash = __nd->__hash_ % __bc;
__chash = __constrain_hash(__nd->__hash_, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__nd->__next_ = __pn->__next_;
__pn->__next_ = __nd;
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__nd->__next_ != nullptr)
__bucket_list_[__nd->__next_->__hash_ % __bc] = __nd;
__bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd;
}
else
{
@@ -1239,26 +1266,26 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
rehash(_STD::max<size_type>(2 * __bc + 1,
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
size_t __chash = __cp->__hash_ % __bc;
size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__cp->__next_ = __pn->__next_;
__pn->__next_ = __cp;
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__cp->__next_ != nullptr)
__bucket_list_[__cp->__next_->__hash_ % __bc] = __cp;
__bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp;
}
else
{
for (bool __found = false; __pn->__next_ != nullptr &&
__pn->__next_->__hash_ % __bc == __chash;
__constrain_hash(__pn->__next_->__hash_, __bc) == __chash;
__pn = __pn->__next_)
{
// __found key_eq() action
@@ -1279,7 +1306,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__pn->__next_ = __cp;
if (__cp->__next_ != nullptr)
{
size_t __nhash = __cp->__next_->__hash_ % __bc;
size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __cp;
}
@@ -1300,11 +1327,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
rehash(_STD::max<size_type>(2 * __bc + 1,
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
size_t __chash = __cp->__hash_ % __bc;
size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pp = __bucket_list_[__chash];
while (__pp->__next_ != __np)
__pp = __pp->__next_;
@@ -1327,12 +1354,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
size_t __chash;
if (__bc != 0)
{
__chash = __hash % __bc;
__chash = __constrain_hash(__hash, __bc);
__nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
__nd->__hash_ % __bc == __chash;
__constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __x))
@@ -1344,22 +1371,22 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_holder __h = __construct_node(__x, __hash);
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
rehash(_STD::max<size_type>(2 * __bc + 1,
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
__chash = __hash % __bc;
__chash = __constrain_hash(__hash, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__h->__next_ = __pn->__next_;
__pn->__next_ = __h.get();
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__h->__next_ != nullptr)
__bucket_list_[__h->__next_->__hash_ % __bc] = __h.get();
__bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get();
}
else
{
@@ -1383,7 +1410,7 @@ template <class... _Args>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique(_Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1395,7 +1422,7 @@ template <class... _Args>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_multi(_Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __node_insert_multi(__h.get());
__h.release();
return __r;
@@ -1407,7 +1434,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
const_iterator __p, _Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
return __r;
@@ -1416,11 +1443,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _P>
template <class _Pp>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
{
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1432,23 +1459,23 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _P>
template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x)
{
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _P>
template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
_P&& __x)
_Pp&& __x)
{
__node_holder __h = __construct_node(_STD::forward<_P>(__x));
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
return __r;
@@ -1483,16 +1510,20 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
{
__n = __next_prime(_STD::max<size_type>(__n, size() > 0));
if (__n == 1)
__n = 2;
else if (__n & (__n - 1))
__n = __next_prime(__n);
size_type __bc = bucket_count();
if (__n > __bc)
__rehash(__n);
else
else if (__n < __bc)
{
__n = _STD::max<size_type>
__n = _VSTD::max<size_type>
(
__n,
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
__is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
__next_prime(size_t(ceil(float(size()) / max_load_factor())))
);
if (__n < __bc)
__rehash(__n);
@@ -1511,17 +1542,17 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
{
for (size_type __i = 0; __i < __nbc; ++__i)
__bucket_list_[__i] = nullptr;
__node_pointer __pp(static_cast<__node_pointer>(_STD::addressof(__p1_.first())));
__node_pointer __pp(static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())));
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
size_type __chash = __cp->__hash_ % __nbc;
size_type __chash = __constrain_hash(__cp->__hash_, __nbc);
__bucket_list_[__chash] = __pp;
size_type __phash = __chash;
for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
__cp = __pp->__next_)
{
__chash = __cp->__hash_ % __nbc;
__chash = __constrain_hash(__cp->__hash_, __nbc);
if (__chash == __phash)
__pp = __cp;
else
@@ -1559,12 +1590,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
size_type __bc = bucket_count();
if (__bc != 0)
{
size_t __chash = __hash % __bc;
size_t __chash = __constrain_hash(__hash, __bc);
__node_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
__nd->__hash_ % __bc == __chash;
__constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
@@ -1584,12 +1615,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
size_type __bc = bucket_count();
if (__bc != 0)
{
size_t __chash = __hash % __bc;
size_t __chash = __constrain_hash(__hash, __bc);
__node_const_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
__nd->__hash_ % __bc == __chash;
__constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
@@ -1610,8 +1641,8 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
@@ -1626,12 +1657,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
size_t __hash)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::move(__v));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
return _STD::move(__h);
return _VSTD::move(__h);
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1641,12 +1672,12 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
return _STD::move(__h);
return _VSTD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1657,12 +1688,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
size_t __hash)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
return _STD::move(__h);
return _VSTD::move(__h);
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -1728,7 +1759,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// current node
__node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
size_type __bc = bucket_count();
size_t __chash = __cn->__hash_ % __bc;
size_t __chash = __constrain_hash(__cn->__hash_, __bc);
// find previous node
__node_pointer __pn = __bucket_list_[__chash];
for (; __pn->__next_ != __cn; __pn = __pn->__next_)
@@ -1736,15 +1767,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// Fix up __bucket_list_
// if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
if (__pn == _STD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
if (__pn == _VSTD::addressof(__p1_.first()) || __constrain_hash(__pn->__hash_, __bc) != __chash)
{
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash)
__bucket_list_[__chash] = nullptr;
}
// if __cn->__next_ is not in same bucket (nullptr is in same bucket)
if (__cn->__next_ != nullptr)
{
size_t __nhash = __cn->__next_->__hash_ % __bc;
size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __pn;
}
@@ -1752,7 +1783,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
return __node_holder(__cn, _D(__node_alloc()));
return __node_holder(__cn, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -1867,19 +1898,19 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__bucket_list_.reset(__u.__bucket_list_.release());
__u.__bucket_list_.reset(__npp);
}
_STD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
__swap_alloc(__bucket_list_.get_deleter().__alloc(),
__u.__bucket_list_.get_deleter().__alloc());
__swap_alloc(__node_alloc(), __u.__node_alloc());
_STD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
__p2_.swap(__u.__p2_);
__p3_.swap(__u.__p3_);
if (size() > 0)
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
if (__u.size() > 0)
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
static_cast<__node_pointer>(_STD::addressof(__u.__p1_.first()));
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -1892,7 +1923,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
if (__np != nullptr)
{
for (__np = __np->__next_; __np != nullptr &&
__np->__hash_ % __bc == __n;
__constrain_hash(__np->__hash_, __bc) == __n;
__np = __np->__next_, ++__r)
;
}

View File

@@ -19,23 +19,36 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#include <xlocale.h>
#ifdef _WIN32
# include <support/win32/locale_win32.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || EMSCRIPTEN
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class locale;
class _LIBCPP_TYPE_VIS locale;
template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
template <class _Facet> const _Facet& use_facet(const locale&);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY
bool
has_facet(const locale&) _NOEXCEPT;
class _LIBCPP_VISIBLE locale
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY
const _Facet&
use_facet(const locale&);
class _LIBCPP_TYPE_VIS locale
{
public:
// types:
class facet;
class id;
class _LIBCPP_TYPE_VIS facet;
class _LIBCPP_TYPE_VIS id;
typedef int category;
static const category // values assigned here are for exposition only
@@ -90,7 +103,7 @@ private:
template <class _Facet> friend const _Facet& use_facet(const locale&);
};
class _LIBCPP_VISIBLE locale::facet
class _LIBCPP_TYPE_VIS locale::facet
: public __shared_count
{
protected:
@@ -106,14 +119,14 @@ private:
virtual void __on_zero_shared() _NOEXCEPT;
};
class _LIBCPP_VISIBLE locale::id
class _LIBCPP_TYPE_VIS locale::id
{
once_flag __flag_;
int32_t __id_;
static int32_t __next_id;
public:
_LIBCPP_INLINE_VISIBILITY id() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
private:
void __init();
void operator=(const id&); // = delete;
@@ -137,10 +150,10 @@ locale
locale::combine(const locale& __other) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!_STD::has_facet<_Facet>(__other))
if (!_VSTD::has_facet<_Facet>(__other))
throw runtime_error("locale::combine: locale missing facet");
#endif // _LIBCPP_NO_EXCEPTIONS
return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other)));
}
template <class _Facet>
@@ -162,7 +175,7 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class _LIBCPP_VISIBLE collate
class _LIBCPP_TYPE_VIS collate
: public locale::facet
{
public:
@@ -227,29 +240,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) + static_cast<size_t>(*__p);
size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr);
}
return static_cast<long>(h);
return static_cast<long>(__h);
}
extern template class _LIBCPP_VISIBLE collate<char>;
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<wchar_t>)
// template <class CharT> class collate_byname;
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS collate_byname;
template <>
class _LIBCPP_VISIBLE collate_byname<char>
class _LIBCPP_TYPE_VIS collate_byname<char>
: public collate<char>
{
locale_t __l;
@@ -268,7 +281,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE collate_byname<wchar_t>
class _LIBCPP_TYPE_VIS collate_byname<wchar_t>
: public collate<wchar_t>
{
locale_t __l;
@@ -292,30 +305,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 _LIBCPP_VISIBLE ctype_base
class _LIBCPP_TYPE_VIS 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__
#ifdef __GLIBC__
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
@@ -326,17 +327,71 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#endif // __APPLE__
#elif defined(_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 (defined(__APPLE__) || defined(__FreeBSD__)) || defined(EMSCRIPTEN)
#ifdef __APPLE__
typedef __uint32_t mask;
#elif defined(__FreeBSD__)
typedef unsigned long mask;
#elif defined(EMSCRIPTEN)
typedef unsigned short mask;
#endif
static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C;
static const mask upper = _CTYPE_U;
static const mask lower = _CTYPE_L;
static const mask alpha = _CTYPE_A;
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#elif defined(__sun__)
typedef unsigned int mask;
static const mask space = _ISSPACE;
static const mask print = _ISPRINT;
static const mask cntrl = _ISCNTRL;
static const mask upper = _ISUPPER;
static const mask lower = _ISLOWER;
static const mask alpha = _ISALPHA;
static const mask digit = _ISDIGIT;
static const mask punct = _ISPUNCT;
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || EMSCRIPTEN || __sun__
typedef unsigned long mask;
static const mask space = 1<<0;
static const mask print = 1<<1;
static const mask cntrl = 1<<2;
static const mask upper = 1<<3;
static const mask lower = 1<<4;
static const mask alpha = 1<<5;
static const mask digit = 1<<6;
static const mask punct = 1<<7;
static const mask xdigit = 1<<8;
static const mask blank = 1<<9;
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
static const mask alnum = alpha | digit;
static const mask graph = alnum | punct;
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <class _CharT> class _LIBCPP_TYPE_VIS ctype;
template <>
class _LIBCPP_VISIBLE ctype<wchar_t>
class _LIBCPP_TYPE_VIS ctype<wchar_t>
: public locale::facet,
public ctype_base
{
@@ -438,7 +493,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE ctype<char>
class _LIBCPP_TYPE_VIS ctype<char>
: public locale::facet, public ctype_base
{
const mask* __tab_;
@@ -451,14 +506,14 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? __tab_[__c] & __m : false;
return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false;
}
_LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{
for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[*__low] : 0;
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
return __low;
}
@@ -466,7 +521,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[*__low] & __m))
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
break;
return __low;
}
@@ -475,7 +530,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[*__low] & __m)))
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
break;
return __low;
}
@@ -537,6 +592,10 @@ public:
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(EMSCRIPTEN)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
protected:
~ctype();
@@ -552,10 +611,10 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS ctype_byname;
template <>
class _LIBCPP_VISIBLE ctype_byname<char>
class _LIBCPP_TYPE_VIS ctype_byname<char>
: public ctype<char>
{
locale_t __l;
@@ -573,7 +632,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t>
: public ctype<wchar_t>
{
locale_t __l;
@@ -704,7 +763,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base
class _LIBCPP_VISIBLE codecvt_base
class _LIBCPP_TYPE_VIS codecvt_base
{
public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -713,12 +772,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -804,7 +863,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -887,7 +946,7 @@ protected:
// template <> class codecvt<char16_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -973,7 +1032,7 @@ protected:
// template <> class codecvt<char32_t, char, mbstate_t>
template <>
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1059,7 +1118,7 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class _LIBCPP_VISIBLE codecvt_byname
class _LIBCPP_TYPE_VIS codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
@@ -1078,14 +1137,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{
}
extern template class codecvt_byname<char, char, mbstate_t>;
extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class codecvt_byname<char16_t, char, mbstate_t>;
extern template class codecvt_byname<char32_t, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>)
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
template <size_t _N>
template <size_t _Np>
struct __narrow_to_utf8
{
template <class _OutputIterator, class _CharT>
@@ -1175,7 +1234,7 @@ struct __narrow_to_utf8<32>
}
};
template <size_t _N>
template <size_t _Np>
struct __widen_from_utf8
{
template <class _OutputIterator>
@@ -1267,10 +1326,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <class _CharT> class _LIBCPP_TYPE_VIS numpunct;
template <>
class _LIBCPP_VISIBLE numpunct<char>
class _LIBCPP_TYPE_VIS numpunct<char>
: public locale::facet
{
public:
@@ -1301,7 +1360,7 @@ protected:
};
template <>
class _LIBCPP_VISIBLE numpunct<wchar_t>
class _LIBCPP_TYPE_VIS numpunct<wchar_t>
: public locale::facet
{
public:
@@ -1333,10 +1392,10 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <class charT> class _LIBCPP_TYPE_VIS numpunct_byname;
template <>
class _LIBCPP_VISIBLE numpunct_byname<char>
class _LIBCPP_TYPE_VIS numpunct_byname<char>
: public numpunct<char>
{
public:
@@ -1354,7 +1413,7 @@ private:
};
template <>
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t>
: public numpunct<wchar_t>
{
public:

View File

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

View File

@@ -6,7 +6,11 @@
#include <type_traits>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -91,7 +95,7 @@ public:
void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
void push_back(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
@@ -129,8 +133,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
{__destruct_at_end(__new_last, false_type());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x)
@@ -141,14 +147,14 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, true_type)
void __move_assign_alloc(__split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _STD::move(__c.__alloc());
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, false_type) _NOEXCEPT
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -162,12 +168,12 @@ private:
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
{}
};
@@ -208,7 +214,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
__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);
@@ -227,7 +233,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
__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);
@@ -249,14 +255,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_;
}
}
@@ -273,7 +279,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_;
}
}
@@ -283,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
while (__begin_ < __new_begin)
while (__begin_ != __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++);
}
@@ -300,7 +306,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last < __end_)
while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), --__end_);
}
@@ -356,10 +362,10 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __first_(_STD::move(__c.__first_)),
__begin_(_STD::move(__c.__begin_)),
__end_(_STD::move(__c.__end_)),
__end_cap_(_STD::move(__c.__end_cap_))
: __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;
@@ -388,8 +394,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _I;
__construct_at_end(_I(__c.begin()), _I(__c.end()));
typedef move_iterator<iterator> _Ip;
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
}
}
@@ -421,10 +427,10 @@ __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());
}
@@ -437,10 +443,10 @@ __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());
}
}
@@ -458,10 +464,10 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
__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 (...)
@@ -481,22 +487,22 @@ __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
{
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_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_;
}
@@ -512,23 +518,23 @@ __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
{
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_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_;
}
@@ -545,22 +551,22 @@ __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
{
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_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_;
}
@@ -576,23 +582,23 @@ __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
{
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_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_;
}
@@ -609,23 +615,23 @@ __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
{
size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
_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_;
}

View File

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

View File

@@ -17,11 +17,15 @@
#include <__locale>
#include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
static const unsigned __limit = 8;
static const int __limit = 8;
// __stdinbuf
@@ -37,7 +41,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type;
explicit __stdinbuf(FILE* __fp);
__stdinbuf(FILE* __fp, state_type* __st);
protected:
virtual int_type underflow();
@@ -49,7 +53,7 @@ private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type __st_;
state_type* __st_;
int __encoding_;
bool __always_noconv_;
@@ -60,9 +64,9 @@ private:
};
template <class _CharT>
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
: __file_(__fp),
__st_()
__st_(__st)
{
imbue(this->getloc());
}
@@ -97,10 +101,10 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
char __extbuf[__limit];
int __nread = _STD::max(1, __encoding_);
int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
char __c = getc(__file_);
int __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c);
@@ -115,19 +119,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
codecvt_base::result __r;
do
{
state_type __sv_st = __st_;
__r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
state_type __sv_st = *__st_;
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt,
&__1buf, &__1buf + 1, __inxt);
switch (__r)
{
case _STD::codecvt_base::ok:
case _VSTD::codecvt_base::ok:
break;
case codecvt_base::partial:
__st_ = __sv_st;
*__st_ = __sv_st;
if (__nread == sizeof(__extbuf))
return traits_type::eof();
{
char __c = getc(__file_);
int __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c);
@@ -136,17 +140,17 @@ __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)
{
for (int __i = __nread; __i > 0;)
{
if (ungetc(__extbuf[--__i], __file_) == EOF)
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF)
return traits_type::eof();
}
}
@@ -163,12 +167,12 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
char* __enxt;
const char_type __ci = traits_type::to_char_type(__c);
const char_type* __inxt;
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
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;
@@ -196,7 +200,7 @@ public:
typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type;
explicit __stdoutbuf(FILE* __fp);
__stdoutbuf(FILE* __fp, state_type* __st);
protected:
virtual int_type overflow (int_type __c = traits_type::eof());
@@ -206,7 +210,7 @@ protected:
private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type __st_;
state_type* __st_;
bool __always_noconv_;
__stdoutbuf(const __stdoutbuf&);
@@ -214,10 +218,10 @@ private:
};
template <class _CharT>
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st)
: __file_(__fp),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(),
__st_(__st),
__always_noconv_(__cv_->always_noconv())
{
}
@@ -245,7 +249,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
do
{
const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__r = __cv_->out(*__st_, this->pbase(), this->pptr(), __e,
__extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
@@ -264,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial)
{
this->setp((char_type*)__e, this->pptr());
this->pbump(this->epptr() - this->pbase());
this->pbump(static_cast<int>(this->epptr() - this->pbase()));
}
}
else
@@ -285,7 +289,7 @@ __stdoutbuf<_CharT>::sync()
do
{
char* __extbe;
__r = __cv_->unshift(__st_, __extbuf,
__r = __cv_->unshift(*__st_, __extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);

View File

@@ -17,17 +17,25 @@
#include <stdexcept>
#include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class, class, class> class __tree;
template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator;
template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator;
template <class, class, class, class> class _LIBCPP_VISIBLE map;
template <class, class, class, class> class _LIBCPP_VISIBLE multimap;
template <class, class, class> class _LIBCPP_VISIBLE set;
template <class, class, class> class _LIBCPP_VISIBLE multiset;
template <class _Tp, class _Compare, class _Allocator> class __tree;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_const_iterator;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS multimap;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS set;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS multiset;
/*
@@ -494,7 +502,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
}
}
template <class> class __map_node_destructor;
template <class _Allocator> class __map_node_destructor;
template <class _Allocator>
class __tree_node_destructor
@@ -523,7 +531,7 @@ public:
void operator()(pointer __p) _NOEXCEPT
{
if (__value_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -598,7 +606,7 @@ public:
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node(_Args&& ...__args)
: __value_(_STD::forward<_Args>(__args)...) {}
: __value_(_VSTD::forward<_Args>(__args)...) {}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node(const value_type& __v)
@@ -606,11 +614,11 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
};
template <class> class __map_iterator;
template <class> class __map_const_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_iterator
class _LIBCPP_TYPE_VIS __tree_iterator
{
typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -665,16 +673,16 @@ private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class, class, class> friend class _LIBCPP_TYPE_VIS __tree_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __map_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset;
};
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_const_iterator
class _LIBCPP_TYPE_VIS __tree_const_iterator
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -751,11 +759,11 @@ private:
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
: __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset;
template <class> friend class _LIBCPP_TYPE_VIS __map_const_iterator;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -924,14 +932,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _V>
pair<iterator, bool> __insert_unique(_V&& __v);
template <class _V>
iterator __insert_unique(const_iterator __p, _V&& __v);
template <class _V>
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
template <class _Vp>
pair<iterator, bool> __insert_unique(_Vp&& __v);
template <class _Vp>
iterator __insert_unique(const_iterator __p, _Vp&& __v);
template <class _Vp>
iterator __insert_multi(_Vp&& __v);
template <class _Vp>
iterator __insert_multi(const_iterator __p, _Vp&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -1013,8 +1021,8 @@ public:
pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const;
typedef __tree_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __tree_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
__node_holder remove(const_iterator __p) _NOEXCEPT;
private:
@@ -1069,7 +1077,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
{__node_alloc() = _STD::move(__t.__node_alloc());}
{__node_alloc() = _VSTD::move(__t.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {}
@@ -1084,7 +1092,7 @@ private:
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
@@ -1278,9 +1286,9 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
_NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<value_compare>::value)
: __begin_node_(_STD::move(__t.__begin_node_)),
__pair1_(_STD::move(__t.__pair1_)),
__pair3_(_STD::move(__t.__pair3_))
: __begin_node_(_VSTD::move(__t.__begin_node_)),
__pair1_(_VSTD::move(__t.__pair1_)),
__pair3_(_VSTD::move(__t.__pair3_))
{
if (size() == 0)
__begin_node() = __end_node();
@@ -1296,7 +1304,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
: __pair1_(__node_allocator(__a)),
__pair3_(0, _STD::move(__t.value_comp()))
__pair3_(0, _VSTD::move(__t.value_comp()))
{
if (__a == __t.__alloc())
{
@@ -1329,7 +1337,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
__begin_node_ = __t.__begin_node_;
__pair1_.first() = __t.__pair1_.first();
__move_assign_alloc(__t);
__pair3_ = _STD::move(__t.__pair3_);
__pair3_ = _VSTD::move(__t.__pair3_);
if (size() == 0)
__begin_node() = __end_node();
else
@@ -1349,7 +1357,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
__move_assign(__t, true_type());
else
{
value_comp() = _STD::move(__t.value_comp());
value_comp() = _VSTD::move(__t.value_comp());
const_iterator __e = end();
if (size() != 0)
{
@@ -1360,7 +1368,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
#endif // _LIBCPP_NO_EXCEPTIONS
while (__cache != nullptr && __t.size() != 0)
{
__cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_);
__cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_);
__node_pointer __next = __detach(__cache);
__node_insert_multi(__cache);
__cache = __next;
@@ -1383,7 +1391,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
}
}
while (__t.size() != 0)
__insert_multi(__e, _STD::move(__t.remove(__t.begin())->__value_));
__insert_multi(__e, _VSTD::move(__t.remove(__t.begin())->__value_));
}
}
@@ -1418,7 +1426,7 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, _STD::addressof(__nd->__value_));
__node_traits::destroy(__na, _VSTD::addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1);
}
}
@@ -1431,7 +1439,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value))
{
using _STD::swap;
using _VSTD::swap;
swap(__begin_node_, __t.__begin_node_);
swap(__pair1_.first(), __t.__pair1_.first());
__swap_alloc(__node_alloc(), __t.__node_alloc());
@@ -1655,10 +1663,10 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
else if (value_comp()(*__hint, __v)) // check after
{
// *__hint < __v
const_iterator __next = _STD::next(__hint);
const_iterator __next = _VSTD::next(__hint);
if (__next == end() || value_comp()(__v, *__next))
{
// *__hint < __v < *_STD::next(__hint)
// *__hint < __v < *_VSTD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1703,8 +1711,8 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
}
@@ -1714,7 +1722,7 @@ template <class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1733,7 +1741,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1750,7 +1758,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1763,7 +1771,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
_Args&&... __args)
{
__node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1773,11 +1781,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator>
template <class _V>
template <class _Vp>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1785,11 +1793,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
template <class _V>
template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
@@ -1797,11 +1805,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
template <class _V>
template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1809,11 +1817,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
template <class _V>
template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1827,10 +1835,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _STD::move(__h);
return _VSTD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1956,7 +1964,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_;
--size();
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p)));
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p)));
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1);
@@ -2045,7 +2053,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _P;
typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2058,7 +2066,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
return _STD::distance(
return _VSTD::distance(
__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)
);
@@ -2152,7 +2160,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
{
typedef pair<iterator, iterator> _P;
typedef pair<iterator, iterator> _Pp;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2165,13 +2173,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
return _P(iterator(__rt),
return _Pp(iterator(__rt),
iterator(
__rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result));
}
return _P(iterator(__result), iterator(__result));
return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2180,7 +2188,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _P;
typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2193,13 +2201,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
return _P(const_iterator(__rt),
return _Pp(const_iterator(__rt),
const_iterator(
__rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result));
}
return _P(const_iterator(__result), const_iterator(__result));
return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2208,7 +2216,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
{
typedef pair<iterator, iterator> _P;
typedef pair<iterator, iterator> _Pp;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2221,10 +2229,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
return _P(iterator(__result), iterator(__result));
return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2233,7 +2241,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
{
typedef pair<const_iterator, const_iterator> _P;
typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2246,10 +2254,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
}
return _P(const_iterator(__result), const_iterator(__result));
return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2267,7 +2275,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
--size();
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
return __node_holder(__np, _D(__node_alloc()));
return __node_holder(__np, _Dp(__node_alloc()));
}
template <class _Tp, class _Compare, class _Allocator>

View File

@@ -15,7 +15,9 @@
#include <cstddef>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS
@@ -25,46 +27,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size;
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const _Tp>
class _LIBCPP_TYPE_VIS tuple_size<const _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
class _LIBCPP_TYPE_VIS tuple_size<volatile _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
class _LIBCPP_TYPE_VIS 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_TYPE_VIS tuple_element;
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
class _LIBCPP_TYPE_VIS 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>
class _LIBCPP_TYPE_VIS 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>
class _LIBCPP_TYPE_VIS 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> class _LIBCPP_TYPE_VIS tuple;
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS pair;
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS array;
template <class _Tp> struct __tuple_like : false_type {};
@@ -77,38 +79,47 @@ template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp&
get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
@@ -143,7 +154,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<> >
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -151,21 +162,21 @@ public:
};
template <class _Hp, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
class _LIBCPP_TYPE_VIS tuple_element<0, __tuple_types<_Hp, _Tp...> >
{
public:
typedef _Hp type;
};
template <size_t _Ip, class _Hp, class ..._Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
{
public:
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
};
template <class ..._Tp>
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
class _LIBCPP_TYPE_VIS tuple_size<__tuple_types<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -214,11 +225,7 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
@@ -237,6 +244,33 @@ struct __tuple_convertible<_Tp, _Up, true, true>
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
// __tuple_constructible
template <bool, class _Tp, class _Up>
struct __tuple_constructible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_constructible<_Up0, _Tp0>::value &&
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_constructible
: public false_type {};
template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
// __tuple_assignable
template <bool, class _Tp, class _Up>

View File

@@ -13,12 +13,14 @@
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS tuple_element;
_LIBCPP_END_NAMESPACE_STD

19
include/__undef_min_max Normal file
View File

@@ -0,0 +1,19 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifdef min
#warning: macro min is incompatible with C++. #undefing min
#undef min
#endif
#ifdef max
#warning: macro max is incompatible with C++. #undefing max
#undef max
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,7 @@ struct array
// capacity:
constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept;
bool empty() const noexcept;
constexpr bool empty() const noexcept;
// element access:
reference operator[](size_type n);
@@ -111,12 +111,14 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_VISIBLE array
struct _LIBCPP_TYPE_VIS array
{
// types:
typedef array __self;
@@ -136,10 +138,10 @@ struct _LIBCPP_VISIBLE array
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_STD::fill_n(__elems_, _Size, __u);}
{_VSTD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators:
_LIBCPP_INLINE_VISIBILITY
@@ -171,11 +173,11 @@ struct _LIBCPP_VISIBLE array
// capacity:
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
/*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return _Size == 0;}
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
@@ -225,7 +227,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
}
template <class _Tp, size_t _Size>
@@ -241,7 +243,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
}
template <class _Tp, size_t _Size>
@@ -282,22 +284,22 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
@@ -308,6 +310,7 @@ _LIBCPP_INLINE_VISIBILITY inline
_Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
return __a[_Ip];
}
@@ -316,6 +319,7 @@ _LIBCPP_INLINE_VISIBILITY inline
const _Tp&
get(const array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
return __a[_Ip];
}
@@ -326,7 +330,8 @@ _LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT
{
return _STD::move(__a[_Ip]);
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
return _VSTD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

File diff suppressed because it is too large Load Diff

View File

@@ -113,7 +113,9 @@ template <size_t N> struct hash<std::bitset<N>>;
*/
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include <__config>
#include <__bit_reference>
@@ -127,17 +129,28 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <cassert>
#endif
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
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
{
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef size_type __storage_type;
protected:
typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -146,7 +159,7 @@ protected:
friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>;
friend struct __bit_array<__bitset>;
__storage_type __first_[_N_words];
@@ -155,12 +168,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -181,8 +194,10 @@ protected:
bool any() const _NOEXCEPT;
size_t __hash_code() const _NOEXCEPT;
private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
@@ -193,37 +208,59 @@ private:
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
: __first_{0}
#endif
{
_STD::fill_n(__first_, _N_words, __storage_type(0));
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
#endif
}
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size>
void
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
{
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
__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));
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
{
__first_[0] = __v;
_STD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
}
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
#if __SIZE_WIDTH__ == 64
: __first_{__v}
#elif __SIZE_WIDTH__ == 32
: __first_{__v, __v >> __bits_per_word}
#else
#error This constructor has not been ported to this platform
#endif
#endif
{
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
}
template <size_t _N_words, size_t _Size>
@@ -277,7 +314,7 @@ unsigned long
__bitset<_N_words, _Size>::to_ulong(false_type) const
{
const_iterator __e = __make_iter(_Size);
const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ulong overflow error");
@@ -300,7 +337,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");
@@ -393,9 +430,9 @@ class __bitset<1, _Size>
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef size_type __storage_type;
protected:
typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -404,7 +441,7 @@ protected:
friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>;
friend struct __bit_array<__bitset>;
__storage_type __first_;
@@ -413,12 +450,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -442,6 +479,7 @@ protected:
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
{
@@ -449,6 +487,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
{
@@ -536,9 +575,9 @@ class __bitset<0, 0>
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
typedef size_type __storage_type;
protected:
typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -547,23 +586,23 @@ protected:
friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>;
friend class __bit_array<__bitset>;
friend struct __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference;
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
__bitset() _NOEXCEPT;
explicit __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
{return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
{return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
@@ -582,22 +621,25 @@ protected:
};
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
}
template <size_t _Size> class bitset;
template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size> class _LIBCPP_TYPE_VIS bitset;
template <size_t _Size> struct _LIBCPP_TYPE_VIS hash<bitset<_Size> >;
template <size_t _Size>
class _LIBCPP_VISIBLE bitset
class _LIBCPP_TYPE_VIS bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{
public:
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
typedef __bitset<__n_words, _Size> base;
@@ -606,8 +648,9 @@ public:
typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@@ -634,7 +677,8 @@ public:
bitset& flip(size_t __pos);
// element access:
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
@@ -650,7 +694,7 @@ public:
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
size_t count() const _NOEXCEPT;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
@@ -674,7 +718,7 @@ bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one)
{
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str));
for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != __zero && __str[__i] != __one)
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -682,17 +726,17 @@ bitset<_Size>::bitset(const _CharT* __str,
#else
assert(!"bitset string ctor has invalid argument");
#endif
size_t _M = _STD::min(__rlen, _Size);
size_t _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0;
for (; __i < _M; ++__i)
for (; __i < _Mp; ++__i)
{
_CharT __c = __str[_M - 1 - __i];
_CharT __c = __str[_Mp - 1 - __i];
if (__c == __zero)
(*this)[__i] = false;
else
(*this)[__i] = true;
}
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
}
template <size_t _Size>
@@ -708,7 +752,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else
assert(!"bitset string pos out of range");
#endif
size_t __rlen = _STD::min(__n, __str.size() - __pos);
size_t __rlen = _VSTD::min(__n, __str.size() - __pos);
for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -716,17 +760,17 @@ 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 _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0;
for (; __i < _M; ++__i)
for (; __i < _Mp; ++__i)
{
_CharT __c = __str[__pos + _M - 1 - __i];
_CharT __c = __str[__pos + _Mp - 1 - __i];
if (_Traits::eq(__c, __zero))
(*this)[__i] = false;
else
(*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>
@@ -760,9 +804,9 @@ template <size_t _Size>
bitset<_Size>&
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;
}
@@ -770,9 +814,9 @@ template <size_t _Size>
bitset<_Size>&
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;
}
@@ -781,7 +825,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::set() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, true);
_VSTD::fill_n(base::__make_iter(0), _Size, true);
return *this;
}
@@ -804,7 +848,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>&
bitset<_Size>::reset() _NOEXCEPT
{
_STD::fill_n(base::__make_iter(0), _Size, false);
_VSTD::fill_n(base::__make_iter(0), _Size, false);
return *this;
}
@@ -917,7 +961,7 @@ inline _LIBCPP_INLINE_VISIBILITY
size_t
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>
@@ -925,7 +969,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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>
@@ -1016,7 +1060,7 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
}
template <size_t _Size>
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
struct _LIBCPP_TYPE_VIS hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -1024,6 +1068,14 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
{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

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

View File

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

View File

@@ -37,8 +37,13 @@ int toupper(int c);
#include <__config>
#include <ctype.h>
#if defined(_MSC_VER)
#include "support/win32/support.h"
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -26,7 +26,9 @@ Macros:
#include <__config>
#include <errno.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
@@ -72,4 +74,320 @@ const int __elast2 = 105;
#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

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

View File

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

View File

@@ -20,6 +20,7 @@ namespace chrono
{
template <class ToDuration, class Rep, class Period>
constexpr
ToDuration
duration_cast(const duration<Rep, Period>& fd);
@@ -29,9 +30,9 @@ template <class Rep>
struct duration_values
{
public:
static Rep zero();
static Rep max();
static Rep min();
static constexpr Rep zero();
static constexpr Rep max();
static constexpr Rep min();
};
// duration
@@ -46,9 +47,9 @@ public:
typedef Rep rep;
typedef Period period;
duration() = default;
constexpr duration() = default;
template <class Rep2>
explicit duration(const Rep2& r,
constexpr explicit duration(const Rep2& r,
typename enable_if
<
is_convertible<Rep2, rep>::value &&
@@ -58,7 +59,7 @@ public:
// conversions
template <class Rep2, class Period2>
duration(const duration<Rep2, Period2>& d,
constexpr duration(const duration<Rep2, Period2>& d,
typename enable_if
<
treat_as_floating_point<rep>::value ||
@@ -67,12 +68,12 @@ public:
// observer
rep count() const;
constexpr rep count() const;
// arithmetic
duration operator+() const;
duration operator-() const;
constexpr duration operator+() const;
constexpr duration operator-() const;
duration& operator++();
duration operator++(int);
duration& operator--();
@@ -86,9 +87,9 @@ public:
// special values
static duration zero();
static duration min();
static duration max();
static constexpr duration zero();
static constexpr duration min();
static constexpr duration max();
};
typedef duration<long long, nano> nanoseconds;
@@ -145,36 +146,48 @@ namespace chrono {
// duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast
@@ -255,14 +268,18 @@ typedef steady_clock high_resolution_clock;
#include <ratio>
#include <limits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
{
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS duration;
template <class _Tp>
struct __is_duration : false_type {};
@@ -282,7 +299,7 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
struct _LIBCPP_TYPE_VIS common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
{
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
@@ -302,7 +319,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
@@ -312,7 +329,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -324,7 +341,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -336,7 +353,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -348,6 +365,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
@@ -359,21 +377,21 @@ duration_cast(const duration<_Rep, _Period>& __fd)
}
template <class _Rep>
struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
struct _LIBCPP_TYPE_VIS treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct _LIBCPP_VISIBLE duration_values
struct _LIBCPP_TYPE_VIS duration_values
{
public:
_LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
};
// duration
template <class _Rep, class _Period>
class _LIBCPP_VISIBLE duration
class _LIBCPP_TYPE_VIS 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");
@@ -385,9 +403,9 @@ private:
rep __rep_;
public:
_LIBCPP_INLINE_VISIBILITY duration() {} // = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
explicit duration(const _Rep2& __r,
typename enable_if
<
@@ -399,7 +417,7 @@ public:
// conversions
template <class _Rep2, class _Period2>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
duration(const duration<_Rep2, _Period2>& __d,
typename enable_if
<
@@ -407,16 +425,16 @@ 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
_LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
// arithmetic
_LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -432,9 +450,9 @@ public:
// special values
_LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
};
typedef duration<long long, nano> nanoseconds;
@@ -449,7 +467,7 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration>
struct __duration_eq
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -460,13 +478,14 @@ struct __duration_eq
template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -477,6 +496,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -488,7 +508,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _LhsDuration, class _RhsDuration>
struct __duration_lt
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -499,13 +519,14 @@ struct __duration_lt
template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -516,6 +537,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -526,6 +548,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -536,6 +559,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -546,30 +570,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r += __rhs;
return __r;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
}
// Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r -= __rhs;
return __r;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
}
// Duration *
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -578,13 +603,13 @@ typename enable_if
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d;
__r *= static_cast<_Cr>(__s);
return __r;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -623,17 +648,18 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d;
__r /= static_cast<_Cr>(__s);
return __r;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -645,23 +671,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
duration<_Cr, _Period> __r = __d;
__r %= static_cast<_Cr>(__s);
return __r;
typedef duration<_Cr, _Period> _Cd;
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
__r %= __rhs;
return __r;
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
}
//////////////////////////////////////////////////////////
@@ -669,7 +696,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
//////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration>
class _LIBCPP_VISIBLE time_point
class _LIBCPP_TYPE_VIS time_point
{
static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration");
@@ -701,19 +728,19 @@ public:
// arithmetic
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
// special values
_LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
};
} // chrono
template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
struct _LIBCPP_TYPE_VIS common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
{
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
@@ -726,7 +753,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 ==
@@ -836,7 +863,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
/////////////////////// clocks ///////////////////////////
//////////////////////////////////////////////////////////
class _LIBCPP_VISIBLE system_clock
class _LIBCPP_TYPE_VIS system_clock
{
public:
typedef microseconds duration;
@@ -850,7 +877,7 @@ public:
static time_point from_time_t(time_t __t) _NOEXCEPT;
};
class _LIBCPP_VISIBLE steady_clock
class _LIBCPP_TYPE_VIS steady_clock
{
public:
typedef nanoseconds duration;

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,9 @@ class codecvt_utf8_utf16
#include <__config>
#include <__locale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -177,7 +179,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf8
class _LIBCPP_TYPE_VIS codecvt_utf8
: public __codecvt_utf8<_Elem>
{
public:
@@ -405,7 +407,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf16
class _LIBCPP_TYPE_VIS codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian>
{
public:
@@ -528,7 +530,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_VISIBLE codecvt_utf8_utf16
class _LIBCPP_TYPE_VIS codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem>
{
public:

View File

@@ -249,17 +249,19 @@ template<class T, class charT, class traits>
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> class _LIBCPP_TYPE_VIS 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 _LIBCPP_VISIBLE complex
class _LIBCPP_TYPE_VIS complex
{
public:
typedef _Tp value_type;
@@ -280,7 +282,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -316,29 +319,30 @@ public:
}
};
template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_VISIBLE complex<long double>;
template<> class _LIBCPP_TYPE_VIS complex<double>;
template<> class _LIBCPP_TYPE_VIS complex<long double>;
template<>
class _LIBCPP_VISIBLE complex<float>
class _LIBCPP_TYPE_VIS complex<float>
{
float __re_;
float __im_;
public:
typedef float value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {}
explicit /*constexpr*/ complex(const complex<double>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -375,25 +379,26 @@ public:
};
template<>
class _LIBCPP_VISIBLE complex<double>
class _LIBCPP_TYPE_VIS complex<double>
{
double __re_;
double __im_;
public:
typedef double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {}
/*constexpr*/ complex(const complex<float>& __c);
explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -430,25 +435,26 @@ public:
};
template<>
class _LIBCPP_VISIBLE complex<long double>
class _LIBCPP_TYPE_VIS complex<long double>
{
long double __re_;
long double __im_;
public:
typedef long double value_type;
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {}
/*constexpr*/ complex(const complex<float>& __c);
/*constexpr*/ complex(const complex<double>& __c);
_LIBCPP_CONSTEXPR complex(const complex<float>& __c);
_LIBCPP_CONSTEXPR complex(const complex<double>& __c);
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -484,33 +490,33 @@ public:
}
};
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
@@ -1173,7 +1179,7 @@ complex<typename __promote<_Tp, _Up>::type>
pow(const complex<_Tp>& __x, const complex<_Up>& __y)
{
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y));
return _VSTD::pow(result_type(__x), result_type(__y));
}
template<class _Tp, class _Up>
@@ -1186,7 +1192,7 @@ typename enable_if
pow(const complex<_Tp>& __x, const _Up& __y)
{
typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _STD::pow(result_type(__x), result_type(__y));
return _VSTD::pow(result_type(__x), result_type(__y));
}
template<class _Tp, class _Up>
@@ -1199,7 +1205,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
@@ -1243,10 +1249,12 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag()))
{
if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
@@ -1345,7 +1353,11 @@ tanh(const complex<_Tp>& __x)
_Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i));
return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
_Tp __2rsh(sinh(__2r));
if (isinf(__2rsh) && isinf(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
}
// asin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -43,7 +43,9 @@ Types:
#include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -54,35 +56,36 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_VISIBLE nullptr_t
struct _LIBCPP_TYPE_VIS nullptr_t
{
void* _;
void* __lx;
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _STD::__get_nullptr_t()
#define nullptr _VSTD::__get_nullptr_t()
#endif // _LIBCPP_HAS_NO_NULLPTR

View File

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

View File

@@ -99,7 +99,21 @@ void perror(const char* s);
#include <__config>
#include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
#endif // getc
#ifdef putc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
#undef putc
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -124,13 +138,15 @@ using ::scanf;
using ::snprintf;
using ::sprintf;
using ::sscanf;
#ifndef _MSC_VER
using ::vfprintf;
using ::vfscanf;
using ::vprintf;
using ::vscanf;
using ::vsscanf;
#endif // _MSC_VER
using ::vprintf;
using ::vsnprintf;
using ::vsprintf;
using ::vsscanf;
using ::fgetc;
using ::fgets;
using ::fputc;

View File

@@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
int at_quick_exit(void (*func)(void)) // C++11
void quick_exit(int status); // C++11
void *aligned_alloc(size_t alignment, size_t size); // C11
} // std
@@ -81,26 +84,39 @@ size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
#include <__config>
#include <stdlib.h>
#ifdef _MSC_VER
#include "support/win32/locale_win32.h"
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::size_t;
using ::div_t;
using ::ldiv_t;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv_t;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::atof;
using ::atoi;
using ::atol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::atoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtod;
using ::strtof;
using ::strtold;
using ::strtol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtoul;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoull;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::rand;
using ::srand;
using ::calloc;
@@ -117,21 +133,39 @@ using ::bsearch;
using ::qsort;
using ::abs;
using ::labs;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::llabs;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::div;
using ::ldiv;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::mblen;
using ::mbtowc;
using ::wctomb;
using ::mbstowcs;
using ::wcstombs;
#ifdef _LIBCPP_HAS_QUICK_EXIT
using ::at_quick_exit;
using ::quick_exit;
#endif
#ifdef _LIBCPP_HAS_C11_FEATURES
using ::aligned_alloc;
#endif
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
#if !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _MSC_VER
_LIBCPP_END_NAMESPACE_STD

View File

@@ -60,7 +60,9 @@ size_t strlen(const char* s);
#include <__config>
#include <string.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -91,7 +93,8 @@ using ::strspn;
using ::strstr;
#ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
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);}

View File

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

View File

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

View File

@@ -106,8 +106,13 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#ifdef _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -119,13 +124,15 @@ using ::FILE;
using ::fwprintf;
using ::fwscanf;
using ::swprintf;
using ::swscanf;
using ::vfwprintf;
using ::vfwscanf;
using ::vswprintf;
using ::vswscanf;
using ::vwprintf;
#ifndef _MSC_VER
using ::swscanf;
using ::vfwscanf;
using ::vswscanf;
using ::vwscanf;
#endif // _MSC_VER
using ::wprintf;
using ::wscanf;
using ::fgetwc;
@@ -139,12 +146,18 @@ using ::putwc;
using ::putwchar;
using ::ungetwc;
using ::wcstod;
#ifndef _MSC_VER
using ::wcstof;
using ::wcstold;
#endif // _MSC_VER
using ::wcstol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoul;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoull;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcscpy;
using ::wcsncpy;
using ::wcscat;
@@ -154,28 +167,37 @@ using ::wcscoll;
using ::wcsncmp;
using ::wcsxfrm;
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
#else
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
using ::wcscspn;
using ::wcslen;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
using ::wcsspn;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
using ::wcstok;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
#endif
using ::wcscspn;
using ::wcslen;
using ::wcsspn;
using ::wcstok;
using ::wmemcmp;
using ::wmemcpy;
using ::wmemmove;

View File

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

View File

@@ -150,7 +150,9 @@ template <class T, class Allocator>
*/
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include <__config>
#include <__split_buffer>
@@ -160,13 +162,15 @@ template <class T, class Allocator>
#include <algorithm>
#include <stdexcept>
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_VISIBLE __deque_iterator;
class _LIBCPP_TYPE_VIS __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -258,7 +262,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_VISIBLE __deque_iterator
class _LIBCPP_TYPE_VIS __deque_iterator
{
typedef _MapPointer __map_iterator;
public:
@@ -276,10 +280,10 @@ public:
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
template <class _P, class _R, class _MP>
template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
__deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
@@ -405,10 +409,10 @@ private:
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
: __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _A> friend class __deque_base;
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
template <class _V, class _P, class _R, class _MP, class _D, _D>
friend class _LIBCPP_VISIBLE __deque_iterator;
template <class _Tp, class _Ap> friend class __deque_base;
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS deque;
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
friend class _LIBCPP_TYPE_VIS __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -535,7 +539,7 @@ copy(_RAIter __f,
__n = __bs;
__m = __f + __n;
}
_STD::copy(__f, __m, __rb);
_VSTD::copy(__f, __m, __rb);
__f = __m;
__r += __n;
}
@@ -562,7 +566,7 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__fe = __fb + __bs;
}
__r = _STD::copy(__fb, __fe, __r);
__r = _VSTD::copy(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
}
@@ -589,7 +593,7 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__fe = __fb + __bs;
}
__r = _STD::copy(__fb, __fe, __r);
__r = _VSTD::copy(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
}
@@ -610,7 +614,7 @@ copy_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -621,7 +625,7 @@ copy_backward(_RAIter __f,
__n = __bs;
__m = __l - __n;
}
_STD::copy_backward(__m, __l, __re);
_VSTD::copy_backward(__m, __l, __re);
__l = __m;
__r -= __n;
}
@@ -649,7 +653,7 @@ copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__lb = __le - __bs;
}
__r = _STD::copy_backward(__lb, __le, __r);
__r = _VSTD::copy_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
}
@@ -677,7 +681,7 @@ copy_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__lb = __le - __bs;
}
__r = _STD::copy_backward(__lb, __le, __r);
__r = _VSTD::copy_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
}
@@ -708,7 +712,7 @@ move(_RAIter __f,
__n = __bs;
__m = __f + __n;
}
_STD::move(__f, __m, __rb);
_VSTD::move(__f, __m, __rb);
__f = __m;
__r += __n;
}
@@ -735,7 +739,7 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__fe = __fb + __bs;
}
__r = _STD::move(__fb, __fe, __r);
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
}
@@ -762,7 +766,7 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__fe = __fb + __bs;
}
__r = _STD::move(__fb, __fe, __r);
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
}
@@ -783,7 +787,7 @@ move_backward(_RAIter __f,
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
while (__f != __l)
{
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _VSTD::prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -794,7 +798,7 @@ move_backward(_RAIter __f,
__n = __bs;
__m = __l - __n;
}
_STD::move_backward(__m, __l, __re);
_VSTD::move_backward(__m, __l, __re);
__l = __m;
__r -= __n;
}
@@ -822,7 +826,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__lb = __le - __bs;
}
__r = _STD::move_backward(__lb, __le, __r);
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
}
@@ -850,7 +854,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__bs = __n;
__lb = __le - __bs;
}
__r = _STD::move_backward(__lb, __le, __r);
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
}
@@ -961,7 +965,7 @@ protected:
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
{
__map_ = _STD::move(__c.__map_);
__map_ = _VSTD::move(__c.__map_);
__start_ = __c.__start_;
size() = __c.size();
__move_assign_alloc(__c);
@@ -977,14 +981,14 @@ protected:
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, true_type)
void __move_assign_alloc(__deque_base& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{
__alloc() = _STD::move(__c.__alloc());
__alloc() = _VSTD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, false_type) _NOEXCEPT
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -998,12 +1002,12 @@ private:
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<allocator_type>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
static void __swap_alloc(allocator_type&, allocator_type&, false_type)
_NOEXCEPT
{}
};
@@ -1097,9 +1101,9 @@ __deque_base<_Tp, _Allocator>::~__deque_base()
template <class _Tp, class _Allocator>
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __map_(_STD::move(__c.__map_)),
__start_(_STD::move(__c.__start_)),
__size_(_STD::move(__c.__size_))
: __map_(_VSTD::move(__c.__map_)),
__start_(_VSTD::move(__c.__start_)),
__size_(_VSTD::move(__c.__size_))
{
__c.__start_ = 0;
__c.size() = 0;
@@ -1107,9 +1111,9 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
template <class _Tp, class _Allocator>
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_type& __a)
: __map_(_STD::move(__c.__map_), __pointer_allocator(__a)),
__start_(_STD::move(__c.__start_)),
__size_(_STD::move(__c.size()), __a)
: __map_(_VSTD::move(__c.__map_), __pointer_allocator(__a)),
__start_(_VSTD::move(__c.__start_)),
__size_(_VSTD::move(__c.size()), __a)
{
if (__a == __c.__alloc())
{
@@ -1133,8 +1137,8 @@ __deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
__is_nothrow_swappable<allocator_type>::value)
{
__map_.swap(__c.__map_);
_STD::swap(__start_, __c.__start_);
_STD::swap(size(), __c.size());
_VSTD::swap(__start_, __c.__start_);
_VSTD::swap(size(), __c.size());
__swap_alloc(__alloc(), __c.__alloc());
}
@@ -1144,7 +1148,7 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
{
allocator_type& __a = __alloc();
for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, _VSTD::addressof(*__i));
size() = 0;
while (__map_.size() > 2)
{
@@ -1163,7 +1167,7 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_VISIBLE deque
class _LIBCPP_TYPE_VIS deque
: private __deque_base<_Tp, _Allocator>
{
public:
@@ -1184,8 +1188,8 @@ public:
typedef typename __base::pointer pointer;
typedef typename __base::const_pointer const_pointer;
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
@@ -1204,12 +1208,16 @@ public:
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
deque(const deque& __c);
deque(const deque& __c, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque(initializer_list<value_type> __il);
deque(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
deque& operator=(const deque& __c);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
@@ -1227,8 +1235,10 @@ public:
void assign(_RAIter __f, _RAIter __l,
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
allocator_type get_allocator() const _NOEXCEPT;
@@ -1313,9 +1323,11 @@ public:
template <class _BiIter>
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void pop_front();
void pop_back();
iterator erase(const_iterator __p);
@@ -1391,7 +1403,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, false_type)
void __copy_assign_alloc(const deque&, false_type)
{}
void __move_assign(deque& __c, true_type)
@@ -1452,6 +1464,8 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
__append(__c.begin(), __c.end());
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
{
@@ -1465,6 +1479,8 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
__append(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(const deque& __c)
@@ -1483,19 +1499,19 @@ template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
deque<_Tp, _Allocator>::deque(deque&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __base(_STD::move(__c))
: __base(_VSTD::move(__c))
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_STD::move(__c), __a)
: __base(_VSTD::move(__c), __a)
{
if (__a != __c.__alloc())
{
typedef move_iterator<iterator> _I;
assign(_I(__c.begin()), _I(__c.end()));
typedef move_iterator<iterator> _Ip;
assign(_Ip(__c.begin()), _Ip(__c.end()));
}
}
@@ -1517,8 +1533,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
{
if (__base::__alloc() != __c.__alloc())
{
typedef move_iterator<iterator> _I;
assign(_I(__c.begin()), _I(__c.end()));
typedef move_iterator<iterator> _Ip;
assign(_Ip(__c.begin()), _Ip(__c.end()));
}
else
__move_assign(__c, true_type());
@@ -1562,11 +1578,11 @@ deque<_Tp, _Allocator>::assign(_RAIter __f, _RAIter __l,
if (static_cast<size_type>(__l - __f) > __base::size())
{
_RAIter __m = __f + __base::size();
_STD::copy(__f, __m, __base::begin());
_VSTD::copy(__f, __m, __base::begin());
__append(__m, __l);
}
else
__erase_to_end(_STD::copy(__f, __l, __base::begin()));
__erase_to_end(_VSTD::copy(__f, __l, __base::begin()));
}
template <class _Tp, class _Allocator>
@@ -1575,12 +1591,12 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
{
if (__n > __base::size())
{
_STD::fill_n(__base::begin(), __base::size(), __v);
_VSTD::fill_n(__base::begin(), __base::size(), __v);
__n -= __base::size();
__append(__n, __v);
}
else
__erase_to_end(_STD::fill_n(__base::begin(), __n, __v));
__erase_to_end(_VSTD::fill_n(__base::begin(), __n, __v));
}
template <class _Tp, class _Allocator>
@@ -1726,7 +1742,7 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
++__base::size();
}
@@ -1740,7 +1756,7 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
++__base::size();
}
@@ -1755,7 +1771,7 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
++__base::size();
}
@@ -1770,7 +1786,7 @@ deque<_Tp, _Allocator>::push_front(const value_type& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1785,7 +1801,7 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
--__base::__start_;
++__base::size();
}
@@ -1801,7 +1817,7 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
@@ -1823,7 +1839,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1831,14 +1847,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
iterator __bm1 = _VSTD::prev(__b);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
__vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = __move_and_check(_STD::next(__b), __b + __pos, __b, __vt);
__b = __move_and_check(_VSTD::next(__b), __b + __pos, __b, __vt);
*__b = *__vt;
}
}
@@ -1850,17 +1866,17 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
++__base::size();
}
else
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
iterator __em1 = _VSTD::prev(__e);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
__vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
@@ -1886,20 +1902,20 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = _STD::move(__v);
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
*__b = _VSTD::move(__v);
}
}
else
@@ -1910,18 +1926,18 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
*--__e = _STD::move(__v);
__e = _VSTD::move_backward(__e - __de, __em1, __e);
*--__e = _VSTD::move(__v);
}
}
return __base::begin() + __pos;
@@ -1944,20 +1960,21 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
else
{
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __b = __base::begin();
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = value_type(_STD::forward<_Args>(__args)...);
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
*__b = _VSTD::move(__tmp);
}
}
else
@@ -1968,18 +1985,19 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
++__base::size();
}
else
{
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __e = __base::end();
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
*--__e = value_type(_STD::forward<_Args>(__args)...);
__e = _VSTD::move_backward(__e - __de, __em1, __e);
*--__e = _VSTD::move(__tmp);
}
}
return __base::begin() + __pos;
@@ -2006,7 +2024,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __pos)
{
for (size_type __m = __n - __pos; __m; --__m, --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*--__i), __v);
__n = __pos;
}
if (__n > 0)
@@ -2016,7 +2034,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
__move_construct_backward_and_check(__old_begin, __obn, __i, __vt);
if (__n < __pos)
__old_begin = __move_and_check(__obn, __old_begin + __pos, __old_begin, __vt);
_STD::fill_n(__old_begin, __n, *__vt);
_VSTD::fill_n(__old_begin, __n, *__vt);
}
}
else
@@ -2032,7 +2050,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __de)
{
for (size_type __m = __n - __de; __m; --__m, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);
__n = __de;
}
if (__n > 0)
@@ -2042,7 +2060,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
__move_construct_and_check(__oen, __old_end, __i, __vt);
if (__n < __de)
__old_end = __move_backward_and_check(__old_end - __de, __oen, __old_end, __vt);
_STD::fill_n(__old_end - __n, __n, *__vt);
_VSTD::fill_n(__old_end - __n, __n, *__vt);
}
}
return __base::begin() + __pos;
@@ -2067,7 +2085,7 @@ typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type*)
{
size_type __n = _STD::distance(__f, __l);
size_type __n = _VSTD::distance(__f, __l);
size_type __pos = __p - __base::begin();
size_type __to_end = __base::size() - __pos;
allocator_type& __a = __base::__alloc();
@@ -2082,9 +2100,9 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
_BiIter __m = __f;
if (__n > __pos)
{
__m = __pos < __n / 2 ? _STD::prev(__l, __pos) : _STD::next(__f, __n - __pos);
__m = __pos < __n / 2 ? _VSTD::prev(__l, __pos) : _VSTD::next(__f, __n - __pos);
for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*--__i), *--__j);
__alloc_traits::construct(__a, _VSTD::addressof(*--__i), *--__j);
__n = __pos;
}
if (__n > 0)
@@ -2092,13 +2110,13 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
iterator __obn = __old_begin + __n;
for (iterator __j = __obn; __j != __old_begin;)
{
__alloc_traits::construct(__a, _STD::addressof(*--__i), _STD::move(*--__j));
__alloc_traits::construct(__a, _VSTD::addressof(*--__i), _VSTD::move(*--__j));
--__base::__start_;
++__base::size();
}
if (__n < __pos)
__old_begin = _STD::move(__obn, __old_begin + __pos, __old_begin);
_STD::copy(__m, __l, __old_begin);
__old_begin = _VSTD::move(__obn, __old_begin + __pos, __old_begin);
_VSTD::copy(__m, __l, __old_begin);
}
}
else
@@ -2114,19 +2132,19 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
size_type __de = __base::size() - __pos;
if (__n > __de)
{
__m = __de < __n / 2 ? _STD::next(__f, __de) : _STD::prev(__l, __n - __de);
__m = __de < __n / 2 ? _VSTD::next(__f, __de) : _VSTD::prev(__l, __n - __de);
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__j);
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__j);
__n = __de;
}
if (__n > 0)
{
iterator __oen = __old_end - __n;
for (iterator __j = __oen; __j != __old_end; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), _STD::move(*__j));
__alloc_traits::construct(__a, _VSTD::addressof(*__i), _VSTD::move(*__j));
if (__n < __de)
__old_end = _STD::move_backward(__old_end - __de, __oen, __old_end);
_STD::copy_backward(__f, __m, __old_end);
__old_end = _VSTD::move_backward(__old_end - __de, __oen, __old_end);
_VSTD::copy_backward(__f, __m, __old_end);
}
}
return __base::begin() + __pos;
@@ -2149,14 +2167,14 @@ void
deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
typename enable_if<__is_forward_iterator<_ForIter>::value>::type*)
{
size_type __n = _STD::distance(__f, __l);
size_type __n = _VSTD::distance(__f, __l);
allocator_type& __a = __base::__alloc();
size_type __back_capacity = __back_spare();
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), *__f);
__alloc_traits::construct(__a, _VSTD::addressof(*__i), *__f);
}
template <class _Tp, class _Allocator>
@@ -2169,7 +2187,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i));
__alloc_traits::construct(__a, _VSTD::addressof(*__i));
}
template <class _Tp, class _Allocator>
@@ -2182,7 +2200,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __n; --__n, ++__i, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__alloc_traits::construct(__a, _VSTD::addressof(*__i), __v);
}
// Create front capacity for one block of elements.
@@ -2240,10 +2258,10 @@ deque<_Tp, _Allocator>::__add_front_capacity()
for (typename __base::__map_pointer __i = __base::__map_.begin();
__i != __base::__map_.end(); ++__i)
__buf.push_back(*__i);
_STD::swap(__base::__map_.__first_, __buf.__first_);
_STD::swap(__base::__map_.__begin_, __buf.__begin_);
_STD::swap(__base::__map_.__end_, __buf.__end_);
_STD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
_VSTD::swap(__base::__map_.__first_, __buf.__first_);
_VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
_VSTD::swap(__base::__map_.__end_, __buf.__end_);
_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
__base::__start_ = __base::__map_.size() == 1 ?
__base::__block_size / 2 :
__base::__start_ + __base::__block_size;
@@ -2260,7 +2278,7 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at back:
size_type __back_capacity = __back_spare() / __base::__block_size;
__back_capacity = _STD::min(__back_capacity, __nb); // don't take more than you need
__back_capacity = _VSTD::min(__back_capacity, __nb); // don't take more than you need
__nb -= __back_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2327,10 +2345,10 @@ deque<_Tp, _Allocator>::__add_front_capacity(size_type __n)
for (typename __base::__map_pointer __i = __base::__map_.begin();
__i != __base::__map_.end(); ++__i)
__buf.push_back(*__i);
_STD::swap(__base::__map_.__first_, __buf.__first_);
_STD::swap(__base::__map_.__begin_, __buf.__begin_);
_STD::swap(__base::__map_.__end_, __buf.__end_);
_STD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
_VSTD::swap(__base::__map_.__first_, __buf.__first_);
_VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
_VSTD::swap(__base::__map_.__end_, __buf.__end_);
_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
__base::__start_ += __ds;
}
}
@@ -2388,10 +2406,10 @@ deque<_Tp, _Allocator>::__add_back_capacity()
for (typename __base::__map_pointer __i = __base::__map_.end();
__i != __base::__map_.begin();)
__buf.push_front(*--__i);
_STD::swap(__base::__map_.__first_, __buf.__first_);
_STD::swap(__base::__map_.__begin_, __buf.__begin_);
_STD::swap(__base::__map_.__end_, __buf.__end_);
_STD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
_VSTD::swap(__base::__map_.__first_, __buf.__first_);
_VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
_VSTD::swap(__base::__map_.__end_, __buf.__end_);
_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
}
}
@@ -2405,7 +2423,7 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
size_type __nb = __recommend_blocks(__n + __base::__map_.empty());
// Number of unused blocks at front:
size_type __front_capacity = __front_spare() / __base::__block_size;
__front_capacity = _STD::min(__front_capacity, __nb); // don't take more than you need
__front_capacity = _VSTD::min(__front_capacity, __nb); // don't take more than you need
__nb -= __front_capacity; // number of blocks need to allocate
// If __nb == 0, then we have sufficient capacity.
if (__nb == 0)
@@ -2474,10 +2492,10 @@ deque<_Tp, _Allocator>::__add_back_capacity(size_type __n)
for (typename __base::__map_pointer __i = __base::__map_.end();
__i != __base::__map_.begin();)
__buf.push_front(*--__i);
_STD::swap(__base::__map_.__first_, __buf.__first_);
_STD::swap(__base::__map_.__begin_, __buf.__begin_);
_STD::swap(__base::__map_.__end_, __buf.__end_);
_STD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
_VSTD::swap(__base::__map_.__first_, __buf.__first_);
_VSTD::swap(__base::__map_.__begin_, __buf.__begin_);
_VSTD::swap(__base::__map_.__end_, __buf.__end_);
_VSTD::swap(__base::__map_.__end_cap(), __buf.__end_cap());
__base::__start_ -= __ds;
}
}
@@ -2525,7 +2543,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
{
// as if
// for (; __f != __l; ++__f, ++__r)
// *__r = _STD::move(*__f);
// *__r = _VSTD::move(*__f);
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2539,7 +2557,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
}
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
__r = _STD::move(__fb, __fe, __r);
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
}
@@ -2555,7 +2573,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
{
// as if
// while (__f != __l)
// *--__r = _STD::move(*--__l);
// *--__r = _VSTD::move(*--__l);
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2570,7 +2588,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
}
if (__lb <= __vt && __vt < __le)
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
__r = _STD::move_backward(__lb, __le, __r);
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
}
@@ -2587,7 +2605,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
allocator_type& __a = __base::__alloc();
// as if
// for (; __f != __l; ++__r, ++__f, ++__base::size())
// __alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__f));
// __alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__f));
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2602,7 +2620,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__fb));
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
__n -= __bs;
__f += __bs;
}
@@ -2619,7 +2637,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
// as if
// for (iterator __j = __l; __j != __f;)
// {
// __alloc_traitsconstruct(__a, _STD::addressof(*--__r), _STD::move(*--__j));
// __alloc_traitsconstruct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__j));
// --__base::__start_;
// ++__base::size();
// }
@@ -2639,7 +2657,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _STD::addressof(*--__r), _STD::move(*--__le));
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
--__base::__start_;
++__base::size();
}
@@ -2659,8 +2677,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
allocator_type& __a = __base::__alloc();
if (__pos < (__base::size() - 1) / 2)
{ // erase from front
_STD::move_backward(__b, __p, _STD::next(__p));
__alloc_traits::destroy(__a, _STD::addressof(*__b));
_VSTD::move_backward(__b, __p, _VSTD::next(__p));
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
--__base::size();
++__base::__start_;
if (__front_spare() >= 2 * __base::__block_size)
@@ -2672,8 +2690,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
}
else
{ // erase from back
iterator __i = _STD::move(_STD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
iterator __i = _VSTD::move(_VSTD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _VSTD::addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2697,9 +2715,9 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
allocator_type& __a = __base::__alloc();
if (__pos < (__base::size() - __n) / 2)
{ // erase from front
iterator __i = _STD::move_backward(__b, __p, __p + __n);
iterator __i = _VSTD::move_backward(__b, __p, __p + __n);
for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, _STD::addressof(*__b));
__alloc_traits::destroy(__a, _VSTD::addressof(*__b));
__base::size() -= __n;
__base::__start_ += __n;
while (__front_spare() >= 2 * __base::__block_size)
@@ -2711,9 +2729,9 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
}
else
{ // erase from back
iterator __i = _STD::move(__p + __n, __base::end(), __p);
iterator __i = _VSTD::move(__p + __n, __base::end(), __p);
for (iterator __e = __base::end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__alloc_traits::destroy(__a, _VSTD::addressof(*__i));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2737,7 +2755,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
iterator __b = __base::begin();
difference_type __pos = __f - __b;
for (iterator __p = __b + __pos; __p != __e; ++__p)
__alloc_traits::destroy(__a, _STD::addressof(*__p));
__alloc_traits::destroy(__a, _VSTD::addressof(*__p));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2771,7 +2789,7 @@ bool
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
const typename deque<_Tp, _Allocator>::size_type __sz = __x.size();
return __sz == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
return __sz == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Tp, class _Allocator>
@@ -2787,7 +2805,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _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 _Tp, class _Allocator>

View File

@@ -80,7 +80,9 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstddef>
#include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace
{
@@ -103,23 +105,23 @@ public:
};
typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
class exception_ptr;
class _LIBCPP_TYPE_VIS exception_ptr;
exception_ptr current_exception() _NOEXCEPT;
_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
_LIBCPP_NORETURN void rethrow_exception(exception_ptr);
class _LIBCPP_VISIBLE exception_ptr
class _LIBCPP_TYPE_VIS exception_ptr
{
void* __ptr_;
public:
@@ -130,7 +132,7 @@ public:
~exception_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
// explicit
_LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY
@@ -141,12 +143,12 @@ public:
{return !(__x == __y);}
friend exception_ptr current_exception() _NOEXCEPT;
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
friend void rethrow_exception(exception_ptr);
};
template<class _E>
template<class _Ep>
exception_ptr
make_exception_ptr(_E __e) _NOEXCEPT
make_exception_ptr(_Ep __e) _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -172,7 +174,7 @@ public:
virtual ~nested_exception() _NOEXCEPT;
// access functions
_ATTRIBUTE(noreturn) void rethrow_nested() const;
_LIBCPP_NORETURN void rethrow_nested() const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
};
@@ -185,7 +187,7 @@ struct __nested
};
template <class _Tp>
_ATTRIBUTE(noreturn)
_LIBCPP_NORETURN
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
@@ -199,12 +201,12 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
#endif
}
template <class _Tp>
_ATTRIBUTE(noreturn)
_LIBCPP_NORETURN
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
@@ -218,15 +220,15 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw _STD::forward<_Tp>(__t);
throw _VSTD::forward<_Tp>(__t);
#endif
}
template <class _E>
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_E>::value
rethrow_if_nested(const _Ep& __e, typename enable_if<
is_polymorphic<_Ep>::value
>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
@@ -234,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
__nep->rethrow_nested();
}
template <class _E>
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_E>::value
rethrow_if_nested(const _Ep&, typename enable_if<
!is_polymorphic<_Ep>::value
>::type* = 0)
{
}

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_TYPE_VIS hash : public std::hash<T>
{ };
template <> struct _LIBCPP_TYPE_VIS 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_TYPE_VIS hash<char *>
: public unary_function<char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char *__c) const _NOEXCEPT
{
return __do_string_hash<const char *>(__c, __c + strlen(__c));
}
};
}
#endif // _LIBCPP_EXT_HASH

View File

@@ -203,8 +203,11 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table>
#include <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
@@ -212,7 +215,11 @@ namespace __gnu_cxx {
using namespace std;
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value
#if __has_feature(is_final)
&& !__is_final(_Hash)
#endif
>
class __hash_map_hasher
: private _Hash
{
@@ -244,7 +251,11 @@ public:
{return __hash_(__x);}
};
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value
#if __has_feature(is_final)
&& !__is_final(_Pred)
#endif
>
class __hash_map_equal
: private _Pred
{
@@ -341,16 +352,16 @@ public:
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::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 _LIBCPP_VISIBLE __hash_map_iterator
class _LIBCPP_TYPE_VIS __hash_map_iterator
{
_HashIterator __i_;
@@ -393,15 +404,15 @@ public:
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 _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, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
class _LIBCPP_VISIBLE __hash_map_const_iterator
class _LIBCPP_TYPE_VIS __hash_map_const_iterator
{
_HashIterator __i_;
@@ -452,20 +463,21 @@ public:
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 _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, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __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 _LIBCPP_VISIBLE hash_map
class _LIBCPP_TYPE_VIS 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;
@@ -495,8 +507,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
@@ -549,6 +561,8 @@ public:
_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);
@@ -665,12 +679,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::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>
@@ -736,12 +750,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 _LIBCPP_VISIBLE hash_multimap
class _LIBCPP_TYPE_VIS 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;
@@ -769,8 +784,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __hash_map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
@@ -823,6 +838,8 @@ public:
_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);
@@ -963,9 +980,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;
}

View File

@@ -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 _LIBCPP_VISIBLE hash_set
class _LIBCPP_TYPE_VIS hash_set
{
public:
// types
@@ -272,6 +275,8 @@ public:
_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);
@@ -424,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 _LIBCPP_VISIBLE hash_multiset
class _LIBCPP_TYPE_VIS hash_multiset
{
public:
// types
@@ -490,6 +495,8 @@ public:
_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);
@@ -627,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;
}

View File

@@ -174,11 +174,15 @@ template <class T, class Allocator>
#include <iterator>
#include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class, class> struct __forward_list_node;
template <class _Tp, class _VoidPtr> struct __forward_list_node;
template <class _NodePtr>
struct __forward_begin_node
@@ -208,11 +212,11 @@ struct __forward_list_node
value_type __value_;
};
template<class, class> class forward_list;
template<class> class __forward_list_const_iterator;
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS forward_list;
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS __forward_list_const_iterator;
template <class _NodePtr>
class _LIBCPP_VISIBLE __forward_list_iterator
class _LIBCPP_TYPE_VIS __forward_list_iterator
{
typedef _NodePtr __node_pointer;
@@ -221,8 +225,8 @@ class _LIBCPP_VISIBLE __forward_list_iterator
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template<class, class> friend class forward_list;
template<class> friend class __forward_list_const_iterator;
template<class, class> friend class _LIBCPP_TYPE_VIS forward_list;
template<class> friend class _LIBCPP_TYPE_VIS __forward_list_const_iterator;
public:
typedef forward_iterator_tag iterator_category;
@@ -272,7 +276,7 @@ public:
};
template <class _NodeConstPtr>
class _LIBCPP_VISIBLE __forward_list_const_iterator
class _LIBCPP_TYPE_VIS __forward_list_const_iterator
{
typedef _NodeConstPtr __node_const_pointer;
@@ -446,7 +450,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value)
{__alloc() = _STD::move(__x.__alloc());}
{__alloc() = _VSTD::move(__x.__alloc());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
@@ -464,7 +468,7 @@ private:
true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(__x, __y);
}
};
@@ -475,7 +479,7 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
: __before_begin_(_STD::move(__x.__before_begin_))
: __before_begin_(_VSTD::move(__x.__before_begin_))
{
__x.__before_begin()->__next_ = nullptr;
}
@@ -509,7 +513,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
__is_nothrow_swappable<__node_allocator>::value)
{
__swap_alloc(__alloc(), __x.__alloc());
using _STD::swap;
using _VSTD::swap;
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
}
@@ -521,7 +525,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{
__node_pointer __next = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
__p = __next;
}
@@ -529,7 +533,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_VISIBLE forward_list
class _LIBCPP_TYPE_VIS forward_list
: private __forward_list_base<_Tp, _Alloc>
{
typedef __forward_list_base<_Tp, _Alloc> base;
@@ -577,11 +581,13 @@ public:
_LIBCPP_INLINE_VISIBILITY
forward_list(forward_list&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
: base(_STD::move(__x)) {}
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~forward_list() = default;
@@ -592,7 +598,9 @@ public:
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator>
typename enable_if
@@ -602,7 +610,9 @@ public:
>::type
assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -677,8 +687,10 @@ public:
iterator
>::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
@@ -718,7 +730,7 @@ public:
template <class _Compare>
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _STD::move(__comp));}
{merge(__x, _VSTD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
@@ -760,13 +772,13 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
@@ -832,17 +844,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
const allocator_type& __a)
: base(_STD::move(__x), __a)
: base(_VSTD::move(__x), __a)
{
if (base::__alloc() != __x.__alloc())
{
typedef move_iterator<iterator> _I;
insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
typedef move_iterator<iterator> _Ip;
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
}
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{
@@ -857,6 +871,8 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
@@ -890,8 +906,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type());
else
{
typedef move_iterator<iterator> _I;
assign(_I(__x.begin()), _I(__x.end()));
typedef move_iterator<iterator> _Ip;
assign(_Ip(__x.begin()), _Ip(__x.end()));
}
}
@@ -910,6 +926,8 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>&
@@ -919,6 +937,8 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
template <class _InputIterator>
typename enable_if
@@ -929,7 +949,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = _VSTD::next(__i);
iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f;
@@ -944,7 +964,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{
iterator __i = before_begin();
iterator __j = _STD::next(__i);
iterator __j = _VSTD::next(__i);
iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v;
@@ -954,6 +974,8 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e);
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
@@ -962,6 +984,8 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end());
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -971,10 +995,10 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -986,9 +1010,9 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -1000,9 +1024,9 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -1014,7 +1038,7 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_allocator& __a = base::__alloc();
__node_pointer __p = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __p->__next_;
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
}
@@ -1028,10 +1052,10 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1045,9 +1069,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1061,9 +1085,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -1078,9 +1102,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1090,7 +1114,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
for (--__n; __n != 0; --__n, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1100,7 +1124,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1128,9 +1152,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1140,7 +1164,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
for (++__f; __f != __l; ++__f, __last = __last->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1150,7 +1174,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1172,7 +1196,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
__node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc();
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_);
}
@@ -1193,7 +1217,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do
{
__p = __n->__next_;
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
__n = __p;
} while (__n != __e);
@@ -1220,13 +1244,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1252,13 +1276,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1293,7 +1317,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list& __x,
const_iterator __i)
{
const_iterator __lm1 = _STD::next(__i);
const_iterator __lm1 = _VSTD::next(__i);
if (__p != __i && __p != __lm1)
{
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1370,7 +1394,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{
if (__i.__ptr_->__next_->__value_ == __v)
{
iterator __j = _STD::next(__i, 2);
iterator __j = _VSTD::next(__i, 2);
for (; __j != __e && *__j == __v; ++__j)
;
erase_after(__i, __j);
@@ -1393,7 +1417,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
if (__pred(__i.__ptr_->__next_->__value_))
{
iterator __j = _STD::next(__i, 2);
iterator __j = _VSTD::next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j)
;
erase_after(__i, __j);
@@ -1413,7 +1437,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = _STD::next(__i);
iterator __j = _VSTD::next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1488,7 +1512,7 @@ void
forward_list<_Tp, _Alloc>::sort(_Compare __comp)
{
base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
_STD::distance(begin(), end()), __comp);
_VSTD::distance(begin(), end()), __comp);
}
template <class _Tp, class _Alloc>
@@ -1514,7 +1538,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
}
difference_type __sz1 = __sz / 2;
difference_type __sz2 = __sz - __sz1;
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp),
@@ -1545,12 +1569,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
typedef forward_list<_Tp, _Alloc> _C;
typedef typename _C::const_iterator _I;
_I __ix = __x.begin();
_I __ex = __x.end();
_I __iy = __y.begin();
_I __ey = __y.end();
typedef forward_list<_Tp, _Alloc> _Cp;
typedef typename _Cp::const_iterator _Ip;
_Ip __ix = __x.begin();
_Ip __ex = __x.end();
_Ip __iy = __y.begin();
_Ip __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy))
return false;
@@ -1570,7 +1594,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator< (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(),
return _VSTD::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end());
}

View File

@@ -171,12 +171,16 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale>
#include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_filebuf
class _LIBCPP_TYPE_VIS basic_filebuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -230,6 +234,7 @@ private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type __st_;
state_type __st_last_;
ios_base::openmode __om_;
ios_base::openmode __cm_;
bool __owns_eb_;
@@ -249,14 +254,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__intbuf_(0),
__ibs_(0),
__file_(0),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__cv_(nullptr),
__st_(),
__st_last_(),
__om_(0),
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
__always_noconv_(__cv_->always_noconv())
__always_noconv_(false)
{
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
{
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
__always_noconv_ = __cv_->always_noconv();
}
setbuf(0, 4096);
}
@@ -284,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__file_ = __rhs.__file_;
__cv_ = __rhs.__cv_;
__st_ = __rhs.__st_;
__st_last_ = __rhs.__st_last_;
__om_ = __rhs.__om_;
__cm_ = __rhs.__cm_;
__owns_eb_ = __rhs.__owns_eb_;
@@ -316,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__rhs.__ibs_ = 0;
__rhs.__file_ = 0;
__rhs.__st_ = state_type();
__rhs.__st_last_ = state_type();
__rhs.__om_ = 0;
__rhs.__cm_ = 0;
__rhs.__owns_eb_ = false;
@@ -331,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
{
close();
swap(__rhs);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -362,9 +376,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 +401,18 @@ 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(__st_last_, __rhs.__st_last_);
_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();
@@ -545,7 +560,7 @@ basic_filebuf<_CharT, _Traits>::close()
{
__rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
if ((__cm_ & ios_base::out) && sync())
if (sync())
__rt = 0;
if (fclose(__h.release()) == 0)
__file_ = 0;
@@ -587,18 +602,22 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;
__st_last_ = __st_;
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
if (__nr != 0)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
__extbufend_ = __extbufnext_ + __nr;
char_type* __inext;
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
this->eback() + __unget_sz,
this->egptr(), __inext);
this->eback() + __ibs_, __inext);
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
@@ -672,6 +691,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
codecvt_base::result __r;
do
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -761,6 +784,10 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
int __width = __cv_->encoding();
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
@@ -780,9 +807,15 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
default:
return pos_type(off_type(-1));
}
#if _WIN32
if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftell(__file_);
#else
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftello(__file_);
#endif
__r.state(__st_);
return __r;
}
@@ -793,8 +826,14 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
{
if (__file_ == 0 || sync())
return pos_type(off_type(-1));
#if _WIN32
if (fseek(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#else
if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#endif
__st_ = __sp.state();
return __sp;
}
@@ -804,6 +843,10 @@ basic_filebuf<_CharT, _Traits>::sync()
{
if (__file_ == 0)
return 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
if (__cm_ & ios_base::out)
{
if (this->pptr() != this->pbase())
@@ -826,6 +869,8 @@ basic_filebuf<_CharT, _Traits>::sync()
else if (__cm_ & ios_base::in)
{
off_type __c;
state_type __state = __st_last_;
bool __update_st = false;
if (__always_noconv_)
__c = this->egptr() - this->gptr();
else
@@ -838,32 +883,24 @@ basic_filebuf<_CharT, _Traits>::sync()
{
if (this->gptr() != this->egptr())
{
reverse(this->gptr(), this->egptr());
codecvt_base::result __r;
const char_type* __e = this->gptr();
char* __extbe;
do
{
__r = __cv_->out(__st_, __e, this->egptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe);
switch (__r)
{
case codecvt_base::noconv:
__c += this->egptr() - this->gptr();
break;
case codecvt_base::ok:
case codecvt_base::partial:
__c += __extbe - __extbuf_;
break;
default:
return -1;
}
} while (__r == codecvt_base::partial);
const int __off = __cv_->length(__state, __extbuf_,
__extbufnext_,
this->gptr() - this->eback());
__c += __extbufnext_ - __extbuf_ - __off;
__update_st = true;
}
}
}
#if _WIN32
if (fseek(__file_, -__c, SEEK_CUR))
return -1;
#else
if (fseeko(__file_, -__c, SEEK_CUR))
return -1;
#endif
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;
this->setg(0, 0, 0);
__cm_ = 0;
}
@@ -957,7 +994,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ifstream
class _LIBCPP_TYPE_VIS basic_ifstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -1019,8 +1056,8 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
: basic_istream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_istream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1030,8 +1067,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>&
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
{
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
@@ -1102,7 +1139,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_ofstream
class _LIBCPP_TYPE_VIS basic_ofstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -1164,8 +1201,8 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
: basic_ostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1175,8 +1212,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>&
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
{
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
@@ -1247,7 +1284,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_fstream
class _LIBCPP_TYPE_VIS basic_fstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -1309,8 +1346,8 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
: basic_iostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
this->set_rdbuf(&__sb_);
}
@@ -1320,8 +1357,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>&
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
{
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

@@ -89,53 +89,55 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
#include <__config>
#include <wchar.h> // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class ios_base;
class _LIBCPP_TYPE_VIS ios_base;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator;
template<class _CharT> struct _LIBCPP_TYPE_VIS char_traits;
template<class _Tp> class _LIBCPP_TYPE_VIS allocator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ios;
class _LIBCPP_TYPE_VIS basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_streambuf;
class _LIBCPP_TYPE_VIS basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_istream;
class _LIBCPP_TYPE_VIS basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ostream;
class _LIBCPP_TYPE_VIS basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_iostream;
class _LIBCPP_TYPE_VIS basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringbuf;
class _LIBCPP_TYPE_VIS basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_istringstream;
class _LIBCPP_TYPE_VIS basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_ostringstream;
class _LIBCPP_TYPE_VIS basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_stringstream;
class _LIBCPP_TYPE_VIS basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_filebuf;
class _LIBCPP_TYPE_VIS basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ifstream;
class _LIBCPP_TYPE_VIS basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_ofstream;
class _LIBCPP_TYPE_VIS basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE basic_fstream;
class _LIBCPP_TYPE_VIS basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE istreambuf_iterator;
class _LIBCPP_TYPE_VIS istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE ostreambuf_iterator;
class _LIBCPP_TYPE_VIS ostreambuf_iterator;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
@@ -170,7 +172,7 @@ typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class _State> class _LIBCPP_VISIBLE fpos;
template <class _State> class _LIBCPP_TYPE_VIS fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
@@ -183,7 +185,7 @@ typedef long long streamoff; // for char_traits in <string>
template <class _CharT, // for <stdexcept>
class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_VISIBLE basic_string;
class _LIBCPP_TYPE_VIS 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

@@ -40,18 +40,20 @@ extern wostream wclog;
#include <istream>
#include <ostream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
extern _LIBCPP_VISIBLE istream cin;
extern _LIBCPP_VISIBLE ostream cout;
extern _LIBCPP_VISIBLE ostream cerr;
extern _LIBCPP_VISIBLE ostream clog;
extern _LIBCPP_VISIBLE wistream wcin;
extern _LIBCPP_VISIBLE wostream wcout;
extern _LIBCPP_VISIBLE wostream wcerr;
extern _LIBCPP_VISIBLE wostream wclog;
extern _LIBCPP_FUNC_VIS istream cin;
extern _LIBCPP_FUNC_VIS ostream cout;
extern _LIBCPP_FUNC_VIS ostream cerr;
extern _LIBCPP_FUNC_VIS ostream clog;
extern _LIBCPP_FUNC_VIS wistream wcin;
extern _LIBCPP_FUNC_VIS wostream wcout;
extern _LIBCPP_FUNC_VIS wostream wcerr;
extern _LIBCPP_FUNC_VIS wostream wclog;
_LIBCPP_END_NAMESPACE_STD

View File

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

View File

@@ -263,10 +263,10 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_istream<charT,traits> istream_type;
istreambuf_iterator() throw();
istreambuf_iterator(istream_type& s) throw();
istreambuf_iterator(streambuf_type* s) throw();
istreambuf_iterator(a-private-type) throw();
istreambuf_iterator() noexcept;
istreambuf_iterator(istream_type& s) noexcept;
istreambuf_iterator(streambuf_type* s) noexcept;
istreambuf_iterator(a-private-type) noexcept;
charT operator*() const;
pointer operator->() const;
@@ -293,13 +293,13 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_ostream<charT,traits> ostream_type;
ostreambuf_iterator(ostream_type& s) throw();
ostreambuf_iterator(streambuf_type* s) throw();
ostreambuf_iterator(ostream_type& s) noexcept;
ostreambuf_iterator(streambuf_type* s) noexcept;
ostreambuf_iterator& operator=(charT c);
ostreambuf_iterator& operator*();
ostreambuf_iterator& operator++();
ostreambuf_iterator& operator++(int);
bool failed() const throw();
bool failed() const noexcept;
};
template <class C> auto begin(C& c) -> decltype(c.begin());
@@ -317,25 +317,31 @@ template <class T, size_t N> T* end(T (&array)[N]);
#include <type_traits>
#include <cstddef>
#include <iosfwd>
#ifdef __APPLE__
#include <Availability.h>
#endif
#ifdef _LIBCPP_DEBUG
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
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 {};
struct _LIBCPP_TYPE_VIS input_iterator_tag {};
struct _LIBCPP_TYPE_VIS output_iterator_tag {};
struct _LIBCPP_TYPE_VIS forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TYPE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TYPE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
{
private:
struct __two {char _; char __;};
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::iterator_category* = 0);
public:
@@ -372,11 +378,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct _LIBCPP_VISIBLE iterator_traits
struct _LIBCPP_TYPE_VIS iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
struct _LIBCPP_TYPE_VIS iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@@ -407,7 +413,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 _LIBCPP_VISIBLE iterator
struct _LIBCPP_TYPE_VIS iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@@ -488,7 +494,7 @@ next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{
_STD::advance(__x, __n);
_VSTD::advance(__x, __n);
return __x;
}
@@ -499,12 +505,12 @@ prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{
_STD::advance(__x, -__n);
_VSTD::advance(__x, -__n);
return __x;
}
template <class _Iter>
class _LIBCPP_VISIBLE reverse_iterator
class _LIBCPP_TYPE_VIS reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@@ -611,7 +617,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class _LIBCPP_VISIBLE back_insert_iterator
class _LIBCPP_TYPE_VIS back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -624,11 +630,11 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_back(__value); return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_back(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_back(_STD::move(__value)); return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_back(_VSTD::move(__value_)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
@@ -644,7 +650,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_VISIBLE front_insert_iterator
class _LIBCPP_TYPE_VIS front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -657,11 +663,11 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_front(__value); return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_front(__value_); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_front(_STD::move(__value)); return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_front(_VSTD::move(__value_)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
@@ -677,7 +683,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_VISIBLE insert_iterator
class _LIBCPP_TYPE_VIS insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -692,11 +698,11 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
{iter = container->insert(iter, __value); ++iter; return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
{iter = container->insert(iter, __value_); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
{iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
@@ -713,7 +719,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_VISIBLE istream_iterator
class _LIBCPP_TYPE_VIS istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@@ -752,7 +758,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class _LIBCPP_VISIBLE ostream_iterator
class _LIBCPP_TYPE_VIS ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -767,9 +773,9 @@ public:
: __out_stream_(&__s), __delim_(0) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
: __out_stream_(&__s), __delim_(__delimiter) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value)
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
{
*__out_stream_ << __value;
*__out_stream_ << __value_;
if (__delim_)
*__out_stream_ << __delim_;
return *this;
@@ -781,7 +787,7 @@ public:
};
template<class _CharT, class _Traits>
class _LIBCPP_VISIBLE istreambuf_iterator
class _LIBCPP_TYPE_VIS istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@@ -793,7 +799,7 @@ public:
typedef basic_streambuf<_CharT,_Traits> streambuf_type;
typedef basic_istream<_CharT,_Traits> istream_type;
private:
streambuf_type* __sbuf_;
mutable streambuf_type* __sbuf_;
class __proxy
{
@@ -807,37 +813,36 @@ private:
};
_LIBCPP_INLINE_VISIBILITY
void __test_for_eof()
bool __test_for_eof() const
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
__sbuf_ = 0;
return __sbuf_ == 0;
}
public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw()
: __sbuf_(__s.rdbuf()) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw()
: __sbuf_(__s) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
: __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY char_type operator*() const
{return static_cast<char_type>(__sbuf_->sgetc());}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof()))
__sbuf_ = 0;
__sbuf_->sbumpc();
return *this;
}
_LIBCPP_INLINE_VISIBILITY __proxy operator++(int)
{
char_type __c = __sbuf_->sgetc();
++(*this);
return __proxy(__c, __sbuf_);
return __proxy(__sbuf_->sbumpc(), __sbuf_);
}
_LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const
{return (__sbuf_ == 0) == (__b.__sbuf_ == 0);}
{return __test_for_eof() == __b.__test_for_eof();}
};
template <class _CharT, class _Traits>
@@ -853,7 +858,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE ostreambuf_iterator
class _LIBCPP_TYPE_VIS ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -864,9 +869,9 @@ public:
private:
streambuf_type* __sbuf_;
public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw()
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw()
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
: __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
{
@@ -877,11 +882,24 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
_LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;}
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
#if !defined(__APPLE__) || \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
template <class _Ch, class _Tr>
friend
_LIBCPP_HIDDEN
ostreambuf_iterator<_Ch, _Tr>
__pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
ios_base& __iob, _Ch __fl);
#endif
};
template <class _Iter>
class _LIBCPP_VISIBLE move_iterator
class _LIBCPP_TYPE_VIS move_iterator
{
private:
_Iter __i;
@@ -1006,43 +1024,52 @@ make_move_iterator(const _Iter& __i)
template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter>
_LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&) _NOEXCEPT;
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
template <class _I, class _O> _O copy(_I, _I, _O);
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
template <class _I, class _O> _O move(_I, _I, _O);
template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
@@ -1063,33 +1090,108 @@ public:
private:
iterator_type __i;
public:
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT {}
_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) _NOEXCEPT
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT {return *__i;}
: __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 {++__i; return *this;}
_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); ++__i; return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT {--__i; return *this;}
{__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); --__i; return __tmp;}
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
{return __wrap_iter(__i + __n);}
{__wrap_iter __w(*this); __w += __n; return __w;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
{__i += __n; return *this;}
{
#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 __wrap_iter(__i - __n);}
{return *this + (-__n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
{__i -= __n; return *this;}
{*this += -__n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
{return __i[__n];}
{
#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 _NOEXCEPT {return __i;}
private:
_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;
@@ -1133,11 +1235,11 @@ private:
template <class _Iter1>
friend
__wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&) _NOEXCEPT;
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
template <class _I, class _O> friend _O copy(_I, _I, _O);
template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
template <class _I, class _O> friend _O move(_I, _I, _O);
template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
@@ -1155,6 +1257,10 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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();
}
@@ -1163,6 +1269,10 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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();
}
@@ -1171,7 +1281,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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>
@@ -1179,7 +1289,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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>
@@ -1187,7 +1297,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
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>
@@ -1195,7 +1305,39 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
return __x.base() <= __y.base();
return !(__y < __x);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x == __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return __y < __x;
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x < __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__y < __x);
}
template <class _Iter1, class _Iter2>
@@ -1203,6 +1345,10 @@ inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
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();
}
@@ -1210,9 +1356,10 @@ template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type __n,
const __wrap_iter<_Iter>& __x) _NOEXCEPT
__wrap_iter<_Iter> __x) _NOEXCEPT
{
return __wrap_iter<_Iter>(__x.base() + __n);
__x += __n;
return __x;
}
#ifdef _LIBCPP_DEBUG
@@ -1222,34 +1369,42 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter>
_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
@@ -1625,88 +1780,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(_C& __c) -> decltype(__c.begin())
begin(_Cp& __c) -> decltype(__c.begin())
{
return __c.begin();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(const _C& __c) -> decltype(__c.begin())
begin(const _Cp& __c) -> decltype(__c.begin())
{
return __c.begin();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
end(_C& __c) -> decltype(__c.end())
end(_Cp& __c) -> decltype(__c.end())
{
return __c.end();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
end(const _C& __c) -> decltype(__c.end())
end(const _Cp& __c) -> decltype(__c.end())
{
return __c.end();
}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
begin(_C& __c)
typename _Cp::iterator
begin(_Cp& __c)
{
return __c.begin();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
begin(const _C& __c)
typename _Cp::const_iterator
begin(const _Cp& __c)
{
return __c.begin();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
end(_C& __c)
typename _Cp::iterator
end(_Cp& __c)
{
return __c.end();
}
template <class _C>
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
end(const _C& __c)
typename _Cp::const_iterator
end(const _Cp& __c)
{
return __c.end();
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _T, size_t _N>
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_T*
begin(_T (&__array)[_N])
_Tp*
begin(_Tp (&__array)[_Np])
{
return __array;
}
template <class _T, size_t _N>
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_T*
end(_T (&__array)[_N])
_Tp*
end(_Tp (&__array)[_Np])
{
return __array + _N;
return __array + _Np;
}
_LIBCPP_END_NAMESPACE_STD

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

@@ -375,15 +375,21 @@ swap(multimap<Key, T, Compare, Allocator>& x,
#include <functional>
#include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value>
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value
#if __has_feature(is_final)
&& !__is_final(_Compare)
#endif
>
class __map_value_compare
: private _Compare
{
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -400,25 +406,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _P& __y) const
bool operator()(const _CP& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _CP& __y) const
bool operator()(const _Pp& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
bool operator()(const _Pp& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _Key& __y) const
bool operator()(const _Pp& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _P& __y) const
bool operator()(const _Key& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
@@ -430,7 +436,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{
_Compare comp;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
@@ -449,25 +455,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _P& __y) const
bool operator()(const _CP& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _CP& __y) const
bool operator()(const _Pp& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
bool operator()(const _Pp& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _Key& __y) const
bool operator()(const _Pp& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _P& __y) const
bool operator()(const _Key& __x, const _Pp& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
@@ -516,20 +522,22 @@ public:
void operator()(pointer __p) _NOEXCEPT
{
if (__second_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class, class, class, class> class map;
template <class, class, class, class> class multimap;
template <class> class __map_const_iterator;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class multimap;
template <class _TreeIterator> class __map_const_iterator;
template <class _TreeIterator>
class _LIBCPP_VISIBLE __map_iterator
class _LIBCPP_TYPE_VIS __map_iterator
{
_TreeIterator __i_;
@@ -588,13 +596,13 @@ public:
bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class> friend class _LIBCPP_TYPE_VIS __map_const_iterator;
};
template <class _TreeIterator>
class _LIBCPP_VISIBLE __map_const_iterator
class _LIBCPP_TYPE_VIS __map_const_iterator
{
_TreeIterator __i_;
@@ -657,14 +665,14 @@ public:
bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS __tree_const_iterator;
};
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE map
class _LIBCPP_TYPE_VIS map
{
public:
// types:
@@ -676,7 +684,7 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class _LIBCPP_VISIBLE value_compare
class _LIBCPP_TYPE_VIS value_compare
: public binary_function<value_type, value_type, bool>
{
friend class map;
@@ -713,8 +721,8 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __map_iterator<typename __base::iterator> iterator;
typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp = key_compare())
@@ -753,17 +761,36 @@ public:
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(const map& __m)
{
__tree_ = __m.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
map(map&& __m)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_STD::move(__m.__tree_))
: __tree_(_VSTD::move(__m.__tree_))
{
}
map(map&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -778,14 +805,6 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(initializer_list<value_type> __il)
{
@@ -793,7 +812,7 @@ public:
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
explicit map(const allocator_type& __a)
@@ -861,59 +880,29 @@ public:
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace() {return __tree_.__emplace_unique();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace(_A0&& __a0)
{return __tree_.__emplace_unique(_STD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
template <class ..._Args>
pair<iterator, bool>
emplace(_A0&& __a0, _Args&& ...__args);
emplace(_Args&& ...__args);
template <class ..._Args>
iterator
emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p)
{return __tree_.__emplace_hint_unique(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_unique(__p.__i_, _STD::forward<_A0>(__a0));}
pair<iterator, bool> insert(_Pp&& __p)
{return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __p)
{return __tree_.__insert_unique(_STD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_unique(__pos.__i_, _STD::forward<_P>(__p));}
iterator insert(const_iterator __pos, _Pp&& __p)
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -934,10 +923,14 @@ public:
insert(__e.__i_, *__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.__i_);}
_LIBCPP_INLINE_VISIBILITY
@@ -987,18 +980,28 @@ private:
typedef typename __base::__node_const_pointer __node_const_pointer;
typedef typename __base::__node_base_pointer __node_base_pointer;
typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
typedef __map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
__node_holder __construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<value_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<key_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
template <class _A0, class _A1, class ..._Args>
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(const key_type& __k);
@@ -1095,7 +1098,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(const_iterator __hint,
else if (__tree_.value_comp().key_comp()(__hint->first, __k)) // check after
{
// *__hint < __k
const_iterator __next = _STD::next(__hint);
const_iterator __next = _VSTD::next(__hint);
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
{
// *__hint < __k < *next(__hint)
@@ -1167,14 +1170,14 @@ map<_Key, _Tp, _Compare, _Allocator>::__find_equal_key(__node_base_const_pointer
template <class _Key, class _Tp, class _Compare, class _Allocator>
map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
: __tree_(_STD::move(__m.__tree_), __a)
: __tree_(_VSTD::move(__m.__tree_), __a)
{
if (__a != __m.get_allocator())
{
const_iterator __e = cend();
while (!__m.empty())
__tree_.__insert_unique(__e.__i_,
_STD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
}
}
@@ -1183,41 +1186,62 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0,
class>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
template <class _A0>
typename enable_if
<
is_constructible<pair<const _Key, _Tp>, _A0>::value,
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0>
typename enable_if
<
is_constructible<_Key, _A0>::value,
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class>
template <class _A0, class _A1, class ..._Args>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
_VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1231,12 +1255,12 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
return _VSTD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1268,7 +1292,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::move(__k));
__node_holder __h = __construct_node(_VSTD::move(__k));
__tree_.__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
@@ -1306,14 +1330,11 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
>
template <class ..._Args>
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
{
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1321,15 +1342,12 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
>
template <class ..._Args>
typename map<_Key, _Tp, _Compare, _Allocator>::iterator
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
_A0&& __a0, _Args&& ...__args)
_Args&& ...__args)
{
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
if (__r.__i_.__ptr_ == __h.get())
__h.release();
@@ -1344,7 +1362,7 @@ bool
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
{
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1353,7 +1371,7 @@ bool
operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1404,7 +1422,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_VISIBLE multimap
class _LIBCPP_TYPE_VIS multimap
{
public:
// types:
@@ -1416,7 +1434,7 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class _LIBCPP_VISIBLE value_compare
class _LIBCPP_TYPE_VIS value_compare
: public binary_function<value_type, value_type, bool>
{
friend class multimap;
@@ -1454,8 +1472,8 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __map_iterator<typename __base::iterator> iterator;
typedef __map_const_iterator<typename __base::const_iterator> const_iterator;
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp = key_compare())
@@ -1495,17 +1513,36 @@ public:
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(const multimap& __m)
{
__tree_ = __m.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multimap(multimap&& __m)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_STD::move(__m.__tree_))
: __tree_(_VSTD::move(__m.__tree_))
{
}
multimap(multimap&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _VSTD::move(__m.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -1520,21 +1557,14 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const allocator_type& __a)
@@ -1594,57 +1624,29 @@ public:
{return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator emplace() {return __tree_.__emplace_multi();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace(_A0&& __a0)
{return __tree_.__emplace_multi(_STD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
template <class ..._Args>
iterator
emplace(_A0&& __a0, _Args&& ...__args);
emplace(_Args&& ...__args);
template <class ..._Args>
iterator
emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p)
{return __tree_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
iterator insert(_Pp&& __p)
{return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __p)
{return __tree_.__insert_multi(_STD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_multi(__pos.__i_, _STD::forward<_P>(__p));}
iterator insert(const_iterator __pos, _Pp&& __p)
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1663,10 +1665,14 @@ public:
__tree_.__insert_multi(__e.__i_, *__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.__i_);}
_LIBCPP_INLINE_VISIBILITY
@@ -1713,18 +1719,28 @@ private:
typedef typename __base::__node_allocator __node_allocator;
typedef typename __base::__node_pointer __node_pointer;
typedef typename __base::__node_const_pointer __node_const_pointer;
typedef __map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _D> __node_holder;
typedef __map_node_destructor<__node_allocator> _Dp;
typedef unique_ptr<__node, _Dp> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
__node_holder __construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<value_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<key_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
template <class _A0, class _A1, class ..._Args>
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@@ -1733,14 +1749,14 @@ private:
template <class _Key, class _Tp, class _Compare, class _Allocator>
multimap<_Key, _Tp, _Compare, _Allocator>::multimap(multimap&& __m, const allocator_type& __a)
: __tree_(_STD::move(__m.__tree_), __a)
: __tree_(_VSTD::move(__m.__tree_), __a)
{
if (__a != __m.get_allocator())
{
const_iterator __e = cend();
while (!__m.empty())
__tree_.__insert_multi(__e.__i_,
_STD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
_VSTD::move(__m.__tree_.remove(__m.begin().__i_)->__value_));
}
}
@@ -1749,43 +1765,62 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0,
class // = typename enable_if<is_convertible<_A0, value_type>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
template <class _A0>
typename enable_if
<
is_constructible<pair<const _Key, _Tp>, _A0>::value,
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0>
typename enable_if
<
is_constructible<_Key, _A0>::value,
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class // = typename enable_if<is_convertible<_A0, key_type>::value>::type
>
template <class _A0, class _A1, class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_),
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
_VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1796,30 +1831,23 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
>
template <class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
{
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class ..._Args,
class //= typename enable_if<is_convertible<_A0, _Key>::value>::type
>
template <class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
_A0&& __a0,
_Args&& ...__args)
{
__node_holder __h = __construct_node(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...);
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
__h.release();
return __r;
@@ -1833,7 +1861,7 @@ bool
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
{
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1842,7 +1870,7 @@ bool
operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Tp, class _Compare, class _Allocator>

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ namespace std
class mutex
{
public:
mutex();
constexpr mutex() noexcept;
~mutex();
mutex(const mutex&) = delete;
@@ -44,7 +44,7 @@ public:
recursive_mutex& operator=(const recursive_mutex&) = delete;
void lock();
bool try_lock();
bool try_lock() noexcept;
void unlock();
typedef pthread_mutex_t* native_handle_type;
@@ -79,7 +79,7 @@ public:
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void lock();
bool try_lock();
bool try_lock() noexcept;
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
@@ -114,9 +114,9 @@ class unique_lock
{
public:
typedef Mutex mutex_type;
unique_lock();
unique_lock() noexcept;
explicit unique_lock(mutex_type& m);
unique_lock(mutex_type& m, defer_lock_t);
unique_lock(mutex_type& m, defer_lock_t) noexcept;
unique_lock(mutex_type& m, try_to_lock_t);
unique_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration>
@@ -128,8 +128,8 @@ public:
unique_lock(unique_lock const&) = delete;
unique_lock& operator=(unique_lock const&) = delete;
unique_lock(unique_lock&& u);
unique_lock& operator=(unique_lock&& u);
unique_lock(unique_lock&& u) noexcept;
unique_lock& operator=(unique_lock&& u) noexcept;
void lock();
bool try_lock();
@@ -141,16 +141,16 @@ public:
void unlock();
void swap(unique_lock& u);
mutex_type* release();
void swap(unique_lock& u) noexcept;
mutex_type* release() noexcept;
bool owns_lock() const;
explicit operator bool () const;
mutex_type* mutex() const;
bool owns_lock() const noexcept;
explicit operator bool () const noexcept;
mutex_type* mutex() const noexcept;
};
template <class Mutex>
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
template <class L1, class L2, class... L3>
int try_lock(L1&, L2&, L3&...);
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
struct once_flag
{
constexpr once_flag();
constexpr once_flag() noexcept;
once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete;
@@ -179,11 +179,15 @@ template<class Callable, class ...Args>
#include <tuple>
#endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE recursive_mutex
class _LIBCPP_TYPE_VIS recursive_mutex
{
pthread_mutex_t __m_;
@@ -197,15 +201,15 @@ private:
public:
void lock();
bool try_lock();
void unlock();
bool try_lock() _NOEXCEPT;
void unlock() _NOEXCEPT;
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return &__m_;}
};
class _LIBCPP_VISIBLE timed_mutex
class _LIBCPP_TYPE_VIS timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -220,14 +224,14 @@ private:
public:
void lock();
bool try_lock();
bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
@@ -247,7 +251,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
return false;
}
class _LIBCPP_VISIBLE recursive_timed_mutex
class _LIBCPP_TYPE_VIS recursive_timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -263,14 +267,14 @@ private:
public:
void lock();
bool try_lock();
bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
@@ -421,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
#endif // _LIBCPP_HAS_NO_VARIADICS
struct once_flag;
struct _LIBCPP_TYPE_VIS once_flag;
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Callable, class... _Args>
void call_once(once_flag&, _Callable&&, _Args&&...);
_LIBCPP_INLINE_VISIBILITY
void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable>
void call_once(once_flag&, _Callable);
_LIBCPP_INLINE_VISIBILITY
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_VISIBLE once_flag
struct _LIBCPP_TYPE_VIS once_flag
{
_LIBCPP_INLINE_VISIBILITY
// constexpr
once_flag() {}
_LIBCPP_CONSTEXPR
once_flag() _NOEXCEPT : __state_(0) {}
private:
once_flag(const once_flag&); // = delete;
@@ -460,23 +466,23 @@ private:
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F>
template <class _Fp>
class __call_once_param
{
_F __f_;
_Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
__execute(_Index());
}
@@ -485,23 +491,23 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_STD::move(_STD::get<0>(__f_)), _STD::move(_STD::get<_Indices>(__f_))...);
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
}
};
#else
template <class _F>
template <class _Fp>
class __call_once_param
{
_F __f_;
_Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
@@ -513,11 +519,11 @@ public:
#endif
template <class _F>
template <class _Fp>
void
__call_once_proxy(void* __vp)
{
__call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
(*__p)();
}
@@ -530,12 +536,12 @@ inline _LIBCPP_INLINE_VISIBILITY
void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
if (__flag.__state_ != ~0ul)
{
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_G> __p(_G(__decay_copy(_STD::forward<_Callable>(__func)),
__decay_copy(_STD::forward<_Args>(__args))...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
}
}

View File

@@ -56,7 +56,9 @@ void operator delete[](void* ptr, void*) noexcept;
#include <exception>
#include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace
{
@@ -81,31 +83,31 @@ public:
void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
} // std
_LIBCPP_VISIBLE void* operator new(std::size_t)
_LIBCPP_FUNC_VIS 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, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void*) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void* operator new[](std::size_t)
_LIBCPP_FUNC_VIS 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, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void*) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_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;}

View File

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

View File

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

View File

@@ -171,22 +171,26 @@ template <class T, class Container, class Compare>
#include <functional>
#include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class queue;
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS queue;
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_VISIBLE queue
class _LIBCPP_TYPE_VIS queue
{
public:
typedef _Container container_type;
@@ -211,7 +215,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_STD::move(__q.c)) {}
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -221,14 +225,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _STD::move(__q.c); return *this;}
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -254,13 +258,13 @@ public:
queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {}
: c(_VSTD::move(__q.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -282,12 +286,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -297,7 +301,7 @@ public:
void swap(queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(c, __q.c);
}
@@ -372,14 +376,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
struct _LIBCPP_TYPE_VIS 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 _LIBCPP_VISIBLE priority_queue
class _LIBCPP_TYPE_VIS priority_queue
{
public:
typedef _Container container_type;
@@ -408,7 +412,7 @@ public:
priority_queue(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
is_nothrow_move_constructible<value_compare>::value)
: c(_STD::move(__q.c)), comp(_STD::move(__q.comp)) {}
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -420,7 +424,7 @@ public:
priority_queue& operator=(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _STD::move(__q.c); comp = _STD::move(__q.comp); return *this;}
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -498,7 +502,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
: c(__c),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -507,10 +511,10 @@ template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
: c(_VSTD::move(__c)),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -523,7 +527,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
: c(__f, __l),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
@@ -536,7 +540,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
comp(__comp)
{
c.insert(c.end(), __f, __l);
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -547,11 +551,11 @@ inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
: c(_VSTD::move(__c)),
comp(__comp)
{
c.insert(c.end(), __f, __l);
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -589,7 +593,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
: c(__c, __a),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
@@ -602,7 +606,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
: c(__q.c, __a),
comp(__q.comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -615,10 +619,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
: c(_STD::move(__c), __a),
: c(_VSTD::move(__c), __a),
comp(__comp)
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
@@ -628,10 +632,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
: c(_STD::move(__q.c), __a),
comp(_STD::move(__q.comp))
: c(_VSTD::move(__q.c), __a),
comp(_VSTD::move(__q.comp))
{
_STD::make_heap(c.begin(), c.end(), comp);
_VSTD::make_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -642,7 +646,7 @@ void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{
c.push_back(__v);
_STD::push_heap(c.begin(), c.end(), comp);
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -652,8 +656,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{
c.push_back(_STD::move(__v));
_STD::push_heap(c.begin(), c.end(), comp);
c.push_back(_VSTD::move(__v));
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -664,8 +668,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{
c.emplace_back(_STD::forward<_Args>(__args)...);
_STD::push_heap(c.begin(), c.end(), comp);
c.emplace_back(_VSTD::forward<_Args>(__args)...);
_VSTD::push_heap(c.begin(), c.end(), comp);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -676,7 +680,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::pop()
{
_STD::pop_heap(c.begin(), c.end(), comp);
_VSTD::pop_heap(c.begin(), c.end(), comp);
c.pop_back();
}
@@ -687,7 +691,7 @@ 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);
}
@@ -703,7 +707,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
struct _LIBCPP_TYPE_VIS 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

@@ -70,7 +70,11 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits>
#include <type_traits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -88,6 +92,12 @@ struct __static_gcd<_Xp, 0>
static const intmax_t value = _Xp;
};
template <>
struct __static_gcd<0, 0>
{
static const intmax_t value = 1;
};
// __static_lcm
template <intmax_t _Xp, intmax_t _Yp>
@@ -221,7 +231,7 @@ public:
};
template <intmax_t _Num, intmax_t _Den = 1>
class _LIBCPP_VISIBLE ratio
class _LIBCPP_TYPE_VIS ratio
{
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
static_assert(_Den != 0, "ratio divide by 0");
@@ -282,7 +292,7 @@ template <class _R1, class _R2> using ratio_multiply
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_multiply
struct _LIBCPP_TYPE_VIS ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -309,7 +319,7 @@ template <class _R1, class _R2> using ratio_divide
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_divide
struct _LIBCPP_TYPE_VIS ratio_divide
: public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -344,7 +354,7 @@ template <class _R1, class _R2> using ratio_add
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_add
struct _LIBCPP_TYPE_VIS ratio_add
: public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -379,7 +389,7 @@ template <class _R1, class _R2> using ratio_subtract
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_subtract
struct _LIBCPP_TYPE_VIS ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -387,11 +397,11 @@ struct _LIBCPP_VISIBLE ratio_subtract
// ratio_equal
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_equal
struct _LIBCPP_TYPE_VIS ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_not_equal
struct _LIBCPP_TYPE_VIS ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
// ratio_less
@@ -404,27 +414,27 @@ struct __ratio_less1
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Q>
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
{
static const bool value = false;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
{
static const bool value = !_Odd;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
{
static const bool value = _Odd;
};
template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
{
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
ratio<_R2::den, _M2>, !_Odd>::value;
@@ -450,19 +460,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_less
struct _LIBCPP_TYPE_VIS ratio_less
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_less_equal
struct _LIBCPP_TYPE_VIS ratio_less_equal
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_greater
struct _LIBCPP_TYPE_VIS ratio_greater
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_greater_equal
struct _LIBCPP_TYPE_VIS 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

View File

@@ -106,7 +106,9 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
#include <__config>
#include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -194,7 +196,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {}
template <class _OuterA2,
@@ -214,8 +216,8 @@ protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())),
__inner_(_STD::move(__other.inner_allocator())) {}
: outer_allocator_type(_VSTD::move(__other.outer_allocator())),
__inner_(_VSTD::move(__other.inner_allocator())) {}
template <class _OuterA2,
class = typename enable_if<
@@ -224,7 +226,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
@@ -274,7 +276,7 @@ protected:
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2,
class = typename enable_if<
@@ -292,7 +294,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT
@@ -354,7 +356,7 @@ struct __outermost<_Alloc, true>
{
typedef typename remove_reference
<
decltype(_STD::declval<_Alloc>().outer_allocator())
decltype(_VSTD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY
@@ -363,7 +365,7 @@ struct __outermost<_Alloc, true>
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
class _LIBCPP_TYPE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
@@ -414,7 +416,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2,
class = typename enable_if<
@@ -431,7 +433,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_STD::move(__other)) {}
: base(_VSTD::move(__other)) {}
// ~scoped_allocator_adaptor() = default;
@@ -471,7 +473,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _STD::forward<_Args>(__args)...);}
__p, _VSTD::forward<_Args>(__args)...);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p)
@@ -494,7 +496,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT
: base(_STD::forward<_OuterA2>(__o), __i) {}
: base(_VSTD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
@@ -505,7 +507,7 @@ private:
(
_OM()(outer_allocator()),
__p,
_STD::forward<_Args>(__args)...
_VSTD::forward<_Args>(__args)...
);
}
@@ -520,7 +522,7 @@ private:
__p,
allocator_arg,
inner_allocator(),
_STD::forward<_Args>(__args)...
_VSTD::forward<_Args>(__args)...
);
}
@@ -533,7 +535,7 @@ private:
(
_OM()(outer_allocator()),
__p,
_STD::forward<_Args>(__args)...,
_VSTD::forward<_Args>(__args)...,
inner_allocator()
);
}

View File

@@ -338,13 +338,15 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
#include <__tree>
#include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_VISIBLE set
class _LIBCPP_TYPE_VIS set
{
public:
// types:
@@ -370,8 +372,8 @@ 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())
@@ -408,11 +410,18 @@ public:
insert(__s.begin(), __s.end());
}
_LIBCPP_INLINE_VISIBILITY
set& operator=(const set& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set(set&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_STD::move(__s.__tree_)) {}
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -430,6 +439,7 @@ public:
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)
@@ -451,13 +461,14 @@ public:
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__s.__tree_);
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -505,11 +516,11 @@ public:
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v)
@@ -517,7 +528,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_STD::move(__v));}
{return __tree_.__insert_unique(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
@@ -525,7 +536,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _STD::move(__v));}
{return __tree_.__insert_unique(__p, _VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -535,9 +546,11 @@ public:
__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);}
@@ -593,13 +606,13 @@ public:
template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a)
: __tree_(_VSTD::move(__s.__tree_), __a)
{
if (__a != __s.get_allocator())
{
const_iterator __e = cend();
while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
}
}
@@ -611,7 +624,7 @@ bool
operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
{
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Key, class _Compare, class _Allocator>
@@ -620,7 +633,7 @@ bool
operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>
@@ -672,7 +685,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_VISIBLE multiset
class _LIBCPP_TYPE_VIS multiset
{
public:
// types:
@@ -698,8 +711,8 @@ 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
@@ -738,11 +751,18 @@ public:
insert(__s.begin(), __s.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(const multiset& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_STD::move(__s.__tree_)) {}
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a)
@@ -757,6 +777,7 @@ public:
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)
@@ -778,13 +799,14 @@ public:
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{
__tree_ = _STD::move(__s.__tree_);
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -832,11 +854,11 @@ public:
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
{return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v)
@@ -844,7 +866,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
{return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
@@ -852,7 +874,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
{return __tree_.__insert_multi(_VSTD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -862,9 +884,11 @@ public:
__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);}
@@ -920,13 +944,13 @@ public:
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
: __tree_(_STD::move(__s.__tree_), __a)
: __tree_(_VSTD::move(__s.__tree_), __a)
{
if (__a != __s.get_allocator())
{
const_iterator __e = cend();
while (!__s.empty())
insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_));
}
}
@@ -938,7 +962,7 @@ bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
{
return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin());
}
template <class _Key, class _Compare, class _Allocator>
@@ -947,7 +971,7 @@ bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
{
return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
}
template <class _Key, class _Compare, class _Allocator>

View File

@@ -175,14 +175,18 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream>
#include <string>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_stringbuf
class _LIBCPP_TYPE_VIS basic_stringbuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -256,17 +260,36 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
: __mode_(__rhs.__mode_)
{
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
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_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout);
this->pbump(__nout);
__hm_ = __p + __hm;
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
ptrdiff_t __binp = -1;
ptrdiff_t __ninp = -1;
ptrdiff_t __einp = -1;
if (__rhs.eback() != nullptr)
{
__binp = __rhs.eback() - __p;
__ninp = __rhs.gptr() - __p;
__einp = __rhs.egptr() - __p;
}
ptrdiff_t __bout = -1;
ptrdiff_t __nout = -1;
ptrdiff_t __eout = -1;
if (__rhs.pbase() != nullptr)
{
__bout = __rhs.pbase() - __p;
__nout = __rhs.pptr() - __p;
__eout = __rhs.epptr() - __p;
}
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__str_ = _VSTD::move(__rhs.__str_);
__p = const_cast<char_type*>(__str_.data());
if (__binp != -1)
this->setg(__p + __binp, __p + __ninp, __p + __einp);
if (__bout != -1)
{
this->setp(__p + __bout, __p + __eout);
this->pbump(__nout);
}
__hm_ = __hm == -1 ? nullptr : __p + __hm;
__p = const_cast<char_type*>(__rhs.__str_.data());
__rhs.setg(__p, __p, __p);
__rhs.setp(__p, __p);
@@ -278,18 +301,37 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>&
basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
{
ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
ptrdiff_t __binp = -1;
ptrdiff_t __ninp = -1;
ptrdiff_t __einp = -1;
if (__rhs.eback() != nullptr)
{
__binp = __rhs.eback() - __p;
__ninp = __rhs.gptr() - __p;
__einp = __rhs.egptr() - __p;
}
ptrdiff_t __bout = -1;
ptrdiff_t __nout = -1;
ptrdiff_t __eout = -1;
if (__rhs.pbase() != nullptr)
{
__bout = __rhs.pbase() - __p;
__nout = __rhs.pptr() - __p;
__eout = __rhs.epptr() - __p;
}
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__str_ = _VSTD::move(__rhs.__str_);
__p = const_cast<char_type*>(__str_.data());
if (__binp != -1)
this->setg(__p + __binp, __p + __ninp, __p + __einp);
if (__bout != -1)
{
this->setp(__p + __bout, __p + __eout);
this->pbump(__nout);
}
__hm_ = __hm == -1 ? nullptr : __p + __hm;
__mode_ = __rhs.__mode_;
__str_ = _STD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout);
this->pbump(__nout);
__hm_ = __p + __hm;
__p = const_cast<char_type*>(__rhs.__str_.data());
__rhs.setg(__p, __p, __p);
__rhs.setp(__p, __p);
@@ -304,28 +346,74 @@ template <class _CharT, class _Traits, class _Allocator>
void
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
{
ptrdiff_t __rninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __reinp = __rhs.egptr() - __rhs.eback();
ptrdiff_t __rnout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __reout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __rhm = __rhs.__hm_ - __rhs.pbase();
ptrdiff_t __lninp = this->gptr() - this->eback();
ptrdiff_t __leinp = this->egptr() - this->eback();
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_);
char_type* __p = const_cast<char_type*>(__rhs.__str_.data());
ptrdiff_t __rbinp = -1;
ptrdiff_t __rninp = -1;
ptrdiff_t __reinp = -1;
if (__rhs.eback() != nullptr)
{
__rbinp = __rhs.eback() - __p;
__rninp = __rhs.gptr() - __p;
__reinp = __rhs.egptr() - __p;
}
ptrdiff_t __rbout = -1;
ptrdiff_t __rnout = -1;
ptrdiff_t __reout = -1;
if (__rhs.pbase() != nullptr)
{
__rbout = __rhs.pbase() - __p;
__rnout = __rhs.pptr() - __p;
__reout = __rhs.epptr() - __p;
}
ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__p = const_cast<char_type*>(__str_.data());
ptrdiff_t __lbinp = -1;
ptrdiff_t __lninp = -1;
ptrdiff_t __leinp = -1;
if (this->eback() != nullptr)
{
__lbinp = this->eback() - __p;
__lninp = this->gptr() - __p;
__leinp = this->egptr() - __p;
}
ptrdiff_t __lbout = -1;
ptrdiff_t __lnout = -1;
ptrdiff_t __leout = -1;
if (this->pbase() != nullptr)
{
__lbout = this->pbase() - __p;
__lnout = this->pptr() - __p;
__leout = this->epptr() - __p;
}
ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
_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);
this->setp(__p, __p + __reout);
this->pbump(__rnout);
__hm_ = __p + __rhm;
__p = const_cast<char_type*>(__str_.data());
if (__rbinp != -1)
this->setg(__p + __rbinp, __p + __rninp, __p + __reinp);
else
this->setg(nullptr, nullptr, nullptr);
if (__rbout != -1)
{
this->setp(__p + __rbout, __p + __reout);
this->pbump(__rnout);
}
else
this->setp(nullptr, nullptr);
__hm_ = __rhm == -1 ? nullptr : __p + __rhm;
__p = const_cast<char_type*>(__rhs.__str_.data());
__rhs.setg(__p, __p + __lninp, __p + __leinp);
__rhs.setp(__p, __p + __leout);
__rhs.pbump(__lnout);
__rhs.__hm_ = __p + __lhm;
if (__lbinp != -1)
__rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp);
else
__rhs.setg(nullptr, nullptr, nullptr);
if (__lbout != -1)
{
__rhs.setp(__p + __lbout, __p + __leout);
__rhs.pbump(__lnout);
}
else
__rhs.setp(nullptr, nullptr);
__rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
locale __tl = __rhs.getloc();
__rhs.pubimbue(this->getloc());
this->pubimbue(__tl);
@@ -451,7 +539,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
__hm_ = _STD::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 +613,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_istringstream
class _LIBCPP_TYPE_VIS basic_istringstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -582,8 +670,8 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -592,8 +680,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>&
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
{
basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
@@ -644,7 +732,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_ostringstream
class _LIBCPP_TYPE_VIS basic_ostringstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -701,8 +789,8 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -711,8 +799,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>&
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
{
basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
@@ -763,7 +851,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_VISIBLE basic_stringstream
class _LIBCPP_TYPE_VIS basic_stringstream
: public basic_iostream<_CharT, _Traits>
{
public:
@@ -820,8 +908,8 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
}
@@ -830,8 +918,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>&
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
{
basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}

View File

@@ -85,22 +85,26 @@ template <class T, class Container>
#include <__config>
#include <deque>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class stack;
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS stack;
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_VISIBLE stack
class _LIBCPP_TYPE_VIS stack
{
public:
typedef _Container container_type;
@@ -125,7 +129,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_STD::move(__q.c)) {}
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -135,14 +139,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _STD::move(__q.c); return *this;}
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -168,13 +172,13 @@ public:
stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
: c(_VSTD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__s.c), __a) {}
: c(_VSTD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -190,12 +194,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
{c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -205,7 +209,7 @@ public:
void swap(stack& __s)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{
using _STD::swap;
using _VSTD::swap;
swap(c, __s.c);
}
@@ -278,7 +282,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

View File

@@ -46,7 +46,9 @@ public:
#include <exception>
#include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace
{

View File

@@ -112,12 +112,14 @@ protected:
#include <iosfwd>
#include <ios>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_VISIBLE basic_streambuf
class _LIBCPP_TYPE_VIS basic_streambuf
{
public:
// types:
@@ -399,13 +401,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>
@@ -459,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode __which)
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
ios_base::openmode)
{
return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
{
return pos_type(off_type(-1));
}
@@ -538,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
{
if (__nout_ < __eout_)
*__nout_++ = *__s;
else if (overflow(*__s) == __eof)
else if (overflow(traits_type::to_int_type(*__s)) == __eof)
break;
}
return __i;
@@ -546,16 +548,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
basic_streambuf<_CharT, _Traits>::overflow(int_type)
{
return traits_type::eof();
}
extern template class basic_streambuf<char>;
extern template class basic_streambuf<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>)
extern template class basic_ios<char>;
extern template class basic_ios<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>)
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -131,11 +131,13 @@ private:
#include <ostream>
#include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE strstreambuf
class _LIBCPP_TYPE_VIS strstreambuf
: public streambuf
{
public:
@@ -150,7 +152,9 @@ public:
strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstreambuf(strstreambuf&& __rhs);
_LIBCPP_INLINE_VISIBILITY
strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -187,7 +191,44 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
class _LIBCPP_VISIBLE 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_TYPE_VIS istrstream
: public istream
{
public:
@@ -207,8 +248,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs)
: istream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: istream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
istream::set_rdbuf(&__sb_);
}
@@ -216,8 +257,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs)
{
istream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
istream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -240,7 +281,7 @@ private:
strstreambuf __sb_;
};
class _LIBCPP_VISIBLE ostrstream
class _LIBCPP_TYPE_VIS ostrstream
: public ostream
{
public:
@@ -256,8 +297,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs)
: ostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: ostream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
ostream::set_rdbuf(&__sb_);
}
@@ -265,8 +306,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs)
{
ostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
ostream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -293,7 +334,7 @@ private:
strstreambuf __sb_; // exposition only
};
class _LIBCPP_VISIBLE strstream
class _LIBCPP_TYPE_VIS strstream
: public iostream
{
public:
@@ -316,8 +357,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs)
: iostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
: iostream(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
{
iostream::set_rdbuf(&__sb_);
}
@@ -325,8 +366,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs)
{
iostream::operator=(_STD::move(__rhs));
__sb_ = _STD::move(__rhs.__sb_);
iostream::operator=(_VSTD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

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

View File

@@ -0,0 +1,38 @@
#define iswalpha sun_iswalpha
#define iswupper sun_iswupper
#define iswlower sun_iswlower
#define iswdigit sun_iswdigit
#define iswxdigit sun_iswxdigit
#define iswalnum sun_iswalnum
#define iswspace sun_iswspace
#define iswpunct sun_iswpunct
#define iswprint sun_iswprint
#define iswgraph sun_iswgraph
#define iswcntrl sun_iswcntrl
#define iswctype sun_iswctype
#define towlower sun_towlower
#define towupper sun_towupper
#define wcswcs sun_wcswcs
#define wcswidth sun_wcswidth
#define wcwidth sun_wcwidth
#define wctype sun_wctype
#define _WCHAR_T 1
#include_next "wchar.h"
#undef iswalpha
#undef iswupper
#undef iswlower
#undef iswdigit
#undef iswxdigit
#undef iswalnum
#undef iswspace
#undef iswpunct
#undef iswprint
#undef iswgraph
#undef iswcntrl
#undef iswctype
#undef towlower
#undef towupper
#undef wcswcs
#undef wcswidth
#undef wcwidth
#undef wctype

View File

@@ -0,0 +1,146 @@
////////////////////////////////////////////////////////////////////////////////
// Minimal xlocale implementation for Solaris. This implements the subset of
// the xlocale APIs that libc++ depends on.
////////////////////////////////////////////////////////////////////////////////
#ifndef __XLOCALE_H_INCLUDED
#define __XLOCALE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _LC_locale_t* locale_t;
#define LC_COLLATE_MASK (1<<0)
#define LC_CTYPE_MASK (1<<1)
#define LC_MESSAGES_MASK (1<<2)
#define LC_MONETARY_MASK (1<<3)
#define LC_NUMERIC_MASK (1<<4)
#define LC_TIME_MASK (1<<5)
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
size_t __mb_cur_max(locale_t l);
#define MB_CUR_MAX_L(l) __mb_cur_max(l)
locale_t newlocale(int mask, const char * locale, locale_t base);
void freelocale(locale_t loc);
wint_t btowc_l(int __c, locale_t __l);
int wctob_l(wint_t __c, locale_t __l);
size_t wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l);
size_t mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
mbstate_t *__ps, locale_t __l);
int mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l);
size_t mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l);
struct lconv *localeconv_l(locale_t __l);
size_t mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l);
int sprintf_l(char *__s, locale_t __l, const char *__format, ...);
int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
int isalnum_l(int,locale_t);
int isalpha_l(int,locale_t);
int isblank_l(int,locale_t);
int iscntrl_l(int,locale_t);
int isdigit_l(int,locale_t);
int isgraph_l(int,locale_t);
int islower_l(int,locale_t);
int isprint_l(int,locale_t);
int ispunct_l(int,locale_t);
int isspace_l(int,locale_t);
int isupper_l(int,locale_t);
int isxdigit_l(int,locale_t);
int iswalnum_l(wchar_t,locale_t);
int iswalpha_l(wchar_t,locale_t);
int iswblank_l(wchar_t,locale_t);
int iswcntrl_l(wchar_t,locale_t);
int iswdigit_l(wchar_t,locale_t);
int iswgraph_l(wchar_t,locale_t);
int iswlower_l(wchar_t,locale_t);
int iswprint_l(wchar_t,locale_t);
int iswpunct_l(wchar_t,locale_t);
int iswspace_l(wchar_t,locale_t);
int iswupper_l(wchar_t,locale_t);
int iswxdigit_l(wchar_t,locale_t);
int iswctype_l(wint_t, wctype_t, locale_t);
int toupper_l(int __c, locale_t __l);
int tolower_l(int __c, locale_t __l);
wint_t towupper_l(wint_t __c, locale_t __l);
wint_t towlower_l(wint_t __c, locale_t __l);
int strcoll_l(const char *__s1, const char *__s2, locale_t __l);
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t __l);
size_t strftime_l(char *__s, size_t __size, const char *__fmt, const struct tm
*__tm, locale_t __l);
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t __l);
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
locale_t __l);
size_t
mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc);
size_t
wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src,
size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc);
locale_t __cloc(void);
// FIXME: These are quick-and-dirty hacks to make things pretend to work
static inline
long long strtoll_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoll(__nptr, __endptr, __base);
}
static inline
long strtol_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtol(__nptr, __endptr, __base);
}
static inline
long double strtold_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtold(__nptr, __endptr);
}
static inline
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoull(__nptr, __endptr, __base);
}
static inline
unsigned long strtoul_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoul(__nptr, __endptr, __base);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -0,0 +1,79 @@
// -*- C++ -*-
//===--------------------- support/win32/limits_win32.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // ymath.h works correctly
#include <float.h> // limit constants
#define __FLT_MANT_DIG__ FLT_MANT_DIG
#define __FLT_DIG__ FLT_DIG
#define __FLT_RADIX__ FLT_RADIX
#define __FLT_MIN_EXP__ FLT_MIN_EXP
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
#define __FLT_MAX_EXP__ FLT_MAX_EXP
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
#define __FLT_MIN__ FLT_MIN
#define __FLT_MAX__ FLT_MAX
#define __FLT_EPSILON__ FLT_EPSILON
// predefined by MinGW GCC
#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
#define __DBL_MANT_DIG__ DBL_MANT_DIG
#define __DBL_DIG__ DBL_DIG
#define __DBL_RADIX__ DBL_RADIX
#define __DBL_MIN_EXP__ DBL_MIN_EXP
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
#define __DBL_MAX_EXP__ DBL_MAX_EXP
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
#define __DBL_MIN__ DBL_MIN
#define __DBL_MAX__ DBL_MAX
#define __DBL_EPSILON__ DBL_EPSILON
// predefined by MinGW GCC
#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
#define __LDBL_DIG__ LDBL_DIG
#define __LDBL_RADIX__ LDBL_RADIX
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
#define __LDBL_MIN__ LDBL_MIN
#define __LDBL_MAX__ LDBL_MAX
#define __LDBL_EPSILON__ LDBL_EPSILON
// predefined by MinGW GCC
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
// __builtin replacements/workarounds
#include <math.h> // HUGE_VAL
#include <ymath.h> // internal MSVC header providing the needed functionality
#define __builtin_huge_val() HUGE_VAL
#define __builtin_huge_valf() _FInf._Float
#define __builtin_huge_vall() _LInf._Long_double
#define __builtin_nan(__dummy) _Nan._Double
#define __builtin_nanf(__dummy) _FNan._Float
#define __builtin_nanl(__dummmy) _LNan._Long_double
#define __builtin_nans(__dummy) _Snan._Double
#define __builtin_nansf(__dummy) _FSnan._Float
#define __builtin_nansl(__dummy) _LSnan._Long_double
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H

View File

@@ -0,0 +1,129 @@
// -*- 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
inline _LIBCPP_INLINE_VISIBILITY
int
islower_l(int c, _locale_t loc)
{
return _islower_l((int)c, loc);
}
inline _LIBCPP_INLINE_VISIBILITY
int
isupper_l(int c, _locale_t loc)
{
return _isupper_l((int)c, loc);
}
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l
#define strxfrm_l _strxfrm_l
#define wcscoll_l _wcscoll_l
#define wcsxfrm_l _wcsxfrm_l
#define toupper_l _toupper_l
#define tolower_l _tolower_l
#define iswspace_l _iswspace_l
#define iswprint_l _iswprint_l
#define iswcntrl_l _iswcntrl_l
#define iswupper_l _iswupper_l
#define iswlower_l _iswlower_l
#define iswalpha_l _iswalpha_l
#define iswdigit_l _iswdigit_l
#define iswpunct_l _iswpunct_l
#define iswxdigit_l _iswxdigit_l
#define towupper_l _towupper_l
#define towlower_l _towlower_l
#define strftime_l _strftime_l
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
// not-so-pressing FIXME: use locale to determine blank characters
inline int isblank_l( int c, locale_t /*loc*/ )
{
return ( c == ' ' || c == '\t' );
}
inline int iswblank_l( wint_t c, locale_t /*loc*/ )
{
return ( c == L' ' || c == L'\t' );
}
#ifdef _MSC_VER
inline int isblank( int c, locale_t /*loc*/ )
{ return ( c == ' ' || c == '\t' ); }
inline int iswblank( wint_t c, locale_t /*loc*/ )
{ return ( c == L' ' || c == L'\t' ); }
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

@@ -0,0 +1,113 @@
// -*- C++ -*-
//===---------------------- support/win32/math_win32.h --------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#include <math.h>
typedef float float_t;
typedef double double_t;
_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
{
return _finite(num) != 0;
}
_LIBCPP_ALWAYS_INLINE bool isinf( double num )
{
return !isfinite(num) && !_isnan(num);
}
_LIBCPP_ALWAYS_INLINE bool isnan( double num )
{
return _isnan(num) != 0;
}
_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
{
int class_ = _fpclass(num);
return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
}
_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x > y;
}
_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x >= y;
}
_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x < y;
}
_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
{
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
else return x <= y;
}
_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
{
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
else return x < y || x > y;
}
_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
{
return isnan(x) || isnan(y);
}
_LIBCPP_ALWAYS_INLINE bool signbit( double num )
{
switch(_fpclass(num))
{
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
case _FPCLASS_NINF:
case _FPCLASS_NN:
case _FPCLASS_ND:
case _FPCLASS_NZ:
return true;
case _FPCLASS_PZ:
case _FPCLASS_PD:
case _FPCLASS_PN:
case _FPCLASS_PINF:
return false;
}
return false;
}
_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
{
return (signbit (x) != signbit (y) ? - x : x);
}
_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
{
return ::_copysign(x,y);
}
_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
{
return ::_copysignl(x,y);
}
_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
{
return _fpclass(num);
}
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H

View File

@@ -0,0 +1,115 @@
// -*- C++ -*-
//===----------------------- support/win32/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
/*
Functions and constants used in libc++ that are missing from the Windows C library.
*/
#include <__config>
#include <wchar.h> // mbstate_t
#include <stdio.h> // _snwprintf
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
#define vfscnaf fscanf
int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
int asprintf( char **sptr, const char *__restrict fmt, ...);
//int vfscanf( FILE *__restrict stream, const char *__restrict format,
// va_list arg);
size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
size_t nmc, size_t len, mbstate_t *__restrict ps );
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
size_t nwc, size_t len, mbstate_t *__restrict ps );
#if defined(_MSC_VER)
#define snprintf _snprintf
#include <xlocinfo.h>
#define atoll _atoi64
#define strtoll _strtoi64
#define strtoull _strtoui64
#define wcstoll _wcstoi64
#define wcstoull _wcstoui64
_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
{ return _Stof(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
{ return _Stod(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
{ return _Stold(nptr, endptr, 0); }
#define _Exit _exit
#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
#include <intrin.h>
_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
static const unsigned int m1 = 0x55555555; //binary: 0101...
static const unsigned int m2 = 0x33333333; //binary: 00110011..
static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
return __builtin_popcount(static_cast<int>(x));
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
}
_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
{
DWORD r = 0;
_BitScanReverse(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
{ return __builtin_ctz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
{
DWORD r = 0;
_BitScanReverse64(&r, x);
return static_cast<int>(r);
}
_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
{
DWORD r = 0;
_BitScanForward(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
{ return __builtin_clz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
{
DWORD r = 0;
_BitScanForward64(&r, x);
return static_cast<int>(r);
}
#endif // !__clang__
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -223,29 +223,30 @@ template <> struct hash<std::error_code>;
#include <stdexcept>
#include <__functional_base>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_code_enum
struct _LIBCPP_TYPE_VIS is_error_code_enum
: public false_type {};
// is_error_condition_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_condition_enum
struct _LIBCPP_TYPE_VIS 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
_LIBCPP_DECLARE_STRONG_ENUM(errc)
{
enum _ {
address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL,
@@ -341,38 +342,32 @@ enum _ {
value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE
};
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc>
: true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc::__lx>
: true_type { };
#endif
class error_condition;
class error_code;
class _LIBCPP_TYPE_VIS error_condition;
class _LIBCPP_TYPE_VIS error_code;
// class error_category
class __do_message;
class _LIBCPP_HIDDEN __do_message;
class _LIBCPP_VISIBLE error_category
class _LIBCPP_TYPE_VIS error_category
{
public:
virtual ~error_category() _NOEXCEPT;
private:
error_category() _NOEXCEPT;
private:
error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete;
@@ -392,7 +387,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
friend class __do_message;
friend class _LIBCPP_HIDDEN __do_message;
};
class _LIBCPP_HIDDEN __do_message
@@ -405,7 +400,7 @@ public:
const error_category& generic_category() _NOEXCEPT;
const error_category& system_category() _NOEXCEPT;
class _LIBCPP_VISIBLE error_condition
class _LIBCPP_TYPE_VIS error_condition
{
int __val_;
const error_category* __cat_;
@@ -417,10 +412,10 @@ public:
error_condition(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
template <class _E>
template <class _Ep>
_LIBCPP_ALWAYS_INLINE
error_condition(_E __e,
typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
error_condition(_Ep __e,
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_condition(__e);}
@@ -431,14 +426,14 @@ public:
__cat_ = &__cat;
}
template <class _E>
template <class _Ep>
_LIBCPP_ALWAYS_INLINE
typename enable_if
<
is_error_condition_enum<_E>::value,
is_error_condition_enum<_Ep>::value,
error_condition&
>::type
operator=(_E __e) _NOEXCEPT
operator=(_Ep __e) _NOEXCEPT
{*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
@@ -456,7 +451,7 @@ public:
string message() const;
_LIBCPP_ALWAYS_INLINE
//explicit
_LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
@@ -472,12 +467,12 @@ bool
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{
return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value();
|| (__x.category() == __y.category() && __x.value() < __y.value());
}
// error_code
class _LIBCPP_VISIBLE error_code
class _LIBCPP_TYPE_VIS error_code
{
int __val_;
const error_category* __cat_;
@@ -489,10 +484,10 @@ public:
error_code(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
template <class _E>
template <class _Ep>
_LIBCPP_ALWAYS_INLINE
error_code(_E __e,
typename enable_if<is_error_code_enum<_E>::value>::type* = 0
error_code(_Ep __e,
typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_code(__e);}
@@ -503,14 +498,14 @@ public:
__cat_ = &__cat;
}
template <class _E>
template <class _Ep>
_LIBCPP_ALWAYS_INLINE
typename enable_if
<
is_error_code_enum<_E>::value,
is_error_code_enum<_Ep>::value,
error_code&
>::type
operator=(_E __e) _NOEXCEPT
operator=(_Ep __e) _NOEXCEPT
{*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
@@ -533,7 +528,7 @@ public:
string message() const;
_LIBCPP_ALWAYS_INLINE
//explicit
_LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
@@ -549,7 +544,7 @@ bool
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{
return __x.category() < __y.category()
|| __x.category() == __y.category() && __x.value() < __y.value();
|| (__x.category() == __y.category() && __x.value() < __y.value());
}
inline _LIBCPP_INLINE_VISIBILITY
@@ -602,7 +597,7 @@ operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
template <>
struct _LIBCPP_VISIBLE hash<error_code>
struct _LIBCPP_TYPE_VIS hash<error_code>
: public unary_function<error_code, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -614,7 +609,7 @@ struct _LIBCPP_VISIBLE hash<error_code>
// system_error
class _LIBCPP_VISIBLE system_error
class _LIBCPP_TYPE_VIS system_error
: public runtime_error
{
error_code __ec_;

View File

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

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