Compare commits

..

227 Commits

Author SHA1 Message Date
NAKAMURA Takumi
b13c5fc1a9 Suppress condition/mutex/thread stuff. 2011-05-01 21:53:00 +09:00
NAKAMURA Takumi
4e66976786 Suppress test/localization. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8074505c5d test: Suppress exception-required tests. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
efdce87766 Suppress -fPIC. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
fd9aadef51 test: Add _win32_seterrormode.fail.cpp to silence Exception diaalogs on Windows desktop. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
6d50da017f test/utilities/type.index/type.index.members/lt.pass.cpp: I don't understand what it is! 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
ae185c2977 test: wchar_t might be "unsigned short" for Win32 targets. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
79356f49bd fstream: fseeko, ftello 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
9117a0a174 test/diagnostics/*err*: Disable 4 tests lack of system_error. 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
591952787f chrono.cpp: suppress clock_gettime() 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
8082261d2c codecvt<wchar_t, char, mbstate_t>::do_unshift(): return noconv 2011-05-01 21:52:59 +09:00
NAKAMURA Takumi
b101cb1408 locale.cpp: tweak strftime_l to strftime 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
cb5181c5a2 locale.cpp: disabled wip 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
c3089afe8d locale.cpp: Tweak for Win32, newlocale() and freelocale(). 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
be2e6396c3 locale.cpp: Tweak for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
0428d2a325 locale: suppress long double 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5ee0769693 locale: Add bogus asprintf() for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
164d6b8bda locale: Win32 tweak. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
117920302f locale: Supress NLS things. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
16acf2ae93 system_error: FIXME: WS2 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
f9d6039245 string.cpp: SECURE_API and swprintf_s() 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4cf42dadd4 __locale: _isctype 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
51ae55e510 __locale: Add LC_XXX_MASK for Win32. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
aeaeb51343 __locale: std::uint32_t may be available here. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
b05cdf81ba test/lit.cfg: Remove -nodefaultlibs for mingw32-clang. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
4a796725e0 test/lit.cfg: Fix suffix. 2011-05-01 21:52:58 +09:00
NAKAMURA Takumi
5a9ed2486b __config: mingw32 no-excpetions 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
beb21a0990 __config: #define _LIBCPP_VISIBILITY_TAG 0 // on mingw32. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
12f526f712 __config: Add endian check based on target processor. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
bd94c33cc3 __config: Tweak yvals.h macro to avoid symbol clashes. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9dc188d64d new.cpp: split new and delete into 8 files. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
9055a62ed4 new: move __new_hander to _STD. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
17c8c462ae exception.cpp: std::uncaught_exception() may return false with -fno-exceptions. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
ec97728ba0 test/utilities: Fix LLP64-aware. 2011-05-01 21:52:57 +09:00
NAKAMURA Takumi
cb430f3a47 test: Mark 316 tests as XFAIL to rename to xfail.pass.cpp. 2011-05-01 21:52:09 +09:00
NAKAMURA Takumi
d3665e1d9d test/lit.cfg: Add .xfail.pass.cpp, to expect compiling successfully and to fail to run. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
6911fb59fd Mark 218 tests as fail to compile lack of C++0x features. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
a177c5da7b test/lit.cfg: Python-2.4 does not accept "delete" in tempfile.NamedTemporaryFile. 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
352c9e1a46 __std_stream: Fix error checking in __stdoutbuf<_CharT>::sync(). 2011-05-01 21:52:08 +09:00
NAKAMURA Takumi
710f61ba2a include/__locale: Tweak __tab_.
FIXME: wip! wip!
2011-05-01 21:52:08 +09:00
Howard Hinnant
469d419a17 Correction to set of overloaded pair constructors for C++0x
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@130521 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-29 18:10:55 +00:00
Douglas Gregor
7ac6af7027 Qualify calls to std::next(), to avoid conflicts with
libraries/applications that define their own 'next' template.


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

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



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


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


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


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

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

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

  template <class _Tp> char  __test(_Tp);

is broken in two ways:

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

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





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

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

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

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


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

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:31:58 +00:00
Daniel Dunbar
26a43c25d7 tests: Remove some stray cleanup code.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113934 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:18:37 +00:00
Daniel Dunbar
7e0c57b203 tests: Fixup lit config, which got garbled somehow...
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113931 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 04:11:29 +00:00
Daniel Dunbar
f5eadcd8d5 tests: Sketch a lit config for running libc++ tests; currently expects libc++ to have been installed.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113925 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 03:57:04 +00:00
Howard Hinnant
45f5717812 Cement ABI on clang for char16_t and char32_t. Also fixed some comments in <iterator>.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113842 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 20:26:27 +00:00
Howard Hinnant
d2a9251977 Experimenting with a new forward fomulation (kudos Daniel Kruegler), updated insert iterators to work better with pproxies, and doubled the speed of __next_prime.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113731 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 01:43:27 +00:00
Howard Hinnant
a0f1dc9f46 Fix another const bug in function. Thanks to Daniel Krugler for finding this and the previous bug.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 15:33:21 +00:00
Howard Hinnant
fdc5a0f321 Fix const bug in function
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@113684 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 15:09:37 +00:00
4413 changed files with 22946 additions and 101967 deletions

159
CMakeLists.txt Normal file
View File

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

18
CREDITS.TXT Normal file
View File

@@ -0,0 +1,18 @@
This file is a partial list of people who have contributed to the LLVM/libc++
project. If you have contributed a patch or made some other contribution to
LLVM/libc++, please submit a patch to this file to add yourself, and it will be
done!
The list is sorted by surname and formatted to allow easy grepping and
beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S).
N: Howard Hinnant
E: hhinnant@apple.com
D: Architect and primary author of libc++
N: Marshall Clow
E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes.

View File

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

View File

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

View File

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

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

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -1028,6 +1028,7 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
}
template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -13,6 +13,13 @@
#pragma GCC system_header
#ifdef __MINGW32__
#include <yvals.h>
#undef _STD
#undef _C2
#define _LIBCPP_VISIBILITY_TAG 0
#endif
#define _LIBCPP_VERSION 1000
#define _LIBCPP_ABI_VERSION 1
@@ -47,6 +54,11 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__
#if !defined(_LIBCPP_LITTLE_ENDIAN) && (defined(__i386__) || defined(__x86_64__))
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#endif
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -82,7 +94,7 @@
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#define _LIBCPP_ALWAYS_INLINE __attribute__((__always_inline__))
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#if defined(__clang__)
@@ -90,10 +102,15 @@
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#else
typedef __char16_t char16_t;
typedef __char32_t char32_t;
#endif
#endif
#if !(__has_feature(cxx_exceptions))
#if !(__has_feature(cxx_exceptions)) || defined(__MINGW32__)
#define _LIBCPP_NO_EXCEPTIONS
#endif
@@ -109,8 +126,9 @@
#define _LIBCPP_HAS_NO_ATTRIBUTES
#endif
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#endif // !(__has_feature(cxx_deleted_functions))
@@ -138,22 +156,19 @@
#define _LIBCPP_HAS_NO_VARIADICS
#endif
#if __has_feature(cxx_inline_namespaces)
#if !(__has_feature(cxx_trailing_return))
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _STD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
inline namespace _LIBCPP_NAMESPACE {
}
}
using namespace _LIBCPP_NAMESPACE;
}
#else // __has_feature(cxx_inline_namespaces)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _STD std
#endif // __has_feature(cxx_inline_namespaces)
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
@@ -181,9 +196,13 @@ using namespace _LIBCPP_NAMESPACE;
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
@@ -243,4 +262,8 @@ template <unsigned> struct __static_assert_check {};
#define constexpr const
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
#endif // _LIBCPP_CONFIG

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -196,12 +196,12 @@ mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const volatile)
// bad_function_call
class bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
};
template<class _Fp> class function; // undefined
template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
namespace __function
{
@@ -396,8 +396,9 @@ class __func<_F, _Alloc, _R(_A0)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
: __f_(_STD::move(__f), _STD::move(__a)) {}
virtual __base<_R(_A0)>* __clone() const;
virtual void __clone(__base<_R(_A0)>*) const;
virtual void destroy();
@@ -478,8 +479,9 @@ class __func<_F, _Alloc, _R(_A0, _A1)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
: __f_(_STD::move(__f), _STD::move(__a)) {}
virtual __base<_R(_A0, _A1)>* __clone() const;
virtual void __clone(__base<_R(_A0, _A1)>*) const;
virtual void destroy();
@@ -560,8 +562,9 @@ class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_STD::move(__f)) {}
_LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
: __f_(_STD::move(__f), _STD::move(__a)) {}
virtual __base<_R(_A0, _A1, _A2)>* __clone() const;
virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
virtual void destroy();
@@ -639,7 +642,7 @@ __func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const
} // __function
template<class _R>
class function<_R()>
class _LIBCPP_VISIBLE function<_R()>
{
typedef __function::__base<_R()> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
@@ -653,16 +656,18 @@ public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
typename enable_if<!is_integral<_F>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
@@ -685,18 +690,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2>
bool operator==(const function<_R2()>&);// = delete;
bool operator==(const function<_R2()>&) const;// = delete;
template<class _R2>
bool operator!=(const function<_R2()>&);// = delete;
bool operator!=(const function<_R2()>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()() const;
@@ -920,7 +926,7 @@ function<_R()>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0>
class function<_R(_A0)>
class _LIBCPP_VISIBLE function<_R(_A0)>
: public unary_function<_A0, _R>
{
typedef __function::__base<_R(_A0)> __base;
@@ -928,33 +934,42 @@ class function<_R(_A0)>
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)()) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() const) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;}
template <class _R2, class _C>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
typename enable_if<!is_integral<_F>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
@@ -977,18 +992,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0>
bool operator==(const function<_R2(_B0)>&);// = delete;
bool operator==(const function<_R2(_B0)>&) const;// = delete;
template<class _R2, class _B0>
bool operator!=(const function<_R2(_B0)>&);// = delete;
bool operator!=(const function<_R2(_B0)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0) const;
@@ -1212,7 +1228,7 @@ function<_R(_A0)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0, class _A1>
class function<_R(_A0, _A1)>
class _LIBCPP_VISIBLE function<_R(_A0, _A1)>
: public binary_function<_A0, _A1, _R>
{
typedef __function::__base<_R(_A0, _A1)> __base;
@@ -1220,33 +1236,42 @@ class function<_R(_A0, _A1)>
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) const) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) volatile) {return __p;}
template <class _R2, class _C, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1) const volatile) {return __p;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0, _B1)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
typename enable_if<!is_integral<_F>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
@@ -1269,6 +1294,7 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
@@ -1278,9 +1304,9 @@ public:
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0, class _B1>
bool operator==(const function<_R2(_B0, _B1)>&);// = delete;
bool operator==(const function<_R2(_B0, _B1)>&) const;// = delete;
template<class _R2, class _B0, class _B1>
bool operator!=(const function<_R2(_B0, _B1)>&);// = delete;
bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0, _A1) const;
@@ -1504,40 +1530,49 @@ function<_R(_A0, _A1)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _R, class _A0, class _A1, class _A2>
class function<_R(_A0, _A1, _A2)>
class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)>
{
typedef __function::__base<_R(_A0, _A1, _A2)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2)) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) volatile) {return __p;}
template <class _R2, class _C, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_B1, _B2) const volatile) {return __p;}
template <class _R2, class _B0, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_B0, _B1, _B2)>& __p) {return __p;}
public:
typedef _R result_type;
// 20.7.16.2.1, construct/copy/destroy:
explicit function() : __f_(0) {}
function(nullptr_t) : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
template<class _F>
function(_F,
typename enable_if<!is_integral<_F>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
@@ -1560,18 +1595,19 @@ public:
// 20.7.16.2.2, function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
operator bool() const {return __f_;}
_LIBCPP_INLINE_VISIBILITY operator bool() const {return __f_;}
private:
// deleted overloads close possible hole in the type system
template<class _R2, class _B0, class _B1, class _B2>
bool operator==(const function<_R2(_B0, _B1, _B2)>&);// = delete;
bool operator==(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
template<class _R2, class _B0, class _B1, class _B2>
bool operator!=(const function<_R2(_B0, _B1, _B2)>&);// = delete;
bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
_R operator()(_A0, _A1, _A2) const;
@@ -1822,11 +1858,11 @@ swap(function<_F>& __x, function<_F>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct is_bind_expression
template<class _Tp> struct _LIBCPP_VISIBLE is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
template<class _Tp> struct is_placeholder
template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -21,21 +21,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct unary_function
struct _LIBCPP_VISIBLE unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct binary_function
struct _LIBCPP_VISIBLE binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct hash;
template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp>
struct __has_result_type
@@ -306,7 +306,7 @@ typename enable_if
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
@@ -319,7 +319,7 @@ typename enable_if
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
@@ -332,7 +332,7 @@ typename enable_if
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
}
// second bullet
@@ -445,7 +445,7 @@ struct __invoke_return
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -467,6 +467,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -873,7 +873,7 @@ __invoke(_R _T::* __f, _T1& __t1)
template <class _F>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F()>::type
decltype(declval<_F>()())
__invoke(_F __f)
{
return __f();
@@ -881,7 +881,7 @@ __invoke(_F __f)
template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0)>::type
decltype(declval<_F>()(declval<_A0&>()))
__invoke(_F __f, _A0& __a0)
{
return __f(__a0);
@@ -889,7 +889,7 @@ __invoke(_F __f, _A0& __a0)
template <class _F, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0, _A1)>::type
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
__invoke(_F __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
@@ -897,7 +897,7 @@ __invoke(_F __f, _A0& __a0, _A1& __a1)
template <class _F, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_A0, _A1, _A2)>::type
decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
@@ -996,7 +996,7 @@ struct __invoke_return2
};
template <class _Tp>
class reference_wrapper
class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -1015,6 +1015,7 @@ public:
// invoke
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type&>::type
operator() () const
{
@@ -1022,6 +1023,7 @@ public:
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type&, _A0>::type
operator() (_A0& __a0) const
{
@@ -1029,6 +1031,7 @@ public:
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type&, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
@@ -1036,6 +1039,7 @@ public:
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type&, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,17 +22,18 @@
_LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_VISIBLE
size_t __next_prime(size_t);
template <class _NodePtr>
struct __hash_node_base
{
typedef __hash_node_base __first_node;
typedef _NodePtr pointer;
// typedef _NodePtr pointer;
pointer __next_;
_NodePtr __next_;
__hash_node_base() : __next_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY __hash_node_base() : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
@@ -57,10 +58,10 @@ 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 unordered_map;
template <class, class, class, class, class> class _LIBCPP_VISIBLE unordered_map;
template <class _NodePtr>
class __hash_iterator
class _LIBCPP_VISIBLE __hash_iterator
{
typedef _NodePtr __node_pointer;
@@ -79,17 +80,21 @@ public:
#endif
pointer;
__hash_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_iterator() {}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_iterator operator++(int)
{
__hash_iterator __t(*this);
@@ -97,25 +102,28 @@ public:
return __t;
}
friend bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_iterator& __x, const __hash_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_map_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
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 _ConstNodePtr>
class __hash_const_iterator
class _LIBCPP_VISIBLE __hash_const_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -146,20 +154,25 @@ public:
__non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
__hash_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_)
{}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return _STD::addressof(__node_->__value_);}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator& operator++()
{
__node_ = __node_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator operator++(int)
{
__hash_const_iterator __t(*this);
@@ -167,26 +180,29 @@ public:
return __t;
}
friend bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_iterator& __x, const __hash_const_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_iterator(__node_pointer __node)
: __node_(__node)
{}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
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> class __hash_const_local_iterator;
template <class> class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class _NodePtr>
class __hash_local_iterator
class _LIBCPP_VISIBLE __hash_local_iterator
{
typedef _NodePtr __node_pointer;
@@ -208,11 +224,14 @@ public:
#endif
pointer;
__hash_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() {}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator& operator++()
{
__node_ = __node_->__next_;
@@ -221,6 +240,7 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator operator++(int)
{
__hash_local_iterator __t(*this);
@@ -228,12 +248,15 @@ public:
return __t;
}
friend bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_local_iterator& __x, const __hash_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@@ -245,12 +268,12 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
};
template <class _ConstNodePtr>
class __hash_const_local_iterator
class _LIBCPP_VISIBLE __hash_const_local_iterator
{
typedef _ConstNodePtr __node_pointer;
@@ -285,16 +308,20 @@ public:
#endif
pointer;
__hash_const_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(const __non_const_iterator& __x)
: __node_(__x.__node_),
__bucket_(__x.__bucket_),
__bucket_count_(__x.__bucket_count_)
{}
reference operator*() const {return __node_->__value_;}
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__node_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator& operator++()
{
__node_ = __node_->__next_;
@@ -303,6 +330,7 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator operator++(int)
{
__hash_const_local_iterator __t(*this);
@@ -310,12 +338,15 @@ public:
return __t;
}
friend bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ == __y.__node_;}
friend bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_const_local_iterator& __x, const __hash_const_local_iterator& __y)
{return __x.__node_ != __y.__node_;}
private:
_LIBCPP_INLINE_VISIBILITY
__hash_const_local_iterator(__node_pointer __node, size_t __bucket,
size_t __bucket_count)
: __node_(__node),
@@ -327,7 +358,7 @@ private:
}
template <class, class, class, class> friend class __hash_table;
template <class> friend class __hash_map_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
};
template <class _Alloc>
@@ -341,13 +372,17 @@ class __bucket_list_deallocator
public:
typedef typename __alloc_traits::pointer pointer;
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator()
: __data_(0) {}
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(const allocator_type& __a, size_type __size)
: __data_(__size, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
: __data_(_STD::move(__x.__data_))
{
@@ -356,12 +391,13 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
size_type& size() {return __data_.first();}
size_type size() const {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __data_.first();}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __data_.first();}
allocator_type& __alloc() {return __data_.second();}
const allocator_type& __alloc() const {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __data_.second();}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
__alloc_traits::deallocate(__alloc(), __p, size());
@@ -387,15 +423,17 @@ private:
public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_node_destructor(allocator_type& __na)
: __na_(__na),
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -457,21 +495,21 @@ private:
__compressed_pair<float, key_equal> __p3_;
// --- Member data end ---
size_type& size() {return __p2_.first();}
_LIBCPP_INLINE_VISIBILITY size_type& size() {return __p2_.first();}
public:
size_type size() const {return __p2_.first();}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __p2_.first();}
hasher& hash_function() {return __p2_.second();}
const hasher& hash_function() const {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY hasher& hash_function() {return __p2_.second();}
_LIBCPP_INLINE_VISIBILITY const hasher& hash_function() const {return __p2_.second();}
float& max_load_factor() {return __p3_.first();}
float max_load_factor() const {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY float& max_load_factor() {return __p3_.first();}
_LIBCPP_INLINE_VISIBILITY float max_load_factor() const {return __p3_.first();}
key_equal& key_eq() {return __p3_.second();}
const key_equal& key_eq() const {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY key_equal& key_eq() {return __p3_.second();}
_LIBCPP_INLINE_VISIBILITY const key_equal& key_eq() const {return __p3_.second();}
__node_allocator& __node_alloc() {return __p1_.second();}
const __node_allocator& __node_alloc() const {return __p1_.second();}
_LIBCPP_INLINE_VISIBILITY __node_allocator& __node_alloc() {return __p1_.second();}
_LIBCPP_INLINE_VISIBILITY const __node_allocator& __node_alloc() const {return __p1_.second();}
public:
typedef __hash_iterator<__node_pointer> iterator;
@@ -501,6 +539,7 @@ public:
template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{
return allocator_traits<__pointer_allocator>::max_size(
@@ -540,8 +579,10 @@ public:
void clear();
void rehash(size_type __n);
void reserve(size_type __n)
_LIBCPP_INLINE_VISIBILITY void reserve(size_type __n)
{rehash(static_cast<size_type>(ceil(__n / max_load_factor())));}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const
{
return __bucket_list_.get_deleter().size();
@@ -553,6 +594,7 @@ public:
const_iterator end() const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
{return hash_function()(__k) % bucket_count();}
@@ -593,24 +635,25 @@ public:
void swap(__hash_table& __u);
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const
{return __bucket_list_.get_deleter().__alloc().max_size();}
size_type bucket_size(size_type __n) const;
float load_factor() const
_LIBCPP_INLINE_VISIBILITY float load_factor() const
{
size_type __bc = bucket_count();
return __bc != 0 ? (float)size() / __bc : 0.f;
}
void max_load_factor(float __mlf)
_LIBCPP_INLINE_VISIBILITY void max_load_factor(float __mlf)
{max_load_factor() = _STD::max(__mlf, load_factor());}
local_iterator begin(size_type __n)
_LIBCPP_INLINE_VISIBILITY local_iterator begin(size_type __n)
{return local_iterator(__bucket_list_[__n], __n, bucket_count());}
local_iterator end(size_type __n)
_LIBCPP_INLINE_VISIBILITY local_iterator end(size_type __n)
{return local_iterator(nullptr, __n, bucket_count());}
const_local_iterator cbegin(size_type __n) const
_LIBCPP_INLINE_VISIBILITY const_local_iterator cbegin(size_type __n) const
{return const_local_iterator(__bucket_list_[__n], __n, bucket_count());}
const_local_iterator cend(size_type __n) const
_LIBCPP_INLINE_VISIBILITY const_local_iterator cend(size_type __n) const
{return const_local_iterator(nullptr, __n, bucket_count());}
private:
void __rehash(size_type __n);
@@ -626,26 +669,31 @@ private:
#endif
__node_holder __construct_node(const value_type& __v, size_t __hash);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u)
{__copy_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table& __u, false_type) {}
void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type);
void __move_assign_alloc(__hash_table& __u)
_LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__hash_table& __u)
{__move_assign_alloc(__u, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table& __u, true_type)
{
__bucket_list_.get_deleter().__alloc() =
_STD::move(__u.__bucket_list_.get_deleter().__alloc());
__node_alloc() = _STD::move(__u.__node_alloc());
}
void __move_assign_alloc(__hash_table&, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) {}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y)
@@ -657,6 +705,7 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, true_type)
@@ -666,6 +715,7 @@ private:
}
template <class _A>
_LIBCPP_INLINE_VISIBILITY
static
void
__swap_alloc(_A& __x, _A& __y, false_type) {}
@@ -675,7 +725,7 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
: __p2_(0),
__p3_(1.0f)
@@ -683,7 +733,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@@ -748,7 +798,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(addressof(__p1_.first()));
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -772,7 +822,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(addressof(__p1_.first()));
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
size() = __u.size();
__u.size() = 0;
}
@@ -825,7 +875,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate(__node_pointer __np)
while (__np != nullptr)
{
__node_pointer __next = __np->__next_;
__node_traits::destroy(__na, addressof(__np->__value_));
__node_traits::destroy(__na, _STD::addressof(__np->__value_));
__node_traits::deallocate(__na, __np, 1);
__np = __next;
}
@@ -864,7 +914,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
if (size() > 0)
{
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(addressof(__p1_.first()));
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
}
@@ -919,7 +969,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
{
@@ -999,7 +1049,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
{
@@ -1007,7 +1057,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
{
@@ -1015,7 +1065,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
{
@@ -1023,7 +1073,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const
{
@@ -1081,7 +1131,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__nd->__next_ = __pn->__next_;
__pn->__next_ = __nd;
// fix up __bucket_list_
@@ -1119,7 +1169,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__cp->__next_ = __pn->__next_;
__pn->__next_ = __cp;
// fix up __bucket_list_
@@ -1225,7 +1275,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
__pn = static_cast<__node_pointer>(addressof(__p1_.first()));
__pn = static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
__h->__next_ = __pn->__next_;
__pn->__next_ = __h.get();
// fix up __bucket_list_
@@ -1383,7 +1433,7 @@ __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>(addressof(__p1_.first())));
__node_pointer __pp(static_cast<__node_pointer>(_STD::addressof(__p1_.first())));
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
@@ -1483,7 +1533,7 @@ __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, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
@@ -1499,7 +1549,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
@@ -1514,7 +1564,7 @@ __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, addressof(__h->__value_), __v);
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
@@ -1530,7 +1580,7 @@ __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, addressof(__h->__value_), __v);
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
@@ -1608,7 +1658,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
// 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 == addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
if (__pn == _STD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
{
if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
__bucket_list_[__chash] = nullptr;
@@ -1629,7 +1679,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p)
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{
@@ -1741,10 +1791,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p3_.swap(__u.__p3_);
if (size() > 0)
__bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(addressof(__p1_.first()));
static_cast<__node_pointer>(_STD::addressof(__p1_.first()));
if (__u.size() > 0)
__u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
static_cast<__node_pointer>(addressof(__u.__p1_.first()));
static_cast<__node_pointer>(_STD::addressof(__u.__p1_.first()));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -19,7 +19,21 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#ifdef __MINGW32__
typedef _locale_t locale_t;
#include <xlocinfo.h>
#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 _M_ALL
#else
#include <xlocale.h>
#endif
#pragma GCC system_header
@@ -30,7 +44,7 @@ class locale;
template <class _Facet> bool has_facet(const locale&) throw();
template <class _Facet> const _Facet& use_facet(const locale&);
class locale
class _LIBCPP_VISIBLE locale
{
public:
// types:
@@ -55,7 +69,8 @@ public:
explicit locale(const string&);
locale(const locale&, const char*, category);
locale(const locale&, const string&, category);
template <class _Facet> locale(const locale&, _Facet*);
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
locale(const locale&, const locale&, category);
~locale() throw();
@@ -89,10 +104,11 @@ private:
template <class _Facet> friend const _Facet& use_facet(const locale&);
};
class locale::facet
class _LIBCPP_VISIBLE locale::facet
: public __shared_count
{
protected:
_LIBCPP_INLINE_VISIBILITY
explicit facet(size_t __refs = 0)
: __shared_count(static_cast<long>(__refs)-1) {}
@@ -104,14 +120,14 @@ private:
virtual void __on_zero_shared();
};
class locale::id
class _LIBCPP_VISIBLE locale::id
{
once_flag __flag_;
int32_t __id_;
static int32_t __next_id;
public:
id() {}
_LIBCPP_INLINE_VISIBILITY id() {}
private:
void __init();
void operator=(const id&); // = delete;
@@ -160,27 +176,31 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class collate
class _LIBCPP_VISIBLE collate
: public locale::facet
{
public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit collate(size_t __refs = 0)
: locale::facet(__refs) {}
_LIBCPP_INLINE_VISIBILITY
int compare(const char_type* __lo1, const char_type* __hi1,
const char_type* __lo2, const char_type* __hi2) const
{
return do_compare(__lo1, __hi1, __lo2, __hi2);
}
_LIBCPP_INLINE_VISIBILITY
string_type transform(const char_type* __lo, const char_type* __hi) const
{
return do_transform(__lo, __hi);
}
_LIBCPP_INLINE_VISIBILITY
long hash(const char_type* __lo, const char_type* __hi) const
{
return do_hash(__lo, __hi);
@@ -235,15 +255,15 @@ collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
return static_cast<long>(h);
}
extern template class collate<char>;
extern template class collate<wchar_t>;
extern template class _LIBCPP_VISIBLE collate<char>;
extern template class _LIBCPP_VISIBLE collate<wchar_t>;
// template <class CharT> class collate_byname;
template <class _CharT> class collate_byname;
template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <>
class collate_byname<char>
class _LIBCPP_VISIBLE collate_byname<char>
: public collate<char>
{
locale_t __l;
@@ -262,7 +282,7 @@ protected:
};
template <>
class collate_byname<wchar_t>
class _LIBCPP_VISIBLE collate_byname<wchar_t>
: public collate<wchar_t>
{
locale_t __l;
@@ -293,9 +313,10 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
// template <class charT> class ctype
class ctype_base {
class _LIBCPP_VISIBLE ctype_base
{
public:
typedef __uint32_t mask;
typedef std::uint32_t mask;
#if __APPLE__
static const mask space = _CTYPE_S;
@@ -308,6 +329,17 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
#elif defined(__MINGW32__)
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;
#else // __APPLE__
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -326,10 +358,10 @@ public:
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class ctype;
template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <>
class ctype<wchar_t>
class _LIBCPP_VISIBLE ctype<wchar_t>
: public locale::facet,
public ctype_base
{
@@ -431,7 +463,7 @@ protected:
};
template <>
class ctype<char>
class _LIBCPP_VISIBLE ctype<char>
: public locale::facet, public ctype_base
{
const mask* __tab_;
@@ -444,7 +476,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? __tab_[__c] & __m : false;
return isascii(__c) ? (__tab_ ? __tab_[__c] & __m : _isctype(__c, __m)) : false;
}
_LIBCPP_ALWAYS_INLINE
@@ -528,7 +560,7 @@ public:
#else
static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif
const mask* table() const throw() {return __tab_;}
_LIBCPP_ALWAYS_INLINE const mask* table() const throw() {return __tab_;}
static const mask* classic_table() throw();
protected:
@@ -545,10 +577,10 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <>
class ctype_byname<char>
class _LIBCPP_VISIBLE ctype_byname<char>
: public ctype<char>
{
locale_t __l;
@@ -566,7 +598,7 @@ protected:
};
template <>
class ctype_byname<wchar_t>
class _LIBCPP_VISIBLE ctype_byname<wchar_t>
: public ctype<wchar_t>
{
locale_t __l;
@@ -697,7 +729,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base
class codecvt_base
class _LIBCPP_VISIBLE codecvt_base
{
public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -706,12 +738,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
// template <> class codecvt<char, char, mbstate_t>
template <>
class codecvt<char, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -797,7 +829,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t>
template <>
class codecvt<wchar_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -880,7 +912,7 @@ protected:
// template <> class codecvt<char16_t, char, mbstate_t>
template <>
class codecvt<char16_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -966,7 +998,7 @@ protected:
// template <> class codecvt<char32_t, char, mbstate_t>
template <>
class codecvt<char32_t, char, mbstate_t>
class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
: public locale::facet,
public codecvt_base
{
@@ -1052,12 +1084,14 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class codecvt_byname
class _LIBCPP_VISIBLE codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const char* __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm, __refs) {}
_LIBCPP_ALWAYS_INLINE
explicit codecvt_byname(const string& __nm, size_t __refs = 0)
: codecvt<_InternT, _ExternT, _StateT>(__nm.c_str(), __refs) {}
protected:
@@ -1074,7 +1108,7 @@ extern template class codecvt_byname<wchar_t, char, mbstate_t>;
extern template class codecvt_byname<char16_t, char, mbstate_t>;
extern template class codecvt_byname<char32_t, char, mbstate_t>;
void __throw_runtime_error(const char*);
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _N>
struct __narrow_to_utf8
@@ -1258,10 +1292,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class numpunct;
template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <>
class numpunct<char>
class _LIBCPP_VISIBLE numpunct<char>
: public locale::facet
{
public:
@@ -1292,7 +1326,7 @@ protected:
};
template <>
class numpunct<wchar_t>
class _LIBCPP_VISIBLE numpunct<wchar_t>
: public locale::facet
{
public:
@@ -1324,10 +1358,10 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class numpunct_byname;
template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <>
class numpunct_byname<char>
class _LIBCPP_VISIBLE numpunct_byname<char>
: public numpunct<char>
{
public:
@@ -1345,7 +1379,7 @@ private:
};
template <>
class numpunct_byname<wchar_t>
class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
: public numpunct<wchar_t>
{
public:

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -14,17 +14,56 @@
#include <__config>
#include <chrono>
#include <system_error>
#ifdef __MINGW32__
typedef unsigned pthread_t;
typedef unsigned pthread_mutex_t;
typedef unsigned pthread_mutexattr_t;
typedef unsigned pthread_cond_t;
typedef unsigned pthread_key_t;
#define PTHREAD_MUTEX_INITIALIZER 0
#define PTHREAD_COND_INITIALIZER 0
#define PTHREAD_MUTEX_RECURSIVE 0
#define pthread_mutex_init(a,b) (*(a) = 0, -1)
#define pthread_mutex_destroy(a) (-1)
#define pthread_mutex_lock(a) (-1)
#define pthread_mutex_trylock(a) (-1)
#define pthread_mutex_unlock(a) (-1)
#define pthread_mutexattr_settype(a,b) (*(a) = (b), -1)
#define pthread_mutexattr_init(a) (*(a) = 0, -1)
#define pthread_mutexattr_destroy(a) (-1)
#define pthread_self() (-1)
#define pthread_equal(a,b) (0)
#define pthread_getspecific(a) ((void*)0)
#define pthread_cond_destroy(a) (-1)
#define pthread_cond_signal(a) (-1)
#define pthread_cond_broadcast(a) (-1)
#define pthread_cond_wait(a,b) (-1)
#define pthread_cond_timedwait(a,b,c) (-1)
#define sched_yield() (-1)
#else
#include <pthread.h>
#endif
#pragma GCC system_header
#ifdef _LIBCPP_SHARED_LOCK
namespace ting {
template <class> class shared_lock;
template <class> class upgrade_lock;
}
#endif // _LIBCPP_SHARED_LOCK
_LIBCPP_BEGIN_NAMESPACE_STD
class mutex
class _LIBCPP_VISIBLE mutex
{
pthread_mutex_t __m_;
public:
_LIBCPP_INLINE_VISIBILITY
mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
~mutex();
@@ -38,12 +77,12 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
native_handle_type native_handle() {return &__m_;}
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
};
struct defer_lock_t {};
struct try_to_lock_t {};
struct adopt_lock_t {};
struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {};
//constexpr
extern const
@@ -58,7 +97,7 @@ extern const
adopt_lock_t adopt_lock;
template <class _Mutex>
class lock_guard
class _LIBCPP_VISIBLE lock_guard
{
public:
typedef _Mutex mutex_type;
@@ -67,10 +106,13 @@ private:
mutex_type& __m_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit lock_guard(mutex_type& __m)
: __m_(__m) {__m_.lock();}
_LIBCPP_INLINE_VISIBILITY
lock_guard(mutex_type& __m, adopt_lock_t)
: __m_(__m) {}
_LIBCPP_INLINE_VISIBILITY
~lock_guard() {__m_.unlock();}
private:
@@ -79,7 +121,7 @@ private:
};
template <class _Mutex>
class unique_lock
class _LIBCPP_VISIBLE unique_lock
{
public:
typedef _Mutex mutex_type;
@@ -89,21 +131,29 @@ private:
bool __owns_;
public:
_LIBCPP_INLINE_VISIBILITY
unique_lock() : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t)
: __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t)
: __m_(&__m), __owns_(__m.try_lock()) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, adopt_lock_t)
: __m_(&__m), __owns_(true) {}
template <class _Clock, class _Duration>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t)
: __m_(&__m), __owns_(__m.try_lock_until(__t)) {}
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d)
: __m_(&__m), __owns_(__m.try_lock_for(__d)) {}
_LIBCPP_INLINE_VISIBILITY
~unique_lock()
{
if (__owns_)
@@ -116,9 +166,11 @@ private:
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u)
: __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u)
{
if (__owns_)
@@ -129,6 +181,28 @@ public:
__u.__owns_ = false;
return *this;
}
#ifdef _LIBCPP_SHARED_LOCK
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
#endif // _LIBCPP_SHARED_LOCK
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void lock();
@@ -141,11 +215,13 @@ public:
void unlock();
_LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u)
{
_STD::swap(__m_, __u.__m_);
_STD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
mutex_type* release()
{
mutex_type* __m = __m_;
@@ -154,9 +230,12 @@ public:
return __m;
}
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;}
};
@@ -221,11 +300,11 @@ unique_lock<_Mutex>::unlock()
}
template <class _Mutex>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
struct cv_status
struct _LIBCPP_VISIBLE cv_status
{
enum _ {
no_timeout,
@@ -234,15 +313,16 @@ struct cv_status
_ __v_;
cv_status(_ __v) : __v_(__v) {}
operator int() const {return __v_;}
_LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
};
class condition_variable
class _LIBCPP_VISIBLE condition_variable
{
pthread_cond_t __cv_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
~condition_variable();
@@ -286,7 +366,7 @@ public:
_Predicate __pred);
typedef pthread_cond_t* native_handle_type;
native_handle_type native_handle() {return &__cv_;}
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;}
private:
void __do_timed_wait(unique_lock<mutex>& __lk,
@@ -294,7 +374,7 @@ private:
};
template <class _To, class _Rep, class _Period>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
chrono::__is_duration<_To>::value,
@@ -362,21 +442,21 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
system_clock::time_point __s_now = system_clock::now();
monotonic_clock::time_point __c_now = monotonic_clock::now();
system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
return monotonic_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Rep, class _Period, class _Predicate>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred)
{
return wait_until(__lk, chrono::monotonic_clock::now() + __d,
return wait_until(__lk, chrono::steady_clock::now() + __d,
_STD::move(__pred));
}

View File

@@ -85,22 +85,20 @@ public:
void shrink_to_fit();
void push_front(const_reference __x);
void push_back(const_reference __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _InputIter>
typename enable_if
<
@@ -118,12 +116,12 @@ public:
__construct_at_end(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, has_trivial_destructor<value_type>());}
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
void __destruct_at_end(pointer __new_last, false_type);
void __destruct_at_end(pointer __new_last, true_type);
@@ -132,23 +130,29 @@ public:
bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __split_buffer& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
{}
};
@@ -184,16 +188,8 @@ __split_buffer<_Tp, _Allocator>::__invariants() const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -204,15 +200,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -220,17 +207,8 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
__alloc_rr& __a = this->__alloc();
do
@@ -241,15 +219,6 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _InputIter>
typename enable_if

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -97,7 +97,7 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
char __extbuf[__limit];
int __nread = max(1, __encoding_);
int __nread = _STD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
char __c = getc(__file_);
@@ -288,12 +288,12 @@ __stdoutbuf<_CharT>::sync()
__r = __cv_->unshift(__st_, __extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
if (__r == codecvt_base::error)
return -1;
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);
if (fwrite(__extbuf, 1, __nmemb, __file_) != __nmemb)
return -1;
} while (__r == codecvt_base::partial);
if (__r == codecvt_base::error)
return -1;
if (fflush(__file_))
return -1;
return 0;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -22,12 +22,12 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class, class, class> class __tree;
template <class, class, class> class __tree_iterator;
template <class, class, class> class __tree_const_iterator;
template <class, class, class, class> class map;
template <class, class, class, class> class multimap;
template <class, class, class> class set;
template <class, class, class> class multiset;
template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator;
template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator;
template <class, class, class, class> class _LIBCPP_VISIBLE map;
template <class, class, class, class> class _LIBCPP_VISIBLE multimap;
template <class, class, class> class _LIBCPP_VISIBLE set;
template <class, class, class> class _LIBCPP_VISIBLE multiset;
/*
@@ -53,7 +53,7 @@ __root, have a non-null __parent_ field.
// Returns: true if __x is a left child of its parent, else false
// Precondition: __x != nullptr.
template <class _NodePtr>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
__tree_is_left_child(_NodePtr __x)
{
@@ -119,7 +119,7 @@ __tree_invariant(_NodePtr __root)
// Returns: pointer to the left-most node under __x.
// Precondition: __x != nullptr.
template <class _NodePtr>
inline
inline _LIBCPP_INLINE_VISIBILITY
_NodePtr
__tree_min(_NodePtr __x)
{
@@ -131,7 +131,7 @@ __tree_min(_NodePtr __x)
// Returns: pointer to the right-most node under __x.
// Precondition: __x != nullptr.
template <class _NodePtr>
inline
inline _LIBCPP_INLINE_VISIBILITY
_NodePtr
__tree_max(_NodePtr __x)
{
@@ -513,15 +513,17 @@ private:
public:
bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node_destructor(allocator_type& __na)
: __na_(__na),
__value_constructed(false)
{}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__value_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -538,6 +540,7 @@ public:
typedef _Pointer pointer;
pointer __left_;
_LIBCPP_INLINE_VISIBILITY
__tree_end_node() : __left_() {}
};
@@ -576,6 +579,7 @@ public:
pointer __parent_;
bool __is_black_;
_LIBCPP_INLINE_VISIBILITY
__tree_node_base() : __right_(), __parent_(), __is_black_(false) {}
};
@@ -591,9 +595,11 @@ public:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node(_Args&& ...__args)
: __value_(_STD::forward<_Args>(__args)...) {}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
explicit __tree_node(const value_type& __v)
: __value_(__v) {}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -603,7 +609,7 @@ template <class> class __map_iterator;
template <class> class __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class __tree_iterator
class _LIBCPP_VISIBLE __tree_iterator
{
typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -626,41 +632,48 @@ public:
#endif
pointer;
__tree_iterator() {}
_LIBCPP_INLINE_VISIBILITY __tree_iterator() {}
reference operator*() const {return __ptr_->__value_;}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator++()
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator operator++(int)
{__tree_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator--()
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator operator--(int)
{__tree_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __tree_iterator& __x, const __tree_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __tree_iterator& __x, const __tree_iterator& __y)
{return !(__x == __y);}
private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class> friend class __tree_const_iterator;
template <class> friend class __map_iterator;
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class set;
template <class, class, class> friend class multiset;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __map_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
};
template <class _Tp, class _ConstNodePtr, class _DiffType>
class __tree_const_iterator
class _LIBCPP_VISIBLE __tree_const_iterator
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -689,7 +702,7 @@ public:
#endif
pointer;
__tree_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
private:
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
@@ -702,36 +715,44 @@ private:
typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
__non_const_iterator;
public:
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {}
reference operator*() const {return __ptr_->__value_;}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++()
{__ptr_ = static_cast<__node_pointer>(__tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator operator++(int)
{__tree_const_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator--()
{__ptr_ = static_cast<__node_pointer>(__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator operator--(int)
{__tree_const_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __tree_const_iterator& __x, const __tree_const_iterator& __y)
{return !(__x == __y);}
private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class set;
template <class, class, class> friend class multiset;
template <class> friend class __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -748,6 +769,7 @@ public:
typedef typename __alloc_traits::difference_type difference_type;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -758,10 +780,10 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node::base::pointer __node_base_pointer;
typedef typename __node::base::const_pointer __node_base_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
private:
typedef typename __node::base::base __end_node_t;
typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
@@ -782,6 +804,7 @@ private:
__compressed_pair<size_type, value_compare> __pair3_;
public:
_LIBCPP_INLINE_VISIBILITY
__node_pointer __end_node()
{
return static_cast<__node_pointer>
@@ -789,6 +812,7 @@ public:
pointer_traits<__end_node_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __end_node() const
{
return static_cast<__node_const_pointer>
@@ -796,22 +820,33 @@ public:
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __pair1_.second();}
private:
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __pair1_.second();}
_LIBCPP_INLINE_VISIBILITY
__node_pointer& __begin_node() {return __begin_node_;}
_LIBCPP_INLINE_VISIBILITY
const __node_pointer& __begin_node() const {return __begin_node_;}
public:
_LIBCPP_INLINE_VISIBILITY
allocator_type __alloc() const {return allocator_type(__node_alloc());}
private:
_LIBCPP_INLINE_VISIBILITY
size_type& size() {return __pair3_.first();}
public:
_LIBCPP_INLINE_VISIBILITY
const size_type& size() const {return __pair3_.first();}
_LIBCPP_INLINE_VISIBILITY
value_compare& value_comp() {return __pair3_.second();}
_LIBCPP_INLINE_VISIBILITY
const value_compare& value_comp() const {return __pair3_.second();}
public:
_LIBCPP_INLINE_VISIBILITY
__node_pointer __root()
{return static_cast<__node_pointer> (__end_node()->__left_);}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __root() const
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
@@ -835,11 +870,16 @@ public:
~__tree();
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __node_traits::max_size(__node_alloc());}
void clear();
@@ -871,13 +911,12 @@ public:
iterator __insert_multi(_V&& __v);
template <class _V>
iterator __insert_multi(const_iterator __p, _V&& __v);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
iterator __insert_unique(const_iterator __p, const value_type& __v);
iterator __insert_multi(const value_type& __v);
iterator __insert_multi(const_iterator __p, const value_type& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
iterator __node_insert_unique(const_iterator __p,
@@ -908,6 +947,7 @@ public:
size_type __count_multi(const _Key& __k) const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const _Key& __v)
{return __lower_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -915,6 +955,7 @@ public:
__node_pointer __root,
__node_pointer __result);
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const _Key& __v) const
{return __lower_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -922,6 +963,7 @@ public:
__node_const_pointer __root,
__node_const_pointer __result) const;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const _Key& __v)
{return __upper_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -929,6 +971,7 @@ public:
__node_pointer __root,
__node_pointer __result);
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const _Key& __v) const
{return __upper_bound(__v, __root(), __end_node());}
template <class _Key>
@@ -954,19 +997,19 @@ public:
__node_holder remove(const_iterator __p);
private:
typename __node::base::pointer&
__find_leaf_low(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
__find_leaf_high(typename __node::base::pointer& __parent, const value_type& __v);
typename __node::base::pointer&
typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf_high(typename __node_base::pointer& __parent, const value_type& __v);
typename __node_base::pointer&
__find_leaf(const_iterator __hint,
typename __node::base::pointer& __parent, const value_type& __v);
typename __node_base::pointer& __parent, const value_type& __v);
template <class _Key>
typename __node::base::pointer&
__find_equal(typename __node::base::pointer& __parent, const _Key& __v);
typename __node_base::pointer&
__find_equal(typename __node_base::pointer& __parent, const _Key& __v);
template <class _Key>
typename __node::base::pointer&
__find_equal(const_iterator __hint, typename __node::base::pointer& __parent,
typename __node_base::pointer&
__find_equal(const_iterator __hint, typename __node_base::pointer& __parent,
const _Key& __v);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -978,33 +1021,42 @@ private:
void destroy(__node_pointer __nd);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t)
{__copy_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, true_type)
{__node_alloc() = __t.__node_alloc();}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t, false_type) {}
void __move_assign(__tree& __t, false_type);
void __move_assign(__tree& __t, true_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t)
{__move_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, true_type)
{__node_alloc() = _STD::move(__t.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, false_type) {}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
{}
@@ -1321,7 +1373,7 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, addressof(__nd->__value_));
__node_traits::destroy(__na, _STD::addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1);
}
}
@@ -1359,8 +1411,8 @@ __tree<_Tp, _Compare, _Allocator>::clear()
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1398,8 +1450,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node::base::pointe
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointer& __parent,
const value_type& __v)
{
__node_pointer __nd = __root();
@@ -1440,9 +1492,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node::base::point
// Set __parent to parent of null leaf
// Return reference to null leaf
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
typename __node::base::pointer& __parent,
typename __node_base::pointer& __parent,
const value_type& __v)
{
if (__hint == end() || !value_comp()(*__hint, __v)) // check before
@@ -1476,8 +1528,8 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer& __parent,
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& __parent,
const _Key& __v)
{
__node_pointer __nd = __root();
@@ -1525,9 +1577,9 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node::base::pointer&
// If __v exists, set parent to node of __v and return reference to node of __v
template <class _Tp, class _Compare, class _Allocator>
template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::__node::base::pointer&
typename __tree<_Tp, _Compare, _Allocator>::__node_base::pointer&
__tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
typename __node::base::pointer& __parent,
typename __node_base::pointer& __parent,
const _Key& __v)
{
if (__hint == end() || value_comp()(__v, *__hint)) // check before
@@ -1557,7 +1609,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
const_iterator __next = _STD::next(__hint);
if (__next == end() || value_comp()(__v, *__next))
{
// *__hint < __v < *next(__hint)
// *__hint < __v < *_STD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1603,7 +1655,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
}
@@ -1676,18 +1728,11 @@ template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
bool __inserted = false;
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
return pair<iterator, bool>(iterator(__r), __inserted);
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1695,16 +1740,11 @@ template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __v);
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
__node_holder __h = __construct_node(_STD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1739,11 +1779,13 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_), __v);
__node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _STD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
@@ -1800,8 +1842,6 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
return iterator(__h.release());
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
@@ -1867,7 +1907,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_;
--size();
__node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(addressof(*__p)));
__node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p)));
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1);

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -25,30 +25,69 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class tuple_size;
template <size_t _Ip, class _Tp> class tuple_element;
template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <class ..._Tp> class tuple;
template <class _T1, class _T2> class pair;
template <class _Tp, size_t _Size> struct array;
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
: public tuple_size<_Tp> {};
template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
{
public:
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
{
public:
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
{
public:
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<const tuple<_Tp...>> : true_type {};
template <class _Tp> struct __tuple_like<const _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<volatile _Tp> : public __tuple_like<_Tp> {};
template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_like<_Tp> {};
template <class... _Tp> struct __tuple_like<tuple<_Tp...> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type {};
template <class _T1, class _T2> struct __tuple_like<const pair<_T1, _T2> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <class _Tp, size_t _Size> struct __tuple_like<const array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...>>::type&
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp>
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&);
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&);
@@ -57,6 +96,10 @@ template <size_t _Ip, class _T1, class _T2>
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&);
template <size_t _Ip, class _T1, class _T2>
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&);
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&
get(array<_Tp, _Size>&);
@@ -65,6 +108,10 @@ template <size_t _Ip, class _Tp, size_t _Size>
const _Tp&
get(const array<_Tp, _Size>&);
template <size_t _Ip, class _Tp, size_t _Size>
_Tp&&
get(array<_Tp, _Size>&&);
// __make_tuple_indices
template <size_t...> struct __tuple_indices {};
@@ -96,7 +143,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class tuple_element<_Ip, __tuple_types<>>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -104,29 +151,34 @@ public:
};
template <class _Hp, class ..._Tp>
class tuple_element<0, __tuple_types<_Hp, _Tp...>>
class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
{
public:
typedef _Hp type;
};
template <size_t _Ip, class _Hp, class ..._Tp>
class tuple_element<_Ip, __tuple_types<_Hp, _Tp...>>
class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
{
public:
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...>>::type type;
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
};
template <class ..._Tp>
class tuple_size<__tuple_types<_Tp...>>
class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...>> : true_type {};
template <class... _Tp> struct __tuple_like<__tuple_types<_Tp...> > : true_type {};
// __make_tuple_types
// __make_tuple_types<_Tuple<_Types...>, _Ep, _Sp>::type is a
// __tuple_types<_Types...> using only those _Types in the range [_Sp, _Ep).
// _Sp defaults to 0 and _Ep defaults to tuple_size<_Tuple>. If _Tuple is a
// lvalue_reference type, then __tuple_types<_Types&...> is the result.
template <class _TupleTypes, class _Tp, size_t _Sp, size_t _Ep>
struct __make_tuple_types_imp;
@@ -135,7 +187,7 @@ struct __make_tuple_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename remove_reference<_Tp>::type _Tpr;
typedef typename __make_tuple_types_imp<__tuple_types<_Types...,
typename conditional<is_reference<_Tp>::value,
typename conditional<is_lvalue_reference<_Tp>::value,
typename tuple_element<_Sp, _Tpr>::type&,
typename tuple_element<_Sp, _Tpr>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
@@ -154,45 +206,23 @@ struct __make_tuple_types
typedef typename __make_tuple_types_imp<__tuple_types<>, _Tp, _Sp, _Ep>::type type;
};
// __make_assignable_types
template <class _Tuple, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp;
template <class ..._Types, class _Tp, size_t _Sp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Sp, _Ep>
{
typedef typename __make_assignable_types_imp<__tuple_types<_Types...,
typename remove_reference<typename tuple_element<_Sp, _Tp>::type>::type>,
_Tp, _Sp+1, _Ep>::type type;
};
template <class ..._Types, class _Tp, size_t _Ep>
struct __make_assignable_types_imp<__tuple_types<_Types...>, _Tp, _Ep, _Ep>
{
typedef __tuple_types<_Types...> type;
};
template <class _Tp, size_t _Ep = tuple_size<typename remove_reference<_Tp>::type>::value, size_t _Sp = 0>
struct __make_assignable_types
{
static_assert(_Sp <= _Ep, "__make_assignable_types input error");
typedef typename __make_assignable_types_imp<__tuple_types<>, typename remove_reference<_Tp>::type, _Sp, _Ep>::type type;
};
// __tuple_convertible
template <bool, class _Tp, class _Up>
struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...>>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value &&
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...>>::value> {};
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<>>
struct __tuple_convertible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
@@ -209,6 +239,19 @@ struct __tuple_convertible<_Tp, _Up, true, true>
// __tuple_assignable
template <bool, class _Tp, class _Up>
struct __tuple_assignable_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_assignable_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_assignable<_Up0&, _Tp0>::value &&
__tuple_assignable_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_assignable_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_assignable
@@ -216,9 +259,9 @@ struct __tuple_assignable
template <class _Tp, class _Up>
struct __tuple_assignable<_Tp, _Up, true, true>
: public __tuple_convertible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_assignable_types<_Up>::type>
: public __tuple_assignable_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
_LIBCPP_END_NAMESPACE_STD

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -256,7 +256,7 @@ template <class RandomAccessIterator, class RandomNumberGenerator>
template<class RandomAccessIterator, class UniformRandomNumberGenerator>
void shuffle(RandomAccessIterator first, RandomAccessIterator last,
UniformRandomNumberGenerator& g);
UniformRandomNumberGenerator&& g);
template <class InputIterator, class Predicate>
bool
@@ -1438,7 +1438,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(move_iterator<_Tp*> __i)
@@ -1450,7 +1450,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*> __i)
@@ -1473,7 +1473,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
has_trivial_copy_assign<_Up>::value,
is_trivially_copy_assignable<_Up>::value,
_Up*
>::type
__copy(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1508,7 +1508,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
has_trivial_copy_assign<_Up>::value,
is_trivially_copy_assignable<_Up>::value,
_Up*
>::type
__copy_backward(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1559,8 +1559,17 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
for (; __n > 0; --__n, ++__first, ++__result)
if (__n > 0)
{
*__result = *__first;
++__result;
for (--__n; __n > 0; --__n)
{
++__first;
*__result = *__first;
++__result;
}
}
return __result;
}
@@ -1573,7 +1582,7 @@ typename enable_if
>::type
copy_n(_InputIterator __first, _Size __n, _OutputIterator __result)
{
return copy(__first, __first + __n, __result);
return _STD::copy(__first, __first + __n, __result);
}
// move
@@ -1593,7 +1602,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
has_trivial_copy_assign<_Up>::value,
is_trivially_copy_assignable<_Up>::value,
_Up*
>::type
__move(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1628,7 +1637,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_same<typename remove_const<_Tp>::type, _Up>::value &&
has_trivial_copy_assign<_Up>::value,
is_trivially_copy_assignable<_Up>::value,
_Up*
>::type
__move_backward(_Tp* __first, _Tp* __last, _Up* __result)
@@ -1766,7 +1775,7 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{
return _STD::__fill_n(__first, __n, __value, integral_constant<bool,
is_pointer<_OutputIterator>::value &&
has_trivial_copy_assign<_Tp>::value &&
is_trivially_copy_assignable<_Tp>::value &&
sizeof(_Tp) == 1>());
}
@@ -2169,7 +2178,7 @@ rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __l
typename iterator_traits<_ForwardIterator>::iterator_category,
random_access_iterator_tag
>::value &&
has_trivial_copy_assign
is_trivially_copy_assignable
<
typename iterator_traits<_ForwardIterator>::value_type
>::value
@@ -2686,7 +2695,11 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
_D __uid;
__rs_default __g = __rs_get();
for (--__last, --__d; __first < __last; ++__first, --__d)
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
{
difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
}
}
@@ -2704,13 +2717,20 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
if (__d > 1)
{
for (--__last; __first < __last; ++__first, --__d)
swap(*__first, *(__first + __rand(__d)));
{
difference_type __i = __rand(__d);
swap(*__first, *(__first + __i));
}
}
}
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_UniformRandomNumberGenerator&& __g)
#else
_UniformRandomNumberGenerator& __g)
#endif
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef uniform_int_distribution<ptrdiff_t> _D;
@@ -2720,7 +2740,11 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
{
_D __uid;
for (--__last, --__d; __first < __last; ++__first, --__d)
swap(*__first, *(__first + __uid(__g, _P(0, __d))));
{
difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
}
}
@@ -3419,8 +3443,8 @@ __sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __c
// _Compare is known to be a reference type
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
const difference_type __limit = has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value ? 30 : 6;
const difference_type __limit = is_trivially_copy_constructible<value_type>::value &&
is_trivially_copy_assignable<value_type>::value ? 30 : 6;
while (true)
{
__restart:
@@ -4054,7 +4078,7 @@ __inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle,
template <class _Tp>
struct __inplace_merge_switch
{
static const unsigned value = has_trivial_copy_assign<_Tp>::value;
static const unsigned value = is_trivially_copy_assignable<_Tp>::value;
};
template <class _BidirectionalIterator, class _Compare>
@@ -4222,7 +4246,7 @@ __stable_sort_move(_RandomAccessIterator __first1, _RandomAccessIterator __last1
template <class _Tp>
struct __stable_sort_switch
{
static const unsigned value = 128*has_trivial_copy_assign<_Tp>::value;
static const unsigned value = 128*is_trivially_copy_assignable<_Tp>::value;
};
template <class _Compare, class _RandomAccessIterator>

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -94,6 +94,7 @@ template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&);
template <int I, class T, size_t N> const T& get(const array<T, N>&);
template <int I, class T, size_t N> T&& get(array<T, N>&&);
} // std
@@ -115,7 +116,7 @@ template <int I, class T, size_t N> const T& get(const array<T, N>&);
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct array
struct _LIBCPP_VISIBLE array
{
// types:
typedef array __self;
@@ -134,8 +135,10 @@ struct array
value_type __elems_[_Size > 0 ? _Size : 1];
// No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) {_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a) {_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY void swap(array& __a)
{_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators:
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
@@ -256,20 +259,22 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
class tuple_size<array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class tuple_size<const array<_Tp, _Size> > : public integral_constant<size_t, _Size> {};
class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class tuple_element<_Ip, array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class tuple_element<_Ip, const array<_Tp, _Size> >
class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
@@ -291,6 +296,18 @@ get(const array<_Tp, _Size>& __a)
return __a[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a)
{
return _STD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ARRAY

1513
include/atomic Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -40,7 +40,10 @@ public:
// 23.3.5.1 constructors:
constexpr bitset();
constexpr bitset(unsigned long long val);
explicit bitset( const char* str );
template <class charT>
explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos,
charT zero = charT('0'), charT one = charT('1'));
template<class charT, class traits, class Allocator>
explicit bitset(const basic_string<charT,traits,Allocator>& str,
typename basic_string<charT,traits,Allocator>::size_type pos = 0,
@@ -592,7 +595,7 @@ template <size_t _Size> class bitset;
template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size>
class bitset
class _LIBCPP_VISIBLE bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
@@ -605,7 +608,10 @@ public:
// 23.3.5.1 constructors:
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
/*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
explicit bitset(const char* __str);
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
template<class _CharT, class _Traits, class _Allocator>
explicit bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
typename basic_string<_CharT,_Traits,_Allocator>::size_type __pos = 0,
@@ -656,17 +662,21 @@ public:
private:
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const {return base::__hash_code();}
friend struct hash<bitset>;
};
template <size_t _Size>
bitset<_Size>::bitset(const char* __str)
template<class _CharT>
bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one)
{
size_t __rlen = strlen(__str);
size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != '0' && __str[__i] != '1')
if (__str[__i] != __zero && __str[__i] != __one)
#ifndef _LIBCPP_NO_EXCEPTIONS
throw invalid_argument("bitset string ctor has invalid argument");
#else
@@ -676,15 +686,11 @@ bitset<_Size>::bitset(const char* __str)
size_t __i = 0;
for (; __i < _M; ++__i)
{
switch (__str[_M - 1 - __i])
{
case '0':
_CharT __c = __str[_M - 1 - __i];
if (__c == __zero)
(*this)[__i] = false;
break;
case '1':
else
(*this)[__i] = true;
break;
}
}
_STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
}
@@ -1010,9 +1016,10 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
}
template <size_t _Size>
struct hash<bitset<_Size> >
struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const
{return __bs.__hash_code();}
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -297,12 +297,6 @@ long double truncl(long double x);
*/
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
#if defined(__clang__) && defined(__APPLE__)
# pragma push_macro("__STRICT_ANSI__")
# undef __STRICT_ANSI__
#endif // defined(__clang__) && defined(__APPLE__)
#include <__config>
#include <math.h>
#include <type_traits>
@@ -317,8 +311,7 @@ using ::double_t;
// abs
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, _A1>::type
abs(_A1 __x) {return fabs(__x);}
@@ -331,8 +324,7 @@ inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
acos(_A1 __x) {return acos((double)__x);}
@@ -345,8 +337,7 @@ inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
asin(_A1 __x) {return asin((double)__x);}
@@ -359,8 +350,7 @@ inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
atan(_A1 __x) {return atan((double)__x);}
@@ -373,8 +363,7 @@ inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x)
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -398,8 +387,7 @@ inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
ceil(_A1 __x) {return ceil((double)__x);}
@@ -412,7 +400,7 @@ inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(_
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
cos(_A1 __x) {return cos((double)__x);}
@@ -425,8 +413,7 @@ inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
cosh(_A1 __x) {return cosh((double)__x);}
@@ -439,8 +426,7 @@ inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(_
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
exp(_A1 __x) {return exp((double)__x);}
@@ -453,8 +439,7 @@ inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
fabs(_A1 __x) {return fabs((double)__x);}
@@ -467,8 +452,7 @@ inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floo
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
floor(_A1 __x) {return floor((double)__x);}
@@ -481,8 +465,7 @@ inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -506,8 +489,7 @@ inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {r
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);}
@@ -520,8 +502,7 @@ inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {re
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
@@ -534,8 +515,7 @@ inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(_
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
log(_A1 __x) {return log((double)__x);}
@@ -548,8 +528,7 @@ inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log1
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
log10(_A1 __x) {return log10((double)__x);}
@@ -570,8 +549,7 @@ inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -595,8 +573,7 @@ inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(_
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
sin(_A1 __x) {return sin((double)__x);}
@@ -609,8 +586,7 @@ inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
sinh(_A1 __x) {return sinh((double)__x);}
@@ -623,8 +599,7 @@ inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
sqrt(_A1 __x) {return sqrt((double)__x);}
@@ -637,8 +612,7 @@ inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(_
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
tan(_A1 __x) {return tan((double)__x);}
@@ -651,8 +625,7 @@ inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
tanh(_A1 __x) {return tanh((double)__x);}
@@ -673,7 +646,7 @@ __libcpp_signbit(_A1 __x)
#undef signbit
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
signbit(_A1 __x)
{
@@ -699,7 +672,7 @@ __libcpp_fpclassify(_A1 __x)
#undef fpclassify
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __x)
{
@@ -725,7 +698,7 @@ __libcpp_isfinite(_A1 __x)
#undef isfinite
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isfinite(_A1 __x)
{
@@ -751,7 +724,7 @@ __libcpp_isinf(_A1 __x)
#undef isinf
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isinf(_A1 __x)
{
@@ -777,7 +750,7 @@ __libcpp_isnan(_A1 __x)
#undef isnan
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnan(_A1 __x)
{
@@ -803,7 +776,7 @@ __libcpp_isnormal(_A1 __x)
#undef isnormal
template <class _A1>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __x)
{
@@ -829,7 +802,7 @@ __libcpp_isgreater(_A1 __x, _A2 __y)
#undef isgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -860,7 +833,7 @@ __libcpp_isgreaterequal(_A1 __x, _A2 __y)
#undef isgreaterequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -891,7 +864,7 @@ __libcpp_isless(_A1 __x, _A2 __y)
#undef isless
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -922,7 +895,7 @@ __libcpp_islessequal(_A1 __x, _A2 __y)
#undef islessequal
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -953,7 +926,7 @@ __libcpp_islessgreater(_A1 __x, _A2 __y)
#undef islessgreater
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -984,7 +957,7 @@ __libcpp_isunordered(_A1 __x, _A2 __y)
#undef isunordered
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_floating_point<_A1>::value &&
@@ -1007,8 +980,7 @@ inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) {return acos
inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) {return acoshl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
acosh(_A1 __x) {return acosh((double)__x);}
@@ -1021,8 +993,7 @@ inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) {return asin
inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) {return asinhl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
asinh(_A1 __x) {return asinh((double)__x);}
@@ -1035,8 +1006,7 @@ inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) {return atan
inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) {return atanhl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
atanh(_A1 __x) {return atanh((double)__x);}
@@ -1049,8 +1019,7 @@ inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) {return cbrtf
inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) {return cbrtl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
cbrt(_A1 __x) {return cbrt((double)__x);}
@@ -1063,8 +1032,7 @@ inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) {return copysignl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1088,8 +1056,7 @@ inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) {return erff(_
inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) {return erfl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
erf(_A1 __x) {return erf((double)__x);}
@@ -1102,8 +1069,7 @@ inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) {return erfcf
inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) {return erfcl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
erfc(_A1 __x) {return erfc((double)__x);}
@@ -1116,8 +1082,7 @@ inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) {return exp2f
inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) {return exp2l(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
exp2(_A1 __x) {return exp2((double)__x);}
@@ -1130,8 +1095,7 @@ inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) {return expm
inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) {return expm1l(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
expm1(_A1 __x) {return expm1((double)__x);}
@@ -1144,8 +1108,7 @@ inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) {return fdiml(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1165,19 +1128,13 @@ fdim(_A1 __x, _A2 __y)
inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) {return (float)((double)__x*__y + __z);}
#define FP_FAST_FMAF
//#if (defined(__ppc__) || defined(__ppc64__))
//inline _LIBCPP_INLINE_VISIBILITY double fma(register double __x, register double __y, register double __z) {asm {fmadd __x, __x, __y, __z} return __x;}
//#define FP_FAST_FMA
//#else
using ::fma;
//#endif
inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) {return fmaf(__x, __y, __z);}
inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) {return fmal(__x, __y, __z);}
template <class _A1, class _A2, class _A3>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1203,8 +1160,7 @@ inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1228,8 +1184,7 @@ inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) {return fminl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1253,8 +1208,7 @@ inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) {return hypotl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1278,8 +1232,7 @@ inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) {return ilogbf(__x);
inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) {return ilogbl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, int>::type
ilogb(_A1 __x) {return ilogb((double)__x);}
@@ -1292,8 +1245,7 @@ inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) {return lga
inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) {return lgammal(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
lgamma(_A1 __x) {return lgamma((double)__x);}
@@ -1306,8 +1258,7 @@ inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) {return llrin
inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) {return llrintl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long long>::type
llrint(_A1 __x) {return llrint((double)__x);}
@@ -1320,8 +1271,7 @@ inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) {return llro
inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) {return llroundl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long long>::type
llround(_A1 __x) {return llround((double)__x);}
@@ -1334,8 +1284,7 @@ inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) {return log1
inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) {return log1pl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
log1p(_A1 __x) {return log1p((double)__x);}
@@ -1348,8 +1297,7 @@ inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) {return log2f
inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) {return log2l(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
log2(_A1 __x) {return log2((double)__x);}
@@ -1362,8 +1310,7 @@ inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) {return logbf
inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) {return logbl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
logb(_A1 __x) {return logb((double)__x);}
@@ -1376,8 +1323,7 @@ inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) {return lrintf(__x)
inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) {return lrintl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
lrint(_A1 __x) {return lrint((double)__x);}
@@ -1390,8 +1336,7 @@ inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) {return lroundf(__
inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) {return lroundl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
lround(_A1 __x) {return lround((double)__x);}
@@ -1409,8 +1354,7 @@ inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) {return
inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) {return nearbyintl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
nearbyint(_A1 __x) {return nearbyint((double)__x);}
@@ -1423,8 +1367,7 @@ inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1448,8 +1391,7 @@ inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double _
inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
nexttoward(_A1 __x, long double __y) {return nexttoward((double)__x, __y);}
@@ -1462,8 +1404,7 @@ inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y)
inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) {return remainderl(__x, __y);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1487,8 +1428,7 @@ inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* _
inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) {return remquol(__x, __y, __z);}
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_arithmetic<_A1>::value &&
@@ -1512,8 +1452,7 @@ inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) {return rintf
inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) {return rintl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
rint(_A1 __x) {return rint((double)__x);}
@@ -1526,8 +1465,7 @@ inline _LIBCPP_INLINE_VISIBILITY float round(float __x) {return roun
inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) {return roundl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
round(_A1 __x) {return round((double)__x);}
@@ -1540,8 +1478,7 @@ inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y)
inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
scalbln(_A1 __x, long __y) {return scalbln((double)__x, __y);}
@@ -1554,8 +1491,7 @@ inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) {r
inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
scalbn(_A1 __x, int __y) {return scalbn((double)__x, __y);}
@@ -1568,8 +1504,7 @@ inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) {return tga
inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) {return tgammal(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
tgamma(_A1 __x) {return tgamma((double)__x);}
@@ -1582,8 +1517,7 @@ inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) {return trun
inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) {return truncl(__x);}
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
trunc(_A1 __x) {return trunc((double)__x);}
@@ -1647,9 +1581,4 @@ using ::truncl;
_LIBCPP_END_NAMESPACE_STD
// FIXME: work around for Clang with -std=C++0x on OSX/iOS
#if defined(__clang__) && defined(__APPLE__)
# pragma pop_macro("__STRICT_ANSI__")
#endif
#endif // _LIBCPP_CMATH

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -191,17 +191,17 @@ template<class T> T norm(const complex<T>&);
template<Integral T> double norm(T);
float norm(float);
template<class T> complex<T> conj(const complex<T>&);
long double conj(long double);
double conj(double);
template<Integral T> double conj(T);
float conj(float);
template<class T> complex<T> conj(const complex<T>&);
complex<long double> conj(long double);
complex<double> conj(double);
template<Integral T> complex<double> conj(T);
complex<float> conj(float);
template<class T> complex<T> proj(const complex<T>&);
long double proj(long double);
double proj(double);
template<Integral T> double proj(T);
float proj(float);
template<class T> complex<T> proj(const complex<T>&);
complex<long double> proj(long double);
complex<double> proj(double);
template<Integral T> complex<double> proj(T);
complex<float> proj(float);
template<class T> complex<T> polar(const T&, const T& = 0);
@@ -253,13 +253,13 @@ template<class T, class charT, class traits>
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class complex;
template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp>
class complex
class _LIBCPP_VISIBLE complex
{
public:
typedef _Tp value_type;
@@ -316,11 +316,11 @@ public:
}
};
template<> class complex<double>;
template<> class complex<long double>;
template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_VISIBLE complex<long double>;
template<>
class complex<float>
class _LIBCPP_VISIBLE complex<float>
{
float __re_;
float __im_;
@@ -375,7 +375,7 @@ public:
};
template<>
class complex<double>
class _LIBCPP_VISIBLE complex<double>
{
double __re_;
double __im_;
@@ -430,7 +430,7 @@ public:
};
template<>
class complex<long double>
class _LIBCPP_VISIBLE complex<long double>
{
long double __re_;
long double __im_;
@@ -781,20 +781,6 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
return !(__x == __y);
}
/*
Move to <istream>
template<class T, class charT, class traits>
basic_istream<charT, traits>&
operator>>(basic_istream<charT, traits>&, complex<T>&);
Move to <ostream>
template<class T, class charT, class traits>
basic_ostream<charT, traits>&
operator<<(basic_ostream<charT, traits>&, const complex<T>&);
*/
// 26.3.7 values:
// real
@@ -994,17 +980,17 @@ conj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
long double
complex<long double>
conj(long double __re)
{
return __re;
return complex<long double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
double
complex<double>
conj(double __re)
{
return __re;
return complex<double>(__re);
}
template<class _Tp>
@@ -1012,18 +998,18 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
double
complex<double>
>::type
conj(_Tp __re)
{
return __re;
return complex<double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
float
complex<float>
conj(float __re)
{
return __re;
return complex<float>(__re);
}
// proj
@@ -1040,21 +1026,21 @@ proj(const complex<_Tp>& __c)
}
inline _LIBCPP_INLINE_VISIBILITY
long double
complex<long double>
proj(long double __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<long double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
double
complex<double>
proj(double __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<double>(__re);
}
template<class _Tp>
@@ -1062,20 +1048,20 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
double
complex<double>
>::type
proj(_Tp __re)
{
return __re;
return complex<double>(__re);
}
inline _LIBCPP_INLINE_VISIBILITY
float
complex<float>
proj(float __re)
{
if (isinf(__re))
__re = abs(__re);
return __re;
return complex<float>(__re);
}
// polar

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -54,7 +54,7 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct nullptr_t
struct _LIBCPP_VISIBLE nullptr_t
{
void* _;
@@ -78,42 +78,6 @@ struct nullptr_t
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
template <typename _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, _Tp* __p) {return 0 == __p;}
template <typename _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator==(_Tp* __p, nullptr_t) {return __p == 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, _Tp* __p) {return 0 != __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator!=(_Tp* __p, nullptr_t) {return __p != 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, _Tp* __p) {return 0 < __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<(_Tp* __p, nullptr_t) {return __p < 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, _Tp* __p) {return 0 <= __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator<=(_Tp* __p, nullptr_t) {return __p <= 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, _Tp* __p) {return 0 > __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>(_Tp* __p, nullptr_t) {return __p > 0;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, _Tp* __p) {return 0 >= __p;}
template <class _Tp>
friend _LIBCPP_ALWAYS_INLINE bool operator>=(_Tp* __p, nullptr_t) {return __p >= 0;}
};
inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -159,7 +159,7 @@ template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class __deque_iterator;
class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -251,7 +251,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 __deque_iterator
class _LIBCPP_VISIBLE __deque_iterator
{
typedef _MapPointer __map_iterator;
public:
@@ -399,9 +399,9 @@ private:
: __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _A> friend class __deque_base;
template <class _Tp, class _A> friend class deque;
template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
template <class _V, class _P, class _R, class _MP, class _D, _D>
friend class __deque_iterator;
friend class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -603,7 +603,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 = prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -776,7 +776,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 = prev(__r);
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __rp = _STD::prev(__r);
pointer __rb = *__rp.__m_iter_;
pointer __re = __rp.__ptr_ + 1;
difference_type __bs = __re - __rb;
@@ -941,6 +941,7 @@ protected:
bool __invariants() const;
_LIBCPP_INLINE_VISIBILITY
void __move_assign(__deque_base& __c)
{
__map_ = _STD::move(__c.__map_);
@@ -950,28 +951,35 @@ protected:
__c.__start_ = __c.size() = 0;
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __deque_base& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
};
@@ -1108,7 +1116,7 @@ __deque_base<_Tp, _Allocator>::clear()
{
allocator_type& __a = __alloc();
for (iterator __i = begin(), __e = end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, addressof(*__i));
__alloc_traits::destroy(__a, _STD::addressof(*__i));
size() = 0;
while (__map_.size() > 2)
{
@@ -1127,7 +1135,7 @@ __deque_base<_Tp, _Allocator>::clear()
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class deque
class _LIBCPP_VISIBLE deque
: private __deque_base<_Tp, _Allocator>
{
public:
@@ -1169,6 +1177,7 @@ public:
deque(initializer_list<value_type> __il, const allocator_type& __a);
deque& operator=(const deque& __c);
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1185,34 +1194,48 @@ 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);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
allocator_type get_allocator() const;
// iterators:
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(__base::begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(__base::begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __base::end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return const_reverse_iterator(__base::end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return const_reverse_iterator(__base::begin());}
// capacity:
_LIBCPP_INLINE_VISIBILITY size_type size() const {return __base::size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __alloc_traits::max_size(__base::__alloc());}
void resize(size_type __n);
void resize(size_type __n, const value_type& __v);
void shrink_to_fit();
bool empty() const {return __base::size() == 0;}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __base::size() == 0;}
// element access:
reference operator[](size_type __i);
@@ -1246,6 +1269,7 @@ public:
template <class _BiIter>
iterator insert (const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
void pop_front();
@@ -1256,20 +1280,25 @@ public:
void swap(deque& __c);
void clear();
_LIBCPP_INLINE_VISIBILITY
bool __invariants() const {return __base::__invariants();}
private:
_LIBCPP_INLINE_VISIBILITY
static size_type __recommend_blocks(size_type __n)
{
return __n / __base::__block_size + (__n % __base::__block_size != 0);
}
_LIBCPP_INLINE_VISIBILITY
size_type __capacity() const
{
return __base::__map_.size() == 0 ? 0 : __base::__map_.size() * __base::__block_size - 1;
}
_LIBCPP_INLINE_VISIBILITY
size_type __front_spare() const
{
return __base::__start_;
}
_LIBCPP_INLINE_VISIBILITY
size_type __back_spare() const
{
return __capacity() - (__base::__start_ + __base::size());
@@ -1298,10 +1327,12 @@ private:
void __move_construct_backward_and_check(iterator __f, iterator __l,
iterator __r, const_pointer& __vt);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, true_type)
{
if (__base::__alloc() != __c.__alloc())
@@ -1313,6 +1344,7 @@ private:
__base::__map_.__alloc() = __c.__map_.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque& __c, false_type)
{}
@@ -1401,14 +1433,14 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
deque<_Tp, _Allocator>::deque(deque&& __c)
: __base(_STD::move(__c))
{
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_STD::move(__c), __a)
{
@@ -1420,7 +1452,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(deque&& __c)
{
@@ -1501,7 +1533,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
_Allocator
deque<_Tp, _Allocator>::get_allocator() const
{
@@ -1560,7 +1592,7 @@ deque<_Tp, _Allocator>::shrink_to_fit()
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::operator[](size_type __i)
{
@@ -1569,7 +1601,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const
{
@@ -1578,7 +1610,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::at(size_type __i)
{
@@ -1589,7 +1621,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::at(size_type __i) const
{
@@ -1600,7 +1632,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::front()
{
@@ -1609,7 +1641,7 @@ deque<_Tp, _Allocator>::front()
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::front() const
{
@@ -1618,7 +1650,7 @@ deque<_Tp, _Allocator>::front() const
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::back()
{
@@ -1627,7 +1659,7 @@ deque<_Tp, _Allocator>::back()
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::back() const
{
@@ -1643,7 +1675,7 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, addressof(*__base::end()), __v);
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
++__base::size();
}
@@ -1657,7 +1689,7 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
@@ -1672,7 +1704,7 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
if (__back_spare() == 0)
__add_back_capacity();
// __back_spare() >= 1
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
@@ -1687,7 +1719,7 @@ deque<_Tp, _Allocator>::push_front(const value_type& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1702,7 +1734,7 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
@@ -1718,7 +1750,7 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
if (__front_spare() == 0)
__add_front_capacity();
// __front_spare() >= 1
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
@@ -1740,7 +1772,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, addressof(*--__base::begin()), __v);
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
@@ -1748,14 +1780,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 = prev(__b);
iterator __bm1 = _STD::prev(__b);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
__vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = __move_and_check(next(__b), __b + __pos, __b, __vt);
__b = __move_and_check(_STD::next(__b), __b + __pos, __b, __vt);
*__b = *__vt;
}
}
@@ -1767,17 +1799,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, addressof(*__base::end()), __v);
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), __v);
++__base::size();
}
else
{
const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = prev(__e);
iterator __em1 = _STD::prev(__e);
if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
__vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
@@ -1803,19 +1835,19 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::move(__v));
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::move(__v));
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = _STD::move(__v);
}
}
@@ -1827,14 +1859,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::move(__v));
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::move(__v));
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1861,19 +1893,19 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
// __front_spare() >= 1
if (__pos == 0)
{
__alloc_traits::construct(__a, addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _STD::addressof(*--__base::begin()), _STD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
else
{
iterator __b = __base::begin();
iterator __bm1 = prev(__b);
__alloc_traits::construct(__a, addressof(*__bm1), _STD::move(*__b));
iterator __bm1 = _STD::prev(__b);
__alloc_traits::construct(__a, _STD::addressof(*__bm1), _STD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
__b = _STD::move(next(__b), __b + __pos, __b);
__b = _STD::move(_STD::next(__b), __b + __pos, __b);
*__b = value_type(_STD::forward<_Args>(__args)...);
}
}
@@ -1885,14 +1917,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
__alloc_traits::construct(__a, addressof(*__base::end()), _STD::forward<_Args>(__args)...);
__alloc_traits::construct(__a, _STD::addressof(*__base::end()), _STD::forward<_Args>(__args)...);
++__base::size();
}
else
{
iterator __e = __base::end();
iterator __em1 = prev(__e);
__alloc_traits::construct(__a, addressof(*__e), _STD::move(*__em1));
iterator __em1 = _STD::prev(__e);
__alloc_traits::construct(__a, _STD::addressof(*__e), _STD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _STD::move_backward(__e - __de, __em1, __e);
@@ -1923,7 +1955,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, addressof(*--__i), __v);
__alloc_traits::construct(__a, _STD::addressof(*--__i), __v);
__n = __pos;
}
if (__n > 0)
@@ -1949,7 +1981,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, addressof(*__i), __v);
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
__n = __de;
}
if (__n > 0)
@@ -2001,7 +2033,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __pos < __n / 2 ? _STD::prev(__l, __pos) : _STD::next(__f, __n - __pos);
for (_BiIter __j = __m; __j != __f; --__base::__start_, ++__base::size())
__alloc_traits::construct(__a, addressof(*--__i), *--__j);
__alloc_traits::construct(__a, _STD::addressof(*--__i), *--__j);
__n = __pos;
}
if (__n > 0)
@@ -2009,7 +2041,7 @@ 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, addressof(*--__i), _STD::move(*--__j));
__alloc_traits::construct(__a, _STD::addressof(*--__i), _STD::move(*--__j));
--__base::__start_;
++__base::size();
}
@@ -2033,14 +2065,14 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
{
__m = __de < __n / 2 ? _STD::next(__f, __de) : _STD::prev(__l, __n - __de);
for (_BiIter __j = __m; __j != __l; ++__i, ++__j, ++__base::size())
__alloc_traits::construct(__a, addressof(*__i), *__j);
__alloc_traits::construct(__a, _STD::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, addressof(*__i), _STD::move(*__j));
__alloc_traits::construct(__a, _STD::addressof(*__i), _STD::move(*__j));
if (__n < __de)
__old_end = _STD::move_backward(__old_end - __de, __oen, __old_end);
_STD::copy_backward(__f, __m, __old_end);
@@ -2073,7 +2105,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
for (iterator __i = __base::end(); __f != __l; ++__i, ++__f, ++__base::size())
__alloc_traits::construct(__a, addressof(*__i), *__f);
__alloc_traits::construct(__a, _STD::addressof(*__i), *__f);
}
template <class _Tp, class _Allocator>
@@ -2086,7 +2118,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, addressof(*__i));
__alloc_traits::construct(__a, _STD::addressof(*__i));
}
template <class _Tp, class _Allocator>
@@ -2099,7 +2131,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, addressof(*__i), __v);
__alloc_traits::construct(__a, _STD::addressof(*__i), __v);
}
// Create front capacity for one block of elements.
@@ -2177,7 +2209,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 = min(__back_capacity, __nb); // don't take more than you need
__back_capacity = _STD::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)
@@ -2322,7 +2354,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 = min(__front_capacity, __nb); // don't take more than you need
__front_capacity = _STD::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)
@@ -2504,7 +2536,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, addressof(*__r), _STD::move(*__f));
// __alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__f));
difference_type __n = __l - __f;
while (__n > 0)
{
@@ -2519,7 +2551,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, addressof(*__r), _STD::move(*__fb));
__alloc_traits::construct(__a, _STD::addressof(*__r), _STD::move(*__fb));
__n -= __bs;
__f += __bs;
}
@@ -2536,7 +2568,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
// as if
// for (iterator __j = __l; __j != __f;)
// {
// __alloc_traitsconstruct(__a, addressof(*--__r), _STD::move(*--__j));
// __alloc_traitsconstruct(__a, _STD::addressof(*--__r), _STD::move(*--__j));
// --__base::__start_;
// ++__base::size();
// }
@@ -2556,7 +2588,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, addressof(*--__r), _STD::move(*--__le));
__alloc_traits::construct(__a, _STD::addressof(*--__r), _STD::move(*--__le));
--__base::__start_;
++__base::size();
}
@@ -2576,8 +2608,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, next(__p));
__alloc_traits::destroy(__a, addressof(*__b));
_STD::move_backward(__b, __p, _STD::next(__p));
__alloc_traits::destroy(__a, _STD::addressof(*__b));
--__base::size();
++__base::__start_;
if (__front_spare() >= 2 * __base::__block_size)
@@ -2589,8 +2621,8 @@ deque<_Tp, _Allocator>::erase(const_iterator __f)
}
else
{ // erase from back
iterator __i = _STD::move(next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, addressof(*__i));
iterator __i = _STD::move(_STD::next(__p), __base::end(), __p);
__alloc_traits::destroy(__a, _STD::addressof(*__i));
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2616,7 +2648,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from front
iterator __i = _STD::move_backward(__b, __p, __p + __n);
for (; __b != __i; ++__b)
__alloc_traits::destroy(__a, addressof(*__b));
__alloc_traits::destroy(__a, _STD::addressof(*__b));
__base::size() -= __n;
__base::__start_ += __n;
while (__front_spare() >= 2 * __base::__block_size)
@@ -2630,7 +2662,7 @@ deque<_Tp, _Allocator>::erase(const_iterator __f, const_iterator __l)
{ // erase from back
iterator __i = _STD::move(__p + __n, __base::end(), __p);
for (iterator __e = __base::end(); __i != __e; ++__i)
__alloc_traits::destroy(__a, addressof(*__i));
__alloc_traits::destroy(__a, _STD::addressof(*__i));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2654,7 +2686,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, addressof(*__p));
__alloc_traits::destroy(__a, _STD::addressof(*__p));
__base::size() -= __n;
while (__back_spare() >= 2 * __base::__block_size)
{
@@ -2665,7 +2697,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
deque<_Tp, _Allocator>::swap(deque& __c)
{
@@ -2673,7 +2705,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
deque<_Tp, _Allocator>::clear()
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -40,10 +40,12 @@ public:
typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f ) throw();
unexpected_handler get_unexpected() throw();
void unexpected [[noreturn]] ();
typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) throw();
terminate_handler get_terminate() throw();
void terminate [[noreturn]] ();
bool uncaught_exception() throw();
@@ -102,10 +104,12 @@ public:
typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
_LIBCPP_VISIBLE unexpected_handler get_unexpected() throw();
_LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
_LIBCPP_VISIBLE terminate_handler get_terminate() throw();
_LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
_LIBCPP_VISIBLE bool uncaught_exception() throw();
@@ -115,22 +119,25 @@ class exception_ptr;
exception_ptr current_exception();
void rethrow_exception(exception_ptr); // noreturn
class exception_ptr
class _LIBCPP_VISIBLE exception_ptr
{
void* __ptr_;
public:
exception_ptr() : __ptr_() {}
exception_ptr(nullptr_t) : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {}
exception_ptr(const exception_ptr&);
exception_ptr& operator=(const exception_ptr&);
~exception_ptr();
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool() const {return __ptr_ != nullptr;}
friend bool operator==(const exception_ptr& __x, const exception_ptr& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
{return !(__x == __y);}
friend exception_ptr current_exception();
@@ -166,7 +173,7 @@ public:
// access functions
void rethrow_nested /*[[noreturn]]*/ () const;
exception_ptr nested_ptr() const {return __ptr_;}
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;}
};
template <class _Tp>
@@ -174,7 +181,7 @@ struct __nested
: public _Tp,
public nested_exception
{
explicit __nested(const _Tp& __t) : _Tp(__t) {}
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
template <class _Tp>
@@ -214,7 +221,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
}
template <class _E>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_E>::value
@@ -226,7 +233,7 @@ rethrow_if_nested(const _E& __e, typename enable_if<
}
template <class _E>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_E>::value

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -217,11 +217,13 @@ class __hash_map_hasher
: private _Hash
{
public:
__hash_map_hasher() : _Hash() {}
__hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : _Hash() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : _Hash(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
@@ -231,11 +233,13 @@ class __hash_map_hasher<_Tp, _Hash, false>
{
_Hash __hash_;
public:
__hash_map_hasher() : __hash_() {}
__hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher() : __hash_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_hasher(const _Hash& __h) : __hash_(__h) {}
_LIBCPP_INLINE_VISIBILITY const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return __hash_(__x);}
};
@@ -245,15 +249,19 @@ class __hash_map_equal
: private _Pred
{
public:
__hash_map_equal() : _Pred() {}
__hash_map_equal(const _Pred& __p) : _Pred(__p) {}
const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : _Pred() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : _Pred(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
@@ -264,15 +272,19 @@ class __hash_map_equal<_Tp, _Pred, false>
{
_Pred __pred_;
public:
__hash_map_equal() : __pred_() {}
__hash_map_equal(const _Pred& __p) : __pred_(__p) {}
const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal() : __pred_() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_equal(const _Pred& __p) : __pred_(__p) {}
_LIBCPP_INLINE_VISIBILITY const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return __pred_(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return __pred_(__x, __y);}
@@ -298,6 +310,7 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
@@ -305,6 +318,7 @@ public:
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -313,6 +327,7 @@ public:
__x.__value_constructed = false;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -322,19 +337,20 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class _HashIterator>
class __hash_map_iterator
class _LIBCPP_VISIBLE __hash_map_iterator
{
_HashIterator __i_;
@@ -354,14 +370,15 @@ public:
#endif
pointer;
__hash_map_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator(_HashIterator __i) : __i_(__i) {}
reference operator*() const {return *operator->();}
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return (pointer)__i_.operator->();}
__hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator operator++(int)
{
__hash_map_iterator __t(*this);
@@ -369,20 +386,22 @@ public:
return __t;
}
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
};
template <class _HashIterator>
class __hash_map_const_iterator
class _LIBCPP_VISIBLE __hash_map_const_iterator
{
_HashIterator __i_;
@@ -402,17 +421,23 @@ public:
#endif
pointer;
__hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator operator++(int)
{
__hash_map_const_iterator __t(*this);
@@ -420,20 +445,22 @@ public:
return __t;
}
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class hash_map;
template <class, class, class, class, class> friend class hash_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class hash_map
class _LIBCPP_VISIBLE hash_map
{
public:
// types
@@ -480,7 +507,7 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
hash_map() {__table_.rehash(193);}
_LIBCPP_INLINE_VISIBILITY hash_map() {__table_.rehash(193);}
explicit hash_map(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
hash_map(size_type __n, const hasher& __hf,
@@ -499,52 +526,77 @@ public:
const allocator_type& __a);
hash_map(const hash_map& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_map& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
mapped_type& operator[](const key_type& __k);
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
private:
@@ -614,16 +666,16 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -646,7 +698,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -674,7 +726,7 @@ operator==(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -684,7 +736,7 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class hash_multimap
class _LIBCPP_VISIBLE hash_multimap
{
public:
// types
@@ -729,6 +781,7 @@ public:
typedef __hash_map_iterator<typename __table::iterator> iterator;
typedef __hash_map_const_iterator<typename __table::const_iterator> const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multimap() {__table_.rehash(193);}
explicit hash_multimap(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -748,49 +801,74 @@ public:
const allocator_type& __a);
hash_multimap(const hash_multimap& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multimap& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -853,7 +931,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::hash_multimap(
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -863,7 +941,7 @@ hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -895,7 +973,7 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -205,7 +205,7 @@ using namespace std;
template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_set
class _LIBCPP_VISIBLE hash_set
{
public:
// types
@@ -231,6 +231,7 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_set() {__table_.rehash(193);}
explicit hash_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -248,47 +249,72 @@ public:
const allocator_type& __a);
hash_set(const hash_set& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_set& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -350,7 +376,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::hash_set(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -360,7 +386,7 @@ hash_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -388,7 +414,7 @@ operator==(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -398,7 +424,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class hash_multiset
class _LIBCPP_VISIBLE hash_multiset
{
public:
// types
@@ -424,6 +450,7 @@ public:
typedef typename __table::const_iterator iterator;
typedef typename __table::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY
hash_multiset() {__table_.rehash(193);}
explicit hash_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -441,46 +468,71 @@ public:
const key_equal& __eql, const allocator_type& __a);
hash_multiset(const hash_multiset& __u);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __p) {__table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
void erase(const_iterator __first, const_iterator __last)
{__table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(hash_multiset& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_funct() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type elems_in_bucket(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
void resize(size_type __n) {__table_.rehash(__n);}
};
@@ -543,7 +595,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::hash_multiset(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -553,7 +605,7 @@ hash_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -585,7 +637,7 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -106,15 +106,21 @@ public:
void resize(size_type n, const value_type& v);
void clear();
void splice_after(const_iterator p, forward_list& x);
void splice_after(const_iterator p, forward_list&& x);
void splice_after(const_iterator p, forward_list& x, const_iterator i);
void splice_after(const_iterator p, forward_list&& x, const_iterator i);
void splice_after(const_iterator p, forward_list& x,
const_iterator first, const_iterator last);
void splice_after(const_iterator p, forward_list&& x,
const_iterator first, const_iterator last);
void remove(const value_type& v);
template <class Predicate> void remove_if(Predicate pred);
void unique();
template <class BinaryPredicate> void unique(BinaryPredicate binary_pred);
void merge(forward_list& x);
void merge(forward_list&& x);
template <class Compare> void merge(forward_list& x, Compare comp);
template <class Compare> void merge(forward_list&& x, Compare comp);
void sort();
template <class Compare> void sort(Compare comp);
@@ -174,7 +180,7 @@ struct __forward_begin_node
pointer __next_;
__forward_begin_node() : __next_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY __forward_begin_node() : __next_(nullptr) {}
};
template <class _Tp, class _VoidPtr>
@@ -198,12 +204,13 @@ template<class, class> class forward_list;
template<class> class __forward_list_const_iterator;
template <class _NodePtr>
class __forward_list_iterator
class _LIBCPP_VISIBLE __forward_list_iterator
{
typedef _NodePtr __node_pointer;
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class forward_list;
@@ -224,16 +231,21 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator& operator++()
{
__ptr_ = __ptr_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator operator++(int)
{
__forward_list_iterator __t(*this);
@@ -241,21 +253,24 @@ public:
return __t;
}
friend bool operator==(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __forward_list_iterator& __x,
const __forward_list_iterator& __y)
{return !(__x == __y);}
};
template <class _NodeConstPtr>
class __forward_list_const_iterator
class _LIBCPP_VISIBLE __forward_list_const_iterator
{
typedef _NodeConstPtr __node_const_pointer;
__node_const_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_const_iterator(__node_const_pointer __p)
: __ptr_(__p) {}
@@ -287,18 +302,24 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p)
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator& operator++()
{
__ptr_ = __ptr_->__next_;
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator operator++(int)
{
__forward_list_const_iterator __t(*this);
@@ -306,10 +327,12 @@ public:
return __t;
}
friend bool operator==(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __forward_list_const_iterator& __x,
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __forward_list_const_iterator& __x,
const __forward_list_const_iterator& __y)
{return !(__x == __y);}
};
@@ -337,21 +360,27 @@ protected:
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin()
{return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const
{return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() {return __before_begin_.second();}
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __alloc() const {return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY
__forward_list_base()
: __before_begin_(__begin_node()) {}
_LIBCPP_INLINE_VISIBILITY
__forward_list_base(const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
@@ -367,10 +396,12 @@ protected:
~__forward_list_base();
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x)
{__copy_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x)
{__move_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());}
@@ -379,7 +410,9 @@ protected:
void clear();
private:
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base&, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x, true_type)
{
if (__alloc() != __x.__alloc())
@@ -387,16 +420,21 @@ private:
__alloc() = __x.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, false_type) {}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, true_type)
{__alloc() = _STD::move(__x.__alloc());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
true_type)
{
@@ -408,7 +446,7 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
: __before_begin_(_STD::move(__x.__before_begin_))
{
@@ -416,7 +454,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a))
@@ -437,7 +475,7 @@ __forward_list_base<_Tp, _Alloc>::~__forward_list_base()
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
{
@@ -454,7 +492,7 @@ __forward_list_base<_Tp, _Alloc>::clear()
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{
__node_pointer __next = __p->__next_;
__node_traits::destroy(__a, addressof(__p->__value_));
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
__p = __next;
}
@@ -462,7 +500,7 @@ __forward_list_base<_Tp, _Alloc>::clear()
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class forward_list
class _LIBCPP_VISIBLE forward_list
: private __forward_list_base<_Tp, _Alloc>
{
typedef __forward_list_base<_Tp, _Alloc> base;
@@ -480,7 +518,7 @@ public:
typedef typename base::iterator iterator;
typedef typename base::const_iterator const_iterator;
forward_list() {} // = default;
_LIBCPP_INLINE_VISIBILITY forward_list() {} // = default;
explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n);
forward_list(size_type __n, const value_type& __v);
@@ -499,6 +537,7 @@ public:
forward_list(const forward_list& __x);
forward_list(const forward_list& __x, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
forward_list(forward_list&& __x) : base(_STD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -523,24 +562,38 @@ public:
void assign(size_type __n, const value_type& __v);
void assign(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return allocator_type(base::__alloc());}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY
iterator before_begin() {return iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator before_begin() const {return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::__before_begin()->__next_ == nullptr;}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY
reference front() {return base::__before_begin()->__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__before_begin()->__next_->__value_;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -563,6 +616,7 @@ public:
iterator insert_after(const_iterator __p, const value_type& __v);
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__is_input_iterator<_InputIterator>::value,
@@ -575,34 +629,44 @@ public:
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY
void swap(forward_list& __x) {base::swap(__x);}
void resize(size_type __n);
void resize(size_type __n, const value_type& __v);
_LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x, const_iterator __i);
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x,
const_iterator __f, const_iterator __l);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void splice_after(const_iterator __p, forward_list& __x);
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
void splice_after(const_iterator __p, forward_list& __x,
const_iterator __f, const_iterator __l);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void remove(const value_type& __v);
template <class _Predicate> void remove_if(_Predicate __pred);
_LIBCPP_INLINE_VISIBILITY
void unique() {unique(__equal_to<value_type>());}
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void merge(forward_list&& __x) {merge(_STD::move(__x), __less<value_type>());}
template <class _Compare> void merge(forward_list&& __x, _Compare __comp);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
template <class _Compare>
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _STD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void sort() {sort(__less<value_type>());}
template <class _Compare> void sort(_Compare __comp);
void reverse();
@@ -630,7 +694,7 @@ private:
};
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>::forward_list(const allocator_type& __a)
: base(__a)
{
@@ -648,7 +712,7 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, addressof(__h->__value_));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
@@ -777,7 +841,7 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
{
@@ -789,7 +853,7 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
{
@@ -807,7 +871,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{
iterator __i = before_begin();
iterator __j = next(__i);
iterator __j = _STD::next(__i);
iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f;
@@ -822,7 +886,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{
iterator __i = before_begin();
iterator __j = next(__i);
iterator __j = _STD::next(__i);
iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v;
@@ -833,7 +897,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
{
@@ -851,7 +915,7 @@ 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, addressof(__h->__value_),
__node_traits::construct(__a, _STD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -866,7 +930,7 @@ 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, addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -880,7 +944,7 @@ 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, addressof(__h->__value_), __v);
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
}
@@ -892,7 +956,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, addressof(__p->__value_));
__node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1);
}
@@ -908,7 +972,7 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _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, addressof(__h->__value_),
__node_traits::construct(__a, _STD::addressof(__h->__value_),
_STD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -925,7 +989,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, 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, addressof(__h->__value_), _STD::move(__v));
__node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -941,7 +1005,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
__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, addressof(__h->__value_), __v);
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
return iterator(__r->__next_);
@@ -958,7 +1022,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
__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, addressof(__h->__value_), __v);
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -968,7 +1032,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, addressof(__h->__value_), __v);
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -978,7 +1042,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, addressof(__first->__value_));
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1008,7 +1072,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
__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, addressof(__h->__value_), *__f);
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1018,7 +1082,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, addressof(__h->__value_), *__f);
__node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__last->__next_ = __h.release();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1028,7 +1092,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr)
{
__node_pointer __next = __first->__next_;
__node_traits::destroy(__a, addressof(__first->__value_));
__node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1);
__first = __next;
}
@@ -1050,7 +1114,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, addressof(__n->__value_));
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_);
}
@@ -1071,7 +1135,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do
{
__p = __n->__next_;
__node_traits::destroy(__a, addressof(__n->__value_));
__node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1);
__n = __p;
} while (__n != __e);
@@ -1104,7 +1168,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, addressof(__h->__value_));
__node_traits::construct(__a, _STD::addressof(__h->__value_));
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1136,7 +1200,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
__ptr = __ptr->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, addressof(__h->__value_), __v);
__node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = nullptr;
__ptr->__next_ = __h.release();
}
@@ -1147,11 +1211,7 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x)
#else
forward_list& __x)
#endif
{
if (!__x.empty())
{
@@ -1172,14 +1232,10 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __i)
{
const_iterator __lm1 = next(__i);
const_iterator __lm1 = _STD::next(__i);
if (__p != __i && __p != __lm1)
{
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1194,11 +1250,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list&& __x,
#else
forward_list& __x,
#endif
const_iterator __f, const_iterator __l)
{
if (__f != __l && __p != __f)
@@ -1218,6 +1270,39 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
}
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x)
{
splice_after(__p, __x);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __i)
{
splice_after(__p, __x, __i);
}
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list&& __x,
const_iterator __f, const_iterator __l)
{
splice_after(__p, __x, __f, __l);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::remove(const value_type& __v)
@@ -1227,7 +1312,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{
if (__i.__ptr_->__next_->__value_ == __v)
{
iterator __j = next(__i, 2);
iterator __j = _STD::next(__i, 2);
for (; __j != __e && *__j == __v; ++__j)
;
erase_after(__i, __j);
@@ -1250,7 +1335,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{
if (__pred(__i.__ptr_->__next_->__value_))
{
iterator __j = next(__i, 2);
iterator __j = _STD::next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j)
;
erase_after(__i, __j);
@@ -1270,7 +1355,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = next(__i);
iterator __j = _STD::next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1282,11 +1367,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
template <class _Tp, class _Alloc>
template <class _Compare>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list<_Tp, _Alloc>::merge(forward_list&& __x, _Compare __comp)
#else
forward_list<_Tp, _Alloc>::merge(forward_list& __x, _Compare __comp)
#endif
{
if (this != &__x)
{
@@ -1344,7 +1425,7 @@ forward_list<_Tp, _Alloc>::__merge(__node_pointer __f1, __node_pointer __f2,
template <class _Tp, class _Alloc>
template <class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
forward_list<_Tp, _Alloc>::sort(_Compare __comp)
{
@@ -1375,7 +1456,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 = next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp),
@@ -1419,7 +1500,7 @@ bool operator==(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool operator!=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1427,7 +1508,7 @@ bool operator!=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool operator< (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1436,7 +1517,7 @@ bool operator< (const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool operator> (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1444,7 +1525,7 @@ bool operator> (const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool operator>=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1452,7 +1533,7 @@ bool operator>=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool operator<=(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
@@ -1460,7 +1541,7 @@ bool operator<=(const forward_list<_Tp, _Alloc>& __x,
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -173,10 +173,15 @@ typedef basic_fstream<wchar_t> wfstream;
#pragma GCC system_header
#ifdef _WIN32
#define fseeko fseek
#define ftello ftell
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_filebuf
class _LIBCPP_VISIBLE basic_filebuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -579,7 +584,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
this->setg(this->eback(),
this->eback() + __unget_sz,
this->eback() + __unget_sz + __nmemb);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
}
else
@@ -587,7 +592,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;
@@ -602,18 +607,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
else if (__inext != this->eback() + __unget_sz)
{
this->setg(this->eback(), this->eback() + __unget_sz, __inext);
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
}
}
}
}
else
__c = *this->gptr();
__c = traits_type::to_int_type(*this->gptr());
if (this->eback() == &__1buf)
this->setg(0, 0, 0);
return __c;
@@ -957,7 +962,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream
template <class _CharT, class _Traits>
class basic_ifstream
class _LIBCPP_VISIBLE basic_ifstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -1102,7 +1107,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream
template <class _CharT, class _Traits>
class basic_ofstream
class _LIBCPP_VISIBLE basic_ofstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -1247,7 +1252,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream
template <class _CharT, class _Traits>
class basic_fstream
class _LIBCPP_VISIBLE basic_fstream
: public basic_iostream<_CharT, _Traits>
{
public:

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -478,133 +478,133 @@ POLICY: For non-variadic implementations, the number of arguments is limited
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct plus : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE plus : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x + __y;}
};
template <class _Tp>
struct minus : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE minus : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x - __y;}
};
template <class _Tp>
struct multiplies : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE multiplies : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x * __y;}
};
template <class _Tp>
struct divides : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE divides : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x / __y;}
};
template <class _Tp>
struct modulus : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE modulus : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x % __y;}
};
template <class _Tp>
struct negate : unary_function<_Tp, _Tp>
struct _LIBCPP_VISIBLE negate : unary_function<_Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x) const
{return -__x;}
};
template <class _Tp>
struct equal_to : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE equal_to : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x == __y;}
};
template <class _Tp>
struct not_equal_to : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE not_equal_to : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x != __y;}
};
template <class _Tp>
struct greater : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE greater : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x > __y;}
};
template <class _Tp>
struct less : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
template <class _Tp>
struct greater_equal : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE greater_equal : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x >= __y;}
};
template <class _Tp>
struct less_equal : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE less_equal : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x <= __y;}
};
template <class _Tp>
struct logical_and : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE logical_and : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x && __y;}
};
template <class _Tp>
struct logical_or : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_VISIBLE logical_or : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x || __y;}
};
template <class _Tp>
struct logical_not : unary_function<_Tp, bool>
struct _LIBCPP_VISIBLE logical_not : unary_function<_Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x) const
{return !__x;}
};
template <class _Tp>
struct bit_and : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE bit_and : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x & __y;}
};
template <class _Tp>
struct bit_or : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE bit_or : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x | __y;}
};
template <class _Tp>
struct bit_xor : binary_function<_Tp, _Tp, _Tp>
struct _LIBCPP_VISIBLE bit_xor : binary_function<_Tp, _Tp, _Tp>
{
_LIBCPP_INLINE_VISIBILITY _Tp operator()(const _Tp& __x, const _Tp& __y) const
{return __x ^ __y;}
};
template <class _Predicate>
class unary_negate
class _LIBCPP_VISIBLE unary_negate
: public unary_function<typename _Predicate::argument_type, bool>
{
_Predicate __pred_;
@@ -621,7 +621,7 @@ unary_negate<_Predicate>
not1(const _Predicate& __pred) {return unary_negate<_Predicate>(__pred);}
template <class _Predicate>
class binary_negate
class _LIBCPP_VISIBLE binary_negate
: public binary_function<typename _Predicate::first_argument_type,
typename _Predicate::second_argument_type,
bool>
@@ -641,7 +641,7 @@ binary_negate<_Predicate>
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
template <class __Operation>
class binder1st
class _LIBCPP_VISIBLE binder1st
: public unary_function<typename __Operation::second_argument_type,
typename __Operation::result_type>
{
@@ -667,7 +667,7 @@ bind1st(const __Operation& __op, const _Tp& __x)
{return binder1st<__Operation>(__op, __x);}
template <class __Operation>
class binder2nd
class _LIBCPP_VISIBLE binder2nd
: public unary_function<typename __Operation::first_argument_type,
typename __Operation::result_type>
{
@@ -675,6 +675,7 @@ protected:
__Operation op;
typename __Operation::second_argument_type value;
public:
_LIBCPP_INLINE_VISIBILITY
binder2nd(const __Operation& __x, const typename __Operation::second_argument_type __y)
: op(__x), value(__y) {}
_LIBCPP_INLINE_VISIBILITY typename __Operation::result_type operator()
@@ -692,7 +693,8 @@ bind2nd(const __Operation& __op, const _Tp& __x)
{return binder2nd<__Operation>(__op, __x);}
template <class _Arg, class _Result>
class pointer_to_unary_function : public unary_function<_Arg, _Result>
class _LIBCPP_VISIBLE pointer_to_unary_function
: public unary_function<_Arg, _Result>
{
_Result (*__f_)(_Arg);
public:
@@ -709,7 +711,8 @@ ptr_fun(_Result (*__f)(_Arg))
{return pointer_to_unary_function<_Arg,_Result>(__f);}
template <class _Arg1, class _Arg2, class _Result>
class pointer_to_binary_function : public binary_function<_Arg1, _Arg2, _Result>
class _LIBCPP_VISIBLE pointer_to_binary_function
: public binary_function<_Arg1, _Arg2, _Result>
{
_Result (*__f_)(_Arg1, _Arg2);
public:
@@ -726,7 +729,7 @@ ptr_fun(_Result (*__f)(_Arg1,_Arg2))
{return pointer_to_binary_function<_Arg1,_Arg2,_Result>(__f);}
template<class _Sp, class _Tp>
class mem_fun_t : public unary_function<_Tp*, _Sp>
class _LIBCPP_VISIBLE mem_fun_t : public unary_function<_Tp*, _Sp>
{
_Sp (_Tp::*__p_)();
public:
@@ -737,7 +740,7 @@ public:
};
template<class _Sp, class _Tp, class _Ap>
class mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp>
class _LIBCPP_VISIBLE mem_fun1_t : public binary_function<_Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
@@ -760,7 +763,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap))
{return mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
template<class _Sp, class _Tp>
class mem_fun_ref_t : public unary_function<_Tp, _Sp>
class _LIBCPP_VISIBLE mem_fun_ref_t : public unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)();
public:
@@ -771,7 +774,7 @@ public:
};
template<class _Sp, class _Tp, class _Ap>
class mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
class _LIBCPP_VISIBLE mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap);
public:
@@ -794,7 +797,7 @@ mem_fun_ref(_Sp (_Tp::*__f)(_Ap))
{return mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
template <class _Sp, class _Tp>
class const_mem_fun_t : public unary_function<const _Tp*, _Sp>
class _LIBCPP_VISIBLE const_mem_fun_t : public unary_function<const _Tp*, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
@@ -805,7 +808,7 @@ public:
};
template <class _Sp, class _Tp, class _Ap>
class const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
class _LIBCPP_VISIBLE const_mem_fun1_t : public binary_function<const _Tp*, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
public:
@@ -828,7 +831,7 @@ mem_fun(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_t<_Sp,_Tp,_Ap>(__f);}
template <class _Sp, class _Tp>
class const_mem_fun_ref_t : public unary_function<_Tp, _Sp>
class _LIBCPP_VISIBLE const_mem_fun_ref_t : public unary_function<_Tp, _Sp>
{
_Sp (_Tp::*__p_)() const;
public:
@@ -839,7 +842,8 @@ public:
};
template <class _Sp, class _Tp, class _Ap>
class const_mem_fun1_ref_t : public binary_function<_Tp, _Ap, _Sp>
class _LIBCPP_VISIBLE const_mem_fun1_ref_t
: public binary_function<_Tp, _Ap, _Sp>
{
_Sp (_Tp::*__p_)(_Ap) const;
public:
@@ -882,6 +886,7 @@ public:
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args)
{
@@ -931,12 +936,12 @@ mem_fn(_R (_T::* __pm)(_Args...) const volatile)
// bad_function_call
class bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
};
template<class _Fp> class function; // undefined
template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
namespace __function
{
@@ -971,8 +976,8 @@ class __base<_R(_ArgTypes...)>
__base(const __base&);
__base& operator=(const __base&);
public:
__base() {}
virtual ~__base() {}
_LIBCPP_INLINE_VISIBILITY __base() {}
_LIBCPP_INLINE_VISIBILITY virtual ~__base() {}
virtual __base* __clone() const = 0;
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
@@ -992,7 +997,9 @@ class __func<_F, _Alloc, _R(_ArgTypes...)>
{
__compressed_pair<_F, _Alloc> __f_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __func(_F __f) : __f_(_STD::move(__f)) {}
_LIBCPP_INLINE_VISIBILITY
explicit __func(_F __f, _Alloc __a) : __f_(_STD::move(__f), _STD::move(__a)) {}
virtual __base<_R(_ArgTypes...)>* __clone() const;
virtual void __clone(__base<_R(_ArgTypes...)>*) const;
@@ -1071,7 +1078,7 @@ __func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const
} // __function
template<class _R, class ..._ArgTypes>
class function<_R(_ArgTypes...)>
class _LIBCPP_VISIBLE function<_R(_ArgTypes...)>
: public __function::__maybe_derive_from_unary_function<_R(_ArgTypes...)>,
public __function::__maybe_derive_from_binary_function<_R(_ArgTypes...)>
{
@@ -1080,24 +1087,33 @@ class function<_R(_ArgTypes...)>
__base* __f_;
template <class _F>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _F&) {return true;}
template <class _R2, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_A...)) {return __p;}
template <class _R2, class _C, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_A...)) {return __p;}
template <class _R2, class _C, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_A...) const) {return __p;}
template <class _R2, class _C, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_A...) volatile) {return __p;}
template <class _R2, class _C, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_C::*__p)(_A...) const volatile) {return __p;}
template <class _R2, class ..._A>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R(_A...)>& __p) {return __p;}
public:
typedef _R result_type;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY
function(nullptr_t) : __f_(0) {}
function(const function&);
function(function&&);
@@ -1106,8 +1122,10 @@ public:
typename enable_if<!is_integral<_F>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&) : __f_(0) {}
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
@@ -1133,17 +1151,19 @@ public:
// function modifiers:
void swap(function&);
template<class _F, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
void assign(_F&& __f, const _Alloc& __a)
{function(allocator_arg, __a, _STD::forward<_F>(__f)).swap(*this);}
// function capacity:
_LIBCPP_INLINE_VISIBILITY
/*explicit*/ operator bool() const {return __f_;}
// deleted overloads close possible hole in the type system
template<class _R2, class... _ArgTypes2>
bool operator==(const function<_R2(_ArgTypes2...)>&) = delete;
bool operator==(const function<_R2(_ArgTypes2...)>&) const = delete;
template<class _R2, class... _ArgTypes2>
bool operator!=(const function<_R2(_ArgTypes2...)>&) = delete;
bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
public:
// function invocation:
_R operator()(_ArgTypes...) const;
@@ -1453,11 +1473,11 @@ swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct is_bind_expression
template<class _Tp> struct _LIBCPP_VISIBLE is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
template<class _Tp> struct is_placeholder
template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders
@@ -1539,10 +1559,7 @@ typename enable_if
__mu(_Ti&, _Uj& __uj)
{
const size_t _Indx = is_placeholder<_Ti>::value - 1;
// compiler bug workaround
typename tuple_element<_Indx, _Uj>::type __t = get<_Indx>(__uj);
return __t;
// return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
return _STD::forward<typename tuple_element<_Indx, _Uj>::type>(get<_Indx>(__uj));
}
template <class _Ti, class _Uj>
@@ -1645,30 +1662,34 @@ class __bind
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
_LIBCPP_INLINE_VISIBILITY
__bind(__bind&& __b)
: __f_(_STD::move(__b.__f_)),
__bound_args_(_STD::move(__b.__bound_args_)) {}
template <class _G, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
explicit __bind(_G&& __f, _BA&& ...__bound_args)
: __f_(_STD::forward<_G>(__f)),
__bound_args_(_STD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
tuple<_Args&&...>(_STD::forward<_Args>(__args)...));
}
};
@@ -1684,11 +1705,13 @@ public:
typedef _R result_type;
template <class _G, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
: base(_STD::forward<_G>(__f),
_STD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
result_type
operator()(_Args&& ...__args)
{
@@ -1696,6 +1719,7 @@ public:
}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
result_type
operator()(_Args&& ...__args) const
{
@@ -1727,104 +1751,118 @@ bind(_F&& __f, _BoundArgs&&... __bound_args)
#endif // _LIBCPP_HAS_NO_VARIADICS
template <>
struct hash<bool>
struct _LIBCPP_VISIBLE hash<bool>
: public unary_function<bool, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(bool __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<char>
struct _LIBCPP_VISIBLE hash<char>
: public unary_function<char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<signed char>
struct _LIBCPP_VISIBLE hash<signed char>
: public unary_function<signed char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(signed char __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<unsigned char>
struct _LIBCPP_VISIBLE hash<unsigned char>
: public unary_function<unsigned char, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned char __v) const {return static_cast<size_t>(__v);}
};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>
struct hash<char16_t>
struct _LIBCPP_VISIBLE hash<char16_t>
: public unary_function<char16_t, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char16_t __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<char32_t>
struct _LIBCPP_VISIBLE hash<char32_t>
: public unary_function<char32_t, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char32_t __v) const {return static_cast<size_t>(__v);}
};
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
template <>
struct hash<wchar_t>
struct _LIBCPP_VISIBLE hash<wchar_t>
: public unary_function<wchar_t, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(wchar_t __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<short>
struct _LIBCPP_VISIBLE hash<short>
: public unary_function<short, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(short __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<unsigned short>
struct _LIBCPP_VISIBLE hash<unsigned short>
: public unary_function<unsigned short, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned short __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<int>
struct _LIBCPP_VISIBLE hash<int>
: public unary_function<int, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(int __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<unsigned int>
struct _LIBCPP_VISIBLE hash<unsigned int>
: public unary_function<unsigned int, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned int __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<long>
struct _LIBCPP_VISIBLE hash<long>
: public unary_function<long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<unsigned long>
struct _LIBCPP_VISIBLE hash<unsigned long>
: public unary_function<unsigned long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned long __v) const {return static_cast<size_t>(__v);}
};
template <>
struct hash<long long>
struct _LIBCPP_VISIBLE hash<long long>
: public unary_function<long long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long long __v) const
{
size_t __r = 0;
@@ -1836,9 +1874,10 @@ struct hash<long long>
};
template <>
struct hash<unsigned long long>
struct _LIBCPP_VISIBLE hash<unsigned long long>
: public unary_function<unsigned long long, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(unsigned long long __v) const
{
size_t __r = 0;
@@ -1850,9 +1889,10 @@ struct hash<unsigned long long>
};
template <>
struct hash<float>
struct _LIBCPP_VISIBLE hash<float>
: public unary_function<float, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(float __v) const
{
if (__v == 0)
@@ -1863,9 +1903,10 @@ struct hash<float>
};
template <>
struct hash<double>
struct _LIBCPP_VISIBLE hash<double>
: public unary_function<double, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(double __v) const
{
if (__v == 0)
@@ -1879,9 +1920,10 @@ struct hash<double>
};
template <>
struct hash<long double>
struct _LIBCPP_VISIBLE hash<long double>
: public unary_function<long double, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long double __v) const
{
if (__v == 0)

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -52,7 +52,7 @@ namespace std // purposefully not versioned
{
template<class _E>
class initializer_list
class _LIBCPP_VISIBLE initializer_list
{
const _E* __begin_;
size_t __size_;

View File

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

View File

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

View File

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

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -160,7 +160,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_istream
class _LIBCPP_VISIBLE basic_istream
: virtual public basic_ios<_CharT, _Traits>
{
streamsize __gc_;
@@ -211,6 +211,7 @@ public:
basic_istream& operator>>(void*& __p);
// 27.7.1.3 Unformatted input:
_LIBCPP_INLINE_VISIBILITY
streamsize gcount() const {return __gc_;}
int_type get();
basic_istream& get(char_type& __c);
@@ -237,7 +238,7 @@ public:
};
template <class _CharT, class _Traits>
class basic_istream<_CharT, _Traits>::sentry
class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
{
bool __ok_;
@@ -248,6 +249,7 @@ public:
explicit sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
// ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY
// explicit
operator bool() const {return __ok_;}
};
@@ -799,6 +801,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen)
{
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit);
else
__c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
@@ -810,6 +819,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -1263,7 +1273,7 @@ basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
case 0:
break;
default:
__c = min(__c, __n);
__c = _STD::min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
@@ -1477,7 +1487,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
class basic_iostream
class _LIBCPP_VISIBLE basic_iostream
: public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits>
{
@@ -1647,7 +1657,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
}
template<class _CharT, class _Traits, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
@@ -1658,7 +1668,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
@@ -1667,7 +1677,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
}
template<class _CharT, class _Traits, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -151,7 +151,7 @@ public:
typedef void pointer;
explicit back_insert_iterator(Container& x);
back_insert_iterator& operator=(typename Container::const_reference value);
back_insert_iterator& operator=(const typename Container::value_type& value);
back_insert_iterator& operator*();
back_insert_iterator& operator++();
back_insert_iterator operator++(int);
@@ -172,7 +172,7 @@ public:
typedef void pointer;
explicit front_insert_iterator(Container& x);
front_insert_iterator& operator=(typename Container::const_reference value);
front_insert_iterator& operator=(const typename Container::value_type& value);
front_insert_iterator& operator*();
front_insert_iterator& operator++();
front_insert_iterator operator++(int);
@@ -194,7 +194,7 @@ public:
typedef void pointer;
insert_iterator(Container& x, typename Container::iterator i);
insert_iterator& operator=(typename Container::const_reference value);
insert_iterator& operator=(const typename Container::value_type& value);
insert_iterator& operator*();
insert_iterator& operator++();
insert_iterator& operator++(int);
@@ -325,11 +325,11 @@ template <class T, size_t N> T* end(T (&array)[N]);
_LIBCPP_BEGIN_NAMESPACE_STD
struct input_iterator_tag {};
struct output_iterator_tag {};
struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
struct _LIBCPP_VISIBLE input_iterator_tag {};
struct _LIBCPP_VISIBLE output_iterator_tag {};
struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
@@ -372,11 +372,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct iterator_traits
struct _LIBCPP_VISIBLE iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct iterator_traits<_Tp*>
struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@@ -407,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct iterator
struct _LIBCPP_VISIBLE iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@@ -482,29 +482,29 @@ distance(_InputIter __first, _InputIter __last)
}
template <class _ForwardIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIter
next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{
advance(__x, __n);
_STD::advance(__x, __n);
return __x;
}
template <class _BidiretionalIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
_BidiretionalIter
prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{
advance(__x, -__n);
_STD::advance(__x, -__n);
return __x;
}
template <class _Iter>
class reverse_iterator
class _LIBCPP_VISIBLE reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@@ -611,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class back_insert_iterator
class _LIBCPP_VISIBLE back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -624,7 +624,7 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_back(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
@@ -644,7 +644,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class front_insert_iterator
class _LIBCPP_VISIBLE front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -657,7 +657,7 @@ public:
typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_front(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
@@ -677,7 +677,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class insert_iterator
class _LIBCPP_VISIBLE insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -692,7 +692,7 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::const_reference __value)
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
{iter = container->insert(iter, __value); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
@@ -713,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class istream_iterator
class _LIBCPP_VISIBLE istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@@ -752,7 +752,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class ostream_iterator
class _LIBCPP_VISIBLE ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -781,7 +781,7 @@ public:
};
template<class _CharT, class _Traits>
class istreambuf_iterator
class _LIBCPP_VISIBLE istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@@ -806,6 +806,7 @@ private:
_LIBCPP_INLINE_VISIBILITY char_type operator*() const {return __keep_;}
};
_LIBCPP_INLINE_VISIBILITY
void __test_for_eof()
{
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
@@ -820,7 +821,7 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
@@ -852,7 +853,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class ostreambuf_iterator
class _LIBCPP_VISIBLE ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -880,7 +881,7 @@ public:
};
template <class _Iter>
class move_iterator
class _LIBCPP_VISIBLE move_iterator
{
private:
_Iter __i;
@@ -901,8 +902,13 @@ public:
template <class _Up> _LIBCPP_INLINE_VISIBILITY move_iterator(const move_iterator<_Up>& __u)
: __i(__u.base()) {}
_LIBCPP_INLINE_VISIBILITY _Iter base() const {return __i;}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {
return static_cast<reference>(*__i);
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {
typename iterator_traits<iterator_type>::reference __ref = *__i;
return &__ref;
}
_LIBCPP_INLINE_VISIBILITY move_iterator& operator++() {++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY move_iterator operator++(int)
{move_iterator __tmp(*this); ++__i; return __tmp;}
@@ -918,7 +924,9 @@ public:
_LIBCPP_INLINE_VISIBILITY move_iterator& operator-=(difference_type __n)
{__i -= __n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{return __i[__n];}
{
return static_cast<reference>(__i[__n]);
}
};
template <class _Iter1, class _Iter2>
@@ -1037,7 +1045,7 @@ template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1136,7 +1144,7 @@ private:
friend
typename enable_if
<
has_trivial_copy_assign<_Tp>::value,
is_trivially_copy_assignable<_Tp>::value,
_Tp*
>::type
__unwrap_iter(__wrap_iter<_Tp*>);
@@ -1615,10 +1623,10 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#endif // _LIBCPP_DEBUG
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(_C& __c) -> decltype(__c.begin())
{
@@ -1626,7 +1634,7 @@ begin(_C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
begin(const _C& __c) -> decltype(__c.begin())
{
@@ -1634,7 +1642,7 @@ begin(const _C& __c) -> decltype(__c.begin())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(_C& __c) -> decltype(__c.end())
{
@@ -1642,17 +1650,17 @@ end(_C& __c) -> decltype(__c.end())
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
auto
end(const _C& __c) -> decltype(__c.end())
{
return __c.end();
}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
begin(_C& __c)
{
@@ -1660,7 +1668,7 @@ begin(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
begin(const _C& __c)
{
@@ -1668,7 +1676,7 @@ begin(const _C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::iterator
end(_C& __c)
{
@@ -1676,17 +1684,17 @@ end(_C& __c)
}
template <class _C>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename _C::const_iterator
end(const _C& __c)
{
return __c.end();
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_DECLTYPE)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
begin(_T (&__array)[_N])
{
@@ -1694,7 +1702,7 @@ begin(_T (&__array)[_N])
}
template <class _T, size_t _N>
inline
inline _LIBCPP_INLINE_VISIBILITY
_T*
end(_T (&__array)[_N])
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -425,7 +425,7 @@ protected:
};
template <class _Tp>
class numeric_limits
class _LIBCPP_VISIBLE numeric_limits
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
{
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
@@ -471,7 +471,7 @@ public:
};
template <class _Tp>
class numeric_limits<const _Tp>
class _LIBCPP_VISIBLE numeric_limits<const _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -517,7 +517,7 @@ public:
};
template <class _Tp>
class numeric_limits<volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -563,7 +563,7 @@ public:
};
template <class _Tp>
class numeric_limits<const volatile _Tp>
class _LIBCPP_VISIBLE numeric_limits<const volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -187,6 +187,7 @@ struct __list_node_base
pointer __prev_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base()
: __prev_(static_cast<pointer>(this)),
__next_(static_cast<pointer>(this))
@@ -205,7 +206,7 @@ template <class, class> class __list_imp;
template <class, class> class __list_const_iterator;
template <class _Tp, class _VoidPtr>
class __list_iterator
class _LIBCPP_VISIBLE __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -216,6 +217,7 @@ class __list_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@@ -234,23 +236,33 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_iterator() {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator++(int) {__list_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_iterator operator--(int) {__list_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __list_iterator& __x, const __list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_iterator& __x, const __list_iterator& __y)
{return !(__x == __y);}
};
template <class _Tp, class _VoidPtr>
class __list_const_iterator
class _LIBCPP_VISIBLE __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -261,6 +273,7 @@ class __list_const_iterator
__node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY
explicit __list_const_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class list;
@@ -278,20 +291,31 @@ public:
pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator++() {__ptr_ = __ptr_->__next_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator++(int) {__list_const_iterator __t(*this); ++(*this); return __t;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator--() {__ptr_ = __ptr_->__prev_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator operator--(int) {__list_const_iterator __t(*this); --(*this); return __t;}
friend bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return __x.__ptr_ == __y.__ptr_;}
friend bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __list_const_iterator& __x, const __list_const_iterator& __y)
{return !(__x == __y);}
};
@@ -327,9 +351,13 @@ protected:
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
_LIBCPP_INLINE_VISIBILITY
size_type& __sz() {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
const size_type& __sz() const {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() {return __size_alloc_.second();}
_LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const {return __size_alloc_.second();}
static void __unlink_nodes(__node_base& __f, __node_base& __l);
@@ -338,35 +366,46 @@ protected:
__list_imp(const allocator_type& __a);
~__list_imp();
void clear();
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __sz() == 0;}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return const_iterator(__end_.__next_);}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return iterator(static_cast<__node_pointer> (&__end_));}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return const_iterator(static_cast<__node_const_pointer>(&__end_));}
void swap(__list_imp& __c);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__list_imp& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__node_alloc_traits::propagate_on_container_move_assignment::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__node_alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, true_type)
{
if (__node_alloc() != __c.__node_alloc())
@@ -374,21 +413,24 @@ private:
__node_alloc() = __c.__node_alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __list_imp& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, true_type)
{
__node_alloc() = _STD::move(__c.__node_alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __list_imp& __c, false_type)
{}
};
// Unlink nodes [__f, __l]
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
{
@@ -397,14 +439,14 @@ __list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__list_imp<_Tp, _Alloc>::__list_imp()
: __size_alloc_(0)
{
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
__list_imp<_Tp, _Alloc>::__list_imp(const allocator_type& __a)
: __size_alloc_(0, __node_allocator(__a))
{
@@ -431,8 +473,8 @@ __list_imp<_Tp, _Alloc>::clear()
{
__node& __n = *__f.__ptr_;
++__f;
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
}
}
}
@@ -459,7 +501,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class list
class _LIBCPP_VISIBLE list
: private __list_imp<_Tp, _Alloc>
{
typedef __list_imp<_Tp, _Alloc> base;
@@ -484,7 +526,9 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
list() {}
_LIBCPP_INLINE_VISIBILITY
list(const allocator_type& __a) : base(__a) {}
list(size_type __n);
list(size_type __n, const value_type& __x);
@@ -506,6 +550,7 @@ public:
list(list&& __c, const allocator_type& __a);
list& operator=(list&& __c);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
list& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
@@ -513,32 +558,52 @@ public:
void assign(_InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
allocator_type get_allocator() const;
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return base::__sz();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return base::empty();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return numeric_limits<difference_type>::max();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return base::begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return base::end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reference front() {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__end_.__next_->__value_;}
_LIBCPP_INLINE_VISIBILITY
reference back() {return base::__end_.__prev_->__value_;}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return base::__end_.__prev_->__value_;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -563,10 +628,13 @@ public:
template <class _InpIter>
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, initializer_list<value_type> __il)
{return insert(__p, __il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
void swap(list& __c) {base::swap(__c);}
_LIBCPP_INLINE_VISIBILITY
void clear() {base::clear();}
void pop_front();
@@ -580,15 +648,18 @@ public:
void splice(const_iterator __p, list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
#endif
void splice(const_iterator __p, list& __c, const_iterator __i);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __i)
{splice(__p, __c, __i);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
{splice(__p, __c, __f, __l);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -600,12 +671,14 @@ public:
void unique(_BinaryPred __binary_pred);
void merge(list& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c) {merge(__c);}
#endif
template <class _Comp>
void merge(list& __c, _Comp __comp);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Comp>
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void sort();
@@ -626,7 +699,7 @@ private:
// Link in nodes [__f, __l] just prior to __p
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
{
@@ -637,12 +710,12 @@ list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__iterator(size_type __n)
{
return __n <= base::__sz() / 2 ? next(begin(), __n)
: prev(end(), base::__sz() - __n);
return __n <= base::__sz() / 2 ? _STD::next(begin(), __n)
: _STD::prev(end(), base::__sz() - __n);
}
template <class _Tp, class _Alloc>
@@ -726,7 +799,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(const list& __c)
{
@@ -741,7 +814,7 @@ list<_Tp, _Alloc>::operator=(const list& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>::list(list&& __c)
: base(allocator_type(_STD::move(__c.__node_alloc())))
{
@@ -749,7 +822,7 @@ list<_Tp, _Alloc>::list(list&& __c)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
: base(__a)
{
@@ -763,7 +836,7 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
list<_Tp, _Alloc>&
list<_Tp, _Alloc>::operator=(list&& __c)
{
@@ -827,7 +900,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
_Alloc
list<_Tp, _Alloc>::get_allocator() const
{
@@ -842,7 +915,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -860,7 +933,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -872,7 +945,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -883,7 +956,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{
while (true)
{
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -913,7 +986,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
++__ds;
__r = iterator(__hold.get());
__hold.release();
@@ -925,7 +998,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
for (++__f; __f != __l; ++__f, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), *__f);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), *__f);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -936,7 +1009,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{
while (true)
{
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -959,7 +1032,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -972,7 +1045,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -987,7 +1060,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1000,7 +1073,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1016,7 +1089,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1030,7 +1103,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
__node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
@@ -1045,7 +1118,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::forward<_Args>(__args)...);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -1061,7 +1134,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), _STD::move(__x));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), _STD::move(__x));
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
return iterator(__hold.release());
@@ -1077,8 +1150,8 @@ list<_Tp, _Alloc>::pop_front()
__node& __n = *base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1089,8 +1162,8 @@ list<_Tp, _Alloc>::pop_back()
__node& __n = *base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1102,8 +1175,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
__node_pointer __r = __n.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
return iterator(__r);
}
@@ -1120,8 +1193,8 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
__node& __n = const_cast<__node&>(*__f.__ptr_);
++__f;
--base::__sz();
__node_alloc_traits::destroy(__na, addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, addressof(__n), 1);
__node_alloc_traits::destroy(__na, _STD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _STD::addressof(__n), 1);
}
}
return iterator(const_cast<__node_pointer>(__l.__ptr_));
@@ -1141,7 +1214,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
@@ -1152,7 +1225,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_));
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_));
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1163,7 +1236,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
{
while (true)
{
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1192,7 +1265,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
++__ds;
iterator __r = iterator(__hold.release());
iterator __e = __r;
@@ -1203,7 +1276,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
for (--__n; __n != 0; --__n, ++__e, ++__ds)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, addressof(__hold->__value_), __x);
__node_alloc_traits::construct(__na, _STD::addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__hold->__prev_ = __e.__ptr_;
__hold.release();
@@ -1214,7 +1287,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
{
while (true)
{
__node_alloc_traits::destroy(__na, addressof(*__e));
__node_alloc_traits::destroy(__na, _STD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
if (__prev == 0)
@@ -1248,7 +1321,7 @@ template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
{
if (__p != __i && __p != next(__i))
if (__p != __i && __p != _STD::next(__i))
{
__node& __f = const_cast<__node&>(*__i.__ptr_);
base::__unlink_nodes(__f, __f);
@@ -1286,7 +1359,7 @@ list<_Tp, _Alloc>::remove(const value_type& __x)
{
if (*__i == __x)
{
iterator __j = next(__i);
iterator __j = _STD::next(__i);
for (; __j != __e && *__j == __x; ++__j)
;
__i = erase(__i, __j);
@@ -1305,7 +1378,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
{
if (__pred(*__i))
{
iterator __j = next(__i);
iterator __j = _STD::next(__i);
for (; __j != __e && __pred(*__j); ++__j)
;
__i = erase(__i, __j);
@@ -1316,7 +1389,7 @@ list<_Tp, _Alloc>::remove_if(_Pred __pred)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::unique()
{
@@ -1330,7 +1403,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
{
for (iterator __i = begin(), __e = end(); __i != __e;)
{
iterator __j = next(__i);
iterator __j = _STD::next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
;
if (++__i != __j)
@@ -1339,7 +1412,7 @@ list<_Tp, _Alloc>::unique(_BinaryPred __binary_pred)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::merge(list& __c)
{
@@ -1362,7 +1435,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
if (__comp(*__f2, *__f1))
{
size_type __ds = 1;
iterator __m2 = next(__f2);
iterator __m2 = _STD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2, ++__ds)
;
base::__sz() += __ds;
@@ -1371,7 +1444,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
__node& __l = *__m2.__ptr_->__prev_;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = next(__f1);
__m2 = _STD::next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1383,7 +1456,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::sort()
{
@@ -1392,7 +1465,7 @@ list<_Tp, _Alloc>::sort()
template <class _Tp, class _Alloc>
template <class _Comp>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::sort(_Comp __comp)
{
@@ -1401,7 +1474,6 @@ list<_Tp, _Alloc>::sort(_Comp __comp)
template <class _Tp, class _Alloc>
template <class _Comp>
inline
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp)
{
@@ -1421,12 +1493,12 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
return __f1;
}
size_type __n2 = __n / 2;
iterator __e1 = next(__f1, __n2);
iterator __e1 = _STD::next(__f1, __n2);
iterator __r = __f1 = __sort(__f1, __e1, __n2, __comp);
iterator __f2 = __e1 = __sort(__e1, __e2, __n - __n2, __comp);
if (__comp(*__f2, *__f1))
{
iterator __m2 = next(__f2);
iterator __m2 = _STD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1434,7 +1506,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__r = __f2;
__e1 = __f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = next(__f1);
__m2 = _STD::next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1444,7 +1516,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
{
if (__comp(*__f2, *__f1))
{
iterator __m2 = next(__f2);
iterator __m2 = _STD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node& __f = *__f2.__ptr_;
@@ -1453,7 +1525,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
__e1 = __m2;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = next(__f1);
__m2 = _STD::next(__f1);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
@@ -1477,7 +1549,7 @@ list<_Tp, _Alloc>::reverse()
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1485,7 +1557,7 @@ operator==(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1493,7 +1565,7 @@ operator< (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1501,7 +1573,7 @@ operator!=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1509,7 +1581,7 @@ operator> (const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1517,7 +1589,7 @@ operator>=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
{
@@ -1525,7 +1597,7 @@ operator<=(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y)
}
template <class _Tp, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
{

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -186,7 +186,10 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
#ifndef _WIN32
#include <nl_types.h>
#endif
#pragma GCC system_header
@@ -198,7 +201,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#if __APPLE__
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, _Tp __v)
@@ -207,7 +210,7 @@ __nolocale_sprintf(char* __restrict __str,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, _Tp __v)
@@ -216,7 +219,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, int __prec, _Tp __v)
@@ -225,7 +228,7 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
{
@@ -233,7 +236,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, _Tp __v)
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
_Tp __v)
@@ -242,7 +245,7 @@ __nolocale_asprintf(char** __ret, const char* __restrict __format, int __prec,
}
template <class _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, _Tp* __v)
@@ -250,14 +253,14 @@ __nolocale_sscanf(const char* __restrict __str,
return sscanf_l(__str, 0, __format, __v);
}
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit_l(__c, 0);
}
inline
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
@@ -265,7 +268,11 @@ __nolocale_isdigit(int __c)
}
#else // __APPLE__
inline int
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sprintf(char* __restrict __str,
const char* __restrict __format, ...)
{
@@ -275,7 +282,11 @@ __nolocale_sprintf(char* __restrict __str,
va_end(__ap);
return __result;
}
inline int
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_snprintf(char* __restrict __str, size_t __size,
const char* __restrict __format, ...)
{
@@ -285,17 +296,32 @@ __nolocale_snprintf(char* __restrict __str, size_t __size,
va_end(__ap);
return __result;
}
inline int
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_asprintf(char** __ret,
const char* __restrict __format, ...)
{
va_list __ap;
va_start(__ap, __format);
int __result = vasprintf(__ret, __format, __ap);
int __result;
#ifdef _WIN32
*__ret = (char*)malloc(4096);
__result = vsprintf(*__ret, __format, __ap);
*__ret = (char*)realloc(*__ret, __result + 1);
#else
__result = vasprintf(__ret, __format, __ap);
#endif
va_end(__ap);
return __result;
}
inline int
inline
#ifndef _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
_LIBCPP_INLINE_VISIBILITY
#endif
int
__nolocale_sscanf(const char* __restrict __str,
const char* __restrict __format, ...)
{
@@ -305,12 +331,15 @@ __nolocale_sscanf(const char* __restrict __str,
va_end(__ap);
return __result;
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isxdigit(int __c)
{
return isxdigit(__c);
}
inline int
inline _LIBCPP_INLINE_VISIBILITY
int
__nolocale_isdigit(int __c)
{
return isdigit(__c);
@@ -503,6 +532,12 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
*__a_end++ = __ct == __atoms[24] ? '+' : '-';
__dc = 0;
return 0;
}
if (__ct == __thousands_sep && __grouping.size() != 0)
{
if (__g_end-__g < __num_get_buf_sz)
@@ -513,22 +548,28 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
return 0;
}
ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
if (__f >= 26)
if (__f >= 24)
return -1;
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
switch (__base)
{
case 8:
case 10:
if (__f >= __base)
return 0;
return -1;
break;
default:
if (__f >= 22)
case 16:
if (__f < 22)
break;
if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
{
__dc = 0;
*__a_end++ = __src[__f];
return 0;
break;
}
return -1;
}
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __src[__f];
++__dc;
return 0;
}
@@ -584,7 +625,7 @@ extern template class __num_get<char>;
extern template class __num_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class num_get
class _LIBCPP_VISIBLE num_get
: public locale::facet,
private __num_get<_CharT>
{
@@ -676,6 +717,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, ios_base& __iob,
@@ -713,22 +755,32 @@ __num_get_signed_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
int __save_errno = errno;
errno = 0;
char *__p2;
long long __ll = strtoll_l(__a, &__p2, __base, 0);
long long __ll;
#ifdef _WIN32
__ll = _strtoi64_l(__a, &__p2, __base, 0);
#else
__ll = strtoll_l(__a, &__p2, __base, 0);
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__ll > numeric_limits<_Tp>::max())
else if (__current_errno == ERANGE ||
__ll < numeric_limits<_Tp>::min() ||
numeric_limits<_Tp>::max() < __ll)
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
}
else if (__ll < numeric_limits<_Tp>::min())
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::min();
if (__ll > 0)
return numeric_limits<_Tp>::max();
else
return numeric_limits<_Tp>::min();
}
return static_cast<_Tp>(__ll);
}
@@ -743,14 +795,30 @@ __num_get_unsigned_integral(const char* __a, const char* __a_end,
{
if (__a != __a_end)
{
if (*__a == '-')
{
__err = ios_base::failbit;
return 0;
}
int __save_errno = errno;
errno = 0;
char *__p2;
unsigned long long __ll = strtoull_l(__a, &__p2, __base, 0);
unsigned long long __ll;
#ifdef _WIN32
__ll = _strtoui64_l(__a, &__p2, __base, 0);
#else
__ll = strtoull_l(__a, &__p2, __base, 0);
#endif
int __current_errno = errno;
if (__current_errno == 0)
errno = __save_errno;
if (__p2 != __a_end)
{
__err = ios_base::failbit;
return 0;
}
else if (__ll > numeric_limits<_Tp>::max())
else if (__current_errno == ERANGE ||
numeric_limits<_Tp>::max() < __ll)
{
__err = ios_base::failbit;
return numeric_limits<_Tp>::max();
@@ -768,7 +836,13 @@ __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err)
if (__a != __a_end)
{
char *__p2;
long double __ld = strtold_l(__a, &__p2, 0);
long double __ld;
#ifdef _WIN32
// Win32 does not use "long double".
__ld = _strtod_l(__a, &__p2, 0);
#else
__ld = strtold_l(__a, &__p2, 0);
#endif
if (__p2 != __a_end)
{
__err = ios_base::failbit;
@@ -1335,7 +1409,7 @@ extern template class __num_put<char>;
extern template class __num_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class num_put
class _LIBCPP_VISIBLE num_put
: public locale::facet,
private __num_put<_CharT>
{
@@ -1406,6 +1480,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~num_put() {}
virtual iter_type do_put(iter_type __s, ios_base& __iob, char_type __fl,
@@ -1627,11 +1702,17 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
template <class _CharT, class _OutputIterator>
_OutputIterator
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type __fl, long double __v) const
char_type __fl, long double __lv) const
{
// Stage 1 - Get number in narrow char
char __fmt[8] = {'%', 0};
#ifdef _WIN32
const char* __len = "";
double __v = __lv;
#else
const char* __len = "L";
long double __v = __lv;
#endif
bool __specify_precision = this->__format_float(__fmt+1, __len, __iob.flags());
const unsigned __nbuf = 30;
char __nar[__nbuf];
@@ -1740,14 +1821,14 @@ __get_up_to_n_digits(_InputIterator& __b, _InputIterator __e,
return __r;
}
class time_base
class _LIBCPP_VISIBLE time_base
{
public:
enum dateorder {no_order, dmy, mdy, ymd, ydm};
};
template <class _CharT>
class __time_get_c_storage
class __time_get_c_storage // purposefully not decorated
{
protected:
typedef basic_string<_CharT> string_type;
@@ -1762,7 +1843,7 @@ protected:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class time_get
class _LIBCPP_VISIBLE time_get
: public locale::facet,
public time_base,
private __time_get_c_storage<_CharT>
@@ -1833,6 +1914,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_get() {}
virtual dateorder do_date_order() const;
@@ -2296,6 +2378,12 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'F':
{
const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
__b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
}
break;
case 'H':
__get_hour(__tm->tm_hour, __b, __e, __err, __ct);
break;
@@ -2406,7 +2494,7 @@ private:
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class time_get_byname
class _LIBCPP_VISIBLE time_get_byname
: public time_get<_CharT, _InputIterator>,
private __time_get_storage<_CharT>
{
@@ -2416,24 +2504,35 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const char* __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
_LIBCPP_INLINE_VISIBILITY
explicit time_get_byname(const string& __nm, size_t __refs = 0)
: time_get<_CharT, _InputIterator>(__refs),
__time_get_storage<_CharT>(__nm) {}
protected:
_LIBCPP_INLINE_VISIBILITY
~time_get_byname() {}
_LIBCPP_INLINE_VISIBILITY
virtual dateorder do_date_order() const {return this->__do_date_order();}
private:
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __weeks() const {return this->__weeks_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __months() const {return this->__months_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type* __am_pm() const {return this->__am_pm_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __c() const {return this->__c_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __r() const {return this->__r_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __x() const {return this->__x_;}
_LIBCPP_INLINE_VISIBILITY
virtual const string_type& __X() const {return this->__X_;}
};
@@ -2455,7 +2554,7 @@ protected:
};
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class time_put
class _LIBCPP_VISIBLE time_put
: public locale::facet,
private __time_put
{
@@ -2480,13 +2579,16 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~time_put() {}
virtual iter_type do_put(iter_type __s, ios_base&, char_type, const tm* __tm,
char __fmt, char __mod) const;
_LIBCPP_ALWAYS_INLINE
explicit time_put(const char* __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
_LIBCPP_ALWAYS_INLINE
explicit time_put(const string& __nm, size_t __refs)
: locale::facet(__refs),
__time_put(__nm) {}
@@ -2544,14 +2646,14 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
char_type* __nb = __nar;
char_type* __ne = __nb + 100;
__do_put(__nb, __ne, __tm, __fmt, __mod);
return copy(__nb, __ne, __s);
return _STD::copy(__nb, __ne, __s);
}
extern template class time_put<char>;
extern template class time_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class time_put_byname
class _LIBCPP_VISIBLE time_put_byname
: public time_put<_CharT, _OutputIterator>
{
public:
@@ -2564,6 +2666,7 @@ public:
: time_put<_CharT, _OutputIterator>(__nm, __refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~time_put_byname() {}
};
@@ -2572,7 +2675,7 @@ extern template class time_put_byname<wchar_t>;
// money_base
class money_base
class _LIBCPP_VISIBLE money_base
{
public:
enum part {none, space, symbol, sign, value};
@@ -2584,7 +2687,7 @@ public:
// moneypunct
template <class _CharT, bool _International = false>
class moneypunct
class _LIBCPP_VISIBLE moneypunct
: public locale::facet,
public money_base
{
@@ -2592,6 +2695,7 @@ public:
typedef _CharT char_type;
typedef basic_string<char_type> string_type;
_LIBCPP_ALWAYS_INLINE
explicit moneypunct(size_t __refs = 0)
: locale::facet(__refs) {}
@@ -2609,6 +2713,7 @@ public:
static const bool intl = _International;
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct() {}
virtual char_type do_decimal_point() const {return numeric_limits<char_type>::max();}
@@ -2636,7 +2741,8 @@ extern template class moneypunct<wchar_t, true>;
// moneypunct_byname
template <class _CharT, bool _International = false>
class moneypunct_byname : public moneypunct<_CharT, _International>
class _LIBCPP_VISIBLE moneypunct_byname
: public moneypunct<_CharT, _International>
{
public:
typedef money_base::pattern pattern;
@@ -2652,6 +2758,7 @@ public:
: moneypunct<_CharT, _International>(__refs) {init(__nm.c_str());}
protected:
_LIBCPP_ALWAYS_INLINE
~moneypunct_byname() {}
virtual char_type do_decimal_point() const {return __decimal_point_;}
@@ -2746,7 +2853,7 @@ extern template class __money_get<char>;
extern template class __money_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class money_get
class _LIBCPP_VISIBLE money_get
: public locale::facet,
private __money_get<_CharT>
{
@@ -2777,6 +2884,7 @@ public:
protected:
_LIBCPP_ALWAYS_INLINE
~money_get() {}
virtual iter_type do_get(iter_type __b, iter_type __e, bool __intl,
@@ -3206,7 +3314,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
break;
case money_base::symbol:
if (!__sym.empty() && (__flags & ios_base::showbase))
__me = copy(__sym.begin(), __sym.end(), __me);
__me = _STD::copy(__sym.begin(), __sym.end(), __me);
break;
case money_base::value:
{
@@ -3265,7 +3373,7 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
}
// print rest of sign, if any
if (__sn.size() > 1)
__me = copy(__sn.begin()+1, __sn.end(), __me);
__me = _STD::copy(__sn.begin()+1, __sn.end(), __me);
// set alignment
if ((__flags & ios_base::adjustfield) == ios_base::left)
__mi = __me;
@@ -3277,7 +3385,7 @@ extern template class __money_put<char>;
extern template class __money_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class money_put
class _LIBCPP_VISIBLE money_put
: public locale::facet,
private __money_put<_CharT>
{
@@ -3307,6 +3415,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~money_put() {}
virtual iter_type do_put(iter_type __s, bool __intl, ios_base& __iob,
@@ -3428,16 +3537,16 @@ extern template class money_put<wchar_t>;
// messages
class messages_base
class _LIBCPP_VISIBLE messages_base
{
public:
typedef nl_catd catalog;
typedef ptrdiff_t catalog;
_LIBCPP_ALWAYS_INLINE messages_base() {}
};
template <class _CharT>
class messages
class _LIBCPP_VISIBLE messages
: public locale::facet,
public messages_base
{
@@ -3471,6 +3580,7 @@ public:
static locale::id id;
protected:
_LIBCPP_ALWAYS_INLINE
~messages() {}
virtual catalog do_open(const basic_string<char>&, const locale&) const;
@@ -3487,7 +3597,14 @@ template <class _CharT>
typename messages<_CharT>::catalog
messages<_CharT>::do_open(const basic_string<char>& __nm, const locale&) const
{
return catopen(__nm.c_str(), NL_CAT_LOCALE);
#ifdef __MINGW32__
return -1;
#else
catalog __cat = reinterpret_cast<catalog>(catopen(__nm.c_str(), NL_CAT_LOCALE));
if (__cat != -1)
__cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
return __cat;
#endif
}
template <class _CharT>
@@ -3495,29 +3612,42 @@ typename messages<_CharT>::string_type
messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
const string_type& __dflt) const
{
#ifdef __MINGW32__
string_type __w;
return __w;
#else
string __ndflt;
__narrow_to_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__ndflt),
__dflt.c_str(),
__dflt.c_str() + __dflt.size());
char* __n = catgets(__c, __set, __msgid, __ndflt.c_str());
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
string_type __w;
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
__n, __n + strlen(__n));
return __w;
#endif
}
template <class _CharT>
void
messages<_CharT>::do_close(catalog __c) const
{
catclose(__c);
#ifndef __MINGW32__
if (__c != -1)
__c <<= 1;
nl_catd __cat = reinterpret_cast<nl_catd>(__c);
catclose(__cat);
#endif
}
extern template class messages<char>;
extern template class messages<wchar_t>;
template <class _CharT>
class messages_byname
class _LIBCPP_VISIBLE messages_byname
: public messages<_CharT>
{
public:
@@ -3533,6 +3663,7 @@ public:
: messages<_CharT>(__refs) {}
protected:
_LIBCPP_ALWAYS_INLINE
~messages_byname() {}
};
@@ -3542,7 +3673,7 @@ extern template class messages_byname<wchar_t>;
template<class _Codecvt, class _Elem = wchar_t,
class _Wide_alloc = allocator<_Elem>,
class _Byte_alloc = allocator<char> >
class wstring_convert
class _LIBCPP_VISIBLE wstring_convert
{
public:
typedef basic_string<char, char_traits<char>, _Byte_alloc> byte_string;
@@ -3569,28 +3700,36 @@ public:
#endif
~wstring_convert();
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(char __byte)
{return from_bytes(&__byte, &__byte+1);}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const char* __ptr)
{return from_bytes(__ptr, __ptr + char_traits<char>::length(__ptr));}
_LIBCPP_ALWAYS_INLINE
wide_string from_bytes(const byte_string& __str)
{return from_bytes(__str.data(), __str.data() + __str.size());}
wide_string from_bytes(const char* __first, const char* __last);
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(_Elem __wchar)
{return to_bytes(&__wchar, &__wchar+1);}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const _Elem* __wptr)
{return to_bytes(__wptr, __wptr + char_traits<_Elem>::length(__wptr));}
_LIBCPP_ALWAYS_INLINE
byte_string to_bytes(const wide_string& __wstr)
{return to_bytes(__wstr.data(), __wstr.data() + __wstr.size());}
byte_string to_bytes(const _Elem* __first, const _Elem* __last);
_LIBCPP_ALWAYS_INLINE
size_t converted() const {return __cvtcount_;}
_LIBCPP_ALWAYS_INLINE
state_type state() const {return __cvtstate_;}
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@@ -3598,7 +3737,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@@ -3617,7 +3756,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
inline _LIBCPP_ALWAYS_INLINE
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_STD::move(__wc.__byte_err_string_)),
@@ -3785,7 +3924,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template <class _Codecvt, class _Elem = wchar_t, class _Tr = char_traits<_Elem> >
class wbuffer_convert
class _LIBCPP_VISIBLE wbuffer_convert
: public basic_streambuf<_Elem, _Tr>
{
public:
@@ -3820,7 +3959,9 @@ public:
state_type __state = state_type());
~wbuffer_convert();
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf() const {return __bufptr_;}
_LIBCPP_INLINE_VISIBILITY
streambuf* rdbuf(streambuf* __bytebuf)
{
streambuf* __r = __bufptr_;
@@ -3828,6 +3969,7 @@ public:
return __r;
}
_LIBCPP_INLINE_VISIBILITY
state_type state() const {return __st_;}
protected:
@@ -3911,7 +4053,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
streamsize __nmemb = min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
streamsize __nmemb = _STD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
static_cast<streamsize>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
state_type __svs = __st_;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -350,40 +350,42 @@ template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::valu
class __map_value_compare
: private _Compare
{
typedef pair<_Key, _Tp> _P;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
__map_value_compare() : _Compare() {}
_LIBCPP_INLINE_VISIBILITY
__map_value_compare(_Compare c) : _Compare(c) {}
_LIBCPP_INLINE_VISIBILITY
const _Compare& key_comp() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
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
{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
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __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
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y);}
// bool operator()(const _Tp& __x, const _Tp& __y) const
// {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
// bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
// {return static_cast<const _Compare&>(*this)(__x, __y.first);}
// bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
// {return static_cast<const _Compare&>(*this)(__x.first, __y);}
// bool operator()(const typename _Tp::first_type& __x,
// const typename _Tp::first_type& __y) const
// {return static_cast<const _Compare&>(*this)(__x, __y);}
};
template <class _Key, class _Tp, class _Compare>
@@ -391,42 +393,44 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{
_Compare comp;
typedef pair<_Key, _Tp> _P;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
__map_value_compare() : comp() {}
_LIBCPP_INLINE_VISIBILITY
__map_value_compare(_Compare c) : comp(c) {}
_LIBCPP_INLINE_VISIBILITY
const _Compare& key_comp() const {return comp;}
_LIBCPP_INLINE_VISIBILITY
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
{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
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __x, const _P& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _P& __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
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
{return comp(__x, __y);}
// bool operator()(const _Tp& __x, const _Tp& __y) const
// {return comp(__x.first, __y.first);}
// bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
// {return comp(__x, __y.first);}
// bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
// {return comp(__x.first, __y);}
// bool operator()(const typename _Tp::first_type& __x,
// const typename _Tp::first_type& __y) const
// {return comp(__x, __y);}
};
template <class _Allocator>
@@ -449,6 +453,7 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
@@ -456,6 +461,7 @@ public:
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__map_node_destructor(__tree_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -465,12 +471,13 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
@@ -481,16 +488,16 @@ template <class, class, class, class> class multimap;
template <class> class __map_const_iterator;
template <class _TreeIterator>
class __map_iterator
class _LIBCPP_VISIBLE __map_iterator
{
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<key_type, mapped_type> value_type;
typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
@@ -501,14 +508,20 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__map_iterator(_TreeIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_iterator operator++(int)
{
__map_iterator __t(*this);
@@ -516,7 +529,9 @@ public:
return __t;
}
_LIBCPP_INLINE_VISIBILITY
__map_iterator& operator--() {--__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_iterator operator--(int)
{
__map_iterator __t(*this);
@@ -524,48 +539,58 @@ public:
return __t;
}
friend bool operator==(const __map_iterator& __x, const __map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
friend
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class> friend class __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
};
template <class _TreeIterator>
class __map_const_iterator
class _LIBCPP_VISIBLE __map_const_iterator
{
_TreeIterator __i_;
typedef typename _TreeIterator::__pointer_traits __pointer_traits;
typedef const typename _TreeIterator::value_type::first_type key_type;
typedef typename _TreeIterator::value_type::second_type mapped_type;
typedef const typename _TreeIterator::value_type::first_type __key_type;
typedef typename _TreeIterator::value_type::second_type __mapped_type;
public:
typedef bidirectional_iterator_tag iterator_category;
typedef pair<key_type, mapped_type> value_type;
typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
rebind<const value_type>
#else
rebind<value_type>::other
rebind<const value_type>::other
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator(_TreeIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator(
__map_iterator<typename _TreeIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator operator++(int)
{
__map_const_iterator __t(*this);
@@ -573,7 +598,9 @@ public:
return __t;
}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator& operator--() {--__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator operator--(int)
{
__map_const_iterator __t(*this);
@@ -581,19 +608,21 @@ public:
return __t;
}
friend bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class map;
template <class, class, class, class> friend class multimap;
template <class, class, class> friend class __tree_const_iterator;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
};
template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > >
class map
class _LIBCPP_VISIBLE map
{
public:
// types:
@@ -605,15 +634,16 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class value_compare
class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool>
{
friend class map;
protected:
key_compare comp;
value_compare(key_compare c) : comp(c) {}
_LIBCPP_INLINE_VISIBILITY value_compare(key_compare c) : comp(c) {}
public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const value_type& __x, const value_type& __y) const
{return comp(__x.first, __y.first);}
};
@@ -644,13 +674,16 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
explicit map(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
map(_InputIterator __f, _InputIterator __l,
const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -659,6 +692,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
map(_InputIterator __f, _InputIterator __l,
const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
@@ -666,6 +700,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
map(const map& __m)
: __tree_(__m.__tree_)
{
@@ -674,6 +709,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
map(map&& __m)
: __tree_(_STD::move(__m.__tree_))
{
@@ -681,24 +717,28 @@ public:
map(map&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(map&& __m)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
map& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
@@ -707,34 +747,51 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit map(const allocator_type& __a)
: __tree_(__a)
{
}
_LIBCPP_INLINE_VISIBILITY
map(const map& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), __a)
{
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
mapped_type& operator[](const key_type& __k);
@@ -745,17 +802,22 @@ public:
mapped_type& at(const key_type& __k);
const mapped_type& at(const key_type& __k) const;
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
_LIBCPP_INLINE_VISIBILITY
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));}
@@ -769,12 +831,14 @@ public:
#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>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_unique(__p.__i_, _STD::forward<_A0>(__a0));}
@@ -790,56 +854,76 @@ public:
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::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));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
insert(const value_type& __v) {return __tree_.__insert_unique(__v);}
_LIBCPP_INLINE_VISIBILITY
iterator
insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p.__i_, __v);}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
insert(__e.__i_, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k)
{return __tree_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f.__i_, __l.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(map& __m) {__tree_.swap(__m.__tree_);}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
@@ -958,7 +1042,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 = next(__hint);
const_iterator __next = _STD::next(__hint);
if (__next == end() || __tree_.value_comp().key_comp()(__k, __next->first))
{
// *__hint < __k < *next(__hint)
@@ -1047,9 +1131,9 @@ 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, addressof(__h->__value_.first));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1062,7 +1146,7 @@ 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, addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1078,9 +1162,9 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1095,9 +1179,9 @@ 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, addressof(__h->__value_.first), __k);
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
@@ -1202,7 +1286,7 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1211,7 +1295,7 @@ operator==(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1220,7 +1304,7 @@ operator< (const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1229,7 +1313,7 @@ operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1238,7 +1322,7 @@ operator> (const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1247,7 +1331,7 @@ operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
const map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1256,7 +1340,7 @@ operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
map<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1266,7 +1350,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 multimap
class _LIBCPP_VISIBLE multimap
{
public:
// types:
@@ -1278,15 +1362,17 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
class value_compare
class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool>
{
friend class multimap;
protected:
key_compare comp;
_LIBCPP_INLINE_VISIBILITY
value_compare(key_compare c) : comp(c) {}
public:
_LIBCPP_INLINE_VISIBILITY
bool operator()(const value_type& __x, const value_type& __y) const
{return comp(__x.first, __y.first);}
};
@@ -1317,13 +1403,16 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp = key_compare())
: __tree_(__vc(__comp)) {}
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multimap(_InputIterator __f, _InputIterator __l,
const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -1332,6 +1421,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multimap(_InputIterator __f, _InputIterator __l,
const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
@@ -1339,6 +1429,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
multimap(const multimap& __m)
: __tree_(__m.__tree_.value_comp(),
__alloc_traits::select_on_container_copy_construction(__m.__tree_.__alloc()))
@@ -1348,6 +1439,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multimap(multimap&& __m)
: __tree_(_STD::move(__m.__tree_))
{
@@ -1355,24 +1447,28 @@ public:
multimap(multimap&& __m, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp, const allocator_type& __a)
: __tree_(__vc(__comp), __a)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(multimap&& __m)
{
__tree_ = _STD::move(__m.__tree_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
multimap& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
@@ -1380,46 +1476,68 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const allocator_type& __a)
: __tree_(__a)
{
}
_LIBCPP_INLINE_VISIBILITY
multimap(const multimap& __m, const allocator_type& __a)
: __tree_(__m.__tree_.value_comp(), __a)
{
insert(__m.begin(), __m.end());
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp().key_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {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));}
@@ -1433,11 +1551,13 @@ public:
#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>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
@@ -1453,53 +1573,73 @@ public:
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::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));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v) {return __tree_.__insert_multi(__v);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p.__i_, __v);}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_multi(__e.__i_, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f.__i_, __l.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(multimap& __m) {__tree_.swap(__m.__tree_);}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
@@ -1545,9 +1685,9 @@ 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, addressof(__h->__value_.first));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1561,7 +1701,7 @@ 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, addressof(__h->__value_), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1578,9 +1718,9 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), _STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__node_traits::construct(__na, _STD::addressof(__h->__value_.second), _STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1623,7 +1763,7 @@ multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1632,7 +1772,7 @@ operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1641,7 +1781,7 @@ operator< (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1650,7 +1790,7 @@ operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1659,7 +1799,7 @@ operator> (const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1668,7 +1808,7 @@ operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
const multimap<_Key, _Tp, _Compare, _Allocator>& __y)
@@ -1677,7 +1817,7 @@ operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __x,
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(multimap<_Key, _Tp, _Compare, _Allocator>& __x,
multimap<_Key, _Tp, _Compare, _Allocator>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -52,8 +52,11 @@ struct allocator_traits
| pointer_traits<pointer>::rebind<const void>
const_void_pointer;
typedef Alloc::difference_type
| ptrdiff_t difference_type;
typedef Alloc::size_type | size_t size_type;
| pointer_traits<pointer>::difference_type
difference_type;
typedef Alloc::size_type
| make_unsigned<difference_type>::type
size_type;
typedef Alloc::propagate_on_container_copy_assignment
| false_type propagate_on_container_copy_assignment;
typedef Alloc::propagate_on_container_move_assignment
@@ -152,7 +155,8 @@ template <class ForwardIterator, class T>
void uninitialized_fill(ForwardIterator first, ForwardIterator last, const T& x);
template <class ForwardIterator, class Size, class T>
void uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
ForwardIterator
uninitialized_fill_n(ForwardIterator first, Size n, const T& x);
template <class Y> struct auto_ptr_ref {};
@@ -531,7 +535,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// allocator_arg_t
struct allocator_arg_t { };
struct _LIBCPP_VISIBLE allocator_arg_t { };
extern const allocator_arg_t allocator_arg;
@@ -548,7 +552,7 @@ addressof(_Tp& __x)
template <class _Tp> class allocator;
template <>
class allocator<void>
class _LIBCPP_VISIBLE allocator<void>
{
public:
typedef void* pointer;
@@ -783,7 +787,7 @@ struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ptr>
struct pointer_traits
struct _LIBCPP_VISIBLE pointer_traits
{
typedef _Ptr pointer;
typedef typename __pointer_traits_element_type<pointer>::type element_type;
@@ -799,13 +803,14 @@ struct pointer_traits
private:
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY
static pointer pointer_to(typename conditional<is_void<element_type>::value,
__nat, element_type>::type& __r)
{return pointer::pointer_to(__r);}
};
template <class _Tp>
struct pointer_traits<_Tp*>
struct _LIBCPP_VISIBLE pointer_traits<_Tp*>
{
typedef _Tp* pointer;
typedef _Tp element_type;
@@ -820,6 +825,7 @@ struct pointer_traits<_Tp*>
private:
struct __nat {};
public:
_LIBCPP_INLINE_VISIBILITY
static pointer pointer_to(typename conditional<is_void<element_type>::value,
__nat, element_type>::type& __r)
{return _STD::addressof(__r);}
@@ -854,7 +860,7 @@ struct __pointer_type<_Tp, _Dp, false>
typedef _Tp* type;
};
}
} // __pointer_type_imp
template <class _Tp, class _Dp>
struct __pointer_type
@@ -970,14 +976,14 @@ public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Alloc, bool = __has_size_type<_Alloc>::value>
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
struct __size_type
{
typedef size_t type;
typedef typename make_unsigned<_DiffType>::type type;
};
template <class _Alloc>
struct __size_type<_Alloc, true>
template <class _Alloc, class _DiffType>
struct __size_type<_Alloc, _DiffType, true>
{
typedef typename _Alloc::size_type type;
};
@@ -1290,8 +1296,20 @@ struct __has_select_on_container_copy_construction
#endif // _LIBCPP_HAS_NO_ADVANCED_SFINAE
template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
struct __alloc_traits_difference_type
{
typedef typename pointer_traits<_Ptr>::difference_type type;
};
template <class _Alloc, class _Ptr>
struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
{
typedef typename _Alloc::difference_type type;
};
template <class _Alloc>
struct allocator_traits
struct _LIBCPP_VISIBLE allocator_traits
{
typedef _Alloc allocator_type;
typedef typename allocator_type::value_type value_type;
@@ -1301,8 +1319,8 @@ struct allocator_traits
typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
typedef typename __pointer_traits_difference_type<allocator_type>::type difference_type;
typedef typename __size_type<allocator_type>::type size_type;
typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type;
typedef typename __size_type<allocator_type, difference_type>::type size_type;
typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
propagate_on_container_copy_assignment;
@@ -1322,38 +1340,46 @@ struct allocator_traits
{typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n)
{return __a.allocate(__n);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
{return allocate(__a, __n, __hint,
__has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
_LIBCPP_INLINE_VISIBILITY
static void deallocate(allocator_type& __a, pointer __p, size_type __n)
{__a.deallocate(__p, __n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
{__construct(__has_construct<allocator_type, pointer, _Args...>(),
__a, __p, _STD::forward<_Args>(__args)...);}
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p)
{
::new ((void*)__p) _Tp();
}
template <class _Tp, class _A0>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0)
{
::new ((void*)__p) _Tp(__a0);
}
template <class _Tp, class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
const _A1& __a1)
{
::new ((void*)__p) _Tp(__a0, __a1);
}
template <class _Tp, class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
const _A1& __a1, const _A2& __a2)
{
@@ -1362,12 +1388,15 @@ struct allocator_traits
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void destroy(allocator_type& __a, _Tp* __p)
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
_LIBCPP_INLINE_VISIBILITY
static size_type max_size(const allocator_type& __a)
{return __max_size(__has_max_size<const allocator_type>(), __a);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(const allocator_type& __a)
{return select_on_container_copy_construction(
@@ -1376,18 +1405,22 @@ struct allocator_traits
private:
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, true_type)
{return __a.allocate(__n, __hint);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, false_type)
{return __a.allocate(__n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
{__a.construct(__p, _STD::forward<_Args>(__args)...);}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
{
::new ((void*)__p) _Tp(_STD::forward<_Args>(__args)...);
@@ -1395,22 +1428,28 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void __destroy(true_type, allocator_type& __a, _Tp* __p)
{__a.destroy(__p);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
static void __destroy(false_type, allocator_type&, _Tp* __p)
{
__p->~_Tp();
}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(true_type, const allocator_type& __a)
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
{return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(true_type, const allocator_type& __a)
{return __a.select_on_container_copy_construction();}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(false_type, const allocator_type& __a)
{return __a;}
@@ -1443,12 +1482,12 @@ struct __uses_allocator<_Tp, _Alloc, false>
};
template <class _Tp, class _Alloc>
struct uses_allocator
struct _LIBCPP_VISIBLE uses_allocator
: public __uses_allocator<_Tp, _Alloc>
{
};
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
#ifndef _LIBCPP_HAS_NO_VARIADICS
// uses-allocator construction
@@ -1466,7 +1505,7 @@ struct __uses_alloc_ctor
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
{};
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_ADVANCED_SFINAE)
#endif // _LIBCPP_HAS_NO_VARIADICS
// allocator
@@ -1486,8 +1525,8 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator() throw() {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) throw() {}
_LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const {return addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const {return addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const {return _STD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const {return _STD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
{return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));}
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) {::operator delete((void*)__p);}
@@ -1507,6 +1546,7 @@ public:
{
::new((void*)__p) _Tp();
}
# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -1540,6 +1580,7 @@ public:
{
::new((void*)__p) _Tp(_STD::move(__a0));
}
# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
void
@@ -1581,7 +1622,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) throw() {return false;}
template <class _OutputIterator, class _Tp>
class raw_storage_iterator
class _LIBCPP_VISIBLE raw_storage_iterator
: public iterator<output_iterator_tag,
_Tp, // purposefully not C++03
ptrdiff_t, // purposefully not C++03
@@ -1634,7 +1675,7 @@ struct auto_ptr_ref
};
template<class _Tp>
class auto_ptr
class _LIBCPP_VISIBLE auto_ptr
{
private:
_Tp* __ptr_;
@@ -1678,7 +1719,7 @@ public:
};
template <>
class auto_ptr<void>
class _LIBCPP_VISIBLE auto_ptr<void>
{
public:
typedef void element_type;
@@ -1918,7 +1959,7 @@ swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
{__x.swap(__y);}
template <class _Tp>
struct default_delete
struct _LIBCPP_VISIBLE default_delete
{
_LIBCPP_INLINE_VISIBILITY default_delete() {}
template <class _Up>
@@ -1932,7 +1973,7 @@ struct default_delete
};
template <class _Tp>
struct default_delete<_Tp[]>
struct _LIBCPP_VISIBLE default_delete<_Tp[]>
{
_LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const
{
@@ -1944,7 +1985,7 @@ private:
};
template <class _Tp, class _Dp = default_delete<_Tp> >
class unique_ptr
class _LIBCPP_VISIBLE unique_ptr
{
public:
typedef _Tp element_type;
@@ -2121,7 +2162,7 @@ public:
};
template <class _Tp, class _Dp>
class unique_ptr<_Tp[], _Dp>
class _LIBCPP_VISIBLE unique_ptr<_Tp[], _Dp>
{
public:
typedef _Tp element_type;
@@ -2356,9 +2397,10 @@ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {re
template <class> struct hash;
template<class _Tp>
struct hash<_Tp*>
struct _LIBCPP_VISIBLE hash<_Tp*>
: public unary_function<_Tp*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(_Tp* __v) const
{
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
@@ -2367,10 +2409,11 @@ struct hash<_Tp*>
};
template <class _Tp, class _Dp>
struct hash<unique_ptr<_Tp, _Dp> >
struct _LIBCPP_VISIBLE hash<unique_ptr<_Tp, _Dp> >
{
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __ptr) const
{
typedef typename argument_type::pointer pointer;
@@ -2405,15 +2448,15 @@ public:
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void __incr(_Tp*)
{__incr(integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
{__incr(integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void __set(size_t __s, _Tp*)
{__set(__s, integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
{__set(__s, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __p)
{__process(__p, integral_constant<bool, has_trivial_destructor<_Tp>::value>());}
{__process(__p, integral_constant<bool, is_trivially_destructible<_Tp>::value>());}
};
template <class _Alloc>
@@ -2429,6 +2472,7 @@ private:
public:
_LIBCPP_INLINE_VISIBILITY __allocator_destructor(_Alloc& __a, size_type __s)
: __alloc_(__a), __s_(__s) {}
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) {__alloc_traits::deallocate(__alloc_, __p, __s_);}
};
@@ -2471,7 +2515,7 @@ uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
}
template <class _ForwardIterator, class _Size, class _Tp>
void
_ForwardIterator
uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
{
__destruct_n __d(0);
@@ -2480,9 +2524,10 @@ uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
for (; __n > 0; ++__f, --__n, __d.__incr((value_type*)0))
::new(&*__f) value_type(__x);
__h.release();
return __f;
}
class bad_weak_ptr
class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
: public std::exception
{
public:
@@ -2504,11 +2549,13 @@ private:
virtual void __on_zero_shared() = 0;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __shared_count(long __refs = 0)
: __shared_owners_(__refs) {}
void __add_shared();
void __release_shared();
bool __release_shared();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __shared_owners_ + 1;}
};
@@ -2518,6 +2565,7 @@ class __shared_weak_count
long __shared_weak_owners_;
public:
_LIBCPP_INLINE_VISIBILITY
explicit __shared_weak_count(long __refs = 0)
: __shared_count(__refs),
__shared_weak_owners_(__refs) {}
@@ -2529,6 +2577,7 @@ public:
void __add_weak();
void __release_shared();
void __release_weak();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __shared_count::use_count();}
__shared_weak_count* lock();
@@ -2545,6 +2594,7 @@ class __shared_ptr_pointer
{
__compressed_pair<__compressed_pair<_Tp, _Dp>, _Alloc> __data_;
public:
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_pointer(_Tp __p, _Dp __d, _Alloc __a)
: __data_(__compressed_pair<_Tp, _Dp>(__p, _STD::move(__d)), _STD::move(__a)) {}
@@ -2593,27 +2643,33 @@ class __shared_ptr_emplace
public:
#ifndef _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a)
: __data_(_STD::move(__a)) {}
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
: __data_(_STD::move(__a), _Tp(_STD::forward<_Args>(__args)...)) {}
#else // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a)
: __data_(__a) {}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0)
: __data_(__a, _Tp(__a0)) {}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1)
: __data_(__a, _Tp(__a0, __a1)) {}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _A0& __a0, _A1& __a1, _A2& __a2)
: __data_(__a, _Tp(__a0, __a1, __a2)) {}
@@ -2623,6 +2679,7 @@ private:
virtual void __on_zero_shared();
virtual void __on_zero_shared_weak();
public:
_LIBCPP_INLINE_VISIBILITY
_Tp* get() {return &__data_.second();}
};
@@ -2645,7 +2702,7 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak()
template<class _Tp> class enable_shared_from_this;
template<class _Tp>
class shared_ptr
class _LIBCPP_VISIBLE shared_ptr
{
public:
typedef _Tp element_type;
@@ -2720,20 +2777,32 @@ public:
template<class _Yp, class _Dp> void reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc> void reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
element_type* get() const {return __ptr_;}
_LIBCPP_INLINE_VISIBILITY
typename add_lvalue_reference<element_type>::type operator*() const {return *__ptr_;}
_LIBCPP_INLINE_VISIBILITY
element_type* operator->() const {return __ptr_;}
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __cntrl_ ? __cntrl_->use_count() : 0;}
_LIBCPP_INLINE_VISIBILITY
bool unique() const {return use_count() == 1;}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __cntrl_ == 0;}
_LIBCPP_INLINE_VISIBILITY
/*explicit*/ operator bool() const {return get() != 0;}
template <class _U> bool owner_before(shared_ptr<_U> const& __p) const
template <class _U>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(shared_ptr<_U> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
template <class _U> bool owner_before(weak_ptr<_U> const& __p) const
template <class _U>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(weak_ptr<_U> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
#ifndef _LIBCPP_NO_RTTI
template <class _Dp>
_LIBCPP_INLINE_VISIBILITY
_Dp* __get_deleter() const
{return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);}
#endif // _LIBCPP_NO_RTTI
@@ -2784,6 +2853,7 @@ public:
private:
template <class _Yp>
_LIBCPP_INLINE_VISIBILITY
void
__enable_weak_this(const enable_shared_from_this<_Yp>* __e)
{
@@ -2791,10 +2861,11 @@ private:
__e->__weak_this_ = *this;
}
_LIBCPP_INLINE_VISIBILITY
void __enable_weak_this(const void*) {}
template <class _Up> friend class shared_ptr;
template <class _Up> friend class weak_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE shared_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE weak_ptr;
};
template<class _Tp>
@@ -3504,7 +3575,7 @@ get_deleter(const shared_ptr<_Tp>& __p)
#endif // _LIBCPP_NO_RTTI
template<class _Tp>
class weak_ptr
class _LIBCPP_VISIBLE weak_ptr
{
public:
typedef _Tp element_type;
@@ -3529,16 +3600,22 @@ public:
void swap(weak_ptr& __r);
void reset();
_LIBCPP_INLINE_VISIBILITY
long use_count() const {return __cntrl_ ? __cntrl_->use_count() : 0;}
_LIBCPP_INLINE_VISIBILITY
bool expired() const {return __cntrl_ == 0 || __cntrl_->use_count() == 0;}
shared_ptr<_Tp> lock() const;
template<class _Up> bool owner_before(const shared_ptr<_Up>& __r) const
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(const shared_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
template<class _Up> bool owner_before(const weak_ptr<_Up>& __r) const
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
bool owner_before(const weak_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
template <class _Up> friend class weak_ptr;
template <class _Up> friend class shared_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE weak_ptr;
template <class _Up> friend class _LIBCPP_VISIBLE shared_ptr;
};
template<class _Tp>
@@ -3673,52 +3750,65 @@ weak_ptr<_Tp>::lock() const
template <class _Tp> struct owner_less;
template <class _Tp>
struct owner_less<shared_ptr<_Tp> >
struct _LIBCPP_VISIBLE owner_less<shared_ptr<_Tp> >
: binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
};
template <class _Tp>
struct owner_less<weak_ptr<_Tp> >
struct _LIBCPP_VISIBLE owner_less<weak_ptr<_Tp> >
: binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
{return __x.owner_before(__y);}
};
template<class _Tp>
class enable_shared_from_this
class _LIBCPP_VISIBLE enable_shared_from_this
{
mutable weak_ptr<_Tp> __weak_this_;
protected:
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this() {}
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this(enable_shared_from_this const&) {}
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this& operator=(enable_shared_from_this const&) {return *this;}
_LIBCPP_INLINE_VISIBILITY
~enable_shared_from_this() {}
public:
_LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp> shared_from_this() {return shared_ptr<_Tp>(__weak_this_);}
_LIBCPP_INLINE_VISIBILITY
shared_ptr<_Tp const> shared_from_this() const {return shared_ptr<const _Tp>(__weak_this_);}
template <class _Up> friend class shared_ptr;
};
template <class _Tp>
struct hash<shared_ptr<_Tp> >
struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
{
typedef shared_ptr<_Tp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __ptr) const
{
return hash<_Tp*>()(__ptr.get());
@@ -3726,7 +3816,7 @@ struct hash<shared_ptr<_Tp> >
};
//enum class
struct pointer_safety
struct _LIBCPP_VISIBLE pointer_safety
{
enum _
{
@@ -3737,7 +3827,9 @@ struct pointer_safety
_ __v_;
_LIBCPP_INLINE_VISIBILITY
pointer_safety(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY
operator int() const {return __v_;}
};

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -180,7 +180,7 @@ template<class Callable, class ...Args>
_LIBCPP_BEGIN_NAMESPACE_STD
class recursive_mutex
class _LIBCPP_VISIBLE recursive_mutex
{
pthread_mutex_t __m_;
@@ -198,10 +198,11 @@ public:
void unlock();
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return &__m_;}
};
class timed_mutex
class _LIBCPP_VISIBLE timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -218,8 +219,9 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -242,7 +244,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
return false;
}
class recursive_timed_mutex
class _LIBCPP_VISIBLE recursive_timed_mutex
{
mutex __m_;
condition_variable __cv_;
@@ -260,8 +262,9 @@ public:
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::monotonic_clock::now() + __d);}
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock();
@@ -361,9 +364,9 @@ lock(_L0& __l0, _L1& __l1)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _L0, class _L1, class ..._L2>
template <class _L0, class _L1, class _L2, class ..._L3>
void
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
__lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
while (true)
{
@@ -372,7 +375,7 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 0:
{
unique_lock<_L0> __u0(__l0);
__i = try_lock(__l1, __l2...);
__i = try_lock(__l1, __l2, __l3...);
if (__i == -1)
{
__u0.release();
@@ -385,32 +388,32 @@ __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& ...__l2)
case 1:
{
unique_lock<_L1> __u1(__l1);
__i = try_lock(__l2..., __l0);
__i = try_lock(__l2, __l3..., __l0);
if (__i == -1)
{
__u1.release();
return;
}
}
if (__i == sizeof...(_L2))
if (__i == sizeof...(_L3) + 1)
__i = 0;
else
__i += 2;
sched_yield();
break;
default:
__lock_first(__i - 2, __l2..., __l0, __l1);
__lock_first(__i - 2, __l2, __l3..., __l0, __l1);
return;
}
}
}
template <class _L0, class _L1, class ..._L2>
inline
template <class _L0, class _L1, class _L2, class ..._L3>
inline _LIBCPP_INLINE_VISIBILITY
void
lock(_L0& __l0, _L1& __l1, _L2& ...__l2)
lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
{
__lock_first(0, __l0, __l1, __l2...);
__lock_first(0, __l0, __l1, __l2, __l3...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -429,8 +432,9 @@ template<class _Callable>
#endif // _LIBCPP_HAS_NO_VARIADICS
struct once_flag
struct _LIBCPP_VISIBLE once_flag
{
_LIBCPP_INLINE_VISIBILITY
// constexpr
once_flag() {}
@@ -457,11 +461,14 @@ class __call_once_param
_F __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
__f_();

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -32,6 +32,7 @@ struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
new_handler set_new_handler(new_handler new_p) throw();
new_handler get_new_handler() throw();
} // std
@@ -81,13 +82,26 @@ public:
void __throw_bad_alloc(); // not in C++ spec
struct nothrow_t {};
struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
_LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // std
#if __APPLE__
#include <cxxabi.h>
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared libray. The global holding the current new handler is
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#else // __APPLE__
_LIBCPP_BEGIN_NAMESPACE_STD
extern ::std::new_handler __new_handler;
_LIBCPP_END_NAMESPACE_STD
#endif
_LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
_LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
_LIBCPP_VISIBLE void operator delete(void*) throw();

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -138,7 +138,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_ostream
class _LIBCPP_VISIBLE basic_ostream
: virtual public basic_ios<_CharT, _Traits>
{
public:
@@ -203,7 +203,7 @@ protected:
};
template <class _CharT, class _Traits>
class basic_ostream<_CharT, _Traits>::sentry
class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
{
bool __ok_;
basic_ostream<_CharT, _Traits>& __os_;
@@ -1276,7 +1276,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, bitset<_Size>& __x)
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
{
return __os << __x.template to_string<_CharT, _Traits>
(use_facet<ctype<_CharT> >(__os.getloc()).widen('0'),

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -167,7 +167,7 @@ bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class queue
class _LIBCPP_VISIBLE queue
{
public:
typedef _Container container_type;
@@ -180,39 +180,49 @@ protected:
container_type c;
public:
_LIBCPP_INLINE_VISIBILITY
queue() : c() {}
_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)) {}
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__q.c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__q.c), __a) {}
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
{
c = _STD::move(__q.c);
@@ -220,25 +230,36 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference front() {return c.front();}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return c.front();}
_LIBCPP_INLINE_VISIBILITY
reference back() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_front();}
_LIBCPP_INLINE_VISIBILITY
void swap(queue& __q)
{
using _STD::swap;
@@ -247,17 +268,19 @@ public:
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
template <class _T1, class _C1>
friend
_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_T1, _C1>& __x,const queue<_T1, _C1>& __y);
};
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -265,7 +288,7 @@ operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -273,7 +296,7 @@ operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -281,7 +304,7 @@ operator!=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -289,7 +312,7 @@ operator> (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -297,7 +320,7 @@ operator>=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
{
@@ -305,7 +328,7 @@ operator<=(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
{
@@ -313,14 +336,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct uses_allocator<queue<_Tp, _Container>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};
template <class _Tp, class _Container = vector<_Tp>,
class _Compare = less<typename _Container::value_type> >
class priority_queue
class _LIBCPP_VISIBLE priority_queue
{
public:
typedef _Container container_type;
@@ -335,6 +358,7 @@ protected:
value_compare comp;
public:
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp = value_compare())
: c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c);
@@ -383,8 +407,11 @@ public:
_Alloc>::value>::type* = 0);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.front();}
void push(const value_type& __v);
@@ -400,7 +427,7 @@ public:
};
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp,
const container_type& __c)
: c(__c),
@@ -412,7 +439,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c)
: c(_STD::move(__c)),
@@ -425,7 +452,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp)
: c(__f, __l),
@@ -436,7 +463,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
const container_type& __c)
@@ -451,7 +478,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp,
container_type&& __c)
@@ -463,7 +490,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
}
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
: c(_STD::move(__q.c)),
comp(_STD::move(__q.comp))
@@ -483,7 +510,7 @@ priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*)
@@ -493,7 +520,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Alloc& __a,
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -505,7 +532,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
const container_type& __c,
const _Alloc& __a,
@@ -519,7 +546,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -534,7 +561,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c,
const _Alloc& __a,
@@ -548,7 +575,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
@@ -562,7 +589,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{
@@ -573,7 +600,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{
@@ -585,7 +612,7 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{
@@ -597,7 +624,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::pop()
{
@@ -606,7 +633,7 @@ priority_queue<_Tp, _Container, _Compare>::pop()
}
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
{
@@ -616,7 +643,7 @@ priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
}
template <class _Tp, class _Container, class _Compare>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y)
@@ -625,7 +652,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -181,12 +181,14 @@ private:
protected:
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
@@ -196,6 +198,7 @@ protected:
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other)
: outer_allocator_type(__other.outer_allocator()),
@@ -205,6 +208,7 @@ protected:
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
: outer_allocator_type(_STD::move(__other.outer_allocator())),
@@ -214,22 +218,28 @@ protected:
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i)
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i)
: outer_allocator_type(_STD::forward<_OuterA2>(__o)),
__inner_(__i)
{
}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const {return __inner_;}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const
{
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
@@ -252,12 +262,14 @@ class __scoped_allocator_storage<_OuterAlloc>
protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc)
: outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
@@ -265,6 +277,7 @@ protected:
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other)
: outer_allocator_type(__other.outer_allocator()) {}
@@ -273,20 +286,26 @@ protected:
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other)
: outer_allocator_type(_STD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
{return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
{return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const
{return scoped_allocator_adaptor<outer_allocator_type>(
@@ -323,6 +342,7 @@ template <class _Alloc, bool = __has_outer_allocator<_Alloc>::value>
struct __outermost
{
typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const {return __a;}
};
@@ -334,12 +354,13 @@ struct __outermost<_Alloc, true>
decltype(_STD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const
{return __outermost<_OuterAlloc>()(__a.outer_allocator());}
};
template <class _OuterAlloc, class... _InnerAllocs>
class scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;
@@ -381,11 +402,13 @@ public:
> other;
};
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() {}
template <class _OuterA2,
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs)
: base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
@@ -394,6 +417,7 @@ public:
class = typename enable_if<
is_constructible<outer_allocator_type, const _OuterA2&>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other)
: base(__other) {}
@@ -401,41 +425,52 @@ public:
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
: base(_STD::move(__other)) {}
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator()
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const
{return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator()
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const
{return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n);}
_LIBCPP_INLINE_VISIBILITY
pointer allocate(size_type __n, const_void_pointer __hint)
{return allocator_traits<outer_allocator_type>::
allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n)
{allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const
{allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
{return allocator_traits<outer_allocator_type>::max_size(outer_allocator());}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _STD::forward<_Args>(__args)...);}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p)
{
typedef __outermost<outer_allocator_type> _OM;
@@ -443,6 +478,7 @@ public:
destroy(_OM()(outer_allocator()), __p);
}
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const
{return base::select_on_container_copy_construction();}
@@ -452,11 +488,13 @@ private:
class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value
>::type>
_LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i)
: base(_STD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 0>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
@@ -469,6 +507,7 @@ private:
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 1>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;
@@ -483,6 +522,7 @@ private:
}
template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void __construct(integral_constant<int, 2>, _Tp* __p, _Args&& ...__args)
{
typedef __outermost<outer_allocator_type> _OM;

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -310,7 +310,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class set
class _LIBCPP_VISIBLE set
{
public:
// types:
@@ -339,11 +339,14 @@ public:
typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare())
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -352,6 +355,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -359,6 +363,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
{
@@ -366,13 +371,16 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set(set&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit set(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
set(const set& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
@@ -383,12 +391,14 @@ public:
set(set&& __s, const allocator_type& __a);
#endif
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -396,6 +406,7 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_unique(__il.begin(), __il.end());
@@ -403,6 +414,7 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s)
{
__tree_ = _STD::move(__s.__tree_);
@@ -410,84 +422,124 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
// modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v)
{return __tree_.__insert_unique(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p, __v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_unique(__e, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k)
{return __tree_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(set& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
};
@@ -509,7 +561,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -518,7 +570,7 @@ operator==(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -527,7 +579,7 @@ operator< (const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -536,7 +588,7 @@ operator!=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -545,7 +597,7 @@ operator> (const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -554,7 +606,7 @@ operator>=(const set<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y)
@@ -564,7 +616,7 @@ operator<=(const set<_Key, _Compare, _Allocator>& __x,
// specialized algorithms:
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y)
@@ -574,7 +626,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class multiset
class _LIBCPP_VISIBLE multiset
{
public:
// types:
@@ -604,11 +656,14 @@ public:
typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare())
: __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a) {}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -617,6 +672,7 @@ public:
}
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
const value_compare& __comp, const allocator_type& __a)
: __tree_(__comp, __a)
@@ -624,6 +680,7 @@ public:
insert(__f, __l);
}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s)
: __tree_(__s.__tree_.value_comp(),
__alloc_traits::select_on_container_copy_construction(__s.__tree_.__alloc()))
@@ -632,11 +689,14 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s)
: __tree_(_STD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a)
: __tree_(__a) {}
_LIBCPP_INLINE_VISIBILITY
multiset(const multiset& __s, const allocator_type& __a)
: __tree_(__s.__tree_.value_comp(), __a)
{
@@ -646,12 +706,14 @@ public:
multiset(multiset&& __s, const allocator_type& __a);
#endif
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
{
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp,
const allocator_type& __a)
: __tree_(__comp, __a)
@@ -659,6 +721,7 @@ public:
insert(__il.begin(), __il.end());
}
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
__tree_.__assign_multi(__il.begin(), __il.end());
@@ -666,6 +729,7 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s)
{
__tree_ = _STD::move(__s.__tree_);
@@ -673,83 +737,123 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __tree_.max_size();}
// modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v)
{return __tree_.__insert_multi(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p, __v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
{
for (const_iterator __e = cend(); __f != __l; ++__f)
__tree_.__insert_multi(__e, *__f);
}
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __tree_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY
value_compare value_comp() const {return __tree_.value_comp();}
// set operations:
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
};
@@ -771,7 +875,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -780,7 +884,7 @@ operator==(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -789,7 +893,7 @@ operator< (const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -798,7 +902,7 @@ operator!=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -807,7 +911,7 @@ operator> (const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -816,7 +920,7 @@ operator>=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y)
@@ -825,7 +929,7 @@ operator<=(const multiset<_Key, _Compare, _Allocator>& __x,
}
template <class _Key, class _Compare, class _Allocator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -182,7 +182,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
template <class _CharT, class _Traits, class _Allocator>
class basic_stringbuf
class _LIBCPP_VISIBLE basic_stringbuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -451,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
__hm_ = max(this->pptr() + 1, __hm_);
__hm_ = _STD::max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in)
{
char_type* __p = const_cast<char_type*>(__str_.data());
@@ -525,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_istringstream
class _LIBCPP_VISIBLE basic_istringstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -644,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_ostringstream
class _LIBCPP_VISIBLE basic_ostringstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -763,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream
template <class _CharT, class _Traits, class _Allocator>
class basic_stringstream
class _LIBCPP_VISIBLE basic_stringstream
: public basic_iostream<_CharT, _Traits>
{
public:

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -92,7 +92,7 @@ bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class stack
class _LIBCPP_VISIBLE stack
{
public:
typedef _Container container_type;
@@ -105,56 +105,76 @@ protected:
container_type c;
public:
_LIBCPP_INLINE_VISIBILITY
stack() : c() {}
_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)) {}
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s) : c(_STD::move(__s.c)) {}
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit stack(const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const container_type& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__s.c, __a) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__c), __a) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_STD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return c.size();}
_LIBCPP_INLINE_VISIBILITY
reference top() {return c.back();}
_LIBCPP_INLINE_VISIBILITY
const_reference top() const {return c.back();}
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> void emplace(_Args&&... __args)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args)
{c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_back();}
_LIBCPP_INLINE_VISIBILITY
void swap(stack& __s)
{
using _STD::swap;
@@ -173,7 +193,7 @@ public:
};
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -181,7 +201,7 @@ operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -189,7 +209,7 @@ operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -197,7 +217,7 @@ operator!=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -205,7 +225,7 @@ operator> (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -213,7 +233,7 @@ operator>=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
{
@@ -221,7 +241,7 @@ operator<=(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
{
@@ -229,7 +249,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct uses_allocator<stack<_Tp, _Container>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -117,7 +117,7 @@ protected:
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class basic_streambuf
class _LIBCPP_VISIBLE basic_streambuf
{
public:
// types:

View File

@@ -200,13 +200,13 @@ public:
basic_string& replace(size_type pos, size_type n1, const_pointer s, size_type n2);
basic_string& replace(size_type pos, size_type n1, const_pointer s);
basic_string& replace(size_type pos, size_type n1, size_type n2, value_type c);
basic_string& replace(iterator i1, iterator i2, const basic_string& str);
basic_string& replace(iterator i1, iterator i2, const_pointer s, size_type n);
basic_string& replace(iterator i1, iterator i2, const_pointer s);
basic_string& replace(iterator i1, iterator i2, size_type n, value_type c);
basic_string& replace(const_iterator i1, const_iterator i2, const basic_string& str);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s, size_type n);
basic_string& replace(const_iterator i1, const_iterator i2, const_pointer s);
basic_string& replace(const_iterator i1, const_iterator i2, size_type n, value_type c);
template<class InputIterator>
basic_string& replace(iterator i1, iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(iterator i1, iterator i2, initializer_list<value_type>);
basic_string& replace(const_iterator i1, const_iterator i2, InputIterator j1, InputIterator j2);
basic_string& replace(const_iterator i1, const_iterator i2, initializer_list<value_type>);
size_type copy(pointer s, size_type n, size_type pos = 0) const;
basic_string substr(size_type pos = 0, size_type n = npos) const;
@@ -442,7 +442,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// fpos
template <class _StateT>
class fpos
class _LIBCPP_VISIBLE fpos
{
private:
_StateT __st_;
@@ -628,7 +628,7 @@ struct _LIBCPP_VISIBLE char_traits<char>
// char_traits<wchar_t>
template <>
struct char_traits<wchar_t>
struct _LIBCPP_VISIBLE char_traits<wchar_t>
{
typedef wchar_t char_type;
typedef wint_t int_type;
@@ -665,7 +665,7 @@ struct char_traits<wchar_t>
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <>
struct char_traits<char16_t>
struct _LIBCPP_VISIBLE char_traits<char16_t>
{
typedef char16_t char_type;
typedef uint_least16_t int_type;
@@ -771,7 +771,7 @@ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
}
template <>
struct char_traits<char32_t>
struct _LIBCPP_VISIBLE char_traits<char32_t>
{
typedef char32_t char_type;
typedef uint_least32_t int_type;
@@ -941,12 +941,13 @@ public:
typedef _Traits traits_type;
typedef typename traits_type::char_type value_type;
typedef _Allocator allocator_type;
typedef typename allocator_type::size_type size_type;
typedef typename allocator_type::difference_type difference_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename allocator_type::reference reference;
typedef typename allocator_type::const_reference const_reference;
typedef typename allocator_type::pointer pointer;
typedef typename allocator_type::const_pointer const_pointer;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
#ifdef _LIBCPP_DEBUG
typedef __debug_iter<basic_string, pointer> iterator;
typedef __debug_iter<basic_string, const_pointer> const_iterator;
@@ -1027,37 +1028,50 @@ private:
public:
static const size_type npos = -1;
basic_string();
explicit basic_string(const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY basic_string();
_LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a);
basic_string(const basic_string& __str);
basic_string(const basic_string& __str, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_string(const_pointer __s);
_LIBCPP_INLINE_VISIBILITY basic_string(const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string(const_pointer __s, size_type __n, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string(size_type __n, value_type __c, const allocator_type& __a);
basic_string(const basic_string& __str, size_type __pos, size_type __n = npos,
const allocator_type& __a = allocator_type());
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last);
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
basic_string(initializer_list<value_type> __il, const allocator_type& __a);
~basic_string();
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const basic_string& __str) {return assign(__str);}
basic_string& operator=(const basic_string& __str);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(basic_string&& __str) {swap(__str); return *this;}
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str);
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const_pointer __s) {return assign(__s);}
basic_string& operator=(value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#ifndef _LIBCPP_DEBUG
@@ -1084,7 +1098,7 @@ public:
_LIBCPP_INLINE_VISIBILITY size_type size() const
{return __is_long() ? __get_long_size() : __get_short_size();}
_LIBCPP_INLINE_VISIBILITY size_type length() const {return size();}
size_type max_size() const;
_LIBCPP_INLINE_VISIBILITY size_type max_size() const;
_LIBCPP_INLINE_VISIBILITY size_type capacity() const
{return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
@@ -1092,7 +1106,9 @@ public:
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
void reserve(size_type res_arg = 0);
_LIBCPP_INLINE_VISIBILITY
void shrink_to_fit() {reserve();}
_LIBCPP_INLINE_VISIBILITY
void clear();
_LIBCPP_INLINE_VISIBILITY bool empty() const {return size() == 0;}
@@ -1107,6 +1123,7 @@ public:
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
basic_string& append(const basic_string& __str, size_type __pos, size_type __n);
basic_string& append(const_pointer __s, size_type __n);
@@ -1127,15 +1144,18 @@ public:
basic_string&
>::type
append(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
void push_back(value_type __c);
_LIBCPP_INLINE_VISIBILITY
void pop_back();
reference front();
const_reference front() const;
reference back();
const_reference back() const;
_LIBCPP_INLINE_VISIBILITY reference front();
_LIBCPP_INLINE_VISIBILITY const_reference front() const;
_LIBCPP_INLINE_VISIBILITY reference back();
_LIBCPP_INLINE_VISIBILITY const_reference back() const;
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(const basic_string& __str);
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n);
basic_string& assign(const_pointer __s, size_type __n);
@@ -1156,14 +1176,17 @@ public:
basic_string&
>::type
assign(_ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
basic_string& insert(size_type __pos1, const basic_string& __str, size_type __pos2, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s, size_type __n);
basic_string& insert(size_type __pos, const_pointer __s);
basic_string& insert(size_type __pos, size_type __n, value_type __c);
iterator insert(const_iterator __pos, value_type __c);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
@@ -1180,35 +1203,46 @@ public:
iterator
>::type
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
{return insert(__pos, __il.begin(), __il.end());}
basic_string& erase(size_type __pos = 0, size_type __n = npos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __pos);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str);
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s, size_type __n2);
basic_string& replace(size_type __pos, size_type __n1, const_pointer __s);
basic_string& replace(size_type __pos, size_type __n1, size_type __n2, value_type __c);
basic_string& replace(iterator __i1, iterator __i2, const basic_string& __str);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n);
basic_string& replace(iterator __i1, iterator __i2, const_pointer __s);
basic_string& replace(iterator __i1, iterator __i2, size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const basic_string& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, const_pointer __s);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
typename enable_if
<
__is_input_iterator<_InputIterator>::value,
basic_string&
>::type
replace(iterator __i1, iterator __i2, _InputIterator __j1, _InputIterator __j2);
basic_string& replace(iterator __i1, iterator __i2, initializer_list<value_type> __il)
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
size_type copy(pointer __s, size_type __n, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
basic_string substr(size_type __pos = 0, size_type __n = npos) const;
_LIBCPP_INLINE_VISIBILITY
void swap(basic_string& __str);
_LIBCPP_INLINE_VISIBILITY const_pointer c_str() const {return data();}
@@ -1216,44 +1250,62 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return __alloc();}
_LIBCPP_INLINE_VISIBILITY
size_type find(const basic_string& __str, size_type __pos = 0) const;
size_type find(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find(const_pointer __s, size_type __pos = 0) const;
size_type find(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const basic_string& __str, size_type __pos = npos) const;
size_type rfind(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type rfind(const_pointer __s, size_type __pos = npos) const;
size_type rfind(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const basic_string& __str, size_type __pos = 0) const;
size_type find_first_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(const_pointer __s, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_first_not_of(value_type __c, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const basic_string& __str, size_type __pos = npos) const;
size_type find_last_not_of(const_pointer __s, size_type __pos, size_type __n) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(const_pointer __s, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
size_type find_last_not_of(value_type __c, size_type __pos = npos) const;
_LIBCPP_INLINE_VISIBILITY
int compare(const basic_string& __str) const;
_LIBCPP_INLINE_VISIBILITY
int compare(size_type __pos1, size_type __n1, const basic_string& __str) const;
int compare(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2) const;
int compare(const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s) const;
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
bool __invariants() const;
_LIBCPP_INLINE_VISIBILITY bool __invariants() const;
private:
_LIBCPP_INLINE_VISIBILITY allocator_type& __alloc() {return __r_.second();}
_LIBCPP_INLINE_VISIBILITY const allocator_type& __alloc() const {return __r_.second();}
@@ -1331,10 +1383,53 @@ private:
size_type __n_copy, size_type __n_del,
size_type __n_add, const_pointer __p_new_stuff);
_LIBCPP_INLINE_VISIBILITY
void __erase_to_end(size_type __pos);
void __invalidate_all_iterators();
void __invalidate_iterators_past(size_type);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str)
{__copy_assign_alloc(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, true_type)
{
if (__alloc() != __str.__alloc())
{
clear();
shrink_to_fit();
}
__alloc() = __str.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, false_type)
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type);
#endif
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_iterators_past(size_type);
friend basic_string operator+<>(const basic_string&, const basic_string&);
friend basic_string operator+<>(const value_type*, const basic_string&);
@@ -1426,7 +1521,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
else
{
size_type __cap = __recommend(__reserve);
__p = __alloc().allocate(__cap+1);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1450,7 +1545,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const_pointer __s, size_type _
else
{
size_type __cap = __recommend(__sz);
__p = __alloc().allocate(__cap+1);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1503,7 +1598,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const_pointer __s, size_
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
: __r_(__str.__alloc())
: __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1537,8 +1632,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
: __r_(__str.__r_.first(), __a)
: __r_(__a)
{
if (__a == __str.__alloc() || !__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
else
__init(__str.__get_long_pointer(), __str.__get_long_size());
__str.__zero();
#ifdef _LIBCPP_DEBUG
__str.__invalidate_all_iterators();
@@ -1562,7 +1661,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
else
{
size_type __cap = __recommend(__n);
__p = __alloc().allocate(__cap+1);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__n);
@@ -1619,7 +1718,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _Input
catch (...)
{
if (__is_long())
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -1646,7 +1745,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(_ForwardIterator __first, _For
else
{
size_type __cap = __recommend(__sz);
__p = __alloc().allocate(__cap+1);
__p = __alloc_traits::allocate(__alloc(), __cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__set_long_size(__sz);
@@ -1690,12 +1789,11 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
{
__invalidate_all_iterators();
if (__is_long())
__alloc().deallocate(__get_long_pointer(), __get_long_cap());
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), __get_long_cap());
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1711,7 +1809,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
__ms - 1;
pointer __p = __alloc().allocate(__cap+1);
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(__p, __old_p, __n_copy);
@@ -1721,7 +1819,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by_and_replace
if (__sec_cp_sz != 0)
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
if (__old_cap+1 != __min_cap)
__alloc().deallocate(__old_p, __old_cap+1);
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
__old_sz = __n_copy + __n_add + __sec_cp_sz;
@@ -1741,7 +1839,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
size_type __cap = __old_cap < __ms / 2 - __alignment ?
__recommend(_STD::max(__old_cap + __delta_cap, 2 * __old_cap)) :
__ms - 1;
pointer __p = __alloc().allocate(__cap+1);
pointer __p = __alloc_traits::allocate(__alloc(), __cap+1);
__invalidate_all_iterators();
if (__n_copy != 0)
traits_type::copy(__p, __old_p, __n_copy);
@@ -1749,7 +1847,7 @@ basic_string<_CharT, _Traits, _Allocator>::__grow_by(size_type __old_cap, size_t
if (__sec_cp_sz != 0)
traits_type::copy(__p + __n_copy + __n_add, __old_p + __n_copy + __n_del, __sec_cp_sz);
if (__old_cap+1 != __min_cap)
__alloc().deallocate(__old_p, __old_cap+1);
__alloc_traits::deallocate(__alloc(), __old_p, __old_cap+1);
__set_long_pointer(__p);
__set_long_cap(__cap+1);
}
@@ -1820,6 +1918,54 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(value_type __c)
return *this;
}
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
{
if (this != &__str)
{
__copy_assign_alloc(__str);
assign(__str);
}
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
{
if (__alloc() != __str.__alloc())
assign(__str);
else
__move_assign(__str, true_type());
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
{
clear();
shrink_to_fit();
__r_ = _STD::move(__str.__r_);
__str.__zero();
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
{
__move_assign(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
return *this;
}
#endif
template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
typename enable_if
@@ -2301,7 +2447,7 @@ typename enable_if
__is_input_iterator<_InputIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
_InputIterator __j1, _InputIterator __j2)
{
for (; true; ++__i1, ++__j1)
@@ -2317,7 +2463,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
erase(__i1, __i2);
break;
}
traits_type::assign(*__i1, *__j1);
traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
}
return *this;
}
@@ -2354,7 +2500,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const basic_string& __str)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const basic_string& __str)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1),
__str.data(), __str.size());
@@ -2363,7 +2509,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s, size_type __n)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s, size_type __n)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s, __n);
}
@@ -2371,7 +2517,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, const_pointer __s)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, const_pointer __s)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __s);
}
@@ -2379,7 +2525,7 @@ basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2,
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(iterator __i1, iterator __i2, size_type __n, value_type __c)
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c)
{
return replace(static_cast<size_type>(__i1 - begin()), static_cast<size_type>(__i2 - __i1), __n, __c);
}
@@ -2506,7 +2652,7 @@ _LIBCPP_INLINE_VISIBILITY inline
typename basic_string<_CharT, _Traits, _Allocator>::size_type
basic_string<_CharT, _Traits, _Allocator>::max_size() const
{
size_type __m = __alloc().max_size();
size_type __m = __alloc_traits::max_size(__alloc());
#if _LIBCPP_BIG_ENDIAN
return (__m <= ~__long_mask ? __m : __m/2) - 1;
#else
@@ -2538,14 +2684,14 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
else
{
if (__res_arg > __cap)
__new_data = __alloc().allocate(__res_arg+1);
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
__new_data = __alloc().allocate(__res_arg+1);
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -2563,7 +2709,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
}
traits_type::copy(__new_data, __p, size()+1);
if (__was_long)
__alloc().deallocate(__p, __cap+1);
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
if (__now_long)
{
__set_long_cap(__res_arg+1);
@@ -2685,7 +2831,8 @@ _LIBCPP_INLINE_VISIBILITY inline
void
basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
{
__r_.swap(__str.__r_);
_STD::swap(__r_.first(), __str.__r_.first());
__swap_alloc(__alloc(), __str.__alloc());
#ifdef _LIBCPP_DEBUG
__invalidate_all_iterators();
__str.__invalidate_all_iterators();
@@ -3104,6 +3251,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1, size_type _
// __invariants
template<class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
basic_string<_CharT, _Traits, _Allocator>::__invariants() const
{
@@ -3495,10 +3643,6 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs, basic_string<_CharT, _Tra
__lhs.swap(__rhs);
}
template<class _CharT, class _Traits, class _Allocator>
struct __is_zero_default_constructible<basic_string<_CharT, _Traits, _Allocator> >
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef basic_string<char16_t> u16string;
@@ -3551,7 +3695,7 @@ template<class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::npos;
template<class _CharT, class _Traits, class _Allocator>
struct hash<basic_string<_CharT, _Traits, _Allocator> >
struct _LIBCPP_VISIBLE hash<basic_string<_CharT, _Traits, _Allocator> >
: public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
{
size_t
@@ -3619,12 +3763,12 @@ extern template
extern template
enable_if<__is_input_iterator<char const*>::value, string&>::type
string::
replace<char const*>(string::iterator, string::iterator, char const*, char const*);
replace<char const*>(string::const_iterator, string::const_iterator, char const*, char const*);
extern template
enable_if<__is_input_iterator<wchar_t const*>::value, wstring&>::type
wstring::
replace<wchar_t const*>(wstring::iterator, wstring::iterator, wchar_t const*, wchar_t const*);
replace<wchar_t const*>(wstring::const_iterator, wstring::const_iterator, wchar_t const*, wchar_t const*);
extern template
enable_if<__is_forward_iterator<wchar_t*>::value, wstring&>::type

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -135,7 +135,7 @@ private:
_LIBCPP_BEGIN_NAMESPACE_STD
class strstreambuf
class _LIBCPP_VISIBLE strstreambuf
: public streambuf
{
public:
@@ -187,20 +187,25 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
class istrstream
class _LIBCPP_VISIBLE istrstream
: public istream
{
public:
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(const char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
explicit istrstream(char* __s)
: istream(&__sb_), __sb_(__s, 0) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(const char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
_LIBCPP_INLINE_VISIBILITY
istrstream(char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs)
: istream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -208,6 +213,7 @@ public:
istream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs)
{
istream::operator=(_STD::move(__rhs));
@@ -218,31 +224,37 @@ public:
virtual ~istrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(istrstream& __rhs)
{
istream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
char *str() {return __sb_.str();}
private:
strstreambuf __sb_;
};
class ostrstream
class _LIBCPP_VISIBLE ostrstream
: public ostream
{
public:
_LIBCPP_INLINE_VISIBILITY
ostrstream()
: ostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
: ostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs)
: ostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -250,6 +262,7 @@ public:
ostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs)
{
ostream::operator=(_STD::move(__rhs));
@@ -260,22 +273,27 @@ public:
virtual ~ostrstream();
_LIBCPP_INLINE_VISIBILITY
void swap(ostrstream& __rhs)
{
ostream::swap(__rhs);
__sb_.swap(__rhs.__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
private:
strstreambuf __sb_; // exposition only
};
class strstream
class _LIBCPP_VISIBLE strstream
: public iostream
{
public:
@@ -286,14 +304,17 @@ public:
typedef char_traits<char>::off_type off_type;
// constructors/destructor
_LIBCPP_INLINE_VISIBILITY
strstream()
: iostream(&__sb_) {}
_LIBCPP_INLINE_VISIBILITY
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
: iostream(&__sb_),
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs)
: iostream(_STD::move(__rhs)),
__sb_(_STD::move(__rhs.__sb_))
@@ -301,6 +322,7 @@ public:
iostream::set_rdbuf(&__sb_);
}
_LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs)
{
iostream::operator=(_STD::move(__rhs));
@@ -311,6 +333,7 @@ public:
virtual ~strstream();
_LIBCPP_INLINE_VISIBILITY
void swap(strstream& __rhs)
{
iostream::swap(__rhs);
@@ -318,9 +341,13 @@ public:
}
// Members:
_LIBCPP_INLINE_VISIBILITY
strstreambuf* rdbuf() const {return const_cast<strstreambuf*>(&__sb_);}
_LIBCPP_INLINE_VISIBILITY
void freeze(bool __freezefl = true) {__sb_.freeze(__freezefl);}
_LIBCPP_INLINE_VISIBILITY
int pcount() const {return __sb_.pcount();}
_LIBCPP_INLINE_VISIBILITY
char* str() {return __sb_.str();}
private:

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -115,22 +115,22 @@ public:
enum class errc
{
address_family_not_supported, // EAFNOSUPPORT
address_in_use, // EADDRINUSE
address_not_available, // EADDRNOTAVAIL
already_connected, // EISCONN
// address_family_not_supported, // EAFNOSUPPORT
// address_in_use, // EADDRINUSE
// address_not_available, // EADDRNOTAVAIL
// already_connected, // EISCONN
argument_list_too_long, // E2BIG
argument_out_of_domain, // EDOM
bad_address, // EFAULT
bad_file_descriptor, // EBADF
bad_message, // EBADMSG
// bad_message, // EBADMSG
broken_pipe, // EPIPE
connection_aborted, // ECONNABORTED
connection_already_in_progress, // EALREADY
connection_refused, // ECONNREFUSED
connection_reset, // ECONNRESET
// connection_aborted, // ECONNABORTED
// connection_already_in_progress, // EALREADY
// connection_refused, // ECONNREFUSED
// connection_reset, // ECONNRESET
cross_device_link, // EXDEV
destination_address_required, // EDESTADDRREQ
// destination_address_required, // EDESTADDRREQ
device_or_resource_busy, // EBUSY
directory_not_empty, // ENOTEMPTY
executable_format_error, // ENOEXEC
@@ -138,8 +138,8 @@ enum class errc
file_too_large, // EFBIG
filename_too_long, // ENAMETOOLONG
function_not_supported, // ENOSYS
host_unreachable, // EHOSTUNREACH
identifier_removed, // EIDRM
// host_unreachable, // EHOSTUNREACH
// identifier_removed, // EIDRM
illegal_byte_sequence, // EILSEQ
inappropriate_io_control_operation, // ENOTTY
interrupted, // EINTR
@@ -147,16 +147,16 @@ enum class errc
invalid_seek, // ESPIPE
io_error, // EIO
is_a_directory, // EISDIR
message_size, // EMSGSIZE
network_down, // ENETDOWN
network_reset, // ENETRESET
network_unreachable, // ENETUNREACH
no_buffer_space, // ENOBUFS
// message_size, // EMSGSIZE
// network_down, // ENETDOWN
// network_reset, // ENETRESET
// network_unreachable, // ENETUNREACH
// no_buffer_space, // ENOBUFS
no_child_process, // ECHILD
no_link, // ENOLINK
// no_link, // ENOLINK
no_lock_available, // ENOLCK
no_message_available, // ENODATA
no_message, // ENOMSG
// no_message, // ENOMSG
no_protocol_option, // ENOPROTOOPT
no_space_on_device, // ENOSPC
no_stream_resources, // ENOSR
@@ -229,12 +229,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum
template <class _Tp> struct is_error_code_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_code_enum
: public false_type {};
// is_error_condition_enum
template <class _Tp> struct is_error_condition_enum
template <class _Tp>
struct _LIBCPP_VISIBLE is_error_condition_enum
: public false_type {};
// Some error codes are not present on all platforms, so we provide equivalents
@@ -244,22 +246,42 @@ template <class _Tp> struct is_error_condition_enum
struct errc
{
enum _ {
#ifdef EAFNOSUPPORT
address_family_not_supported = EAFNOSUPPORT,
#endif
#ifdef EADDRINUSE
address_in_use = EADDRINUSE,
#endif
#ifdef EADDRNOTAVAIL
address_not_available = EADDRNOTAVAIL,
#endif
#ifdef EISCONN
already_connected = EISCONN,
#endif
argument_list_too_long = E2BIG,
argument_out_of_domain = EDOM,
bad_address = EFAULT,
bad_file_descriptor = EBADF,
#ifdef EBADMSG
bad_message = EBADMSG,
#endif
broken_pipe = EPIPE,
#ifdef ECONNABORTED
connection_aborted = ECONNABORTED,
#endif
#ifdef EALREADY
connection_already_in_progress = EALREADY,
#endif
#ifdef ECONNREFUSED
connection_refused = ECONNREFUSED,
#endif
#ifdef ECONNRESET
connection_reset = ECONNRESET,
#endif
cross_device_link = EXDEV,
#ifdef EDESTADDRREQ
destination_address_required = EDESTADDRREQ,
#endif
device_or_resource_busy = EBUSY,
directory_not_empty = ENOTEMPTY,
executable_format_error = ENOEXEC,
@@ -267,8 +289,12 @@ enum _ {
file_too_large = EFBIG,
filename_too_long = ENAMETOOLONG,
function_not_supported = ENOSYS,
#ifdef EHOSTUNREACH
host_unreachable = EHOSTUNREACH,
#endif
#ifdef EIDRM
identifier_removed = EIDRM,
#endif
illegal_byte_sequence = EILSEQ,
inappropriate_io_control_operation = ENOTTY,
interrupted = EINTR,
@@ -276,21 +302,37 @@ enum _ {
invalid_seek = ESPIPE,
io_error = EIO,
is_a_directory = EISDIR,
#ifdef EMSGSIZE
message_size = EMSGSIZE,
#endif
#ifdef ENETDOWN
network_down = ENETDOWN,
#endif
#ifdef ENETRESET
network_reset = ENETRESET,
#endif
#ifdef ENETUNREACH
network_unreachable = ENETUNREACH,
#endif
#ifdef ENOBUFS
no_buffer_space = ENOBUFS,
#endif
no_child_process = ECHILD,
#ifdef ENOLINK
no_link = ENOLINK,
#endif
no_lock_available = ENOLCK,
#ifdef ENOMSG
#ifdef ENODATA
no_message_available = ENODATA,
#else
no_message_available = ENOMSG,
#endif
no_message = ENOMSG,
#endif
#ifdef ENOPROTOOPT,
no_protocol_option = ENOPROTOOPT,
#endif
no_space_on_device = ENOSPC,
#ifdef ENOSR
no_stream_resources = ENOSR,
@@ -302,24 +344,42 @@ enum _ {
no_such_file_or_directory = ENOENT,
no_such_process = ESRCH,
not_a_directory = ENOTDIR,
#ifdef ENOTSOCK
not_a_socket = ENOTSOCK,
#endif
#ifdef ENOSTR
not_a_stream = ENOSTR,
#else
not_a_stream = EINVAL,
#endif
#ifdef ENOTCONN
not_connected = ENOTCONN,
#endif
not_enough_memory = ENOMEM,
#ifdef ENOTSUP
not_supported = ENOTSUP,
#endif
#ifdef ECANCELED
operation_canceled = ECANCELED,
#endif
#ifdef EINPROGRESS
operation_in_progress = EINPROGRESS,
#endif
operation_not_permitted = EPERM,
#ifdef EOPNOTSUPP
operation_not_supported = EOPNOTSUPP,
#endif
#ifdef EWOULDBLOCK
operation_would_block = EWOULDBLOCK,
#endif
owner_dead = EOWNERDEAD,
permission_denied = EACCES,
#ifdef EPROTO
protocol_error = EPROTO,
#endif
#ifdef EPROTONOSUPPORT
protocol_not_supported = EPROTONOSUPPORT,
#endif
read_only_file_system = EROFS,
resource_deadlock_would_occur = EDEADLK,
resource_unavailable_try_again = EAGAIN,
@@ -327,30 +387,44 @@ enum _ {
state_not_recoverable = ENOTRECOVERABLE,
#ifdef ETIME
stream_timeout = ETIME,
#else
#elif defined(ETIMEDOUT)
stream_timeout = ETIMEDOUT,
#endif
#ifdef ETXTBSY
text_file_busy = ETXTBSY,
#endif
#ifdef ETIMEDOUT
timed_out = ETIMEDOUT,
#endif
too_many_files_open_in_system = ENFILE,
too_many_files_open = EMFILE,
too_many_links = EMLINK,
#ifdef ELOOP
too_many_symbolic_link_levels = ELOOP,
#endif
#ifdef EOVERFLOW
value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE
#endif
#ifdef EPROTOTYPE
wrong_protocol_type = EPROTOTYPE,
#endif
};
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <> struct is_error_condition_enum<errc>
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { };
template <> struct is_error_condition_enum<errc::_>
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { };
class error_condition;
@@ -360,7 +434,7 @@ class error_code;
class __do_message;
class error_category
class _LIBCPP_VISIBLE error_category
{
public:
virtual ~error_category();
@@ -399,7 +473,7 @@ public:
const error_category& generic_category();
const error_category& system_category();
class error_condition
class _LIBCPP_VISIBLE error_condition
{
int __val_;
const error_category* __cat_;
@@ -469,7 +543,7 @@ operator<(const error_condition& __x, const error_condition& __y)
// error_code
class error_code
class _LIBCPP_VISIBLE error_code
{
int __val_;
const error_category* __cat_;
@@ -588,9 +662,10 @@ bool
operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
template <>
struct hash<error_code>
struct _LIBCPP_VISIBLE hash<error_code>
: public unary_function<error_code, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const error_code& __ec) const
{
return static_cast<size_t>(__ec.value());
@@ -599,7 +674,7 @@ struct hash<error_code>
// system_error
class system_error
class _LIBCPP_VISIBLE system_error
: public runtime_error
{
error_code __ec_;

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -95,7 +95,15 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
#ifdef __MINGW32__
#define pthread_key_delete(a) (-1)
#define pthread_join(a,b) (-1)
#define pthread_detach(a) (-1)
#define nanosleep(a,b) (-1)
#define pthread_key_create(a,b) (-1)
#else
#include <pthread.h>
#endif
#pragma GCC system_header
@@ -118,8 +126,11 @@ public:
__thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
pointer get() const {return static_cast<_Tp*>(pthread_getspecific(__key_));}
_LIBCPP_INLINE_VISIBILITY
pointer operator*() const {return *get();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return get();}
pointer release();
void reset(pointer __p = nullptr);
@@ -175,7 +186,7 @@ __thread_id get_id();
} // this_thread
class __thread_id
class _LIBCPP_VISIBLE __thread_id
{
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
// NULL is the no-thread value on Darwin. Someone needs to check
@@ -183,40 +194,50 @@ class __thread_id
pthread_t __id_;
public:
_LIBCPP_INLINE_VISIBILITY
__thread_id() : __id_(0) {}
friend bool operator==(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(__thread_id __x, __thread_id __y)
{return __x.__id_ == __y.__id_;}
friend bool operator!=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(__thread_id __x, __thread_id __y)
{return !(__x == __y);}
friend bool operator< (__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator< (__thread_id __x, __thread_id __y)
{return __x.__id_ < __y.__id_;}
friend bool operator<=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator<=(__thread_id __x, __thread_id __y)
{return !(__y < __x);}
friend bool operator> (__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator> (__thread_id __x, __thread_id __y)
{return __y < __x ;}
friend bool operator>=(__thread_id __x, __thread_id __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator>=(__thread_id __x, __thread_id __y)
{return !(__x < __y);}
template<class _CharT, class _Traits>
friend
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id)
{return __os << __id.__id_;}
private:
_LIBCPP_INLINE_VISIBILITY
__thread_id(pthread_t __id) : __id_(__id) {}
friend __thread_id this_thread::get_id();
friend class thread;
friend class _LIBCPP_VISIBLE thread;
};
template<class _Tp> struct hash;
template<>
struct hash<__thread_id>
struct _LIBCPP_VISIBLE hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(__thread_id __v) const
{
const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
@@ -227,7 +248,7 @@ struct hash<__thread_id>
namespace this_thread
{
inline
inline _LIBCPP_INLINE_VISIBILITY
__thread_id
get_id()
{
@@ -236,21 +257,17 @@ get_id()
} // this_thread
class thread
class _LIBCPP_VISIBLE thread
{
pthread_t __t_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
thread(const thread&) = delete;
thread& operator=(const thread&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
thread(const thread&);
thread& operator=(const thread&);
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
public:
typedef __thread_id id;
typedef pthread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
thread() : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
@@ -266,16 +283,21 @@ public:
~thread();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
thread& operator=(thread&& __t);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
bool joinable() const {return __t_ != 0;}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
id get_id() const {return __t_;}
_LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return __t_;}
static unsigned hardware_concurrency();
@@ -283,7 +305,7 @@ public:
class __assoc_sub_state;
class __thread_struct_imp;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __thread_struct
{
@@ -299,13 +321,13 @@ public:
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
extern __thread_specific_ptr<__thread_struct> __thread_local_data;
__thread_specific_ptr<__thread_struct>& __thread_local_data();
template <class _F>
void*
__thread_proxy(void* __vp)
{
__thread_local_data.reset(new __thread_struct);
__thread_local_data().reset(new __thread_struct);
std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
(*__p)();
return nullptr;
@@ -345,7 +367,7 @@ thread::thread(_F __f)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline
inline _LIBCPP_INLINE_VISIBILITY
thread&
thread::operator=(thread&& __t)
{
@@ -358,7 +380,7 @@ thread::operator=(thread&& __t)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline
inline _LIBCPP_INLINE_VISIBILITY
void swap(thread& __x, thread& __y) {__x.swap(__y);}
namespace this_thread
@@ -390,15 +412,15 @@ sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
}
template <class _Duration>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
sleep_until(const chrono::time_point<chrono::monotonic_clock, _Duration>& __t)
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
{
using namespace chrono;
sleep_for(__t - monotonic_clock::now());
sleep_for(__t - steady_clock::now());
}
inline
inline _LIBCPP_INLINE_VISIBILITY
void yield() {sched_yield();}
} // this_thread

View File

@@ -74,11 +74,8 @@ const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...);
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...);
template <class... T> tuple<T&...> tie(T&...);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, const tuple<U...>&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(const tuple<T...>&, tuple<U...>&&);
template <class... T, class... U> tuple<T..., U...> tuple_cat(tuple<T...>&&, tuple<U...>&&);
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
@@ -88,6 +85,7 @@ template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
// 20.4.1.5, element access:
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type& get(tuple<T...>&);
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type const& get(const tuple<T...>&);
template <intsize_t I, class... T> typename tuple_element<I, tuple<T...>>::type&& get(tuple<T...>&&);
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
@@ -122,13 +120,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// tuple_size
template <class ..._Tp>
class tuple_size<tuple<_Tp...>>
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
template <class ..._Tp>
class tuple_size<const tuple<_Tp...>>
class _LIBCPP_VISIBLE tuple_size<tuple<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -136,17 +128,10 @@ class tuple_size<const tuple<_Tp...>>
// tuple_element
template <size_t _Ip, class ..._Tp>
class tuple_element<_Ip, tuple<_Tp...>>
class _LIBCPP_VISIBLE tuple_element<_Ip, tuple<_Tp...> >
{
public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
};
template <size_t _Ip, class ..._Tp>
class tuple_element<_Ip, const tuple<_Tp...>>
{
public:
typedef const typename tuple_element<_Ip, __tuple_types<_Tp...>>::type type;
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
};
// __tuple_leaf
@@ -155,7 +140,7 @@ template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
inline
inline _LIBCPP_INLINE_VISIBILITY
void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
{
swap(__x.get(), __y.get());
@@ -193,18 +178,21 @@ public:
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
template <class _Tp>
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: value(_STD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
{static_assert(!is_reference<_Hp>::value ||
is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
>::value),
>::value) ||
(is_rvalue_reference<_Hp>::value &&
!is_lvalue_reference<_Tp>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc>
@@ -249,6 +237,10 @@ public:
>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
__tuple_leaf(const __tuple_leaf& __t)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
@@ -297,7 +289,8 @@ public:
__tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
: _Hp(__a) {}
template <class _Tp>
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t)
: _Hp(_STD::forward<_Tp>(__t)) {}
@@ -341,7 +334,9 @@ public:
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp> void __swallow(_Tp&&...) {}
template <class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
void __swallow(_Tp&&...) {}
// __tuple_impl
@@ -353,6 +348,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
{
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
@@ -363,6 +359,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(allocator_arg_t, const _Alloc& __a,
__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
@@ -376,9 +373,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(_Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(_STD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_STD::get<_Indx>(__t)))...
@@ -387,9 +385,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class _Alloc, class _Tuple,
class = typename enable_if
<
__tuple_convertible<_Tuple, tuple<_Tp...>>::value
__tuple_convertible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(), __a,
@@ -398,9 +397,10 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
{}
template <class _Tuple>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
__tuple_assignable<_Tuple, tuple<_Tp...>>::value,
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_impl&
>::type
operator=(_Tuple&& __t)
@@ -410,6 +410,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)
{
__swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...);
@@ -417,18 +418,21 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
};
template <class ..._Tp>
class tuple
class _LIBCPP_VISIBLE tuple
{
typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
base base_;
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...>>::type& get(tuple<_Up...>&);
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...>>::type& get(const tuple<_Up...>&);
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit tuple(const _Tp& ... __t)
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
@@ -438,6 +442,7 @@ public:
) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
@@ -461,6 +466,7 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
@@ -483,6 +489,7 @@ public:
>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
: base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Up)>::type(),
@@ -497,6 +504,7 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(_Tuple&& __t)
: base_(_STD::forward<_Tuple>(__t)) {}
@@ -506,6 +514,7 @@ public:
__tuple_convertible<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
: base_(allocator_arg_t(), __a, _STD::forward<_Tuple>(__t)) {}
@@ -515,6 +524,7 @@ public:
__tuple_assignable<_Tuple, tuple>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
tuple&
operator=(_Tuple&& __t)
{
@@ -522,22 +532,29 @@ public:
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple& __t) {base_.swap(__t.base_);}
};
template <>
class tuple<>
class _LIBCPP_VISIBLE tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
tuple() {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
template <class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(array<_U, 0>) {}
template <class _Alloc, class _U>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) {}
};
@@ -549,27 +566,37 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) {__t.swap(__u);}
// get
template <size_t _Ip, class ..._Tp>
inline
typename tuple_element<_Ip, tuple<_Tp...>>::type&
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline
const typename tuple_element<_Ip, tuple<_Tp...>>::type&
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...>>::type type;
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&& __t)
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
// tie
template <class ..._Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&...>
tie(_Tp&... __t)
{
@@ -579,10 +606,13 @@ tie(_Tp&... __t)
template <class _Up>
struct __ignore_t
{
_LIBCPP_INLINE_VISIBILITY
__ignore_t() {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__ignore_t(_Tp&&) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
const __ignore_t& operator=(_Tp&&) const {return *this;}
};
@@ -597,7 +627,7 @@ struct ___make_tuple_return
};
template <class _Tp>
struct ___make_tuple_return<reference_wrapper<_Tp>>
struct ___make_tuple_return<reference_wrapper<_Tp> >
{
typedef _Tp& type;
};
@@ -609,7 +639,7 @@ struct __make_tuple_return
};
template <class... _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
tuple<typename __make_tuple_return<_Tp>::type...>
make_tuple(_Tp&&... __t)
{
@@ -617,7 +647,7 @@ make_tuple(_Tp&&... __t)
}
template <class... _Tp>
inline
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
forward_as_tuple(_Tp&&... __t)
{
@@ -628,6 +658,7 @@ template <size_t _I>
struct __tuple_equal
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y);
@@ -638,6 +669,7 @@ template <>
struct __tuple_equal<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return true;
@@ -645,7 +677,7 @@ struct __tuple_equal<0>
};
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -653,7 +685,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -664,6 +696,7 @@ template <size_t _I>
struct __tuple_less
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_less<_I-1>()(__x, __y) ||
@@ -675,6 +708,7 @@ template <>
struct __tuple_less<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return false;
@@ -682,7 +716,7 @@ struct __tuple_less<0>
};
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -690,7 +724,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -698,7 +732,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -706,7 +740,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -715,76 +749,144 @@ operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
// tuple_cat
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
template <class _Tp, class _Up> struct __tuple_cat_type;
template <class ..._Ttypes, class ..._Utypes>
struct __tuple_cat_type<tuple<_Ttypes...>, __tuple_types<_Utypes...> >
{
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., get<_I2>(__y)...);
typedef tuple<_Ttypes..., _Utypes...> type;
};
template <class _ResultTuple, bool _Is_Tuple0TupleLike, class ..._Tuples>
struct __tuple_cat_return_1
{
};
template <class ..._Types, class _Tuple0>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0>
{
typedef typename __tuple_cat_type<tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type>::type
type;
};
template <class ..._Types, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_1<tuple<_Types...>, true, _Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_1<
typename __tuple_cat_type<
tuple<_Types...>,
typename __make_tuple_types<typename remove_reference<_Tuple0>::type>::type
>::type,
__tuple_like<typename remove_reference<_Tuple1>::type>::value,
_Tuple1, _Tuples...>
{
};
template <class ..._Tuples> struct __tuple_cat_return;
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return<_Tuple0, _Tuples...>
: public __tuple_cat_return_1<tuple<>,
__tuple_like<typename remove_reference<_Tuple0>::type>::value, _Tuple0,
_Tuples...>
{
};
template <>
struct __tuple_cat_return<>
{
typedef tuple<> type;
};
inline _LIBCPP_INLINE_VISIBILITY
tuple<>
tuple_cat()
{
return tuple<>();
}
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref_imp;
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, const tuple<_Up...>& __y, __tuple_indices<_I2...>)
template <class ..._Types, size_t ..._I0, class _Tuple0>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>, _Tuple0>
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., get<_I2>(__y)...);
}
typedef typename remove_reference<_Tuple0>::type _T0;
typedef tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0, _T0>::type>::type&&...> type;
};
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, const tuple<_Up...>& __y)
template <class ..._Types, size_t ..._I0, class _Tuple0, class _Tuple1, class ..._Tuples>
struct __tuple_cat_return_ref_imp<tuple<_Types...>, __tuple_indices<_I0...>,
_Tuple0, _Tuple1, _Tuples...>
: public __tuple_cat_return_ref_imp<
tuple<_Types..., typename __apply_cv<_Tuple0,
typename tuple_element<_I0,
typename remove_reference<_Tuple0>::type>::type>::type&&...>,
typename __make_tuple_indices<tuple_size<typename
remove_reference<_Tuple1>::type>::value>::type,
_Tuple1, _Tuples...>
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
__y, typename __make_tuple_indices<sizeof...(_Up)>::type());
}
};
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(const tuple<_Tp...>& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
template <class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref
: public __tuple_cat_return_ref_imp<tuple<>,
typename __make_tuple_indices<
tuple_size<typename remove_reference<_Tuple0>::type>::value
>::type, _Tuple0, _Tuples...>
{
return tuple<_Tp..., _Up...>(get<_I1>(__x)..., _STD::forward<_Up>(get<_I2>(__y))...);
}
};
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(const tuple<_Tp...>& __x, tuple<_Up...>&& __y)
{
return __tuple_cat(__x, typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
}
template <class _Types, class _I0, class _J0>
struct __tuple_cat;
template <class... _Tp, size_t ..._I1, class... _Up, size_t ..._I2>
inline
tuple<_Tp..., _Up...>
__tuple_cat(tuple<_Tp...>&& __x, __tuple_indices<_I1...>, tuple<_Up...>&& __y, __tuple_indices<_I2...>)
template <class ..._Types, size_t ..._I0, size_t ..._J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
{
return tuple<_Tp..., _Up...>(_STD::forward<_Tp>(get<_I1>(__x))..., _STD::forward<_Up>(get<_I2>(__y))...);
}
template <class _Tuple0>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
{
return _STD::forward_as_tuple(_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...);
}
template <class... _Tp, class... _Up>
inline
tuple<_Tp..., _Up...>
tuple_cat(tuple<_Tp...>&& __x, tuple<_Up...>&& __y)
template <class _Tuple0, class _Tuple1, class ..._Tuples>
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
{
typedef typename remove_reference<_Tuple0>::type _T0;
typedef typename remove_reference<_Tuple1>::type _T1;
return __tuple_cat<
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
(_STD::forward_as_tuple(
_STD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_STD::forward<_Tuple0>(__t0))...
),
_STD::forward<_Tuple1>(__t1),
_STD::forward<_Tuples>(__tpls)...);
}
};
template <class _Tuple0, class... _Tuples>
inline _LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
{
return __tuple_cat(_STD::move(__x), typename __make_tuple_indices<sizeof...(_Tp)>::type(),
_STD::move(__y), typename __make_tuple_indices<sizeof...(_Up)>::type());
typedef typename remove_reference<_Tuple0>::type _T0;
return __tuple_cat<tuple<>, __tuple_indices<>,
typename __make_tuple_indices<tuple_size<_T0>::value>::type>()
(tuple<>(), _STD::forward<_Tuple0>(__t0),
_STD::forward<_Tuples>(__tpls)...);
}
template <class ..._Tp, class _Alloc>
struct uses_allocator<tuple<_Tp...>, _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<tuple<_Tp...>, _Alloc>
: true_type {};
template <class _T1, class _T2>

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -73,21 +73,27 @@ class _LIBCPP_EXCEPTION_ABI type_info
protected:
const char* __type_name;
_LIBCPP_INLINE_VISIBILITY
explicit type_info(const char* __n)
: __type_name(__n) {}
public:
virtual ~type_info();
_LIBCPP_INLINE_VISIBILITY
const char* name() const {return __type_name;}
_LIBCPP_INLINE_VISIBILITY
bool before(const type_info& __arg) const
{return __type_name < __arg.__type_name;}
_LIBCPP_INLINE_VISIBILITY
size_t hash_code() const throw()
{return *reinterpret_cast<const size_t*>(&__type_name);}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const type_info& __arg) const
{return __type_name == __arg.__type_name;}
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const type_info& __arg) const
{return !operator==(__arg);}

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -288,11 +288,16 @@ class __unordered_map_hasher
: private _Hash
{
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher() : _Hash() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher(const _Hash& __h) : _Hash(__h) {}
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
@@ -302,11 +307,16 @@ class __unordered_map_hasher<_Tp, _Hash, false>
{
_Hash __hash_;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher() : __hash_() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher(const _Hash& __h) : __hash_(__h) {}
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const _Tp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const typename _Tp::first_type& __x) const
{return __hash_(__x);}
};
@@ -316,15 +326,22 @@ class __unordered_map_equal
: private _Pred
{
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal() : _Pred() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal(const _Pred& __p) : _Pred(__p) {}
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const {return *this;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
@@ -335,15 +352,22 @@ class __unordered_map_equal<_Tp, _Pred, false>
{
_Pred __pred_;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal() : __pred_() {}
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal(const _Pred& __p) : __pred_(__p) {}
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
{return __pred_(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const typename _Tp::first_type& __x,
const typename _Tp::first_type& __y) const
{return __pred_(__x, __y);}
@@ -369,6 +393,7 @@ public:
bool __first_constructed;
bool __second_constructed;
_LIBCPP_INLINE_VISIBILITY
explicit __hash_map_node_destructor(allocator_type& __na)
: __na_(__na),
__first_constructed(false),
@@ -376,6 +401,7 @@ public:
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -384,6 +410,7 @@ public:
__x.__value_constructed = false;
}
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
__first_constructed(__x.__value_constructed),
@@ -393,19 +420,20 @@ public:
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
{
if (__second_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.second));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
if (__first_constructed)
__alloc_traits::destroy(__na_, addressof(__p->__value_.first));
__alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
if (__p)
__alloc_traits::deallocate(__na_, __p, 1);
}
};
template <class _HashIterator>
class __hash_map_iterator
class _LIBCPP_VISIBLE __hash_map_iterator
{
_HashIterator __i_;
@@ -425,14 +453,20 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator operator++(int)
{
__hash_map_iterator __t(*this);
@@ -440,20 +474,22 @@ public:
return __t;
}
friend bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class> friend class __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
};
template <class _HashIterator>
class __hash_map_const_iterator
class _LIBCPP_VISIBLE __hash_map_const_iterator
{
_HashIterator __i_;
@@ -473,17 +509,24 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator() {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(_HashIterator __i) : __i_(__i) {}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator(
__hash_map_iterator<typename _HashIterator::__non_const_iterator> __i)
: __i_(__i.__i_) {}
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return *operator->();}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return (pointer)__i_.operator->();}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator& operator++() {++__i_; return *this;}
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator operator++(int)
{
__hash_map_const_iterator __t(*this);
@@ -491,20 +534,22 @@ public:
return __t;
}
friend bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ == __y.__i_;}
friend bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class unordered_map;
template <class, class, class, class, class> friend class unordered_multimap;
template <class> friend class __hash_const_iterator;
template <class> friend class __hash_const_local_iterator;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class unordered_map
class _LIBCPP_VISIBLE unordered_map
{
public:
// types
@@ -553,6 +598,7 @@ public:
typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_map() {} // = default;
explicit unordered_map(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -590,26 +636,38 @@ public:
#endif
unordered_map& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace()
{return __table_.__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 __table_.__emplace_unique(_STD::forward<_A0>(__a0));}
@@ -621,11 +679,13 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator)
{return __table_.__emplace_unique().first;}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0)
{return __table_.__emplace_unique(_STD::forward<_A0>(__a0)).first;}
@@ -633,50 +693,68 @@ public:
template <class _A0, class... _Args,
class = typename enable_if<is_convertible<_A0, key_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args)
{return emplace(_STD::forward<_A0>(__a0),
_STD::forward<_Args>(__args)...).first;}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __x)
{return __table_.__insert_unique(_STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, _P&& __x)
{return insert(_STD::forward<_P>(__x)).first;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_map& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
@@ -688,24 +766,39 @@ public:
mapped_type& at(const key_type& __k);
const mapped_type& at(const key_type& __k) const;
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
private:
@@ -741,7 +834,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
const allocator_type& __a)
: __table_(__a)
@@ -799,7 +892,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
unordered_map&& __u)
: __table_(_STD::move(__u.__table_))
@@ -853,7 +946,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
{
@@ -864,7 +957,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -886,10 +979,10 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first),
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second),
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
@@ -906,7 +999,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_),
__node_traits::construct(__na, _STD::addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
@@ -939,9 +1032,9 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type&
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first), __k);
__node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second));
__node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _STD::move(__h);
}
@@ -950,7 +1043,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type&
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -1014,7 +1107,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::at(const key_type& __k) const
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1042,7 +1135,7 @@ operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1052,7 +1145,7 @@ operator!=(const unordered_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 unordered_multimap
class _LIBCPP_VISIBLE unordered_multimap
{
public:
// types
@@ -1099,6 +1192,7 @@ public:
typedef __hash_map_iterator<typename __table::local_iterator> local_iterator;
typedef __hash_map_const_iterator<typename __table::const_local_iterator> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_multimap() {} // = default
explicit unordered_multimap(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -1137,26 +1231,38 @@ public:
#endif
unordered_multimap& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator emplace()
{return __table_.__emplace_multi();}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_A0&& __a0)
{return __table_.__emplace_multi(_STD::forward<_A0>(__a0));}
@@ -1168,11 +1274,13 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p)
{return __table_.__emplace_hint_multi(__p.__i_);}
template <class _A0,
class = typename enable_if<is_convertible<_A0, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _A0&& __a0)
{return __table_.__emplace_hint_multi(__p.__i_, _STD::forward<_A0>(__a0));}
@@ -1183,65 +1291,97 @@ public:
iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __x)
{return __table_.__insert_multi(_STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __x)
{return __table_.__insert_multi(__p.__i_, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _P,
class = typename enable_if<is_convertible<_P, value_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, _P&& __x)
{return __table_.__insert_multi(__p.__i_, _STD::forward<_P>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first.__i_, __last.__i_);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_multimap& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const
{return __table_.hash_function().hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const
{return __table_.key_eq().key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const
{return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
private:
@@ -1303,7 +1443,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
const allocator_type& __a)
: __table_(__a)
@@ -1331,7 +1471,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
unordered_multimap&& __u)
: __table_(_STD::move(__u.__table_))
@@ -1387,7 +1527,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multimap&& __u)
{
@@ -1398,7 +1538,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -1420,10 +1560,10 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_.first),
__node_traits::construct(__na, _STD::addressof(__h->__value_.first),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, addressof(__h->__value_.second),
__node_traits::construct(__na, _STD::addressof(__h->__value_.second),
_STD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
@@ -1440,7 +1580,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, addressof(__h->__value_),
__node_traits::construct(__na, _STD::addressof(__h->__value_),
_STD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
@@ -1483,7 +1623,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -1493,7 +1633,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __fir
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)
@@ -1525,7 +1665,7 @@ operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -271,7 +271,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class unordered_set
class _LIBCPP_VISIBLE unordered_set
{
public:
// types
@@ -299,6 +299,7 @@ public:
typedef typename __table::const_local_iterator local_iterator;
typedef typename __table::const_local_iterator const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_set() {} // = default;
explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -335,81 +336,125 @@ public:
#endif
unordered_set& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator, _Args&&... __args)
{return __table_.__emplace_unique(_STD::forward<_Args>(__args)...).first;}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(value_type&& __x)
{return __table_.__insert_unique(_STD::move(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, value_type&& __x)
{return insert(_STD::move(__x)).first;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_set& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
};
@@ -460,7 +505,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const allocator_type& __a)
: __table_(__a)
@@ -488,7 +533,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
unordered_set&& __u)
: __table_(_STD::move(__u.__table_))
@@ -540,7 +585,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
{
@@ -551,7 +596,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_set<_Value, _Hash, _Pred, _Alloc>&
unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
initializer_list<value_type> __il)
@@ -562,7 +607,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -572,7 +617,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -600,7 +645,7 @@ operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -610,7 +655,7 @@ operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class unordered_multiset
class _LIBCPP_VISIBLE unordered_multiset
{
public:
// types
@@ -638,6 +683,7 @@ public:
typedef typename __table::const_local_iterator local_iterator;
typedef typename __table::const_local_iterator const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
unordered_multiset() {} // = default
explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
@@ -674,79 +720,123 @@ public:
#endif
unordered_multiset& operator=(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const
{return allocator_type(__table_.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return __table_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY
size_type size() const {return __table_.size();}
_LIBCPP_INLINE_VISIBILITY
size_type max_size() const {return __table_.max_size();}
_LIBCPP_INLINE_VISIBILITY
iterator begin() {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
iterator end() {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const {return __table_.end();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const {return __table_.begin();}
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const {return __table_.end();}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
{return __table_.__emplace_multi(_STD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __table_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __x) {return __table_.__insert_multi(_STD::move(__x));}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __x)
{return __table_.__insert_multi(__p, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __x)
{return __table_.__insert_multi(__p, _STD::move(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
_LIBCPP_INLINE_VISIBILITY
size_type erase(const key_type& __k) {return __table_.__erase_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __first, const_iterator __last)
{return __table_.erase(__first, __last);}
_LIBCPP_INLINE_VISIBILITY
void clear() {__table_.clear();}
_LIBCPP_INLINE_VISIBILITY
void swap(unordered_multiset& __u) {__table_.swap(__u.__table_);}
_LIBCPP_INLINE_VISIBILITY
hasher hash_function() const {return __table_.hash_function();}
_LIBCPP_INLINE_VISIBILITY
key_equal key_eq() const {return __table_.key_eq();}
_LIBCPP_INLINE_VISIBILITY
iterator find(const key_type& __k) {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<iterator, iterator> equal_range(const key_type& __k)
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
{return __table_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_count() const {return __table_.bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const {return __table_.max_bucket_count();}
_LIBCPP_INLINE_VISIBILITY
size_type bucket_size(size_type __n) const {return __table_.bucket_size(__n);}
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const key_type& __k) const {return __table_.bucket(__k);}
_LIBCPP_INLINE_VISIBILITY
local_iterator begin(size_type __n) {return __table_.begin(__n);}
_LIBCPP_INLINE_VISIBILITY
local_iterator end(size_type __n) {return __table_.end(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator begin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator end(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cbegin(size_type __n) const {return __table_.cbegin(__n);}
_LIBCPP_INLINE_VISIBILITY
const_local_iterator cend(size_type __n) const {return __table_.cend(__n);}
_LIBCPP_INLINE_VISIBILITY
float load_factor() const {return __table_.load_factor();}
_LIBCPP_INLINE_VISIBILITY
float max_load_factor() const {return __table_.max_load_factor();}
_LIBCPP_INLINE_VISIBILITY
void max_load_factor(float __mlf) {__table_.max_load_factor(__mlf);}
_LIBCPP_INLINE_VISIBILITY
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
};
@@ -798,7 +888,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const allocator_type& __a)
: __table_(__a)
@@ -826,7 +916,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
unordered_multiset&& __u)
: __table_(_STD::move(__u.__table_))
@@ -878,7 +968,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
unordered_multiset&& __u)
@@ -901,7 +991,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
_InputIterator __last)
@@ -911,7 +1001,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
void
swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)
@@ -943,7 +1033,7 @@ operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y)

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -38,7 +38,7 @@ template <class T> typename remove_reference<T>::type&& move(T&&);
template <class T>
typename conditional
<
!has_nothrow_move_constructor<T>::value && has_copy_constructor<T>::value,
!is_nothrow_move_constructible<T>::value && is_copy_constructible<T>::value,
const T&,
T&&
>::type
@@ -100,6 +100,10 @@ template<size_t I, class T1, class T2>
const typename const tuple_element<I, std::pair<T1, T2> >::type&
get(const std::pair<T1, T2>&);
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&&
get(std::pair<T1, T2>&&);
} // std
*/
@@ -174,7 +178,7 @@ inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typename conditional
<
!has_nothrow_move_constructor<_Tp>::value && has_copy_constructor<_Tp>::value,
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
const _Tp&,
_Tp&&
>::type
@@ -186,7 +190,7 @@ move_if_noexcept(_Tp& __x)
return _STD::move(__x);
}
struct piecewise_construct_t { };
struct _LIBCPP_VISIBLE piecewise_construct_t { };
//constexpr
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
@@ -194,7 +198,7 @@ template <class _T1, class _T2> struct pair;
template <class _T1, class _T2> void swap(pair<_T1, _T2>&, pair<_T1, _T2>&);
template <class _T1, class _T2>
struct pair
struct _LIBCPP_VISIBLE pair
{
typedef _T1 first_type;
typedef _T2 second_type;
@@ -207,6 +211,13 @@ struct pair
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(__p.first), second(__p.second) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _U1, class _U2,
@@ -218,6 +229,14 @@ struct pair
second(_STD::forward<_U2>(__u2))
{}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(_STD::forward<_U1>(__p.first)),
second(_STD::forward<_U2>(__p.second)) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Tuple,
@@ -230,7 +249,10 @@ struct pair
typename __make_tuple_types<_Tuple>::type>::type>(get<1>(__p)))
{}
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
tuple<_Args2...> __second_args)
: pair(__pc, __first_args, __second_args,
@@ -240,6 +262,7 @@ struct pair
template <class _Tuple,
class = typename enable_if<__tuple_assignable<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair&
operator=(_Tuple&& __p)
{
@@ -253,16 +276,13 @@ struct pair
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY pair(const pair<_U1, _U2>& __p)
: first(__p.first), second(__p.second) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void _LIBCPP_INLINE_VISIBILITY swap(pair& __p) {_STD::swap(*this, __p);}
private:
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t,
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
__tuple_indices<_I1...>, __tuple_indices<_I2...>);
@@ -349,7 +369,7 @@ struct __make_pair_return
};
template <class _T1, class _T2>
inline
inline _LIBCPP_INLINE_VISIBILITY
pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
make_pair(_T1&& __t1, _T2&& __t2)
{
@@ -372,34 +392,36 @@ make_pair(_T1 __x, _T2 __y)
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _T1, class _T2>
class tuple_size<pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
class _LIBCPP_VISIBLE tuple_size<pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class tuple_size<const pair<_T1, _T2> > : public integral_constant<size_t, 2> {};
class _LIBCPP_VISIBLE tuple_size<const pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class tuple_element<0, pair<_T1, _T2> >
class _LIBCPP_VISIBLE tuple_element<0, pair<_T1, _T2> >
{
public:
typedef _T1 type;
};
template <class _T1, class _T2>
class tuple_element<1, pair<_T1, _T2> >
class _LIBCPP_VISIBLE tuple_element<1, pair<_T1, _T2> >
{
public:
typedef _T2 type;
};
template <class _T1, class _T2>
class tuple_element<0, const pair<_T1, _T2> >
class _LIBCPP_VISIBLE tuple_element<0, const pair<_T1, _T2> >
{
public:
typedef const _T1 type;
};
template <class _T1, class _T2>
class tuple_element<1, const pair<_T1, _T2> >
class _LIBCPP_VISIBLE tuple_element<1, const pair<_T1, _T2> >
{
public:
typedef const _T2 type;
@@ -421,6 +443,16 @@ struct __get_pair<0>
_LIBCPP_INLINE_VISIBILITY
const _T1&
get(const pair<_T1, _T2>& __p) {return __p.first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T1&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T1>(__p.first);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <>
@@ -437,6 +469,16 @@ struct __get_pair<1>
_LIBCPP_INLINE_VISIBILITY
const _T2&
get(const pair<_T1, _T2>& __p) {return __p.second;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY
_T2&&
get(pair<_T1, _T2>&& __p) {return _STD::forward<_T2>(__p.second);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <size_t _Ip, class _T1, class _T2>
@@ -455,6 +497,18 @@ get(const pair<_T1, _T2>& __p)
return __get_pair<_Ip>::get(__p);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&& __p)
{
return __get_pair<_Ip>::get(_STD::move(__p));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,8 @@
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
@@ -318,30 +318,34 @@ protected:
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
__vector_base();
__vector_base(const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY __vector_base();
_LIBCPP_INLINE_VISIBILITY __vector_base(const allocator_type& __a);
~__vector_base();
_LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __begin_);}
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last)
{__destruct_at_end(__new_last, has_trivial_destructor<value_type>());}
void __destruct_at_end(const_pointer __new_last, false_type);
void __destruct_at_end(const_pointer __new_last, true_type);
{__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, false_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(const_pointer __new_last, true_type);
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c)
{__copy_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__vector_base& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());}
private:
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c, true_type)
{
if (__alloc() != __c.__alloc())
@@ -353,22 +357,27 @@ private:
__alloc() = __c.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __vector_base& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const __vector_base& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
{}
};
@@ -475,20 +484,28 @@ public:
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type* = 0);
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il);
_LIBCPP_INLINE_VISIBILITY
vector(initializer_list<value_type> __il, const allocator_type& __a);
#ifdef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
~vector() {__invalidate_all_iterators();}
#endif
vector(const vector& __x);
vector(const vector& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(const vector& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x);
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
@@ -509,15 +526,16 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const_reference __u);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const {return this->__alloc();}
iterator begin();
const_iterator begin() const;
iterator end();
const_iterator end() const;
_LIBCPP_INLINE_VISIBILITY iterator begin();
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const;
_LIBCPP_INLINE_VISIBILITY iterator end();
_LIBCPP_INLINE_VISIBILITY const_iterator end() const;
_LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
@@ -551,7 +569,7 @@ public:
_LIBCPP_INLINE_VISIBILITY const value_type* data() const
{return _STD::__to_raw_pointer(this->__begin_);}
void push_back(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -585,10 +603,11 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
iterator erase(const_iterator __position);
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY void clear() {__base::clear();}
@@ -601,16 +620,12 @@ public:
bool __invariants() const;
private:
void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
void allocate(size_type __n);
void deallocate();
size_type __recommend(size_type __new_size) const;
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n);
void __construct_at_end(size_type __n, false_type);
void __construct_at_end(size_type __n, true_type);
void __construct_at_end(size_type __n, const_reference __x);
void __construct_at_end(size_type __n, const_reference __x, false_type);
void __construct_at_end(size_type __n, const_reference __x, true_type);
template <class _ForwardIterator>
typename enable_if
<
@@ -621,7 +636,9 @@ private:
void __move_construct_at_end(pointer __first, pointer __last);
void __append(size_type __n);
void __append(size_type __n, const_reference __x);
_LIBCPP_INLINE_VISIBILITY
iterator __make_iter(pointer __p);
_LIBCPP_INLINE_VISIBILITY
const_iterator __make_iter(const_pointer __p) const;
void __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v);
pointer __swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p);
@@ -718,16 +735,8 @@ vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
{
__construct_at_end(__n, __is_zero_default_constructible<value_type>());
}
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
{
allocator_type& __a = this->__alloc();
do
@@ -738,15 +747,6 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, false_type)
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, true_type)
{
_STD::memset(this->__end_, 0, __n*sizeof(value_type));
this->__end_ += __n;
}
// Copy constructs __n objects starting at __end_ from __x
// throws if construction throws
// Precondition: __n > 0
@@ -757,14 +757,6 @@ template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
__construct_at_end(__n, __x, integral_constant<bool, has_trivial_copy_constructor<value_type>::value &&
has_trivial_copy_assign<value_type>::value>());
}
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, false_type)
{
allocator_type& __a = this->__alloc();
do
@@ -775,15 +767,6 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x,
} while (__n > 0);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x, true_type)
{
_STD::fill_n(this->__end_, __n, __x);
this->__end_ += __n;
}
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
typename enable_if
@@ -1118,7 +1101,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
if (__n <= capacity())
{
size_type __s = size();
_STD::fill_n(this->__begin_, min(__n, __s), __u);
_STD::fill_n(this->__begin_, _STD::min(__n, __s), __u);
if (__n > __s)
__construct_at_end(__n - __s, __u);
else
@@ -1744,8 +1727,8 @@ private:
{return (__n - 1) / __bits_per_word + 1;}
public:
vector();
explicit vector(const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY vector();
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
~vector();
explicit vector(size_type __n);
vector(size_type __n, const value_type& __v);
@@ -1772,10 +1755,11 @@ public:
vector(initializer_list<value_type> __il, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
vector(vector&& __v);
_LIBCPP_INLINE_VISIBILITY vector(vector&& __v);
vector(vector&& __v, const allocator_type& __a);
vector& operator=(vector&& __v);
_LIBCPP_INLINE_VISIBILITY vector& operator=(vector&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
@@ -1796,6 +1780,7 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
@@ -1855,10 +1840,11 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
iterator erase(const_iterator __position);
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
_LIBCPP_INLINE_VISIBILITY void clear() {__size_ = 0;}
@@ -1871,13 +1857,13 @@ public:
bool __invariants() const;
private:
void __invalidate_all_iterators();
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
void allocate(size_type __n);
void deallocate();
_LIBCPP_INLINE_VISIBILITY static size_type __align(size_type __new_size)
{return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n, bool __x);
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
template <class _ForwardIterator>
typename enable_if
<
@@ -1906,9 +1892,11 @@ private:
{return iterator(const_cast<__storage_pointer>(__p.__seg_), __p.__ctz_);}
#endif // _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __v)
{__copy_assign_alloc(__v, integral_constant<bool,
__storage_traits::propagate_on_container_copy_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __c, true_type)
{
if (__alloc() != __c.__alloc())
@@ -1916,31 +1904,38 @@ private:
__alloc() = __c.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __c, false_type)
{}
void __move_assign(vector& __c, false_type);
void __move_assign(vector& __c, true_type);
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(vector& __c)
{__move_assign_alloc(__c, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const vector& __c, true_type)
{
__alloc() = _STD::move(__c.__alloc());
}
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(const vector& __c, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y)
{__swap_alloc(__x, __y, integral_constant<bool,
__storage_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, true_type)
{
using _STD::swap;
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, false_type)
{}
@@ -1951,7 +1946,7 @@ private:
friend class __bit_iterator<vector, false>;
friend class __bit_iterator<vector, true>;
friend class __bit_array<vector>;
friend struct hash<vector>;
friend struct _LIBCPP_VISIBLE hash<vector>;
};
template <class _Allocator>
@@ -2225,7 +2220,6 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
}
template <class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>::~vector()
{
if (__begin_ != 0)
@@ -2722,17 +2716,14 @@ vector<bool, _Allocator>::__hash_code() const
}
template <class _Allocator>
struct hash<vector<bool, _Allocator> >
struct _LIBCPP_VISIBLE hash<vector<bool, _Allocator> >
: public unary_function<vector<bool, _Allocator>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const vector<bool, _Allocator>& __vec) const
{return __vec.__hash_code();}
};
template <class _Tp, class _Allocator>
struct __is_zero_default_constructible<vector<_Tp, _Allocator> >
: public integral_constant<bool, __is_zero_default_constructible<_Allocator>::value> {};
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool

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