Update libc++ to 3.8.0. Excerpted list of fixes (with upstream revision

numbers):

r242679 Implement the plugin-based version of std::search. There are no
        searchers yet; those are coming soon.
r242682 Implement the default searcher for std::experimental::search.
r243728 Add <experimental/any> v2.
r245330 implement more of N4258 - Cleaning up noexcept in the standard
        library. Specifically add new noexcept stuff to vector and
	string's move-assignment operations
r245334 Fix PR22606 - Leak pthread_key with static storage duration to
        ensure all of thread-local destructors are called.
r245335 Fix PR23589: std::function doesn't recognize null pointer to
        varargs function.
r247036 Implementation of Boyer-Moore and Boyer-Moore-Horspool
        searchers for the LFTS.
r249325 Implement LWG#2063, and update the issues links to point to the
        github generated pages
r249738 Split <ctype.h> out of <cctype>.
r249739 Split <errno.h> out of <cerrno>.
r249740 Split <float.h> out of <cfloat>.
r249741 Split <inttypes.h> out of <cinttypes>.
r249742 Split <math.h> out of <cmath>.
r249743 Split <setjmp.h> out of <csetjmp>.
r249761 Split <stddef.h> out of <cstddef>.
r249798 Split <stdio.h> out of <cstdio>.
r249800 Split <stdlib.h> out of <cstdlib>.
r249889 Split <wchar.h> out of <cwchar>.
r249890 Split <wctype.h> out of <cwctype>.
r249929 Split <string.h> out of <cstring>.
r250254 ABI versioning macros for libc++.
r251246 Fix LWG#2244: basic_istream::seekg
r251247 Fix LWG#2127: Move-construction with raw_storage_iterator.
r251253 Fix LWG#2476: scoped_allocator_adaptor is not assignable
r251257 Fix LWG#2489: mem_fn() should be noexcept
r251618 Implement P0004R1 'Remove Deprecated iostreams aliases'
r251766 Implement the first part of P0006R0: Adopt Type Traits Variable
        Templates for C++17.
r252195 Implement P0092R1 for C++1z
r252350 Allow deque to handle incomplete types.
r252406 More of P0006R0: type traits variable aliases for C++17.
r252407 Implement LWG#2353: std::next is over-constrained
r252905 Implement P0074: Making owner_less more flexible
r253215 Implement P0013R1: Logical Operator Type Traits.
r253274 Implement P0007: Constant View: A proposal for a std::as_const
        helper function template.
r254119 Add static_assert to set/multiset/map/multimap/forward_list/deque
        that the allocator's value_type match the container's value_type.
r254283 Implement more of P0006; Type Traits Variable Templates.
r255941 LWG2485: get() should be overloaded for const tuple&&.
r256325 Fix LWG Issue #2367 - Fixing std::tuple and std::pair's default
        constructors.
r256652 Fix for ALL undefined behavior in <list>.
r256859 First half of LWG#2354: 'Unnecessary copying when inserting
        into maps with braced-init syntax'

Exp-run:	antoine
Relnotes:	yes
This commit is contained in:
Dimitry Andric 2016-05-26 18:52:49 +00:00
commit 9729cf0934
89 changed files with 6832 additions and 4807 deletions

View File

@ -500,7 +500,7 @@ HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q}
HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT
.endif
CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCFLAGS} ${XCXXFLAGS}" \
CROSSENV+= CC="${XCC} ${XCFLAGS}" CXX="${XCXX} ${XCXXFLAGS} ${XCFLAGS}" \
CPP="${XCPP} ${XCFLAGS}" \
AS="${XAS}" AR="${XAR}" LD="${XLD}" NM=${XNM} \
OBJDUMP=${XOBJDUMP} OBJCOPY="${XOBJCOPY}" \

View File

@ -11,19 +11,37 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#if !defined(_MSC_VER) || defined(__clang__)
#if defined(_MSC_VER) && !defined(__clang__)
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
#endif
#ifdef __cplusplus
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define _GNUC_VER 0
#endif
#define _LIBCPP_VERSION 3700
#define _LIBCPP_VERSION 3800
#ifndef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
#endif
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
// Change short string represention so that string data starts at offset 0,
// improving its alignment in some cases.
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
// Fix deque iterator type in order to support incomplete types.
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
// Fix undefined behavior in how std::list stores it's linked nodes.
#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
#endif
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
@ -37,6 +55,9 @@
#ifndef __has_builtin
#define __has_builtin(__x) 0
#endif
#ifndef __has_extension
#define __has_extension(__x) 0
#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
@ -61,6 +82,16 @@
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
#ifdef __BYTE_ORDER__
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 1
#define _LIBCPP_BIG_ENDIAN 0
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#define _LIBCPP_LITTLE_ENDIAN 0
#define _LIBCPP_BIG_ENDIAN 1
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#endif // __BYTE_ORDER__
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
@ -227,9 +258,12 @@
#if defined(__clang__)
#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
!defined(__arm__)
#define _LIBCPP_ALTERNATE_STRING_LAYOUT
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
!defined(__arm__)) || \
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
#endif
#if __has_feature(cxx_alignas)
@ -273,6 +307,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_UNUSED __attribute__((__unused__))
#if !(__has_feature(cxx_default_function_template_args))
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#endif
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
@ -354,14 +392,19 @@ typedef __char32_t char32_t;
#elif defined(__ANDROID__)
#define _LIBCPP_HAS_QUICK_EXIT
#elif defined(__linux__)
#include <features.h>
#if !defined(_LIBCPP_HAS_MUSL_LIBC)
# include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#else // defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif // __linux__
#endif
#if !(__has_feature(cxx_noexcept))
@ -390,6 +433,11 @@ namespace std {
#define _LIBCPP_HAS_NO_ASAN
#endif
// Allow for build-time disabling of unsigned integer sanitization
#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute((no_sanitize("unsigned-integer-overflow")))
#endif
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
@ -437,6 +485,7 @@ namespace std {
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
@ -444,22 +493,18 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_NO_NOEXCEPT
#else // __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@ -498,7 +543,6 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
@ -532,9 +576,9 @@ namespace std {
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _LIBCPP_UNUSED
#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
@ -579,9 +623,11 @@ typedef unsigned int char32_t;
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
extern "C++" {
template <bool> struct __static_assert_test;
template <> struct __static_assert_test<true> {};
template <unsigned> struct __static_assert_check {};
}
#define static_assert(__b, __m) \
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
@ -724,6 +770,12 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
#else
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
#endif
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
const void *, const void *, const void *, const void *);
@ -733,7 +785,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
# if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
@ -765,7 +817,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_STDOUT
#endif
#if defined(__ANDROID__) || defined(__CloudABI__)
#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
@ -775,4 +827,21 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif
#endif // _LIBCPP_CONFIG
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
#define _LIBCPP_HAS_C_ATOMIC_IMP
#elif _GNUC_VER > 407
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
#endif
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
|| defined(_LIBCPP_HAS_NO_THREADS)
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
#endif
#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#endif
#endif // __cplusplus
#endif // _LIBCPP_CONFIG

View File

@ -17,218 +17,7 @@
#pragma GCC system_header
#endif
template <class _Tp>
class __mem_fn
: public __weak_result_type<_Tp>
{
public:
// types
typedef _Tp type;
private:
type __f_;
public:
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
// invoke
typename __invoke_return<type>::type
operator() () const
{
return __invoke(__f_);
}
template <class _A0>
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const
{
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const
{
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1, class _A2>
typename __invoke_return2<type, _A0, _A1, _A2>::type
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
{
return __invoke(__f_, __a0, __a1, __a2);
}
};
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp _Tp::*>
mem_fn(_Rp _Tp::* __pm)
{
return __mem_fn<_Rp _Tp::*>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)()>
mem_fn(_Rp (_Tp::* __pm)())
{
return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0)>
mem_fn(_Rp (_Tp::* __pm)(_A0))
{
return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1))
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const>
mem_fn(_Rp (_Tp::* __pm)() const)
{
return __mem_fn<_Rp (_Tp::*)() const>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const>
mem_fn(_Rp (_Tp::* __pm)(_A0) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() volatile>
mem_fn(_Rp (_Tp::* __pm)() volatile)
{
return __mem_fn<_Rp (_Tp::*)() volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const volatile>
mem_fn(_Rp (_Tp::* __pm)() const volatile)
{
return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm);
}
// bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
};
template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
template<class _Fp>
struct __maybe_derive_from_unary_function
{
};
template<class _Rp, class _A1>
struct __maybe_derive_from_unary_function<_Rp(_A1)>
: public unary_function<_A1, _Rp>
{
};
template<class _Fp>
struct __maybe_derive_from_binary_function
{
};
template<class _Rp, class _A1, class _A2>
struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp>
{
};
namespace __function {
template<class _Fp> class __base;
@ -662,15 +451,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)()) {return __p;}
template <class _R2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2()>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -769,7 +549,7 @@ function<_Rp()>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -796,7 +576,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -947,27 +727,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)()) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;}
template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;}
template <class _R2, class _B0>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_B0)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1066,7 +825,7 @@ function<_Rp(_A0)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1093,7 +852,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1244,27 +1003,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {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 _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;}
template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;}
template <class _R2, class _B0, class _B1>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1363,7 +1101,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1390,7 +1128,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1540,27 +1278,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {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 _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;}
template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__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<_R2(_B0, _B1, _B2)>& __p) {return __p;}
public:
typedef _Rp result_type;
@ -1660,7 +1377,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1687,7 +1404,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@ -1856,274 +1573,4 @@ void
swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY 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 _LIBCPP_TYPE_VIS_ONLY is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders
{
template <int _Np> struct __ph {};
extern __ph<1> _1;
extern __ph<2> _2;
extern __ph<3> _3;
extern __ph<4> _4;
extern __ph<5> _5;
extern __ph<6> _6;
extern __ph<7> _7;
extern __ph<8> _8;
extern __ph<9> _9;
extern __ph<10> _10;
} // placeholders
template<int _Np>
struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
__mu(reference_wrapper<_Tp> __t, _Uj&)
{
return __t.get();
}
/*
template <bool _IsBindExpr, class _Ti, class ..._Uj>
struct __mu_return1 {};
template <class _Ti, class ..._Uj>
struct __mu_return1<true, _Ti, _Uj...>
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class ..._Uj, size_t ..._Indx>
inline _LIBCPP_INLINE_VISIBILITY
typename __mu_return1<true, _Ti, _Uj...>::type
__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
{
__ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...);
}
template <class _Ti, class ..._Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_bind_expression<_Ti>::value,
typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
>::type
__mu(_Ti& __ti, tuple<_Uj...>& __uj)
{
typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
return __mu_expand(__ti, __uj, __indices());
}
template <bool IsPh, class _Ti, class _Uj>
struct __mu_return2 {};
template <class _Ti, class _Uj>
struct __mu_return2<true, _Ti, _Uj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
};
template <class _Ti, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
0 < is_placeholder<_Ti>::value,
typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
>::type
__mu(_Ti&, _Uj& __uj)
{
const size_t _Indx = is_placeholder<_Ti>::value - 1;
// compiler bug workaround
typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj);
return __t;
// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
}
template <class _Ti, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
!is_bind_expression<_Ti>::value &&
is_placeholder<_Ti>::value == 0 &&
!__is_reference_wrapper<_Ti>::value,
_Ti&
>::type
__mu(_Ti& __ti, _Uj& __uj)
{
return __ti;
}
template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
struct ____mu_return;
template <class _Ti, class ..._Uj>
struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
{
typedef typename result_of<_Ti(_Uj...)>::type type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, true, _TupleUj>
{
typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
_TupleUj>::type&& type;
};
template <class _Ti, class _TupleUj>
struct ____mu_return<_Ti, false, false, _TupleUj>
{
typedef _Ti& type;
};
template <class _Ti, class _TupleUj>
struct __mu_return
: public ____mu_return<_Ti,
is_bind_expression<_Ti>::value,
0 < is_placeholder<_Ti>::value,
_TupleUj>
{
};
template <class _Ti, class _TupleUj>
struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
{
typedef _Ti& type;
};
template <class _Fp, class _BoundArgs, class _TupleUj>
struct __bind_return;
template <class _Fp, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
_Fp&,
typename __mu_return
<
_BoundArgs,
_TupleUj
>::type...
>::type type;
};
template <class _Fp, class ..._BoundArgs, class _TupleUj>
struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
_Fp&,
typename __mu_return
<
const _BoundArgs,
_TupleUj
>::type...
>::type type;
};
template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
inline _LIBCPP_INLINE_VISIBILITY
typename __bind_return<_Fp, _BoundArgs, _Args>::type
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
}
template<class _Fp, class ..._BoundArgs>
class __bind
{
_Fp __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
template <class _Gp, class ..._BA>
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
: __f_(_VSTD::forward<_Gp>(__f)),
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
}
template <class ..._Args>
typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(__args...));
}
};
template<class _Fp, class ..._BoundArgs>
struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
template<class _Rp, class _Fp, class ..._BoundArgs>
class __bind_r
: public __bind<_Fp, _BoundArgs...>
{
typedef __bind<_Fp, _BoundArgs...> base;
public:
typedef _Rp result_type;
template <class _Gp, class ..._BA>
explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
: base(_VSTD::forward<_Gp>(__f),
_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
result_type
operator()(_Args&& ...__args)
{
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
}
template <class ..._Args>
result_type
operator()(_Args&& ...__args) const
{
typedef __invoke_void_return_wrapper<_Rp> _Invoker;
return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
}
};
template<class _Rp, class _Fp, class ..._BoundArgs>
struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
template<class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
template<class _Rp, class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
*/
#endif // _LIBCPP_FUNCTIONAL_03

View File

@ -77,62 +77,6 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void>
};
#endif
// addressof
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__strong _Tp*
addressof(__strong _Tp& __x) _NOEXCEPT
{
return &__x;
}
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__weak _Tp*
addressof(__weak _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__autoreleasing _Tp*
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
{
return &__x;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__unsafe_unretained _Tp*
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
#else // _LIBCPP_HAS_NO_VARIADICS
// __weak_result_type
template <class _Tp>
@ -314,6 +258,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
@ -358,8 +304,12 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
typedef _Rp result_type;
};
#endif // _LIBCPP_HAS_NO_VARIADICS
// __invoke
#ifndef _LIBCPP_HAS_NO_VARIADICS
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args,
@ -414,31 +364,79 @@ __invoke(_Fp&& __f, _Args&& ...__args)
{
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
struct __invoke_return
{
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
#else // _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ret>
struct __invoke_void_return_wrapper
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
static _Ret __call(_Args&&... __args)
{
static _Ret __call(_Args&&... __args) {
return __invoke(_VSTD::forward<_Args>(__args)...);
}
#else
template <class _Fn>
static _Ret __call(_Fn __f) {
return __invoke(__f);
}
template <class _Fn, class _A0>
static _Ret __call(_Fn __f, _A0& __a0) {
return __invoke(__f, __a0);
}
template <class _Fn, class _A0, class _A1>
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
return __invoke(__f, __a0, __a1);
}
template <class _Fn, class _A0, class _A1, class _A2>
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
return __invoke(__f, __a0, __a1, __a2);
}
#endif
};
template <>
struct __invoke_void_return_wrapper<void>
{
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
static void __call(_Args&&... __args)
{
static void __call(_Args&&... __args) {
__invoke(_VSTD::forward<_Args>(__args)...);
}
#else
template <class _Fn>
static void __call(_Fn __f) {
__invoke(__f);
}
template <class _Fn, class _A0>
static void __call(_Fn __f, _A0& __a0) {
__invoke(__f, __a0);
}
template <class _Fn, class _A0, class _A1>
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
__invoke(__f, __a0, __a1);
}
template <class _Fn, class _A0, class _A1, class _A2>
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
__invoke(__f, __a0, __a1, __a2);
}
#endif
};
template <class _Tp>
@ -463,14 +461,120 @@ public:
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
_LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
}
#else
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type>::type
operator() () const {
return __invoke(get());
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const {
return __invoke(get(), __a0);
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0 const>::type
operator() (_A0 const& __a0) const {
return __invoke(get(), __a0);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1>::type
operator() (_A0 const& __a0, _A1& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1 const>::type
operator() (_A0& __a0, _A1 const& __a1) const {
return __invoke(get(), __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1 const>::type
operator() (_A0 const& __a0, _A1 const& __a1) const {
return __invoke(get(), __a0, __a1);
}
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 {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
};
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
@ -510,6 +614,7 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
return cref(__t.get());
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

View File

@ -46,12 +46,7 @@ template <class _Tp, class _VoidPtr>
struct __hash_node
: public __hash_node_base
<
typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__hash_node<_Tp, _VoidPtr> >
#else
rebind<__hash_node<_Tp, _VoidPtr> >::other
#endif
typename __rebind_pointer<_VoidPtr, __hash_node<_Tp, _VoidPtr> >::type
>
{
typedef _Tp value_type;
@ -98,13 +93,7 @@ public:
typedef typename pointer_traits<__node_pointer>::element_type::value_type value_type;
typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
@ -229,20 +218,8 @@ public:
typedef typename __node::value_type value_type;
typedef typename pointer_traits<__node_pointer>::difference_type difference_type;
typedef const value_type& reference;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node>
#else
rebind<__node>::other
#endif
__non_const_node_pointer;
typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer;
typedef typename __rebind_pointer<__node_pointer, __node>::type __non_const_node_pointer;
typedef __hash_iterator<__non_const_node_pointer> __non_const_iterator;
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT
@ -376,13 +353,7 @@ public:
typedef typename __pointer_traits::element_type::value_type value_type;
typedef typename __pointer_traits::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT
{
@ -514,13 +485,9 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator
typedef pointer_traits<__node_pointer> __pointer_traits;
typedef typename __pointer_traits::element_type __node;
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__non_const_node>
#else
rebind<__non_const_node>::other
#endif
__non_const_node_pointer;
typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type
__non_const_node_pointer;
typedef __hash_local_iterator<__non_const_node_pointer>
__non_const_iterator;
public:
@ -530,13 +497,9 @@ public:
>::type value_type;
typedef typename __pointer_traits::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, const value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT
{
@ -780,13 +743,8 @@ public:
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer;
typedef __hash_node_base<__node_pointer> __first_node;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__first_node>
#else
rebind<__first_node>::other
#endif
__node_base_pointer;
typedef typename __rebind_pointer<__node_pointer, __first_node>::type
__node_base_pointer;
private:
@ -836,6 +794,7 @@ public:
typedef __hash_local_iterator<__node_pointer> local_iterator;
typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
_LIBCPP_INLINE_VISIBILITY
__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
@ -843,6 +802,7 @@ public:
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value);
_LIBCPP_INLINE_VISIBILITY
__hash_table(const hasher& __hf, const key_equal& __eql);
__hash_table(const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
@ -863,6 +823,7 @@ public:
__hash_table& operator=(const __hash_table& __u);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__hash_table& operator=(__hash_table&& __u)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
@ -934,9 +895,13 @@ public:
return __bucket_list_.get_deleter().size();
}
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT;
template <class _Key>
@ -965,6 +930,7 @@ public:
__node_holder remove(const_iterator __p) _NOEXCEPT;
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type __count_unique(const _Key& __k) const;
template <class _Key>
size_type __count_multi(const _Key& __k) const;
@ -1130,11 +1096,12 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
is_nothrow_default_constructible<__first_node>::value &&
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value)
: __p2_(0),
@ -1143,7 +1110,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@ -1203,6 +1170,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
_NOEXCEPT_(
is_nothrow_move_constructible<__bucket_list>::value &&
is_nothrow_move_constructible<__first_node>::value &&
is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
@ -1410,7 +1378,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
_NOEXCEPT_(
@ -1495,7 +1463,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
{
@ -1507,7 +1475,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
{
@ -1519,7 +1487,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
{
@ -1531,7 +1499,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
{
@ -2108,7 +2076,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -2124,7 +2092,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@ -2256,7 +2224,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{

View File

@ -37,6 +37,8 @@
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
# include <xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include <support/musl/xlocale.h>
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@ -329,7 +331,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_TYPE_VIS ctype_base
{
public:
#ifdef __GLIBC__
#if defined(__GLIBC__)
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
@ -359,7 +361,7 @@ public:
typedef __uint32_t mask;
# elif defined(__FreeBSD__)
typedef unsigned long mask;
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
typedef unsigned short mask;
# endif
static const mask space = _CTYPE_S;

View File

@ -14,7 +14,9 @@
#include <__config>
#include <chrono>
#include <system_error>
#ifndef _LIBCPP_HAS_NO_THREADS
#include <pthread.h>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -306,6 +308,7 @@ public:
template <class _Rep, class _Period, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
@ -390,7 +393,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
}
template <class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,

View File

@ -0,0 +1,66 @@
// -*- C++ -*-
//===--------------------------- __nullptr --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_NULLPTR
#define _LIBCPP_NULLPTR
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
{
void* __lx;
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t()
_LIBCPP_END_NAMESPACE_STD
#else // _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_NULLPTR

View File

@ -56,9 +56,12 @@ public:
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY
__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
_LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(__alloc_rr& __a);
_LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
@ -128,7 +131,9 @@ public:
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, false_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY
@ -266,7 +271,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
@ -275,7 +280,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
@ -309,7 +314,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
@ -317,14 +322,14 @@ __split_buffer<_Tp, _Allocator>::__split_buffer()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{

View File

@ -548,31 +548,15 @@ template <class _VoidPtr>
class __tree_node_base
: public __tree_end_node
<
typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__tree_node_base<_VoidPtr> >
#else
rebind<__tree_node_base<_VoidPtr> >::other
#endif
typename __rebind_pointer<_VoidPtr, __tree_node_base<_VoidPtr> >::type
>
{
__tree_node_base(const __tree_node_base&);
__tree_node_base& operator=(const __tree_node_base&);
public:
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__tree_node_base>
#else
rebind<__tree_node_base>::other
#endif
pointer;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const __tree_node_base>
#else
rebind<const __tree_node_base>::other
#endif
const_pointer;
typedef typename __rebind_pointer<_VoidPtr, __tree_node_base>::type pointer;
typedef typename __rebind_pointer<_VoidPtr, const __tree_node_base>::type const_pointer;
typedef __tree_end_node<pointer> base;
pointer __right_;
@ -623,13 +607,7 @@ public:
typedef _Tp value_type;
typedef _DiffType difference_type;
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
@ -694,13 +672,7 @@ public:
typedef _Tp value_type;
typedef _DiffType difference_type;
typedef const value_type& reference;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, const value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
@ -710,13 +682,8 @@ public:
private:
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__non_const_node>
#else
rebind<__non_const_node>::other
#endif
__non_const_node_pointer;
typedef typename __rebind_pointer<__node_pointer, __non_const_node>::type
__non_const_node_pointer;
typedef __tree_iterator<value_type, __non_const_node_pointer, difference_type>
__non_const_iterator;
public:
@ -730,14 +697,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++() {
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<typename __node::base>
#else
rebind<typename __node::base>::other
#endif
__node_base_pointer;
typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type
__node_base_pointer;
__ptr_ = static_cast<__node_pointer>(
__tree_next(static_cast<__node_base_pointer>(__ptr_)));
return *this;
@ -749,14 +710,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator--() {
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<typename __node::base>
#else
rebind<typename __node::base>::other
#endif
__node_base_pointer;
typedef typename __rebind_pointer<__node_pointer, typename __node::base>::type
__node_base_pointer;
__ptr_ = static_cast<__node_pointer>(
__tree_prev(static_cast<__node_base_pointer>(__ptr_)));
return *this;
@ -810,20 +765,9 @@ public:
typedef typename __node_base::pointer __node_base_const_pointer;
private:
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>
#else
rebind<__end_node_t>::other
#endif
__end_node_ptr;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
#else
rebind<__end_node_t>::other
#endif
__end_node_const_ptr;
typedef typename __rebind_pointer<__node_pointer, __end_node_t>::type
__end_node_ptr;
typedef __end_node_ptr __end_node_const_ptr;
__node_pointer __begin_node_;
__compressed_pair<__end_node_t, __node_allocator> __pair1_;
@ -965,6 +909,13 @@ public:
iterator __insert_multi(const value_type& __v);
iterator __insert_multi(const_iterator __p, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique( value_type&& __v);
iterator __insert_unique(const_iterator __p, value_type&& __v);
iterator __insert_multi( value_type&& __v);
iterator __insert_multi(const_iterator __p, value_type&& __v);
#endif
pair<iterator, bool> __node_insert_unique(__node_pointer __nd);
iterator __node_insert_unique(const_iterator __p,
__node_pointer __nd);
@ -1118,8 +1069,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
: __pair1_(__node_allocator(__a)),
__begin_node_(__node_pointer()),
: __begin_node_(__node_pointer()),
__pair1_(__node_allocator(__a)),
__pair3_(0)
{
__begin_node() = __end_node();
@ -1128,8 +1079,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
const allocator_type& __a)
: __pair1_(__node_allocator(__a)),
__begin_node_(__node_pointer()),
: __begin_node_(__node_pointer()),
__pair1_(__node_allocator(__a)),
__pair3_(0, __comp)
{
__begin_node() = __end_node();
@ -1785,6 +1736,28 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(value_type&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<value_type>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, value_type&& __v)
{
__node_holder __h = __construct_node(_VSTD::forward<value_type>(__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>
template <class _Vp>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
@ -1809,6 +1782,28 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v
return __r;
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(value_type&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
__node_holder __h = __construct_node(_VSTD::forward<value_type>(__v));
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, value_type&& __v)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
__node_holder __h = __construct_node(_VSTD::forward<value_type>(__v));
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
return iterator(__h.release());
}
template <class _Tp, class _Compare, class _Allocator>
template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
@ -1843,7 +1838,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@ -86,6 +86,11 @@ template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&&) _NOEXCEPT;
#endif
// pair specializations
@ -109,6 +114,11 @@ template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&&) _NOEXCEPT;
#endif
// array specializations
@ -132,35 +142,15 @@ template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&&
get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
// __lazy_and
template <bool _Last, class ..._Preds>
struct __lazy_and_impl;
template <class ..._Preds>
struct __lazy_and_impl<false, _Preds...> : false_type {};
template <>
struct __lazy_and_impl<true> : true_type {};
template <class _Pred>
struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
template <class _Hp, class ..._Tp>
struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
template <class _P1, class ..._Pr>
struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
// __lazy_not
template <class _Pred>
struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
// __make_tuple_indices
template <size_t...> struct __tuple_indices {};

View File

@ -851,7 +851,7 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
return _VSTD::move(__f); // explicitly moved for (emulated) C++03
return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03
}
// find
@ -1687,25 +1687,6 @@ search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const
}
// copy
template <class _Iter>
struct __libcpp_is_trivial_iterator
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
{
static const bool value = is_pointer<_Iter>::value;
};
template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
_Iter
@ -2330,7 +2311,7 @@ __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirec
{
if (__first == --__last)
break;
swap(*__first, *__last);
_VSTD::iter_swap(__first, __last);
++__first;
}
}
@ -2342,7 +2323,7 @@ __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_ac
{
if (__first != __last)
for (; __first < --__last; ++__first)
swap(*__first, *__last);
_VSTD::iter_swap(__first, __last);
}
template <class _BidirectionalIterator>
@ -3037,7 +3018,7 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
if (_Rp == 0)
return static_cast<result_type>(_Eng(__g, _Dt)());
size_t __w = _Dt - __clz(_Rp) - 1;
if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0)
if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
++__w;
_Eng __e(__g, __w);
_UIntType __u;

View File

@ -89,12 +89,13 @@ template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <size_t I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexcept; // constexpr in C++14
} // std
@ -324,6 +325,15 @@ get(array<_Tp, _Size>&& __a) _NOEXCEPT
return _VSTD::move(__a.__elems_[_Ip]);
}
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&&
get(const array<_Tp, _Size>&& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
return _VSTD::move(__a.__elems_[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD

View File

@ -535,21 +535,20 @@ void atomic_signal_fence(memory_order m) noexcept;
#ifdef _LIBCPP_HAS_NO_THREADS
#error <atomic> is not supported on this single threaded system
#else // !_LIBCPP_HAS_NO_THREADS
#endif
#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
#error <atomic> is not implemented
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
#if !__has_feature(cxx_atomic) && _GNUC_VER < 407
#error <atomic> is not implemented
#else
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
#if _GNUC_VER >= 407
#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
namespace __gcc_atomic {
template <typename _Tp>
struct __gcc_atomic_t {
@ -816,7 +815,7 @@ static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
return __atomic_fetch_xor(&__a->__a_value, __pattern,
__gcc_atomic::__to_gcc_order(__order));
}
#endif // _GNUC_VER >= 407
#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@ -836,7 +835,7 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile _NOEXCEPT
{
#if __has_feature(cxx_atomic)
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
return __c11_atomic_is_lock_free(sizeof(_Tp));
#else
return __atomic_is_lock_free(sizeof(_Tp), 0);
@ -1790,8 +1789,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
// lock-free property
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
@ -1803,10 +1800,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
#endif // !__has_feature(cxx_atomic)
_LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
#endif // _LIBCPP_ATOMIC

View File

@ -168,7 +168,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@ -180,8 +182,11 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip() _NOEXCEPT;
@ -192,22 +197,27 @@ protected:
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type, false_type) const;
unsigned long long to_ullong(true_type, true_type) const;
};
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@ -245,7 +255,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@ -264,7 +274,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@ -273,7 +283,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@ -282,7 +292,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@ -325,7 +335,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
__bitset<_N_words, _Size>::to_ulong(true_type) const
{
@ -348,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type) const
{
@ -356,7 +366,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
{
@ -414,7 +424,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{
@ -450,7 +460,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@ -462,23 +474,32 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void flip() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
_LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
@ -486,7 +507,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
@ -494,7 +515,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@ -502,7 +523,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@ -510,7 +531,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@ -518,7 +539,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
__bitset<1, _Size>::flip() _NOEXCEPT
{
@ -528,7 +549,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
__bitset<1, _Size>::to_ulong() const
{
@ -536,7 +557,7 @@ __bitset<1, _Size>::to_ulong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
__bitset<1, _Size>::to_ullong() const
{
@ -544,7 +565,7 @@ __bitset<1, _Size>::to_ullong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
__bitset<1, _Size>::all() const _NOEXCEPT
{
@ -553,7 +574,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
__bitset<1, _Size>::any() const _NOEXCEPT
{
@ -562,7 +583,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
{
@ -593,7 +614,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
@ -620,13 +643,13 @@ protected:
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
@ -663,16 +686,23 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
_LIBCPP_INLINE_VISIBILITY
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true);
_LIBCPP_INLINE_VISIBILITY
bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos);
_LIBCPP_INLINE_VISIBILITY
bitset operator~() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset& flip() _NOEXCEPT;
bitset& flip(size_t __pos);
@ -680,28 +710,40 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
_LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
_LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT>
_LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
_LIBCPP_INLINE_VISIBILITY
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
_LIBCPP_INLINE_VISIBILITY
size_t count() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
bool operator==(const bitset& __rhs) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
_LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
_LIBCPP_INLINE_VISIBILITY
bitset operator<<(size_t __pos) const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
@ -774,7 +816,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{
@ -783,7 +825,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{
@ -792,7 +834,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{
@ -821,7 +863,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::set() _NOEXCEPT
{
@ -844,7 +886,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::reset() _NOEXCEPT
{
@ -867,7 +909,7 @@ bitset<_Size>::reset(size_t __pos)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator~() const _NOEXCEPT
{
@ -877,7 +919,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>&
bitset<_Size>::flip() _NOEXCEPT
{
@ -901,7 +943,7 @@ bitset<_Size>::flip(size_t __pos)
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long
bitset<_Size>::to_ulong() const
{
@ -909,7 +951,7 @@ bitset<_Size>::to_ulong() const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
unsigned long long
bitset<_Size>::to_ullong() const
{
@ -932,7 +974,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, _Traits, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@ -941,7 +983,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@ -949,7 +991,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
basic_string<char, char_traits<char>, allocator<char> >
bitset<_Size>::to_string(char __zero, char __one) const
{
@ -957,7 +999,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
bitset<_Size>::count() const _NOEXCEPT
{
@ -965,7 +1007,7 @@ bitset<_Size>::count() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{
@ -973,7 +1015,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{
@ -994,7 +1036,7 @@ bitset<_Size>::test(size_t __pos) const
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::all() const _NOEXCEPT
{
@ -1002,7 +1044,7 @@ bitset<_Size>::all() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
bitset<_Size>::any() const _NOEXCEPT
{
@ -1010,7 +1052,7 @@ bitset<_Size>::any() const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{
@ -1020,7 +1062,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
}
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
inline
bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{

View File

@ -37,10 +37,6 @@ int toupper(int c);
#include <__config>
#include <ctype.h>
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -48,117 +44,20 @@ int toupper(int c);
_LIBCPP_BEGIN_NAMESPACE_STD
#ifdef isalnum
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
#undef isalnum
inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
#else // isalnum
using ::isalnum;
#endif // isalnum
#ifdef isalpha
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
#undef isalpha
inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
#else // isalpha
using ::isalpha;
#endif // isalpha
#ifdef isblank
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
#undef isblank
inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
#else // isblank
using ::isblank;
#endif // isblank
#ifdef iscntrl
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
#undef iscntrl
inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
#else // iscntrl
using ::iscntrl;
#endif // iscntrl
#ifdef isdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
#undef isdigit
inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
#else // isdigit
using ::isdigit;
#endif // isdigit
#ifdef isgraph
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
#undef isgraph
inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
#else // isgraph
using ::isgraph;
#endif // isgraph
#ifdef islower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
#undef islower
inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
#else // islower
using ::islower;
#endif // islower
#ifdef isprint
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
#undef isprint
inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
#else // isprint
using ::isprint;
#endif // isprint
#ifdef ispunct
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
#undef ispunct
inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
#else // ispunct
using ::ispunct;
#endif // ispunct
#ifdef isspace
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
#undef isspace
inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
#else // isspace
using ::isspace;
#endif // isspace
#ifdef isupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
#undef isupper
inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
#else // isupper
using ::isupper;
#endif // isupper
#ifdef isxdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
#undef isxdigit
inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
#else // isxdigit
using ::isxdigit;
#endif // isxdigit
#ifdef tolower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
#undef tolower
inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
#else // tolower
using ::tolower;
#endif // tolower
#ifdef toupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
#undef toupper
inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
#else // toupper
using ::toupper;
#endif // toupper
_LIBCPP_END_NAMESPACE_STD

View File

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

View File

@ -1,5 +1,5 @@
// -*- C++ -*-
//===---------------------------- cctype ----------------------------------===//
//===---------------------------- cfenv -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//

View File

@ -67,12 +67,4 @@ Macros:
#pragma GCC system_header
#endif
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif
#endif // _LIBCPP_CFLOAT

View File

@ -26,6 +26,9 @@ duration_cast(const duration<Rep, Period>& fd);
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
template <class Rep> constexpr bool treat_as_floating_point_v
= treat_as_floating_point<Rep>::value; // C++17
template <class Rep>
struct duration_values
{
@ -194,6 +197,13 @@ template <class Rep1, class Period1, class Rep2, class Period2>
template <class ToDuration, class Rep, class Period>
ToDuration duration_cast(const duration<Rep, Period>& d);
template <class ToDuration, class Rep, class Period>
constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
template <class ToDuration, class Rep, class Period>
constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
template <class ToDuration, class Rep, class Period>
constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
// time_point arithmetic (all constexpr in C++14)
template <class Clock, class Duration1, class Rep2, class Period2>
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
@ -227,6 +237,20 @@ template <class Clock, class Duration1, class Duration2>
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
floor(const time_point<Clock, Duration>& tp); // C++17
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
ceil(const time_point<Clock, Duration>& tp); // C++17
template <class ToDuration, class Clock, class Duration>
constexpr time_point<Clock, ToDuration>
round(const time_point<Clock, Duration>& tp); // C++17
template <class Rep, class Period>
constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
// Clocks
class system_clock
@ -392,6 +416,11 @@ duration_cast(const duration<_Rep, _Period>& __fd)
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
= treat_as_floating_point<_Rep>::value;
#endif
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY duration_values
{
@ -401,6 +430,58 @@ public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
};
#if _LIBCPP_STD_VER > 14
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
floor(const duration<_Rep, _Period>& __d)
{
_ToDuration __t = duration_cast<_ToDuration>(__d);
if (__t > __d)
__t = __t - _ToDuration{1};
return __t;
}
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
ceil(const duration<_Rep, _Period>& __d)
{
_ToDuration __t = duration_cast<_ToDuration>(__d);
if (__t < __d)
__t = __t + _ToDuration{1};
return __t;
}
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
_ToDuration
>::type
round(const duration<_Rep, _Period>& __d)
{
_ToDuration __lower = floor<_ToDuration>(__d);
_ToDuration __upper = __lower + _ToDuration{1};
auto __lowerDiff = __d - __lower;
auto __upperDiff = __upper - __d;
if (__lowerDiff < __upperDiff)
return __lower;
if (__lowerDiff > __upperDiff)
return __upper;
return __lower.count() & 1 ? __upper : __lower;
}
#endif
// duration
template <class _Rep, class _Period>
@ -807,6 +888,56 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
#if _LIBCPP_STD_VER > 14
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
floor(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
ceil(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
}
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
time_point<_Clock, _ToDuration>
>::type
round(const time_point<_Clock, _Duration>& __t)
{
return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
}
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
typename enable_if
<
numeric_limits<_Rep>::is_signed,
duration<_Rep, _Period>
>::type
abs(duration<_Rep, _Period> __d)
{
return __d >= __d.zero() ? __d : -__d;
}
#endif
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>

View File

@ -246,10 +246,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
_LIBCPP_BEGIN_NAMESPACE_STD
using::imaxdiv_t;
#undef imaxabs
using::imaxabs;
#undef imaxdiv
using::imaxdiv;
using::strtoimax;
using::strtoumax;

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,12 @@
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef __cplusplus
#include <ccomplex>
@ -28,8 +34,4 @@
#endif // __cplusplus
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#endif // _LIBCPP_COMPLEX_H

View File

@ -124,14 +124,18 @@ class _LIBCPP_TYPE_VIS condition_variable_any
condition_variable __cv_;
shared_ptr<mutex> __mut_;
public:
_LIBCPP_INLINE_VISIBILITY
condition_variable_any();
_LIBCPP_INLINE_VISIBILITY
void notify_one() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void notify_all() _NOEXCEPT;
template <class _Lock>
void wait(_Lock& __lock);
template <class _Lock, class _Predicate>
_LIBCPP_INLINE_VISIBILITY
void wait(_Lock& __lock, _Predicate __pred);
template <class _Lock, class _Clock, class _Duration>
@ -141,27 +145,30 @@ public:
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
template <class _Lock, class _Rep, class _Period>
cv_status
_LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d);
template <class _Lock, class _Rep, class _Period, class _Predicate>
bool
_LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
};
inline _LIBCPP_INLINE_VISIBILITY
inline
condition_variable_any::condition_variable_any()
: __mut_(make_shared<mutex>()) {}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_one() _NOEXCEPT
{
@ -169,7 +176,7 @@ condition_variable_any::notify_one() _NOEXCEPT
__cv_.notify_one();
}
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::notify_all() _NOEXCEPT
{
@ -196,7 +203,7 @@ condition_variable_any::wait(_Lock& __lock)
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
{
@ -218,7 +225,7 @@ condition_variable_any::wait_until(_Lock& __lock,
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
@ -231,7 +238,7 @@ condition_variable_any::wait_until(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
cv_status
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d)
@ -240,7 +247,7 @@ condition_variable_any::wait_for(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
inline _LIBCPP_INLINE_VISIBILITY
inline
bool
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,

View File

@ -38,10 +38,6 @@ void longjmp(jmp_buf env, int val);
#pragma GCC system_header
#endif
#ifndef setjmp
#define setjmp(env) setjmp(env)
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::jmp_buf;

View File

@ -35,12 +35,14 @@ Types:
#include <__config>
#include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
#include_next <stddef.h>
#include <__nullptr>
_LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
@ -53,50 +55,6 @@ using ::max_align_t;
typedef long double max_align_t;
#endif
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
{
void* __lx;
struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t()
#endif // _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_CSTDDEF

View File

@ -103,41 +103,6 @@ void perror(const char* s);
#pragma GCC system_header
#endif
// snprintf
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
#endif // getc
#ifdef putc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
#undef putc
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
#ifdef clearerr
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
#undef clearerr
inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
#endif // clearerr
#ifdef feof
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
#undef feof
inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
#endif // feof
#ifdef ferror
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
#undef ferror
inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
#endif // ferror
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;

View File

@ -84,9 +84,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config>
#include <stdlib.h>
#ifdef _LIBCPP_MSVCRT
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -131,20 +128,14 @@ using ::getenv;
using ::system;
using ::bsearch;
using ::qsort;
#undef abs
using ::abs;
#undef labs
using ::labs;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef llabs
using ::llabs;
#endif // _LIBCPP_HAS_NO_LONG_LONG
#undef div
using ::div;
#undef ldiv
using ::ldiv;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef lldiv
using ::lldiv;
#endif // _LIBCPP_HAS_NO_LONG_LONG
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
@ -162,19 +153,6 @@ using ::quick_exit;
using ::aligned_alloc;
#endif
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _LIBCPP_MSVCRT
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CSTDLIB

View File

@ -0,0 +1,69 @@
// -*- C++ -*-
//===---------------------------- ctype.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_CTYPE_H
#define _LIBCPP_CTYPE_H
/*
ctype.h synopsis
int isalnum(int c);
int isalpha(int c);
int isblank(int c); // C99
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <ctype.h>
#ifdef __cplusplus
#if defined(_LIBCPP_MSVCRT)
// We support including .h headers inside 'extern "C"' contexts, so switch
// back to C++ linkage before including these C++ headers.
extern "C++" {
#include "support/win32/support.h"
#include "support/win32/locale_win32.h"
}
#endif // _LIBCPP_MSVCRT
#undef isalnum
#undef isalpha
#undef isblank
#undef iscntrl
#undef isdigit
#undef isgraph
#undef islower
#undef isprint
#undef ispunct
#undef isspace
#undef isupper
#undef isxdigit
#undef tolower
#undef toupper
#endif
#endif // _LIBCPP_CTYPE_H

View File

@ -106,9 +106,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@ -161,16 +158,13 @@ using ::wcscoll;
using ::wcsncmp;
using ::wcsxfrm;
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
#else
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
@ -185,7 +179,6 @@ inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, cons
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
#endif
using ::wcscspn;

View File

@ -63,150 +63,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::wint_t;
using ::wctrans_t;
using ::wctype_t;
#ifdef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
#undef iswalnum
inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
#else // iswalnum
using ::iswalnum;
#endif
#ifdef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
#undef iswalpha
inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
#else // iswalpha
using ::iswalpha;
#endif
#ifdef iswblank
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
#undef iswblank
inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
#else // iswblank
using ::iswblank;
#endif
#ifdef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
#undef iswcntrl
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
#else // iswcntrl
using ::iswcntrl;
#endif
#ifdef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
#undef iswdigit
inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
#else // iswdigit
using ::iswdigit;
#endif
#ifdef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
#undef iswgraph
inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
#else // iswgraph
using ::iswgraph;
#endif
#ifdef iswlower
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
#undef iswlower
inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
#else // iswlower
using ::iswlower;
#endif
#ifdef iswprint
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
#undef iswprint
inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
#else // iswprint
using ::iswprint;
#endif
#ifdef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
#undef iswpunct
inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
#else // iswpunct
using ::iswpunct;
#endif
#ifdef iswspace
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
#undef iswspace
inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
#else // iswspace
using ::iswspace;
#endif
#ifdef iswupper
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
#undef iswupper
inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
#else // iswupper
using ::iswupper;
#endif
#ifdef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
#undef iswxdigit
inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
#else // iswxdigit
using ::iswxdigit;
#endif
#ifdef iswctype
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
#undef iswctype
inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
#else // iswctype
using ::iswctype;
#endif
#ifdef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
#undef wctype
inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
#else // wctype
using ::wctype;
#endif
#ifdef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
#undef towlower
inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
#else // towlower
using ::towlower;
#endif
#ifdef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
#undef towupper
inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
#else // towupper
using ::towupper;
#endif
#ifdef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
#undef towctrans
inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
#else // towctrans
using ::towctrans;
#endif
#ifdef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
#undef wctrans
inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
#else // wctrans
using ::wctrans;
#endif
_LIBCPP_END_NAMESPACE_STD

View File

@ -261,8 +261,21 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
template <class _ValueType, class _DiffType>
struct __deque_block_size {
static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _DiffType, _DiffType _BS =
#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
// Keep template parameter to avoid changing all template declarations thoughout
// this file.
0
#else
__deque_block_size<_ValueType, _DiffType>::value
#endif
>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
{
typedef _MapPointer __map_iterator;
@ -273,7 +286,7 @@ private:
__map_iterator __m_iter_;
pointer __ptr_;
static const difference_type __block_size = _BlockSize;
static const difference_type __block_size;
public:
typedef _ValueType value_type;
typedef random_access_iterator_tag iterator_category;
@ -287,7 +300,7 @@ public:
template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
@ -520,6 +533,12 @@ private:
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
};
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
_DiffType, _BlockSize>::__block_size =
__deque_block_size<_ValueType, _DiffType>::value;
// copy
template <class _RAIter,
@ -532,10 +551,11 @@ copy(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
pointer __re = *__r.__m_iter_ + _B2;
pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@ -560,11 +580,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -587,11 +608,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -705,10 +727,11 @@ move(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
pointer __re = *__r.__m_iter_ + _B2;
pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@ -733,11 +756,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -760,11 +784,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
pointer __fe = *__f.__m_iter_ + _B1;
pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@ -909,7 +934,7 @@ protected:
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
static const difference_type __block_size;
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
@ -919,9 +944,9 @@ protected:
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
difference_type, __block_size> iterator;
difference_type> iterator;
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
difference_type, __block_size> const_iterator;
difference_type> const_iterator;
__map __map_;
size_type __start_;
@ -939,8 +964,10 @@ protected:
_LIBCPP_INLINE_VISIBILITY
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
_LIBCPP_INLINE_VISIBILITY
__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
_LIBCPP_INLINE_VISIBILITY
explicit __deque_base(const allocator_type& __a);
public:
~__deque_base();
@ -996,6 +1023,11 @@ private:
{}
};
template <class _Tp, class _Allocator>
const typename __deque_base<_Tp, _Allocator>::difference_type
__deque_base<_Tp, _Allocator>::__block_size =
__deque_block_size<value_type, difference_type>::value;
template <class _Tp, class _Allocator>
bool
__deque_base<_Tp, _Allocator>::__invariants() const
@ -1060,13 +1092,13 @@ __deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deque_base<_Tp, _Allocator>::__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __start_(0), __size_(0) {}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
@ -1164,6 +1196,9 @@ public:
typedef _Tp value_type;
typedef _Allocator allocator_type;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
typedef __deque_base<value_type, allocator_type> __base;
typedef typename __base::__alloc_traits __alloc_traits;
@ -1211,8 +1246,11 @@ public:
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
_LIBCPP_INLINE_VISIBILITY
deque(deque&& __c, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
deque& operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
@ -1231,6 +1269,7 @@ public:
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT;
// iterators:
@ -1283,13 +1322,21 @@ public:
bool empty() const _NOEXCEPT {return __base::size() == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY
reference operator[](size_type __i);
_LIBCPP_INLINE_VISIBILITY
const_reference operator[](size_type __i) const;
_LIBCPP_INLINE_VISIBILITY
reference at(size_type __i);
_LIBCPP_INLINE_VISIBILITY
const_reference at(size_type __i) 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;
// 23.2.2.3 modifiers:
@ -1328,6 +1375,7 @@ public:
iterator erase(const_iterator __p);
iterator erase(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY
void swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
@ -1335,6 +1383,7 @@ public:
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
#endif
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@ -1507,7 +1556,7 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __base(_VSTD::move(__c))
@ -1515,7 +1564,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_VSTD::move(__c), __a)
{
@ -1527,7 +1576,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
@ -1611,7 +1660,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Allocator
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
{
@ -1670,7 +1719,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::operator[](size_type __i)
{
@ -1679,7 +1728,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const
{
@ -1688,7 +1737,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::at(size_type __i)
{
@ -1699,7 +1748,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::at(size_type __i) const
{
@ -1710,7 +1759,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::front()
{
@ -1719,7 +1768,7 @@ deque<_Tp, _Allocator>::front()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::front() const
{
@ -1728,7 +1777,7 @@ deque<_Tp, _Allocator>::front() const
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::back()
{
@ -1737,7 +1786,7 @@ deque<_Tp, _Allocator>::back()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::back() const
{
@ -2029,7 +2078,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
if (__n > __pos)
@ -2054,7 +2102,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
size_type __de = __base::size() - __pos;
@ -2119,7 +2166,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
_BiIter __m = __f;
@ -2150,7 +2196,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
_BiIter __m = __l;
@ -2685,7 +2730,6 @@ template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::erase(const_iterator __f)
{
difference_type __n = 1;
iterator __b = __base::begin();
difference_type __pos = __f - __b;
iterator __p = __b + __pos;
@ -2781,7 +2825,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
@ -2795,7 +2839,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
deque<_Tp, _Allocator>::clear() _NOEXCEPT
{

View File

@ -0,0 +1,398 @@
// -*- C++ -*-
//===-------------------------- errno.h -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_ERRNO_H
#define _LIBCPP_ERRNO_H
/*
errno.h synopsis
Macros:
EDOM
EILSEQ // C99
ERANGE
errno
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <errno.h>
#ifdef __cplusplus
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
static const int __elast1 = ELAST+1;
static const int __elast2 = ELAST+2;
#else
static const int __elast1 = 104;
static 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)
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 9901
#endif
#ifndef EADDRINUSE
#define EADDRINUSE 9902
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL 9903
#endif
#ifndef EISCONN
#define EISCONN 9904
#endif
#ifndef EBADMSG
#define EBADMSG 9905
#endif
#ifndef ECONNABORTED
#define ECONNABORTED 9906
#endif
#ifndef EALREADY
#define EALREADY 9907
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED 9908
#endif
#ifndef ECONNRESET
#define ECONNRESET 9909
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ 9910
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH 9911
#endif
#ifndef EIDRM
#define EIDRM 9912
#endif
#ifndef EMSGSIZE
#define EMSGSIZE 9913
#endif
#ifndef ENETDOWN
#define ENETDOWN 9914
#endif
#ifndef ENETRESET
#define ENETRESET 9915
#endif
#ifndef ENETUNREACH
#define ENETUNREACH 9916
#endif
#ifndef ENOBUFS
#define ENOBUFS 9917
#endif
#ifndef ENOLINK
#define ENOLINK 9918
#endif
#ifndef ENODATA
#define ENODATA 9919
#endif
#ifndef ENOMSG
#define ENOMSG 9920
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 9921
#endif
#ifndef ENOSR
#define ENOSR 9922
#endif
#ifndef ENOTSOCK
#define ENOTSOCK 9923
#endif
#ifndef ENOSTR
#define ENOSTR 9924
#endif
#ifndef ENOTCONN
#define ENOTCONN 9925
#endif
#ifndef ENOTSUP
#define ENOTSUP 9926
#endif
#ifndef ECANCELED
#define ECANCELED 9927
#endif
#ifndef EINPROGRESS
#define EINPROGRESS 9928
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 9929
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 9930
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 9931
#endif
#ifndef EPROTO
#define EPROTO 9932
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 9933
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 9934
#endif
#ifndef ETIME
#define ETIME 9935
#endif
#ifndef ETXTBSY
#define ETXTBSY 9936
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 9938
#endif
#ifndef ELOOP
#define ELOOP 9939
#endif
#ifndef EOVERFLOW
#define EOVERFLOW 9940
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE 9941
#endif
#ifndef ENOSYS
#define ENOSYS 9942
#endif
#ifndef EINVAL
#define EINVAL 9943
#endif
#ifndef ERANGE
#define ERANGE 9944
#endif
#ifndef EILSEQ
#define EILSEQ 9945
#endif
// Windows Mobile doesn't appear to define these:
#ifndef E2BIG
#define E2BIG 9946
#endif
#ifndef EDOM
#define EDOM 9947
#endif
#ifndef EFAULT
#define EFAULT 9948
#endif
#ifndef EBADF
#define EBADF 9949
#endif
#ifndef EPIPE
#define EPIPE 9950
#endif
#ifndef EXDEV
#define EXDEV 9951
#endif
#ifndef EBUSY
#define EBUSY 9952
#endif
#ifndef ENOTEMPTY
#define ENOTEMPTY 9953
#endif
#ifndef ENOEXEC
#define ENOEXEC 9954
#endif
#ifndef EEXIST
#define EEXIST 9955
#endif
#ifndef EFBIG
#define EFBIG 9956
#endif
#ifndef ENAMETOOLONG
#define ENAMETOOLONG 9957
#endif
#ifndef ENOTTY
#define ENOTTY 9958
#endif
#ifndef EINTR
#define EINTR 9959
#endif
#ifndef ESPIPE
#define ESPIPE 9960
#endif
#ifndef EIO
#define EIO 9961
#endif
#ifndef EISDIR
#define EISDIR 9962
#endif
#ifndef ECHILD
#define ECHILD 9963
#endif
#ifndef ENOLCK
#define ENOLCK 9964
#endif
#ifndef ENOSPC
#define ENOSPC 9965
#endif
#ifndef ENXIO
#define ENXIO 9966
#endif
#ifndef ENODEV
#define ENODEV 9967
#endif
#ifndef ENOENT
#define ENOENT 9968
#endif
#ifndef ESRCH
#define ESRCH 9969
#endif
#ifndef ENOTDIR
#define ENOTDIR 9970
#endif
#ifndef ENOMEM
#define ENOMEM 9971
#endif
#ifndef EPERM
#define EPERM 9972
#endif
#ifndef EACCES
#define EACCES 9973
#endif
#ifndef EROFS
#define EROFS 9974
#endif
#ifndef EDEADLK
#define EDEADLK 9975
#endif
#ifndef EAGAIN
#define EAGAIN 9976
#endif
#ifndef ENFILE
#define ENFILE 9977
#endif
#ifndef EMFILE
#define EMFILE 9978
#endif
#ifndef EMLINK
#define EMLINK 9979
#endif
#endif // __cplusplus
#endif // _LIBCPP_ERRNO_H

View File

@ -235,7 +235,7 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
is_polymorphic<_Ep>::value
>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
__nep->rethrow_nested();
}

View File

@ -50,6 +50,12 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last,
_LIBCPP_BEGIN_NAMESPACE_LFTS
template <class _ForwardIterator, class _Searcher>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
{ return __s(__f, __l); }
template <class _PopulationIterator, class _SampleIterator, class _Distance,
class _UniformRandomNumberGenerator>
_LIBCPP_INLINE_VISIBILITY

View File

@ -0,0 +1,590 @@
// -*- C++ -*-
//===------------------------------ any -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_ANY
#define _LIBCPP_EXPERIMENTAL_ANY
/*
experimental/any synopsis
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
class bad_any_cast : public bad_cast
{
public:
virtual const char* what() const noexcept;
};
class any
{
public:
// 6.3.1 any construct/destruct
any() noexcept;
any(const any& other);
any(any&& other) noexcept;
template <class ValueType>
any(ValueType&& value);
~any();
// 6.3.2 any assignments
any& operator=(const any& rhs);
any& operator=(any&& rhs) noexcept;
template <class ValueType>
any& operator=(ValueType&& rhs);
// 6.3.3 any modifiers
void clear() noexcept;
void swap(any& rhs) noexcept;
// 6.3.4 any observers
bool empty() const noexcept;
const type_info& type() const noexcept;
};
// 6.4 Non-member functions
void swap(any& x, any& y) noexcept;
template<class ValueType>
ValueType any_cast(const any& operand);
template<class ValueType>
ValueType any_cast(any& operand);
template<class ValueType>
ValueType any_cast(any&& operand);
template<class ValueType>
const ValueType* any_cast(const any* operand) noexcept;
template<class ValueType>
ValueType* any_cast(any* operand) noexcept;
} // namespace fundamentals_v1
} // namespace experimental
} // namespace std
*/
#include <experimental/__config>
#include <memory>
#include <new>
#include <typeinfo>
#include <type_traits>
#include <cstdlib>
#include <cassert>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
{
public:
virtual const char* what() const _NOEXCEPT;
};
#if _LIBCPP_STD_VER > 11 // C++ > 11
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
inline void __throw_bad_any_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_any_cast();
#else
assert(!"bad_any_cast");
#endif
}
// Forward declarations
class any;
template <class _ValueType>
typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const *) _NOEXCEPT;
template <class _ValueType>
typename add_pointer<_ValueType>::type
any_cast(any *) _NOEXCEPT;
namespace __any_imp
{
typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
_Buffer;
template <class _Tp>
struct _IsSmallObject
: public integral_constant<bool
, sizeof(_Tp) <= sizeof(_Buffer)
&& alignment_of<_Buffer>::value
% alignment_of<_Tp>::value == 0
&& is_nothrow_move_constructible<_Tp>::value
>
{};
enum class _Action
{
_Destroy,
_Copy,
_Move,
_Get,
_TypeInfo
};
template <class _Tp>
struct _SmallHandler;
template <class _Tp>
struct _LargeHandler;
template <class _Tp>
using _Handler = typename conditional<_IsSmallObject<_Tp>::value
, _SmallHandler<_Tp>
, _LargeHandler<_Tp>
>::type;
template <class _ValueType>
using _EnableIfNotAny = typename
enable_if<
!is_same<typename decay<_ValueType>::type, any>::value
>::type;
} // namespace __any_imp
class any
{
public:
// 6.3.1 any construct/destruct
_LIBCPP_INLINE_VISIBILITY
any() _NOEXCEPT : __h(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
any(any const & __other) : __h(nullptr)
{
if (__other.__h) __other.__call(_Action::_Copy, this);
}
_LIBCPP_INLINE_VISIBILITY
any(any && __other) _NOEXCEPT : __h(nullptr)
{
if (__other.__h) __other.__call(_Action::_Move, this);
}
template <
class _ValueType
, class = __any_imp::_EnableIfNotAny<_ValueType>
>
any(_ValueType && __value);
_LIBCPP_INLINE_VISIBILITY
~any()
{
this->clear();
}
// 6.3.2 any assignments
_LIBCPP_INLINE_VISIBILITY
any & operator=(any const & __rhs)
{
any(__rhs).swap(*this);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
any & operator=(any && __rhs) _NOEXCEPT
{
any(_VSTD::move(__rhs)).swap(*this);
return *this;
}
template <
class _ValueType
, class = __any_imp::_EnableIfNotAny<_ValueType>
>
any & operator=(_ValueType && __rhs);
// 6.3.3 any modifiers
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT
{
if (__h) this->__call(_Action::_Destroy);
}
void swap(any & __rhs) _NOEXCEPT;
// 6.3.4 any observers
_LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT
{
return __h == nullptr;
}
#if !defined(_LIBCPP_NO_RTTI)
_LIBCPP_INLINE_VISIBILITY
const type_info & type() const _NOEXCEPT
{
if (__h) {
return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
} else {
return typeid(void);
}
}
#endif
private:
typedef __any_imp::_Action _Action;
typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
union _Storage
{
void * __ptr;
__any_imp::_Buffer __buf;
};
_LIBCPP_ALWAYS_INLINE
void * __call(_Action __a, any * __other = nullptr,
type_info const * __info = nullptr) const
{
return __h(__a, this, __other, __info);
}
_LIBCPP_ALWAYS_INLINE
void * __call(_Action __a, any * __other = nullptr,
type_info const * __info = nullptr)
{
return __h(__a, this, __other, __info);
}
template <class>
friend struct __any_imp::_SmallHandler;
template <class>
friend struct __any_imp::_LargeHandler;
template <class _ValueType>
friend typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const *) _NOEXCEPT;
template <class _ValueType>
friend typename add_pointer<_ValueType>::type
any_cast(any *) _NOEXCEPT;
_HandleFuncPtr __h;
_Storage __s;
};
namespace __any_imp
{
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY _SmallHandler
{
_LIBCPP_INLINE_VISIBILITY
static void* __handle(_Action __act, any const * __this, any * __other,
type_info const * __info)
{
switch (__act)
{
case _Action::_Destroy:
__destroy(const_cast<any &>(*__this));
return nullptr;
case _Action::_Copy:
__copy(*__this, *__other);
return nullptr;
case _Action::_Move:
__move(const_cast<any &>(*__this), *__other);
return nullptr;
case _Action::_Get:
return __get(const_cast<any &>(*__this), __info);
case _Action::_TypeInfo:
return __type_info();
}
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
static void __create(any & __dest, _Up && __v)
{
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
__dest.__h = &_SmallHandler::__handle;
}
private:
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __destroy(any & __this)
{
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
__value.~_Tp();
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __copy(any const & __this, any & __dest)
{
_SmallHandler::__create(__dest, *static_cast<_Tp const *>(
static_cast<void const *>(&__this.__s.__buf)));
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __move(any & __this, any & __dest)
{
_SmallHandler::__create(__dest, _VSTD::move(
*static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
__destroy(__this);
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __get(any & __this, type_info const * __info)
{
#if !defined(_LIBCPP_NO_RTTI)
if (typeid(_Tp) == *__info) {
return static_cast<void*>(&__this.__s.__buf);
}
return nullptr;
#else
return static_cast<void*>(&__this.__s.__buf);
#endif
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __type_info()
{
#if !defined(_LIBCPP_NO_RTTI)
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
#else
return nullptr;
#endif
}
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY _LargeHandler
{
_LIBCPP_INLINE_VISIBILITY
static void* __handle(_Action __act, any const * __this, any * __other,
type_info const * __info)
{
switch (__act)
{
case _Action::_Destroy:
__destroy(const_cast<any &>(*__this));
return nullptr;
case _Action::_Copy:
__copy(*__this, *__other);
return nullptr;
case _Action::_Move:
__move(const_cast<any &>(*__this), *__other);
return nullptr;
case _Action::_Get:
return __get(const_cast<any &>(*__this), __info);
case _Action::_TypeInfo:
return __type_info();
}
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
static void __create(any & __dest, _Up && __v)
{
typedef allocator<_Tp> _Alloc;
typedef __allocator_destructor<_Alloc> _Dp;
_Alloc __a;
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Up>(__v));
__dest.__s.__ptr = __hold.release();
__dest.__h = &_LargeHandler::__handle;
}
private:
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __destroy(any & __this)
{
delete static_cast<_Tp*>(__this.__s.__ptr);
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __copy(any const & __this, any & __dest)
{
_LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void __move(any & __this, any & __dest)
{
__dest.__s.__ptr = __this.__s.__ptr;
__dest.__h = &_LargeHandler::__handle;
__this.__h = nullptr;
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __get(any & __this, type_info const * __info)
{
#if !defined(_LIBCPP_NO_RTTI)
if (typeid(_Tp) == *__info) {
return static_cast<void*>(__this.__s.__ptr);
}
return nullptr;
#else
return static_cast<void*>(__this.__s.__ptr);
#endif
}
_LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
static void* __type_info()
{
#if !defined(_LIBCPP_NO_RTTI)
return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
#else
return nullptr;
#endif
}
};
} // namespace __any_imp
template <class _ValueType, class>
_LIBCPP_INLINE_VISIBILITY
any::any(_ValueType && __v) : __h(nullptr)
{
typedef typename decay<_ValueType>::type _Tp;
static_assert(is_copy_constructible<_Tp>::value,
"_ValueType must be CopyConstructible.");
typedef __any_imp::_Handler<_Tp> _HandlerType;
_HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
}
template <class _ValueType, class>
_LIBCPP_INLINE_VISIBILITY
any & any::operator=(_ValueType && __v)
{
typedef typename decay<_ValueType>::type _Tp;
static_assert(is_copy_constructible<_Tp>::value,
"_ValueType must be CopyConstructible.");
any(_VSTD::forward<_ValueType>(__v)).swap(*this);
return *this;
}
inline _LIBCPP_INLINE_VISIBILITY
void any::swap(any & __rhs) _NOEXCEPT
{
if (__h && __rhs.__h) {
any __tmp;
__rhs.__call(_Action::_Move, &__tmp);
this->__call(_Action::_Move, &__rhs);
__tmp.__call(_Action::_Move, this);
}
else if (__h) {
this->__call(_Action::_Move, &__rhs);
}
else if (__rhs.__h) {
__rhs.__call(_Action::_Move, this);
}
}
// 6.4 Non-member functions
inline _LIBCPP_INLINE_VISIBILITY
void swap(any & __lhs, any & __rhs) _NOEXCEPT
{
__lhs.swap(__rhs);
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any const & __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename add_const<typename remove_reference<_ValueType>::type>::type
_Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any & __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename remove_reference<_ValueType>::type _Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
_ValueType any_cast(any && __v)
{
static_assert(
is_reference<_ValueType>::value
|| is_copy_constructible<_ValueType>::value,
"_ValueType is required to be a reference or a CopyConstructible type.");
typedef typename remove_reference<_ValueType>::type _Tp;
_Tp * __tmp = any_cast<_Tp>(&__v);
if (__tmp == nullptr)
__throw_bad_any_cast();
return *__tmp;
}
template <class _ValueType>
inline _LIBCPP_INLINE_VISIBILITY
typename add_pointer<typename add_const<_ValueType>::type>::type
any_cast(any const * __any) _NOEXCEPT
{
static_assert(!is_reference<_ValueType>::value,
"_ValueType may not be a reference.");
return any_cast<_ValueType>(const_cast<any *>(__any));
}
template <class _ValueType>
_LIBCPP_INLINE_VISIBILITY
typename add_pointer<_ValueType>::type
any_cast(any * __any) _NOEXCEPT
{
using __any_imp::_Action;
static_assert(!is_reference<_ValueType>::value,
"_ValueType may not be a reference.");
typedef typename add_pointer<_ValueType>::type _ReturnType;
if (__any && __any->__h) {
return static_cast<_ReturnType>(
__any->__call(_Action::_Get, nullptr,
#if !defined(_LIBCPP_NO_RTTI)
&typeid(_ValueType)
#else
nullptr
#endif
));
}
return nullptr;
}
#endif // _LIBCPP_STD_VER > 11
_LIBCPP_END_NAMESPACE_LFTS
#endif // _LIBCPP_EXPERIMENTAL_ANY

View File

@ -137,7 +137,7 @@ public:
private:
size_t __size_;
value_type * __base_;
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
{

View File

@ -0,0 +1,454 @@
// -*- C++ -*-
//===-------------------------- functional --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXPERIMENTAL_FUNCTIONAL
#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL
/*
experimental/functional synopsis
#include <algorithm>
namespace std {
namespace experimental {
inline namespace fundamentals_v1 {
// See C++14 20.9.9, Function object binders
template <class T> constexpr bool is_bind_expression_v
= is_bind_expression<T>::value;
template <class T> constexpr int is_placeholder_v
= is_placeholder<T>::value;
// 4.2, Class template function
template<class> class function; // undefined
template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
template<class R, class... ArgTypes>
void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
template<class R, class... ArgTypes>
bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
template<class R, class... ArgTypes>
bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
template<class R, class... ArgTypes>
bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
// 4.3, Searchers
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
class default_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_searcher;
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
class boyer_moore_horspool_searcher;
template<class ForwardIterator, class BinaryPredicate = equal_to<>>
default_searcher<ForwardIterator, BinaryPredicate>
make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
template<class RandomAccessIterator,
class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
class BinaryPredicate = equal_to<>>
boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
make_boyer_moore_horspool_searcher(
RandomAccessIterator pat_first, RandomAccessIterator pat_last,
Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
} // namespace fundamentals_v1
} // namespace experimental
template<class R, class... ArgTypes, class Alloc>
struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
} // namespace std
*/
#include <experimental/__config>
#include <functional>
#include <algorithm>
#include <type_traits>
#include <vector>
#include <array>
#include <unordered_map>
#include <__undef_min_max>
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_LFTS
#if _LIBCPP_STD_VER > 11
// default searcher
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class default_searcher {
public:
_LIBCPP_INLINE_VISIBILITY
default_searcher(_ForwardIterator __f, _ForwardIterator __l,
_BinaryPredicate __p = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__p) {}
template <typename _ForwardIterator2>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
{
return _VSTD::search(__f, __l, __first_, __last_, __pred_);
}
private:
_ForwardIterator __first_;
_ForwardIterator __last_;
_BinaryPredicate __pred_;
};
template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
default_searcher<_ForwardIterator, _BinaryPredicate>
make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ())
{
return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p);
}
template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable;
// General case for BM data searching; use a map
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
public: // TODO private:
typedef _Value value_type;
typedef _Key key_type;
const _Value __default_value_;
std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
public:
_LIBCPP_INLINE_VISIBILITY
_BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
: __default_value_(__default), __table(__sz, __hf, __pred) {}
_LIBCPP_INLINE_VISIBILITY
void insert(const key_type &__key, value_type __val)
{
__table [__key] = __val; // Would skip_.insert (val) be better here?
}
_LIBCPP_INLINE_VISIBILITY
value_type operator [](const key_type & __key) const
{
auto __it = __table.find (__key);
return __it == __table.end() ? __default_value_ : __it->second;
}
};
// Special case small numeric values; use an array
template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
private:
typedef _Value value_type;
typedef _Key key_type;
typedef typename std::make_unsigned<key_type>::type unsigned_key_type;
typedef std::array<value_type, _VSTD::numeric_limits<unsigned_key_type>::max()> skip_map;
skip_map __table;
public:
_LIBCPP_INLINE_VISIBILITY
_BMSkipTable(std::size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/)
{
std::fill_n(__table.begin(), __table.size(), __default);
}
_LIBCPP_INLINE_VISIBILITY
void insert(key_type __key, value_type __val)
{
__table[static_cast<unsigned_key_type>(__key)] = __val;
}
_LIBCPP_INLINE_VISIBILITY
value_type operator [](key_type __key) const
{
return __table[static_cast<unsigned_key_type>(__key)];
}
};
template <class _RandomAccessIterator1,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class boyer_moore_searcher {
private:
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
_VSTD::is_integral<value_type>::value && // what about enums?
sizeof(value_type) == 1 &&
is_same<_Hash, hash<value_type>>::value &&
is_same<_BinaryPredicate, equal_to<>>::value
> skip_table_type;
public:
boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__pred),
__pattern_length_(_VSTD::distance(__first_, __last_)),
__skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
__suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)}
{
// build the skip table
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
__skip_->insert(*__f, __i);
this->__build_suffix_table ( __first_, __last_, __pred_ );
}
template <typename _RandomAccessIterator2>
_RandomAccessIterator2
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
static_assert ( std::is_same<
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
>::value,
"Corpus and Pattern iterators must point to the same type" );
if (__f == __l ) return __l; // empty corpus
if (__first_ == __last_) return __f; // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance (__f, __l))
return __l;
// Do the search
return this->__search(__f, __l);
}
public: // TODO private:
_RandomAccessIterator1 __first_;
_RandomAccessIterator1 __last_;
_BinaryPredicate __pred_;
difference_type __pattern_length_;
shared_ptr<skip_table_type> __skip_;
shared_ptr<vector<difference_type>> __suffix_;
template <typename _RandomAccessIterator2>
_RandomAccessIterator2 __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
_RandomAccessIterator2 __cur = __f;
const _RandomAccessIterator2 __last = __l - __pattern_length_;
const skip_table_type & __skip = *__skip_.get();
const vector<difference_type> & __suffix = *__suffix_.get();
while (__cur <= __last)
{
// Do we match right where we are?
difference_type __j = __pattern_length_;
while (__pred_(__first_ [__j-1], __cur [__j-1])) {
__j--;
// We matched - we're done!
if ( __j == 0 )
return __cur;
}
// Since we didn't match, figure out how far to skip forward
difference_type __k = __skip[__cur [ __j - 1 ]];
difference_type __m = __j - __k - 1;
if (__k < __j && __m > __suffix[ __j ])
__cur += __m;
else
__cur += __suffix[ __j ];
}
return __l; // We didn't find anything
}
template<typename _Iterator, typename _Container>
void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
{
const std::size_t __count = _VSTD::distance(__f, __l);
__prefix[0] = 0;
std::size_t __k = 0;
for ( std::size_t __i = 1; __i < __count; ++__i )
{
while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
__k = __prefix [ __k - 1 ];
if ( __pred ( __f[__k], __f[__i] ))
__k++;
__prefix [ __i ] = __k;
}
}
void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_BinaryPredicate __pred)
{
const std::size_t __count = _VSTD::distance(__f, __l);
vector<difference_type> & __suffix = *__suffix_.get();
if (__count > 0)
{
_VSTD::vector<value_type> __scratch(__count);
__compute_bm_prefix(__f, __l, __pred, __scratch);
for ( std::size_t __i = 0; __i <= __count; __i++ )
__suffix[__i] = __count - __scratch[__count-1];
typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
__compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
for ( std::size_t __i = 0; __i < __count; __i++ )
{
const std::size_t __j = __count - __scratch[__i];
const difference_type __k = __i - __scratch[__i] + 1;
if (__suffix[__j] > __k)
__suffix[__j] = __k;
}
}
}
};
template<class _RandomAccessIterator,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
{
return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
}
// boyer-moore-horspool
template <class _RandomAccessIterator1,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_TYPE_VIS
class boyer_moore_horspool_searcher {
private:
typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
_VSTD::is_integral<value_type>::value && // what about enums?
sizeof(value_type) == 1 &&
is_same<_Hash, hash<value_type>>::value &&
is_same<_BinaryPredicate, equal_to<>>::value
> skip_table_type;
public:
boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
_Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
: __first_(__f), __last_(__l), __pred_(__pred),
__pattern_length_(_VSTD::distance(__first_, __last_)),
__skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)}
{
// build the skip table
if ( __f != __l )
{
__l = __l - 1;
for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
__skip_->insert(*__f, __pattern_length_ - 1 - __i);
}
}
template <typename _RandomAccessIterator2>
_RandomAccessIterator2
operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
{
static_assert ( std::is_same<
typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
>::value,
"Corpus and Pattern iterators must point to the same type" );
if (__f == __l ) return __l; // empty corpus
if (__first_ == __last_) return __f; // empty pattern
// If the pattern is larger than the corpus, we can't find it!
if ( __pattern_length_ > _VSTD::distance (__f, __l))
return __l;
// Do the search
return this->__search(__f, __l);
}
private:
_RandomAccessIterator1 __first_;
_RandomAccessIterator1 __last_;
_BinaryPredicate __pred_;
difference_type __pattern_length_;
shared_ptr<skip_table_type> __skip_;
template <typename _RandomAccessIterator2>
_RandomAccessIterator2 __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const {
_RandomAccessIterator2 __cur = __f;
const _RandomAccessIterator2 __last = __l - __pattern_length_;
const skip_table_type & __skip = *__skip_.get();
while (__cur <= __last)
{
// Do we match right where we are?
difference_type __j = __pattern_length_;
while (__pred_(__first_[__j-1], __cur[__j-1]))
{
__j--;
// We matched - we're done!
if ( __j == 0 )
return __cur;
}
__cur += __skip[__cur[__pattern_length_-1]];
}
return __l;
}
};
template<class _RandomAccessIterator,
class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
class _BinaryPredicate = equal_to<>>
_LIBCPP_INLINE_VISIBILITY
boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
_Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
{
return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
}
#endif // _LIBCPP_STD_VER > 11
_LIBCPP_END_NAMESPACE_LFTS
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */

View File

@ -368,7 +368,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
{
_HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::first_type key_type;
typedef typename _HashIterator::value_type::second_type mapped_type;
public:
@ -376,13 +375,8 @@ public:
typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_iterator() {}
@ -419,7 +413,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
{
_HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::first_type key_type;
typedef typename _HashIterator::value_type::second_type mapped_type;
public:
@ -427,13 +420,8 @@ public:
typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY __hash_map_const_iterator() {}
@ -681,7 +669,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>

View File

@ -0,0 +1,83 @@
// -*- C++ -*-
//===--------------------------- float.h ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_FLOAT_H
#define _LIBCPP_FLOAT_H
/*
float.h synopsis
Macros:
FLT_ROUNDS
FLT_EVAL_METHOD // C99
FLT_RADIX
FLT_MANT_DIG
DBL_MANT_DIG
LDBL_MANT_DIG
DECIMAL_DIG // C99
FLT_DIG
DBL_DIG
LDBL_DIG
FLT_MIN_EXP
DBL_MIN_EXP
LDBL_MIN_EXP
FLT_MIN_10_EXP
DBL_MIN_10_EXP
LDBL_MIN_10_EXP
FLT_MAX_EXP
DBL_MAX_EXP
LDBL_MAX_EXP
FLT_MAX_10_EXP
DBL_MAX_10_EXP
LDBL_MAX_10_EXP
FLT_MAX
DBL_MAX
LDBL_MAX
FLT_EPSILON
DBL_EPSILON
LDBL_EPSILON
FLT_MIN
DBL_MIN
LDBL_MIN
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <float.h>
#ifdef __cplusplus
#ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
#endif
#ifndef DECIMAL_DIG
#define DECIMAL_DIG __DECIMAL_DIG__
#endif
#endif // __cplusplus
#endif // _LIBCPP_FLOAT_H

View File

@ -197,15 +197,9 @@ struct __forward_begin_node
template <class _Tp, class _VoidPtr>
struct _LIBCPP_HIDDEN __begin_node_of
{
typedef __forward_begin_node
<
typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__forward_list_node<_Tp, _VoidPtr> >
#else
rebind<__forward_list_node<_Tp, _VoidPtr> >::other
#endif
> type;
typedef __forward_begin_node<
typename __rebind_pointer<_VoidPtr, __forward_list_node<_Tp, _VoidPtr> >::type
> type;
};
template <class _Tp, class _VoidPtr>
@ -240,13 +234,7 @@ public:
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_pointer, value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {}
@ -295,13 +283,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
<
typename pointer_traits<__node_const_pointer>::element_type
>::type __node;
typedef typename pointer_traits<__node_const_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node>
#else
rebind<__node>::other
#endif
__node_pointer;
typedef typename __rebind_pointer<__node_const_pointer, __node>::type __node_pointer;
template<class, class> friend class forward_list;
@ -311,13 +293,7 @@ public:
typedef const value_type& reference;
typedef typename pointer_traits<__node_const_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_const_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<__node_const_pointer, const value_type>::type pointer;
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {}
@ -537,6 +513,9 @@ public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename allocator_traits<allocator_type>::pointer pointer;

View File

@ -1234,11 +1234,9 @@ const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_03>
#else // _LIBCPP_HAS_NO_VARIADICS
////////////////////////////////////////////////////////////////////////////////
// MEMFUN
//==============================================================================
template <class _Tp>
class __mem_fn
@ -1251,26 +1249,130 @@ private:
type __f_;
public:
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const
{
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
}
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return<type, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const {
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
}
#else
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0>::type
operator() (_A0& __a0) const {
return __invoke(__f_, __a0);
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return0<type, _A0 const>::type
operator() (_A0 const& __a0) const {
return __invoke(__f_, __a0);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1>::type
operator() (_A0& __a0, _A1& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1>::type
operator() (_A0 const& __a0, _A1& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0, _A1 const>::type
operator() (_A0& __a0, _A1 const& __a1) const {
return __invoke(__f_, __a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return1<type, _A0 const, _A1 const>::type
operator() (_A0 const& __a0, _A1 const& __a1) const {
return __invoke(__f_, __a0, __a1);
}
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 {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
template <class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(__f_, __a0, __a1, __a2);
}
#endif
};
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp _Tp::*>
mem_fn(_Rp _Tp::* __pm)
mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
{
return __mem_fn<_Rp _Tp::*>(__pm);
}
////////////////////////////////////////////////////////////////////////////////
// FUNCTION
//==============================================================================
// bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
@ -1283,7 +1385,7 @@ template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
template<class _Rp, class ..._ArgTypes>
template<class _Rp>
struct __maybe_derive_from_unary_function
{
};
@ -1294,7 +1396,7 @@ struct __maybe_derive_from_unary_function<_Rp(_A1)>
{
};
template<class _Rp, class ..._ArgTypes>
template<class _Rp>
struct __maybe_derive_from_binary_function
{
};
@ -1305,6 +1407,28 @@ struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
{
};
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Fp const&) { return true; }
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Fp* __ptr) { return __ptr; }
template <class _Ret, class _Class>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
bool __not_null(function<_Fp> const& __f) { return !!__f; }
} // namespace __function
#ifndef _LIBCPP_HAS_NO_VARIADICS
namespace __function {
template<class _Fp> class __base;
template<class _Rp, class ..._ArgTypes>
@ -1440,28 +1564,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)>
typename aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const _Fp&) {return true;}
template <class _R2, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (*__p)(_Ap...)) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...)) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) volatile) {return __p;}
template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const volatile) {return __p;}
template <class _R2, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_R2(_Ap...)>& __p) {return !!__p;}
template <class _Fp, bool = !is_same<_Fp, function>::value &&
__invokable<_Fp&, _ArgTypes...>::value>
struct __callable;
@ -1626,7 +1728,7 @@ function<_Rp(_ArgTypes...)>::function(_Fp __f,
>::type*)
: __f_(0)
{
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
@ -1653,7 +1755,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
@ -1848,6 +1950,16 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
#else // _LIBCPP_HAS_NO_VARIADICS
#include <__functional_03>
#endif
////////////////////////////////////////////////////////////////////////////////
// BIND
//==============================================================================
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
@ -1878,6 +1990,9 @@ template<int _Np>
struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&

View File

@ -512,6 +512,16 @@ public:
virtual ~future_error() _NOEXCEPT;
};
inline _LIBCPP_ALWAYS_INLINE
void __throw_future_error(future_errc _Ev)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw future_error(make_error_code(_Ev));
#else
assert(!"future_error");
#endif
}
class _LIBCPP_TYPE_VIS __assoc_sub_state
: public __shared_count
{
@ -566,6 +576,7 @@ public:
void wait();
template <class _Rep, class _Period>
future_status
_LIBCPP_INLINE_VISIBILITY
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
template <class _Clock, class _Duration>
future_status
@ -589,7 +600,7 @@ __assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs
}
template <class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
inline
future_status
__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
{
@ -645,10 +656,8 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@ -664,10 +673,8 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@ -725,10 +732,8 @@ void
__assoc_state<_Rp&>::set_value(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@ -739,10 +744,8 @@ void
__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@ -849,6 +852,7 @@ class __deferred_assoc_state
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@ -858,7 +862,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -895,6 +899,7 @@ class __deferred_assoc_state<void, _Fp>
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@ -904,7 +909,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -943,6 +948,7 @@ class __async_assoc_state
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@ -952,7 +958,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -997,6 +1003,7 @@ class __async_assoc_state<void, _Fp>
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@ -1006,7 +1013,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
inline
__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@ -1108,6 +1115,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<_Rp> share();
// retrieving the value
@ -1138,10 +1146,8 @@ template <class _Rp>
future<_Rp>::future(__assoc_state<_Rp>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
throw future_error(make_error_code(future_errc::future_already_retrieved));
#endif
__throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@ -1212,6 +1218,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<_Rp&> share();
// retrieving the value
@ -1242,10 +1249,8 @@ template <class _Rp>
future<_Rp&>::future(__assoc_state<_Rp&>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
throw future_error(make_error_code(future_errc::future_already_retrieved));
#endif
__throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@ -1311,6 +1316,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
shared_future<void> share();
// retrieving the value
@ -1445,10 +1451,8 @@ template <class _Rp>
future<_Rp>
promise<_Rp>::get_future()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
return future<_Rp>(__state_);
}
@ -1456,10 +1460,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@ -1469,10 +1471,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(_VSTD::move(__r));
}
@ -1482,10 +1482,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@ -1493,10 +1491,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@ -1506,10 +1502,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(_VSTD::move(__r));
}
@ -1519,10 +1513,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@ -1619,10 +1611,8 @@ template <class _Rp>
future<_Rp&>
promise<_Rp&>::get_future()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
return future<_Rp&>(__state_);
}
@ -1630,10 +1620,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@ -1641,10 +1629,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@ -1652,10 +1638,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@ -1663,10 +1647,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
#endif
__throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@ -1861,6 +1843,7 @@ public:
void swap(__packaged_task_function&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
_Rp operator()(_ArgTypes...) const;
};
@ -2000,7 +1983,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f)
}
template<class _Rp, class ..._ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
inline
_Rp
__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
@ -2087,11 +2070,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2109,11 +2092,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2131,10 +2114,8 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::reset()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
throw future_error(make_error_code(future_errc::no_state));
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@ -2218,11 +2199,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2241,11 +2222,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
throw future_error(make_error_code(future_errc::no_state));
__throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
__throw_future_error(future_errc::promise_already_satisfied);
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@ -2264,10 +2245,8 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::reset()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
throw future_error(make_error_code(future_errc::no_state));
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@ -2592,7 +2571,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
}
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<_Rp>
future<_Rp>::share()
{
@ -2600,7 +2579,7 @@ future<_Rp>::share()
}
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<_Rp&>
future<_Rp&>::share()
{
@ -2609,7 +2588,7 @@ future<_Rp&>::share()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_future<void>
future<void>::share()
{

View File

@ -0,0 +1,251 @@
// -*- C++ -*-
//===--------------------------- inttypes.h -------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_INTTYPES_H
#define _LIBCPP_INTTYPES_H
/*
inttypes.h synopsis
This entire header is C99 / C++0X
#include <stdint.h> // <cinttypes> includes <cstdint>
Macros:
PRId8
PRId16
PRId32
PRId64
PRIdLEAST8
PRIdLEAST16
PRIdLEAST32
PRIdLEAST64
PRIdFAST8
PRIdFAST16
PRIdFAST32
PRIdFAST64
PRIdMAX
PRIdPTR
PRIi8
PRIi16
PRIi32
PRIi64
PRIiLEAST8
PRIiLEAST16
PRIiLEAST32
PRIiLEAST64
PRIiFAST8
PRIiFAST16
PRIiFAST32
PRIiFAST64
PRIiMAX
PRIiPTR
PRIo8
PRIo16
PRIo32
PRIo64
PRIoLEAST8
PRIoLEAST16
PRIoLEAST32
PRIoLEAST64
PRIoFAST8
PRIoFAST16
PRIoFAST32
PRIoFAST64
PRIoMAX
PRIoPTR
PRIu8
PRIu16
PRIu32
PRIu64
PRIuLEAST8
PRIuLEAST16
PRIuLEAST32
PRIuLEAST64
PRIuFAST8
PRIuFAST16
PRIuFAST32
PRIuFAST64
PRIuMAX
PRIuPTR
PRIx8
PRIx16
PRIx32
PRIx64
PRIxLEAST8
PRIxLEAST16
PRIxLEAST32
PRIxLEAST64
PRIxFAST8
PRIxFAST16
PRIxFAST32
PRIxFAST64
PRIxMAX
PRIxPTR
PRIX8
PRIX16
PRIX32
PRIX64
PRIXLEAST8
PRIXLEAST16
PRIXLEAST32
PRIXLEAST64
PRIXFAST8
PRIXFAST16
PRIXFAST32
PRIXFAST64
PRIXMAX
PRIXPTR
SCNd8
SCNd16
SCNd32
SCNd64
SCNdLEAST8
SCNdLEAST16
SCNdLEAST32
SCNdLEAST64
SCNdFAST8
SCNdFAST16
SCNdFAST32
SCNdFAST64
SCNdMAX
SCNdPTR
SCNi8
SCNi16
SCNi32
SCNi64
SCNiLEAST8
SCNiLEAST16
SCNiLEAST32
SCNiLEAST64
SCNiFAST8
SCNiFAST16
SCNiFAST32
SCNiFAST64
SCNiMAX
SCNiPTR
SCNo8
SCNo16
SCNo32
SCNo64
SCNoLEAST8
SCNoLEAST16
SCNoLEAST32
SCNoLEAST64
SCNoFAST8
SCNoFAST16
SCNoFAST32
SCNoFAST64
SCNoMAX
SCNoPTR
SCNu8
SCNu16
SCNu32
SCNu64
SCNuLEAST8
SCNuLEAST16
SCNuLEAST32
SCNuLEAST64
SCNuFAST8
SCNuFAST16
SCNuFAST32
SCNuFAST64
SCNuMAX
SCNuPTR
SCNx8
SCNx16
SCNx32
SCNx64
SCNxLEAST8
SCNxLEAST16
SCNxLEAST32
SCNxLEAST64
SCNxFAST8
SCNxFAST16
SCNxFAST32
SCNxFAST64
SCNxMAX
SCNxPTR
Types:
imaxdiv_t
intmax_t imaxabs(intmax_t j);
imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <inttypes.h>
#ifdef __cplusplus
#include <stdint.h>
#undef imaxabs
#undef imaxdiv
#endif // __cplusplus
#endif // _LIBCPP_INTTYPES_H

View File

@ -114,9 +114,9 @@ class basic_ios
public:
// types:
typedef charT char_type;
typedef typename traits::int_type int_type;
typedef typename traits::pos_type pos_type;
typedef typename traits::off_type off_type;
typedef typename traits::int_type int_type; // removed in C++17
typedef typename traits::pos_type pos_type; // removed in C++17
typedef typename traits::off_type off_type; // removed in C++17
typedef traits traits_type;
operator unspecified-bool-type() const;
@ -216,7 +216,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__locale>
#include <system_error>
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include <atomic> // for __xindex_
#endif
@ -254,14 +254,12 @@ public:
static const fmtflags floatfield = scientific | fixed;
typedef unsigned int iostate;
typedef iostate io_state;
static const iostate badbit = 0x1;
static const iostate eofbit = 0x2;
static const iostate failbit = 0x4;
static const iostate goodbit = 0x0;
typedef unsigned int openmode;
typedef openmode open_mode;
static const openmode app = 0x01;
static const openmode ate = 0x02;
static const openmode binary = 0x04;
@ -270,10 +268,15 @@ public:
static const openmode trunc = 0x20;
enum seekdir {beg, cur, end};
typedef seekdir seek_dir;
#if _LIBCPP_STD_VER <= 14
typedef iostate io_state;
typedef openmode open_mode;
typedef seekdir seek_dir;
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
#endif
class _LIBCPP_TYPE_VIS Init;
@ -367,7 +370,9 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
static atomic<int> __xindex_;
#else
static int __xindex_;

View File

@ -1407,6 +1407,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{

View File

@ -437,6 +437,12 @@ struct __is_bidirectional_iterator : public __has_iterator_category_convertible_
template <class _Tp>
struct __is_random_access_iterator : public __has_iterator_category_convertible_to<_Tp, random_access_iterator_tag> {};
template <class _Tp>
struct __is_exactly_input_iterator
: public integral_constant<bool,
__has_iterator_category_convertible_to<_Tp, input_iterator_tag>::value &&
!__has_iterator_category_convertible_to<_Tp, forward_iterator_tag>::value> {};
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct _LIBCPP_TYPE_VIS_ONLY iterator
@ -513,12 +519,12 @@ distance(_InputIter __first, _InputIter __last)
return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
}
template <class _ForwardIter>
template <class _InputIter>
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)
_InputIter
next(_InputIter __x,
typename iterator_traits<_InputIter>::difference_type __n = 1,
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0)
{
_VSTD::advance(__x, __n);
return __x;
@ -1404,6 +1410,23 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
return __x;
}
template <class _Iter>
struct __libcpp_is_trivial_iterator
: public _LIBCPP_BOOL_CONSTANT(is_pointer<_Iter>::value) {};
template <class _Iter>
struct __libcpp_is_trivial_iterator<move_iterator<_Iter> >
: public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
template <class _Iter>
struct __libcpp_is_trivial_iterator<reverse_iterator<_Iter> >
: public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
template <class _Iter>
struct __libcpp_is_trivial_iterator<__wrap_iter<_Iter> >
: public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value) {};
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp*

View File

@ -237,7 +237,8 @@ protected:
static _LIBCPP_CONSTEXPR const bool is_bounded = true;
static _LIBCPP_CONSTEXPR const bool is_modulo = !_VSTD::is_signed<_Tp>::value;
#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__)
#if defined(__i386__) || defined(__x86_64__) || defined(__pnacl__) || \
defined(__wasm__)
static _LIBCPP_CONSTEXPR const bool traps = true;
#else
static _LIBCPP_CONSTEXPR const bool traps = false;

View File

@ -175,6 +175,7 @@ template <class T, class Alloc>
#include <initializer_list>
#include <iterator>
#include <algorithm>
#include <type_traits>
#include <__undef_min_max>
@ -187,34 +188,66 @@ template <class T, class Alloc>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __list_node;
template <class _Tp, class _VoidPtr> struct __list_node_base;
template <class _Tp, class _VoidPtr>
struct __list_node_pointer_traits {
typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
__node_pointer;
typedef typename __rebind_pointer<_VoidPtr, __list_node_base<_Tp, _VoidPtr> >::type
__base_pointer;
#if defined(_LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB)
typedef __base_pointer __link_pointer;
#else
typedef typename conditional<
is_pointer<_VoidPtr>::value,
__base_pointer,
__node_pointer
>::type __link_pointer;
#endif
typedef typename conditional<
is_same<__link_pointer, __node_pointer>::value,
__base_pointer,
__node_pointer
>::type __non_link_pointer;
static _LIBCPP_INLINE_VISIBILITY
__link_pointer __unsafe_link_pointer_cast(__link_pointer __p) {
return __p;
}
static _LIBCPP_INLINE_VISIBILITY
__link_pointer __unsafe_link_pointer_cast(__non_link_pointer __p) {
return static_cast<__link_pointer>(static_cast<_VoidPtr>(__p));
}
};
template <class _Tp, class _VoidPtr>
struct __list_node_base
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
#endif
typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
typedef typename _NodeTraits::__node_pointer __node_pointer;
typedef typename _NodeTraits::__base_pointer __base_pointer;
typedef typename _NodeTraits::__link_pointer __link_pointer;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node_base> __base_pointer;
#else
rebind<__list_node_base>::other __base_pointer;
#endif
pointer __prev_;
pointer __next_;
__link_pointer __prev_;
__link_pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base() : __prev_(__self()), __next_(__self()) {}
__list_node_base() : __prev_(_NodeTraits::__unsafe_link_pointer_cast(__self())),
__next_(_NodeTraits::__unsafe_link_pointer_cast(__self())) {}
_LIBCPP_INLINE_VISIBILITY
pointer __self()
{
return static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this));
__base_pointer __self() {
return pointer_traits<__base_pointer>::pointer_to(*this);
}
_LIBCPP_INLINE_VISIBILITY
__node_pointer __as_node() {
return static_cast<__node_pointer>(__self());
}
};
@ -223,6 +256,14 @@ struct __list_node
: public __list_node_base<_Tp, _VoidPtr>
{
_Tp __value_;
typedef __list_node_base<_Tp, _VoidPtr> __base;
typedef typename __base::__link_pointer __link_pointer;
_LIBCPP_INLINE_VISIBILITY
__link_pointer __as_link() {
return static_cast<__link_pointer>(__base::__self());
}
};
template <class _Tp, class _Alloc = allocator<_Tp> > class _LIBCPP_TYPE_VIS_ONLY list;
@ -232,25 +273,21 @@ template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_it
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
#endif
typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
typedef typename _NodeTraits::__link_pointer __link_pointer;
__node_pointer __ptr_;
__link_pointer __ptr_;
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
explicit __list_iterator(__node_pointer __p, const void* __c) _NOEXCEPT
explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
: __ptr_(__p)
{
__get_db()->__insert_ic(this, __c);
}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
explicit __list_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
#endif
@ -262,13 +299,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef value_type& reference;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@ -314,7 +345,7 @@ public:
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::iterator");
#endif
return __ptr_->__value_;
return __ptr_->__as_node()->__value_;
}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const
@ -323,7 +354,7 @@ public:
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::iterator");
#endif
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
}
_LIBCPP_INLINE_VISIBILITY
@ -365,25 +396,21 @@ public:
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
#endif
typedef __list_node_pointer_traits<_Tp, _VoidPtr> _NodeTraits;
typedef typename _NodeTraits::__link_pointer __link_pointer;
__node_pointer __ptr_;
__link_pointer __ptr_;
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
explicit __list_const_iterator(__node_pointer __p, const void* __c) _NOEXCEPT
explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
: __ptr_(__p)
{
__get_db()->__insert_ic(this, __c);
}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __list_const_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
explicit __list_const_iterator(__link_pointer __p) _NOEXCEPT : __ptr_(__p) {}
#endif
template<class, class> friend class list;
@ -392,13 +419,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef const value_type& reference;
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@ -451,7 +472,7 @@ public:
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::const_iterator");
#endif
return __ptr_->__value_;
return __ptr_->__as_node()->__value_;
}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const
@ -460,7 +481,7 @@ public:
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::iterator");
#endif
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
return pointer_traits<pointer>::pointer_to(__ptr_->__as_node()->__value_);
}
_LIBCPP_INLINE_VISIBILITY
@ -518,6 +539,9 @@ protected:
typedef allocator_traits<__node_allocator> __node_alloc_traits;
typedef typename __node_alloc_traits::pointer __node_pointer;
typedef typename __node_alloc_traits::pointer __node_const_pointer;
typedef __list_node_pointer_traits<value_type, __void_pointer> __node_pointer_traits;
typedef typename __node_pointer_traits::__link_pointer __link_pointer;
typedef __link_pointer __link_const_pointer;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
typedef typename __alloc_traits::difference_type difference_type;
@ -528,6 +552,12 @@ protected:
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
_LIBCPP_INLINE_VISIBILITY
__link_pointer __end_as_link() const _NOEXCEPT {
return __node_pointer_traits::__unsafe_link_pointer_cast(
const_cast<__node_base&>(__end_).__self());
}
_LIBCPP_INLINE_VISIBILITY
size_type& __sz() _NOEXCEPT {return __size_alloc_.first();}
_LIBCPP_INLINE_VISIBILITY
@ -540,7 +570,7 @@ protected:
const __node_allocator& __node_alloc() const _NOEXCEPT
{return __size_alloc_.second();}
static void __unlink_nodes(__node_pointer __f, __node_pointer __l) _NOEXCEPT;
static void __unlink_nodes(__link_pointer __f, __link_pointer __l) _NOEXCEPT;
__list_imp()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
@ -572,22 +602,18 @@ protected:
iterator end() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)), this);
return iterator(__end_as_link(), this);
#else
return iterator(static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)));
return iterator(__end_as_link());
#endif
}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
return const_iterator(static_cast<__node_const_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))), this);
return const_iterator(__end_as_link(), this);
#else
return const_iterator(static_cast<__node_const_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))));
return const_iterator(__end_as_link());
#endif
}
@ -642,7 +668,7 @@ private:
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
__list_imp<_Tp, _Alloc>::__unlink_nodes(__link_pointer __f, __link_pointer __l)
_NOEXCEPT
{
__f->__prev_->__next_ = __l->__next_;
@ -680,17 +706,16 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
if (!empty())
{
__node_allocator& __na = __node_alloc();
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__link_pointer __f = __end_.__next_;
__link_pointer __l = __end_as_link();
__unlink_nodes(__f, __l->__prev_);
__sz() = 0;
while (__f != __l)
{
__node_pointer __n = __f;
__node_pointer __np = __f->__as_node();
__f = __f->__next_;
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
}
#if _LIBCPP_DEBUG_LEVEL >= 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
@ -729,13 +754,13 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
swap(__sz(), __c.__sz());
swap(__end_, __c.__end_);
if (__sz() == 0)
__end_.__next_ = __end_.__prev_ = __end_.__self();
__end_.__next_ = __end_.__prev_ = __end_as_link();
else
__end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_.__self();
__end_.__prev_->__next_ = __end_.__next_->__prev_ = __end_as_link();
if (__c.__sz() == 0)
__c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_.__self();
__c.__end_.__next_ = __c.__end_.__prev_ = __c.__end_as_link();
else
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_.__self();
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
#if _LIBCPP_DEBUG_LEVEL >= 2
__libcpp_db* __db = __get_db();
@ -748,8 +773,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
{
--__p;
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
if (__i->__ptr_ == static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ == __c.__end_as_link())
{
__cn2->__add(*__p);
if (--__cn1->end_ != __p)
@ -762,8 +786,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
{
--__p;
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
if (__i->__ptr_ == static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)))
if (__i->__ptr_ == __end_as_link())
{
__cn1->__add(*__p);
if (--__cn2->end_ != __p)
@ -787,6 +810,7 @@ class _LIBCPP_TYPE_VIS_ONLY list
typedef typename base::__node_alloc_traits __node_alloc_traits;
typedef typename base::__node_base __node_base;
typedef typename base::__node_base_pointer __node_base_pointer;
typedef typename base::__link_pointer __link_pointer;
public:
typedef _Tp value_type;
@ -910,25 +934,25 @@ public:
reference front()
{
_LIBCPP_ASSERT(!empty(), "list::front called on empty list");
return base::__end_.__next_->__value_;
return base::__end_.__next_->__as_node()->__value_;
}
_LIBCPP_INLINE_VISIBILITY
const_reference front() const
{
_LIBCPP_ASSERT(!empty(), "list::front called on empty list");
return base::__end_.__next_->__value_;
return base::__end_.__next_->__as_node()->__value_;
}
_LIBCPP_INLINE_VISIBILITY
reference back()
{
_LIBCPP_ASSERT(!empty(), "list::back called on empty list");
return base::__end_.__prev_->__value_;
return base::__end_.__prev_->__as_node()->__value_;
}
_LIBCPP_INLINE_VISIBILITY
const_reference back() const
{
_LIBCPP_ASSERT(!empty(), "list::back called on empty list");
return base::__end_.__prev_->__value_;
return base::__end_.__prev_->__as_node()->__value_;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -1033,9 +1057,9 @@ public:
#endif // _LIBCPP_DEBUG_LEVEL >= 2
private:
static void __link_nodes (__node_pointer __p, __node_pointer __f, __node_pointer __l);
void __link_nodes_at_front(__node_pointer __f, __node_pointer __l);
void __link_nodes_at_back (__node_pointer __f, __node_pointer __l);
static void __link_nodes (__link_pointer __p, __link_pointer __f, __link_pointer __l);
void __link_nodes_at_front(__link_pointer __f, __link_pointer __l);
void __link_nodes_at_back (__link_pointer __f, __link_pointer __l);
iterator __iterator(size_type __n);
template <class _Comp>
static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
@ -1049,7 +1073,7 @@ private:
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l)
list<_Tp, _Alloc>::__link_nodes(__link_pointer __p, __link_pointer __f, __link_pointer __l)
{
__p->__prev_->__next_ = __f;
__f->__prev_ = __p->__prev_;
@ -1061,9 +1085,9 @@ list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_p
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes_at_front(__node_pointer __f, __node_pointer __l)
list<_Tp, _Alloc>::__link_nodes_at_front(__link_pointer __f, __link_pointer __l)
{
__f->__prev_ = base::__end_.__self();
__f->__prev_ = base::__end_as_link();
__l->__next_ = base::__end_.__next_;
__l->__next_->__prev_ = __l;
base::__end_.__next_ = __f;
@ -1073,9 +1097,9 @@ list<_Tp, _Alloc>::__link_nodes_at_front(__node_pointer __f, __node_pointer __l)
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes_at_back(__node_pointer __f, __node_pointer __l)
list<_Tp, _Alloc>::__link_nodes_at_back(__link_pointer __f, __link_pointer __l)
{
__l->__next_ = base::__end_.__self();
__l->__next_ = base::__end_as_link();
__f->__prev_ = base::__end_.__prev_;
__f->__prev_->__next_ = __f;
base::__end_.__prev_ = __l;
@ -1352,12 +1376,12 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link());
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
return iterator(__hold.release()->__as_link(), this);
#else
return iterator(__hold.release());
return iterator(__hold.release()->__as_link());
#endif
}
@ -1383,9 +1407,9 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
++__ds;
#if _LIBCPP_DEBUG_LEVEL >= 2
__r = iterator(__hold.get(), this);
__r = iterator(__hold->__as_link(), this);
#else
__r = iterator(__hold.get());
__r = iterator(__hold->__as_link());
#endif
__hold.release();
iterator __e = __r;
@ -1397,7 +1421,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__e.__ptr_->__next_ = __hold->__as_link();
__hold->__prev_ = __e.__ptr_;
__hold.release();
}
@ -1408,8 +1432,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
while (true)
{
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
__link_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
if (__prev == 0)
break;
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1451,9 +1475,9 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
++__ds;
#if _LIBCPP_DEBUG_LEVEL >= 2
__r = iterator(__hold.get(), this);
__r = iterator(__hold.get()->__as_link(), this);
#else
__r = iterator(__hold.get());
__r = iterator(__hold.get()->__as_link());
#endif
__hold.release();
iterator __e = __r;
@ -1465,7 +1489,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
__e.__ptr_->__next_ = __hold.get();
__e.__ptr_->__next_ = __hold.get()->__as_link();
__hold->__prev_ = __e.__ptr_;
__hold.release();
}
@ -1476,8 +1500,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
while (true)
{
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
__link_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
if (__prev == 0)
break;
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1503,7 +1527,8 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes_at_front(__hold.get(), __hold.get());
__link_pointer __nl = __hold->__as_link();
__link_nodes_at_front(__nl, __nl);
++base::__sz();
__hold.release();
}
@ -1516,7 +1541,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes_at_back(__hold.get(), __hold.get());
__link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link());
++base::__sz();
__hold.release();
}
@ -1531,7 +1556,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes_at_front(__hold.get(), __hold.get());
__link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link());
++base::__sz();
__hold.release();
}
@ -1544,7 +1569,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes_at_back(__hold.get(), __hold.get());
__link_nodes_at_back(__hold.get()->__as_link(), __hold.get()->__as_link());
++base::__sz();
__hold.release();
}
@ -1560,7 +1585,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes_at_front(__hold.get(), __hold.get());
__link_nodes_at_front(__hold.get()->__as_link(), __hold.get()->__as_link());
++base::__sz();
__hold.release();
}
@ -1574,7 +1599,8 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes_at_back(__hold.get(), __hold.get());
__link_pointer __nl = __hold->__as_link();
__link_nodes_at_back(__nl, __nl);
++base::__sz();
__hold.release();
}
@ -1594,12 +1620,14 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_pointer __nl = __hold.get()->__as_link();
__link_nodes(__p.__ptr_, __nl, __nl);
++base::__sz();
__hold.release();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
return iterator(__nl, this);
#else
return iterator(__hold.release());
return iterator(__nl);
#endif
}
@ -1619,12 +1647,14 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_pointer __nl = __hold->__as_link();
__link_nodes(__p.__ptr_, __nl, __nl);
++base::__sz();
__hold.release();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
return iterator(__nl, this);
#else
return iterator(__hold.release());
return iterator(__nl);
#endif
}
@ -1636,7 +1666,7 @@ list<_Tp, _Alloc>::pop_front()
{
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = base::__end_.__next_;
__link_pointer __n = base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1654,8 +1684,9 @@ list<_Tp, _Alloc>::pop_front()
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_pointer __np = __n->__as_node();
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
}
template <class _Tp, class _Alloc>
@ -1664,7 +1695,7 @@ list<_Tp, _Alloc>::pop_back()
{
_LIBCPP_ASSERT(!empty(), "list::pop_back() called with empty list");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = base::__end_.__prev_;
__link_pointer __n = base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1682,8 +1713,9 @@ list<_Tp, _Alloc>::pop_back()
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_pointer __np = __n->__as_node();
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
}
template <class _Tp, class _Alloc>
@ -1698,8 +1730,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
_LIBCPP_ASSERT(__p != end(),
"list::erase(iterator) called with a non-dereferenceable iterator");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = __p.__ptr_;
__node_pointer __r = __n->__next_;
__link_pointer __n = __p.__ptr_;
__link_pointer __r = __n->__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1717,8 +1749,9 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_pointer __np = __n->__as_node();
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__r, this);
#else
@ -1741,7 +1774,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
while (__f != __l)
{
__node_pointer __n = __f.__ptr_;
__link_pointer __n = __f.__ptr_;
++__f;
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1759,8 +1792,9 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_pointer __np = __n->__as_node();
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
__node_alloc_traits::deallocate(__na, __np, 1);
}
}
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1787,9 +1821,9 @@ list<_Tp, _Alloc>::resize(size_type __n)
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
++__ds;
#if _LIBCPP_DEBUG_LEVEL >= 2
iterator __r = iterator(__hold.release(), this);
iterator __r = iterator(__hold.release()->__as_link(), this);
#else
iterator __r = iterator(__hold.release());
iterator __r = iterator(__hold.release()->__as_link());
#endif
iterator __e = __r;
#ifndef _LIBCPP_NO_EXCEPTIONS
@ -1800,7 +1834,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
__e.__ptr_->__next_ = __hold.get();
__e.__ptr_->__next_ = __hold.get()->__as_link();
__hold->__prev_ = __e.__ptr_;
__hold.release();
}
@ -1811,8 +1845,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
while (true)
{
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
__link_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
if (__prev == 0)
break;
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1845,10 +1879,11 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
++__ds;
__link_pointer __nl = __hold.release()->__as_link();
#if _LIBCPP_DEBUG_LEVEL >= 2
iterator __r = iterator(__hold.release(), this);
iterator __r = iterator(__nl, this);
#else
iterator __r = iterator(__hold.release());
iterator __r = iterator(__nl);
#endif
iterator __e = __r;
#ifndef _LIBCPP_NO_EXCEPTIONS
@ -1859,7 +1894,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
{
__hold.reset(__node_alloc_traits::allocate(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__e.__ptr_->__next_ = __hold.get();
__e.__ptr_->__next_ = __hold.get()->__as_link();
__hold->__prev_ = __e.__ptr_;
__hold.release();
}
@ -1870,8 +1905,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
while (true)
{
__node_alloc_traits::destroy(__na, _VSTD::addressof(*__e));
__node_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_, 1);
__link_pointer __prev = __e.__ptr_->__prev_;
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
if (__prev == 0)
break;
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -1883,8 +1918,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
__link_nodes(base::__end_as_link(), __r.__ptr_, __e.__ptr_);
base::__sz() += __ds;
}
}
@ -1902,8 +1936,8 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
#endif
if (!__c.empty())
{
__node_pointer __f = __c.__end_.__next_;
__node_pointer __l = __c.__end_.__prev_;
__link_pointer __f = __c.__end_.__next_;
__link_pointer __l = __c.__end_.__prev_;
base::__unlink_nodes(__f, __l);
__link_nodes(__p.__ptr_, __f, __l);
base::__sz() += __c.__sz();
@ -1916,8 +1950,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ != __c.__end_as_link())
{
__cn1->__add(*__p);
(*__p)->__c_ = __cn1;
@ -1947,7 +1980,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
#endif
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
{
__node_pointer __f = __i.__ptr_;
__link_pointer __f = __i.__ptr_;
base::__unlink_nodes(__f, __f);
__link_nodes(__p.__ptr_, __f, __f);
--__c.__sz();
@ -2001,9 +2034,9 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
__c.__sz() -= __s;
base::__sz() += __s;
}
__node_pointer __first = __f.__ptr_;
__link_pointer __first = __f.__ptr_;
--__l;
__node_pointer __last = __l.__ptr_;
__link_pointer __last = __l.__ptr_;
base::__unlink_nodes(__first, __last);
__link_nodes(__p.__ptr_, __first, __last);
#if _LIBCPP_DEBUG_LEVEL >= 2
@ -2014,7 +2047,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
{
--__p;
iterator* __j = static_cast<iterator*>((*__p)->__i_);
for (__node_pointer __k = __f.__ptr_;
for (__link_pointer __k = __f.__ptr_;
__k != __l.__ptr_; __k = __k->__next_)
{
if (__j->__ptr_ == __k)
@ -2126,8 +2159,8 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
;
base::__sz() += __ds;
__c.__sz() -= __ds;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__link_pointer __f = __f2.__ptr_;
__link_pointer __l = __m2.__ptr_->__prev_;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _VSTD::next(__f1);
@ -2146,8 +2179,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ != __c.__end_as_link())
{
__cn1->__add(*__p);
(*__p)->__c_ = __cn1;
@ -2190,7 +2222,7 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
case 2:
if (__comp(*--__e2, *__f1))
{
__node_pointer __f = __e2.__ptr_;
__link_pointer __f = __e2.__ptr_;
base::__unlink_nodes(__f, __f);
__link_nodes(__f1.__ptr_, __f, __f);
return __e2;
@ -2206,8 +2238,8 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
iterator __m2 = _VSTD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__link_pointer __f = __f2.__ptr_;
__link_pointer __l = __m2.__ptr_->__prev_;
__r = __f2;
__e1 = __f2 = __m2;
base::__unlink_nodes(__f, __l);
@ -2224,8 +2256,8 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
iterator __m2 = _VSTD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__link_pointer __f = __f2.__ptr_;
__link_pointer __l = __m2.__ptr_->__prev_;
if (__e1 == __f2)
__e1 = __m2;
__f2 = __m2;
@ -2269,8 +2301,7 @@ template <class _Tp, class _Alloc>
bool
list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
{
return __i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(this->__end_)));
return __i->__ptr_ != this->__end_as_link();
}
template <class _Tp, class _Alloc>

View File

@ -1888,6 +1888,9 @@ protected:
virtual const string_type& __r() const;
virtual const string_type& __x() const;
virtual const string_type& __X() const;
_LIBCPP_ALWAYS_INLINE
~__time_get_c_storage() {}
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
@ -3773,11 +3776,14 @@ private:
wstring_convert(const wstring_convert& __wc);
wstring_convert& operator=(const wstring_convert& __wc);
public:
_LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
_LIBCPP_ALWAYS_INLINE
wstring_convert(_Codecvt* __pcvt, state_type __state);
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
const wide_string& __wide_err = wide_string());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_ALWAYS_INLINE
wstring_convert(wstring_convert&& __wc);
#endif
~wstring_convert();
@ -3811,7 +3817,7 @@ public:
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@ -3819,7 +3825,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@ -3838,7 +3844,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 _LIBCPP_ALWAYS_INLINE
inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
@ -4313,18 +4319,9 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir
int __width = __cv_->encoding();
if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
// __width > 0 || __off == 0
switch (__way)
{
case ios_base::beg:
break;
case ios_base::cur:
break;
case ios_base::end:
break;
default:
// __width > 0 || __off == 0, now check __way
if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
return pos_type(off_type(-1));
}
pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
__r.state(__st_);
return __r;

View File

@ -126,9 +126,11 @@ public:
template <class... Args>
iterator emplace_hint(const_iterator position, Args&&... args);
pair<iterator, bool> insert(const value_type& v);
pair<iterator, bool> insert( value_type&& v); // C++17
template <class P>
pair<iterator, bool> insert(P&& p);
iterator insert(const_iterator position, const value_type& v);
iterator insert(const_iterator position, value_type&& v); // C++17
template <class P>
iterator insert(const_iterator position, P&& p);
template <class InputIterator>
@ -336,9 +338,11 @@ public:
template <class... Args>
iterator emplace_hint(const_iterator position, Args&&... args);
iterator insert(const value_type& v);
iterator insert( value_type&& v); // C++17
template <class P>
iterator insert(P&& p);
iterator insert(const_iterator position, const value_type& v);
iterator insert(const_iterator position, value_type&& v); // C++17
template <class P>
iterator insert(const_iterator position, P&& p);
template <class InputIterator>
@ -704,13 +708,8 @@ public:
typedef pair<__key_type, __mapped_type> value_type;
typedef typename _TreeIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename __pointer_traits::pointer, value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_iterator() _NOEXCEPT {}
@ -770,13 +769,8 @@ public:
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<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename __pointer_traits::pointer, const value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY
__map_const_iterator() _NOEXCEPT {}
@ -840,6 +834,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
@ -1096,6 +1093,17 @@ public:
insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p.__i_, __v);}
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
insert( value_type&& __v) {return __tree_.__insert_unique(_VSTD::forward<value_type>(__v));}
_LIBCPP_INLINE_VISIBILITY
iterator
insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p.__i_, _VSTD::forward<value_type>(__v));}
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
@ -1523,7 +1531,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@ -1696,6 +1704,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
@ -1944,6 +1955,15 @@ public:
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p.__i_, __v);}
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
_LIBCPP_INLINE_VISIBILITY
iterator insert( value_type&& __v) {return __tree_.__insert_multi(_VSTD::forward<value_type>(__v));}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(__p.__i_, _VSTD::forward<value_type>(__v));}
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)

File diff suppressed because it is too large Load Diff

View File

@ -612,7 +612,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <cassert>
#endif
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
@ -932,6 +932,15 @@ public:
{return _VSTD::addressof(__r);}
};
template <class _From, class _To>
struct __rebind_pointer {
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
typedef typename pointer_traits<_From>::template rebind<_To> type;
#else
typedef typename pointer_traits<_From>::template rebind<_To>::other type;
#endif
};
// allocator_traits
namespace __has_pointer_type_imp
@ -1669,7 +1678,7 @@ private:
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
{return numeric_limits<size_type>::max();}
{return numeric_limits<size_type>::max() / sizeof(value_type);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
@ -1900,6 +1909,10 @@ public:
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
{::new(&*__x_) _Tp(__element); return *this;}
#if _LIBCPP_STD_VER >= 14
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
{::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
#endif
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
{raw_storage_iterator __t(*this); ++__x_; return __t;}
@ -2659,10 +2672,17 @@ public:
: __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
template <class _Up, class _Ep>
_LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
_LIBCPP_INLINE_VISIBILITY
typename enable_if<
!is_array<_Up>::value &&
is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
is_assignable<deleter_type&, _Ep&>::value,
unique_ptr&
>::type
operator=(unique_ptr<_Up, _Ep> __u)
{
reset(__u.release());
__ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
__ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
return *this;
}
@ -3174,7 +3194,7 @@ struct __murmur2_or_cityhash<_Size, 32>
// murmur2
template <class _Size>
_Size
__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
const _Size __m = 0x5bd1e995;
const _Size __r = 24;
@ -3324,7 +3344,7 @@ struct __murmur2_or_cityhash<_Size, 64>
// cityhash64
template <class _Size>
_Size
__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
const char* __s = static_cast<const char*>(__key);
if (__len <= 32) {
@ -3854,7 +3874,9 @@ private:
struct __nat {int __for_bool_;};
public:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp>
explicit shared_ptr(_Yp* __p,
@ -3867,15 +3889,18 @@ public:
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
_LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
shared_ptr(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp> shared_ptr(shared_ptr<_Yp>&& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -3932,6 +3957,7 @@ public:
~shared_ptr();
_LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3939,8 +3965,10 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3948,6 +3976,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr<_Tp>&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp>&& __r);
template<class _Yp>
typename enable_if
@ -3956,6 +3985,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr
>::type&
_LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@ -3965,6 +3995,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp> __r);
#endif
template <class _Yp, class _Dp>
@ -3975,12 +4006,16 @@ public:
shared_ptr&
>::type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp> __r);
#endif
_LIBCPP_INLINE_VISIBILITY
void swap(shared_ptr& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -3988,6 +4023,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p);
template<class _Yp, class _Dp>
typename enable_if
@ -3995,6 +4031,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc>
typename enable_if
@ -4002,6 +4039,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
_LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
@ -4103,7 +4141,7 @@ private:
};
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
: __ptr_(0),
@ -4112,7 +4150,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
: __ptr_(0),
@ -4235,7 +4273,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
: __ptr_(__p),
__cntrl_(__r.__cntrl_)
@ -4245,7 +4283,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEX
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -4256,7 +4294,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@ -4270,7 +4308,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -4281,7 +4319,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@ -4568,7 +4606,7 @@ shared_ptr<_Tp>::~shared_ptr()
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
{
@ -4578,7 +4616,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4593,7 +4631,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
{
@ -4603,7 +4641,7 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4617,7 +4655,7 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
!is_array<_Yp>::value &&
@ -4632,7 +4670,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
template<class _Tp>
template <class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
!is_array<_Yp>::value &&
@ -4680,7 +4718,7 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
{
@ -4689,7 +4727,7 @@ shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
shared_ptr<_Tp>::reset() _NOEXCEPT
{
@ -4698,7 +4736,7 @@ shared_ptr<_Tp>::reset() _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4711,7 +4749,7 @@ shared_ptr<_Tp>::reset(_Yp* __p)
template<class _Tp>
template<class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -4724,7 +4762,7 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5041,23 +5079,27 @@ private:
__shared_weak_count* __cntrl_;
public:
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp> weak_ptr(weak_ptr<_Yp>&& __r,
template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~weak_ptr();
_LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -5065,10 +5107,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@ -5076,6 +5120,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -5086,9 +5131,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void swap(weak_ptr& __r) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@ -5112,7 +5160,7 @@ public:
};
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
: __ptr_(0),
@ -5121,7 +5169,7 @@ weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -5132,7 +5180,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5145,7 +5193,7 @@ weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5159,7 +5207,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@ -5170,7 +5218,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@ -5191,7 +5239,7 @@ weak_ptr<_Tp>::~weak_ptr()
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
{
@ -5201,7 +5249,7 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5216,7 +5264,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
{
@ -5226,7 +5274,7 @@ weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5242,7 +5290,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@ -5255,7 +5303,7 @@ weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
{
@ -5272,7 +5320,7 @@ swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
weak_ptr<_Tp>::reset() _NOEXCEPT
{
@ -5305,7 +5353,11 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
return __r;
}
#if _LIBCPP_STD_VER > 14
template <class _Tp = void> struct owner_less;
#else
template <class _Tp> struct owner_less;
#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
@ -5339,6 +5391,30 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
{return __x.owner_before(__y);}
};
#if _LIBCPP_STD_VER > 14
template <>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<void>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
{return __x.owner_before(__y);}
typedef void is_transparent;
};
#endif
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
{
@ -5381,7 +5457,9 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
// enabled with clang.
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
class _LIBCPP_TYPE_VIS __sp_mut
{
@ -5507,7 +5585,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
return atomic_compare_exchange_weak(__p, __v, __w);
}
#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
//enum class
struct _LIBCPP_TYPE_VIS pointer_safety
@ -5574,6 +5652,15 @@ template <typename _Alloc>
_LIBCPP_INLINE_VISIBILITY
void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
struct __noexcept_move_assign_container : public integral_constant<bool,
_Traits::propagate_on_container_move_assignment::value
#if _LIBCPP_STD_VER > 14
|| _Traits::is_always_equal::value
#else
&& is_nothrow_move_assignable<_Alloc>::value
#endif
> {};
_LIBCPP_END_NAMESPACE_STD

View File

@ -455,9 +455,13 @@ module std [system] {
export *
}
// FIXME: We don't have modules for the <foo.h> headers, because they might
// be included from the C library's headers, and that would create a #include
// cycle. For the same reason, we don't have a module for __config.
//module __config { header "__config" export * }
// FIXME: These should be private.
module __bit_reference { header "__bit_reference" export * }
module __config { header "__config" export * }
module __debug { header "__debug" export * }
module __functional_base { header "__functional_base" export * }
module __hash_table { header "__hash_table" export * }

View File

@ -179,7 +179,9 @@ template<class Callable, class ...Args>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#ifndef _LIBCPP_HAS_NO_THREADS
#include <sched.h>
#endif
#include <__undef_min_max>

View File

@ -3119,6 +3119,7 @@ public:
independent_bits_engine<_Eng, _Wp, _UI>& __x);
private:
_LIBCPP_INLINE_VISIBILITY
result_type __eval(false_type);
result_type __eval(true_type);
@ -3144,7 +3145,7 @@ private:
};
template<class _Engine, size_t __w, class _UIntType>
inline _LIBCPP_INLINE_VISIBILITY
inline
_UIntType
independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
{
@ -3735,7 +3736,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -3765,7 +3766,7 @@ public:
template<class _RealType>
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
typename uniform_real_distribution<_RealType>::result_type
uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@ -3851,7 +3852,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -3878,7 +3879,7 @@ public:
};
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
bernoulli_distribution::result_type
bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
{
@ -5522,7 +5523,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@ -5552,7 +5553,7 @@ public:
template <class _RealType>
template<class _URNG>
inline _LIBCPP_INLINE_VISIBILITY
inline
_RealType
cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@ -6044,9 +6045,6 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
discrete_distribution<_IT>& __x)
{
typedef discrete_distribution<_IT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@ -6358,7 +6356,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_constant_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@ -6698,7 +6695,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_linear_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;

View File

@ -62,6 +62,19 @@ typedef ratio< 1000000000000000000, 1> exa;
typedef ratio< 1000000000000000000000, 1> zetta; // not supported
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
// 20.11.5, ratio comparison
template <class R1, class R2> constexpr bool ratio_equal_v
= ratio_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_not_equal_v
= ratio_not_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_v
= ratio_less<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_less_equal_v
= ratio_less_equal<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_v
= ratio_greater<R1, R2>::value; // C++17
template <class R1, class R2> constexpr bool ratio_greater_equal_v
= ratio_greater_equal<R1, R2>::value; // C++17
}
*/
@ -485,6 +498,26 @@ struct __ratio_gcd
__static_lcm<_R1::den, _R2::den>::value> type;
};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
= ratio_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
= ratio_not_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
= ratio_less<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
= ratio_less_equal<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
= ratio_greater<_R1, _R2>::value;
template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
= ratio_greater_equal<_R1, _R2>::value;
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_RATIO

View File

@ -762,6 +762,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <memory>
#include <vector>
#include <deque>
#include <cassert>
#include <__undef_min_max>
@ -955,6 +956,17 @@ public:
regex_constants::error_type code() const {return __code_;}
};
template <regex_constants::error_type _Ev>
_LIBCPP_ALWAYS_INLINE
void __throw_regex_error()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(_Ev);
#else
assert(!"regex_error");
#endif
}
template <class _CharT>
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
{
@ -964,7 +976,12 @@ public:
typedef locale locale_type;
typedef ctype_base::mask char_class_type;
#if defined(__mips__) && defined(__GLIBC__)
static const char_class_type __regex_word = static_cast<char_class_type>(_ISbit(15));
#else
static const char_class_type __regex_word = 0x80;
#endif
private:
locale __loc_;
const ctype<char_type>* __ct_;
@ -1036,6 +1053,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(wchar_t __ch, int __radix) const;
};
@ -1258,7 +1276,7 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
int
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
{
@ -1721,6 +1739,8 @@ template <class _CharT>
void
__back_ref<_CharT>::__exec(__state& __s) const
{
if (__mexp_ > __s.__sub_matches_.size())
__throw_regex_error<regex_constants::error_backref>();
sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
if (__sm.matched)
{
@ -2256,10 +2276,8 @@ public:
}
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__b.size() != 1 || __e.size() != 1)
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
if (__icase_)
{
__b[0] = __traits_.translate_nocase(__b[0]);
@ -2952,7 +2970,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
: base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
: base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
virtual void __exec(__state&) const;
};
@ -3012,10 +3030,8 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
case egrep:
__first = __parse_egrep(__first, __last);
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::__re_err_grammar);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_grammar>();
}
return __first;
}
@ -3046,10 +3062,8 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
}
}
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first != __last)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
}
return __first;
}
@ -3062,19 +3076,15 @@ basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
{
__owns_one_state<_CharT>* __sa = __end_;
_ForwardIterator __temp = __parse_ERE_branch(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
__first = __temp;
while (__first != __last && *__first == '|')
{
__owns_one_state<_CharT>* __sb = __end_;
__temp = __parse_ERE_branch(++__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
__push_alternation(__sa, __sb);
__first = __temp;
}
@ -3088,10 +3098,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
_ForwardIterator __last)
{
_ForwardIterator __temp = __parse_ERE_expression(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::__re_err_empty);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::__re_err_empty>();
do
{
__first = __temp;
@ -3126,10 +3134,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__temp = __parse_extended_reg_exp(++__temp, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__temp;
@ -3194,10 +3200,8 @@ basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
__first = __parse_RE_expression(__temp, __last);
__temp = __parse_Back_close_paren(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
__first = __temp;
}
@ -3511,22 +3515,16 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __min = 0;
__first = __temp;
__temp = __parse_DUP_COUNT(__first, __last, __min);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
if (*__first != ',')
{
__temp = __parse_Back_close_brace(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
__push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
true);
__first = __temp;
@ -3537,18 +3535,14 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __max = -1;
__first = __parse_DUP_COUNT(__first, __last, __max);
__temp = __parse_Back_close_brace(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
if (__max == -1)
__push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
else
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
true);
}
@ -3608,15 +3602,11 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __min;
_ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
switch (*__first)
{
case '}':
@ -3631,10 +3621,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
break;
case ',':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
if (*__first == '}')
{
++__first;
@ -3650,20 +3638,14 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __max = -1;
__temp = __parse_DUP_COUNT(__first, __last, __max);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
__first = __temp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != '}')
throw regex_error(regex_constants::error_brace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brace>();
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
@ -3673,10 +3655,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
}
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_badbrace);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_badbrace>();
}
}
break;
@ -3694,10 +3674,8 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
if (__first != __last && *__first == '[')
{
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
bool __negate = false;
if (*__first == '^')
{
@ -3706,29 +3684,23 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
}
__bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
// __ml owned by *this
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
{
__ml->__add_char(']');
++__first;
}
__first = __parse_follow_list(__first, __last, __ml);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
if (*__first == '-')
{
__ml->__add_char('-');
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ']')
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
++__first;
}
return __first;
@ -3848,10 +3820,8 @@ basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
basic_string<_CharT>& __str,
__bracket_expression<_CharT, _Traits>* __ml)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case 0:
@ -3892,10 +3862,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
_ForwardIterator __last,
basic_string<_CharT>* __str)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case '\\':
@ -3963,10 +3931,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
else
__push_char(_CharT(__val));
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
return __first;
}
@ -3982,18 +3948,14 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
value_type _Equal_close[2] = {'=', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close,
_Equal_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [= ... =]
typedef typename _Traits::string_type string_type;
string_type __collate_name =
__traits_.lookup_collatename(__first, __temp);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__collate_name.empty())
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
string_type __equiv_name =
__traits_.transform_primary(__collate_name.begin(),
__collate_name.end());
@ -4009,10 +3971,8 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
case 2:
__ml->__add_digraph(__collate_name[0], __collate_name[1]);
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
}
}
__first = _VSTD::next(__temp, 2);
@ -4031,18 +3991,14 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
value_type _Colon_close[2] = {':', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close,
_Colon_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [: ... :]
typedef typename _Traits::char_class_type char_class_type;
char_class_type __class_type =
__traits_.lookup_classname(__first, __temp, __flags_ & icase);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__class_type == 0)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
__ml->__add_class(__class_type);
__first = _VSTD::next(__temp, 2);
return __first;
@ -4060,22 +4016,17 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
value_type _Dot_close[2] = {'.', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close,
_Dot_close+2);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
throw regex_error(regex_constants::error_brack);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [. ... .]
typedef typename _Traits::string_type string_type;
__col_sym = __traits_.lookup_collatename(__first, __temp);
switch (__col_sym.size())
{
case 1:
case 2:
break;
#ifndef _LIBCPP_NO_EXCEPTIONS
default:
throw regex_error(regex_constants::error_collate);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_collate>();
}
__first = _VSTD::next(__temp, 2);
return __first;
@ -4219,10 +4170,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
__marked_count_ += __mexp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@ -4234,10 +4183,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
__marked_count_ += __mexp;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@ -4274,19 +4221,15 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
case '(':
{
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
_ForwardIterator __temp = _VSTD::next(__first);
if (__temp != __last && *__first == '?' && *__temp == ':')
{
++__open_count_;
__first = __parse_ecma_exp(++__temp, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
--__open_count_;
++__first;
}
@ -4296,16 +4239,20 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__first = __parse_ecma_exp(__first, __last);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
throw regex_error(regex_constants::error_paren);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__first;
}
}
break;
case '*':
case '+':
case '?':
case '{':
__throw_regex_error<regex_constants::error_badrepeat>();
break;
default:
__first = __parse_pattern_character(__first, __last);
break;
@ -4323,6 +4270,9 @@ basic_regex<_CharT, _Traits>::__parse_atom_escape(_ForwardIterator __first,
if (__first != __last && *__first == '\\')
{
_ForwardIterator __t1 = _VSTD::next(__first);
if (__t1 == __last)
__throw_regex_error<regex_constants::error_escape>();
_ForwardIterator __t2 = __parse_decimal_escape(__t1, __last);
if (__t2 != __t1)
__first = __t2;
@ -4360,10 +4310,8 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
unsigned __v = *__first - '0';
for (++__first; '0' <= *__first && *__first <= '9'; ++__first)
__v = 10 * __v + *__first - '0';
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__v > mark_count())
throw regex_error(regex_constants::error_backref);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_backref>();
__push_back_ref(__v);
}
}
@ -4479,62 +4427,42 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(_CharT(*__t % 32));
__first = ++__t;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
break;
case 'u':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
// drop through
case 'x':
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
if (__str)
*__str = _CharT(__sum);
@ -4558,10 +4486,8 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(*__first);
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
__throw_regex_error<regex_constants::error_escape>();
break;
}
}
@ -5422,8 +5348,8 @@ match_results<_BidirectionalIterator, _Allocator>::match_results(
__unmatched_(),
__prefix_(),
__suffix_(),
__position_start_(),
__ready_(false)
__ready_(false),
__position_start_()
{
}
@ -5466,8 +5392,8 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
if ('0' <= *__fmt_first && *__fmt_first <= '9')
{
size_t __i = *__fmt_first - '0';
__out = _VSTD::copy(__matches_[__i].first,
__matches_[__i].second, __out);
__out = _VSTD::copy((*this)[__i].first,
(*this)[__i].second, __out);
}
else
{
@ -5518,8 +5444,8 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __out,
++__fmt_first;
__i = 10 * __i + *__fmt_first - '0';
}
__out = _VSTD::copy(__matches_[__i].first,
__matches_[__i].second, __out);
__out = _VSTD::copy((*this)[__i].first,
(*this)[__i].second, __out);
}
else
{
@ -5648,9 +5574,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
@ -5720,9 +5644,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());
@ -5808,9 +5730,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__states.pop_back();
break;
default:
#ifndef _LIBCPP_NO_EXCEPTIONS
throw regex_error(regex_constants::__re_err_unknown);
#endif
__throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());

View File

@ -58,6 +58,8 @@ public:
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator() noexcept;
@ -457,6 +459,8 @@ public:
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_VSTD::move(__other)) {}
// scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
// scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY

View File

@ -409,6 +409,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
@ -819,6 +822,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;

View File

@ -0,0 +1,45 @@
// -*- C++ -*-
//===--------------------------- setjmp.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SETJMP_H
#define _LIBCPP_SETJMP_H
/*
setjmp.h synopsis
Macros:
setjmp
Types:
jmp_buf
void longjmp(jmp_buf env, int val);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <setjmp.h>
#ifdef __cplusplus
#ifndef setjmp
#define setjmp(env) setjmp(env)
#endif
#endif // __cplusplus
#endif // _LIBCPP_SETJMP_H

View File

@ -0,0 +1,62 @@
// -*- C++ -*-
//===--------------------------- stddef.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_ptrdiff_t) || defined(__need_size_t) || \
defined(__need_wchar_t) || defined(__need_NULL) || defined(__need_wint_t)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stddef.h>
#elif !defined(_LIBCPP_STDDEF_H)
#define _LIBCPP_STDDEF_H
/*
stddef.h synopsis
Macros:
offsetof(type,member-designator)
NULL
Types:
ptrdiff_t
size_t
max_align_t
nullptr_t
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stddef.h>
#ifdef __cplusplus
extern "C++" {
#include <__nullptr>
using std::nullptr_t;
}
// Re-use the compiler's <stddef.h> max_align_t where possible.
#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
typedef long double max_align_t;
#endif
#endif
#endif // _LIBCPP_STDDEF_H

View File

@ -0,0 +1,127 @@
// -*- C++ -*-
//===---------------------------- stdio.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_FILE) || defined(__need___FILE)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdio.h>
#elif !defined(_LIBCPP_STDIO_H)
#define _LIBCPP_STDIO_H
/*
stdio.h synopsis
Macros:
BUFSIZ
EOF
FILENAME_MAX
FOPEN_MAX
L_tmpnam
NULL
SEEK_CUR
SEEK_END
SEEK_SET
TMP_MAX
_IOFBF
_IOLBF
_IONBF
stderr
stdin
stdout
Types:
FILE
fpos_t
size_t
int remove(const char* filename);
int rename(const char* old, const char* new);
FILE* tmpfile(void);
char* tmpnam(char* s);
int fclose(FILE* stream);
int fflush(FILE* stream);
FILE* fopen(const char* restrict filename, const char* restrict mode);
FILE* freopen(const char* restrict filename, const char * restrict mode,
FILE * restrict stream);
void setbuf(FILE* restrict stream, char* restrict buf);
int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
int fprintf(FILE* restrict stream, const char* restrict format, ...);
int fscanf(FILE* restrict stream, const char * restrict format, ...);
int printf(const char* restrict format, ...);
int scanf(const char* restrict format, ...);
int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
int sprintf(char* restrict s, const char* restrict format, ...);
int sscanf(const char* restrict s, const char* restrict format, ...);
int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
int vprintf(const char* restrict format, va_list arg);
int vscanf(const char* restrict format, va_list arg); // C99
int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
va_list arg);
int vsprintf(char* restrict s, const char* restrict format, va_list arg);
int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
int fgetc(FILE* stream);
char* fgets(char* restrict s, int n, FILE* restrict stream);
int fputc(int c, FILE* stream);
int fputs(const char* restrict s, FILE* restrict stream);
int getc(FILE* stream);
int getchar(void);
char* gets(char* s); // removed in C++14
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
int ungetc(int c, FILE* stream);
size_t fread(void* restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
FILE* restrict stream);
int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
int fseek(FILE* stream, long offset, int whence);
int fsetpos(FILE*stream, const fpos_t* pos);
long ftell(FILE* stream);
void rewind(FILE* stream);
void clearerr(FILE* stream);
int feof(FILE* stream);
int ferror(FILE* stream);
void perror(const char* s);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdio.h>
#ifdef __cplusplus
// snprintf
#if defined(_LIBCPP_MSVCRT)
extern "C++" {
#include "support/win32/support.h"
}
#endif
#undef getc
#undef putc
#undef clearerr
#undef feof
#undef ferror
#endif
#endif // _LIBCPP_STDIO_H

View File

@ -0,0 +1,130 @@
// -*- C++ -*-
//===--------------------------- stdlib.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_malloc_and_calloc)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdlib.h>
#elif !defined(_LIBCPP_STDLIB_H)
#define _LIBCPP_STDLIB_H
/*
stdlib.h synopsis
Macros:
EXIT_FAILURE
EXIT_SUCCESS
MB_CUR_MAX
NULL
RAND_MAX
Types:
size_t
div_t
ldiv_t
lldiv_t // C99
double atof (const char* nptr);
int atoi (const char* nptr);
long atol (const char* nptr);
long long atoll(const char* nptr); // C99
double strtod (const char* restrict nptr, char** restrict endptr);
float strtof (const char* restrict nptr, char** restrict endptr); // C99
long double strtold (const char* restrict nptr, char** restrict endptr); // C99
long strtol (const char* restrict nptr, char** restrict endptr, int base);
long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
int rand(void);
void srand(unsigned int seed);
void* calloc(size_t nmemb, size_t size);
void free(void* ptr);
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);
void abort(void);
int atexit(void (*func)(void));
void exit(int status);
void _Exit(int status);
char* getenv(const char* name);
int system(const char* string);
void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
void qsort(void* base, size_t nmemb, size_t size,
int (*compar)(const void *, const void *));
int abs( int j);
long abs( long j);
long long abs(long long j); // C++0X
long labs( long j);
long long llabs(long long j); // C99
div_t div( int numer, int denom);
ldiv_t div( long numer, long denom);
lldiv_t div(long long numer, long long denom); // C++0X
ldiv_t ldiv( long numer, long denom);
lldiv_t lldiv(long long numer, long long denom); // C99
int mblen(const char* s, size_t n);
int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
int at_quick_exit(void (*func)(void)) // C++11
void quick_exit(int status); // C++11
void *aligned_alloc(size_t alignment, size_t size); // C11
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <stdlib.h>
#ifdef __cplusplus
extern "C++" {
#ifdef _LIBCPP_MSVCRT
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#undef abs
#undef div
#undef labs
#undef ldiv
#ifndef _LIBCPP_HAS_NO_LONG_LONG
#undef llabs
#undef lldiv
#endif
// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
} // extern "C++"
#endif // __cplusplus
#endif // _LIBCPP_STDLIB_H

View File

@ -115,8 +115,8 @@ public:
basic_string& operator=(const basic_string& str);
basic_string& operator=(basic_string&& str)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value ); // C++17
basic_string& operator=(const value_type* s);
basic_string& operator=(value_type c);
basic_string& operator=(initializer_list<value_type>);
@ -517,10 +517,14 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -550,7 +554,7 @@ char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<_CharT>::length(const char_type* __s)
{
@ -561,7 +565,7 @@ char_traits<_CharT>::length(const char_type* __s)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
const _CharT*
char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -595,7 +599,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
_CharT*
char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -607,7 +611,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
inline
_CharT*
char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -726,11 +730,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
_LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -742,10 +752,10 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xDFFF);}
{return int_type(0xFFFF);}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
int
char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@ -759,7 +769,7 @@ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<char16_t>::length(const char_type* __s)
{
@ -769,7 +779,7 @@ char_traits<char16_t>::length(const char_type* __s)
return __len;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
const char16_t*
char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -782,7 +792,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -802,7 +812,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -813,7 +823,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char16_t*
char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -839,11 +849,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
_LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
_LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
_LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@ -858,7 +874,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
{return int_type(0xFFFFFFFF);}
};
inline _LIBCPP_INLINE_VISIBILITY
inline
int
char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@ -872,7 +888,7 @@ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
size_t
char_traits<char32_t>::length(const char_type* __s)
{
@ -882,7 +898,7 @@ char_traits<char32_t>::length(const char_type* __s)
return __len;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
const char32_t*
char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@ -895,7 +911,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -915,7 +931,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@ -926,7 +942,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
inline _LIBCPP_INLINE_VISIBILITY
inline
char32_t*
char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@ -1185,7 +1201,31 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __basic_string_common<true>)
#pragma warning( pop )
#endif // _LIBCPP_MSVC
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_NO_EXCEPTIONS
template <class _Iter>
struct __libcpp_string_gets_noexcept_iterator_impl : public true_type {};
#elif defined(_LIBCPP_HAS_NO_NOEXCEPT)
template <class _Iter>
struct __libcpp_string_gets_noexcept_iterator_impl : public false_type {};
#else
template <class _Iter, bool = __is_forward_iterator<_Iter>::value>
struct __libcpp_string_gets_noexcept_iterator_impl : public _LIBCPP_BOOL_CONSTANT((
noexcept(++(declval<_Iter&>())) &&
is_nothrow_assignable<_Iter&, _Iter>::value &&
noexcept(declval<_Iter>() == declval<_Iter>()) &&
noexcept(*declval<_Iter>())
)) {};
template <class _Iter>
struct __libcpp_string_gets_noexcept_iterator_impl<_Iter, false> : public false_type {};
#endif
template <class _Iter>
struct __libcpp_string_gets_noexcept_iterator
: public _LIBCPP_BOOL_CONSTANT(__libcpp_is_trivial_iterator<_Iter>::value || __libcpp_string_gets_noexcept_iterator_impl<_Iter>::value) {};
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template <class _CharT, size_t = sizeof(_CharT)>
struct __padding
@ -1198,7 +1238,7 @@ struct __padding<_CharT, 1>
{
};
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template<class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_string
@ -1234,7 +1274,7 @@ public:
private:
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
struct __long
{
@ -1294,7 +1334,7 @@ private:
value_type __data_[__min_cap];
};
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
union __ulx{__long __lx; __short __lxx;};
@ -1377,8 +1417,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
basic_string& operator=(value_type __c);
@ -1480,15 +1519,16 @@ public:
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
basic_string&
>::type
append(_InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string&
>::type
append(_ForwardIterator __first, _ForwardIterator __last);
@ -1510,6 +1550,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(basic_string&& str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{*this = _VSTD::move(str); return *this;}
#endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
@ -1519,15 +1560,16 @@ public:
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
basic_string&
>::type
assign(_InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string&
>::type
assign(_ForwardIterator __first, _ForwardIterator __last);
@ -1548,15 +1590,16 @@ public:
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
iterator
>::type
insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
iterator
>::type
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
@ -1698,7 +1741,7 @@ private:
const allocator_type& __alloc() const _NOEXCEPT
{return __r_.second();}
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@ -1716,7 +1759,7 @@ private:
{return __r_.first().__s.__size_;}
# endif
#else // _LIBCPP_ALTERNATE_STRING_LAYOUT
#else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@ -1734,7 +1777,7 @@ private:
{return __r_.first().__s.__size_ >> 1;}
# endif
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_long_size(size_type __s) _NOEXCEPT
@ -1801,8 +1844,7 @@ private:
template <class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value,
void
>::type
__init(_InputIterator __first, _InputIterator __last);
@ -1846,10 +1888,15 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type);
void __move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
_NOEXCEPT;
#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
#endif
#endif
_LIBCPP_INLINE_VISIBILITY
@ -2174,8 +2221,7 @@ template <class _CharT, class _Traits, class _Allocator>
template <class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value,
void
>::type
basic_string<_CharT, _Traits, _Allocator>::__init(_InputIterator __first, _InputIterator __last)
@ -2431,6 +2477,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__alloc() != __str.__alloc())
assign(__str);
@ -2442,7 +2489,11 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
#if _LIBCPP_STD_VER > 14
_NOEXCEPT
#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
#endif
{
clear();
shrink_to_fit();
@ -2455,8 +2506,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@ -2469,15 +2519,14 @@ template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator <_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _InputIterator __last)
{
clear();
for (; __first != __last; ++__first)
push_back(*__first);
basic_string __temp(__first, __last, __alloc());
assign(__temp.data(), __temp.size());
return *this;
}
@ -2485,7 +2534,8 @@ template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::assign(_ForwardIterator __first, _ForwardIterator __last)
@ -2618,14 +2668,14 @@ template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::append(_InputIterator __first, _InputIterator __last)
{
for (; __first != __last; ++__first)
push_back(*__first);
basic_string __temp (__first, __last, __alloc());
append(__temp.data(), __temp.size());
return *this;
}
@ -2633,7 +2683,8 @@ template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string<_CharT, _Traits, _Allocator>&
>::type
basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _ForwardIterator __last)
@ -2749,9 +2800,9 @@ template <class _CharT, class _Traits, class _Allocator>
template<class _InputIterator>
typename enable_if
<
__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value,
typename basic_string<_CharT, _Traits, _Allocator>::iterator
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
typename basic_string<_CharT, _Traits, _Allocator>::iterator
>::type
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
{
@ -2760,24 +2811,16 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIt
"string::insert(iterator, range) called with an iterator not"
" referring to this string");
#endif
size_type __old_sz = size();
difference_type __ip = __pos - begin();
for (; __first != __last; ++__first)
push_back(*__first);
pointer __p = __get_pointer();
_VSTD::rotate(__p + __ip, __p + __old_sz, __p + size());
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(this, __p + __ip);
#else
return iterator(__p + __ip);
#endif
basic_string __temp(__first, __last, __alloc());
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
}
template <class _CharT, class _Traits, class _Allocator>
template<class _ForwardIterator>
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
typename basic_string<_CharT, _Traits, _Allocator>::iterator
>::type
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
@ -2980,22 +3023,8 @@ typename enable_if
basic_string<_CharT, _Traits, _Allocator>::replace(const_iterator __i1, const_iterator __i2,
_InputIterator __j1, _InputIterator __j2)
{
for (; true; ++__i1, ++__j1)
{
if (__i1 == __i2)
{
if (__j1 != __j2)
insert(__i1, __j1, __j2);
break;
}
if (__j1 == __j2)
{
erase(__i1, __i2);
break;
}
traits_type::assign(const_cast<value_type&>(*__i1), *__j1);
}
return *this;
basic_string __temp(__j1, __j2, __alloc());
return this->replace(__i1, __i2, __temp);
}
template <class _CharT, class _Traits, class _Allocator>
@ -3788,7 +3817,11 @@ bool
operator==(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
return __rhs.compare(__lhs) == 0;
typedef basic_string<_CharT, _Traits, _Allocator> _String;
_LIBCPP_ASSERT(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
size_t __lhs_len = _Traits::length(__lhs);
if (__lhs_len != __rhs.size()) return false;
return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
}
template<class _CharT, class _Traits, class _Allocator>
@ -3797,7 +3830,11 @@ bool
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
return __lhs.compare(__rhs) == 0;
typedef basic_string<_CharT, _Traits, _Allocator> _String;
_LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
size_t __rhs_len = _Traits::length(__rhs);
if (__rhs_len != __lhs.size()) return false;
return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
}
// operator!=

View File

@ -113,11 +113,38 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class __thread_specific_ptr;
class _LIBCPP_TYPE_VIS __thread_struct;
class _LIBCPP_HIDDEN __thread_struct_imp;
class __assoc_sub_state;
_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
class _LIBCPP_TYPE_VIS __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
template <class _Tp>
class __thread_specific_ptr
{
pthread_key_t __key_;
// Only __thread_local_data() may construct a __thread_specific_ptr
// and only with _Tp == __thread_struct.
static_assert((is_same<_Tp, __thread_struct>::value), "");
__thread_specific_ptr();
friend _LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
@ -125,7 +152,6 @@ class __thread_specific_ptr
public:
typedef _Tp* pointer;
__thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
@ -159,7 +185,10 @@ __thread_specific_ptr<_Tp>::__thread_specific_ptr()
template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{
pthread_key_delete(__key_);
// __thread_specific_ptr is only created with a static storage duration
// so this destructor is only invoked during program termination. Invoking
// pthread_key_delete(__key_) may prevent other threads from deleting their
// thread local data. For this reason we leak the key.
}
template <class _Tp>
@ -289,6 +318,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
_LIBCPP_INLINE_VISIBILITY
thread& operator=(thread&& __t) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@ -307,26 +337,6 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class _LIBCPP_TYPE_VIS __thread_struct
{
__thread_struct_imp* __p_;
__thread_struct(const __thread_struct&);
__thread_struct& operator=(const __thread_struct&);
public:
__thread_struct();
~__thread_struct();
void notify_all_at_thread_exit(condition_variable*, mutex*);
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args, size_t ..._Indices>
@ -390,7 +400,7 @@ thread::thread(_Fp __f)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
inline
thread&
thread::operator=(thread&& __t) _NOEXCEPT
{

View File

@ -80,28 +80,33 @@ template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // cons
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
template <intsize_t I, class T> class tuple_element; // undefined
template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t _Ip, class ..._Tp>
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14
template <size_t I, class T> class tuple_element; // undefined
template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
template <size_t I, class T>
using tuple_element_t = typename tuple_element <I, T>::type; // C++14
// 20.4.1.5, element access:
template <intsize_t I, class... T>
template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
typename const tuple_element<I, tuple<T...>>::type &
template <size_t I, class... T>
const typename tuple_element<I, tuple<T...>>::type&
get(const tuple<T...>&) noexcept; // constexpr in C++14
template <intsize_t I, class... T>
template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
get(tuple<T...>&&) noexcept; // constexpr in C++14
template <size_t I, class... T>
const typename tuple_element<I, tuple<T...>>::type&&
get(const tuple<T...>&&) noexcept; // constexpr in C++14
template <class T1, class... T>
constexpr T1& get(tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14
constexpr const T1& get(const tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
template <class T1, class... T>
constexpr const T1&& get(const tuple<T...>&&) noexcept; // C++14
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
@ -507,6 +512,8 @@ class _LIBCPP_TYPE_VIS_ONLY tuple
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
public:
template <bool _Dummy = true, class = typename enable_if<
@ -766,6 +773,16 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const type&&>(
static_cast<const __tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
#if _LIBCPP_STD_VER > 11
// get by type
template <typename _T1, size_t _Idx, typename... _Args>
@ -822,6 +839,13 @@ constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
template <class _T1, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept
{
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
#endif
// tie

File diff suppressed because it is too large Load Diff

View File

@ -656,7 +656,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
{
_HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::value_type::first_type key_type;
typedef typename _HashIterator::value_type::value_type::second_type mapped_type;
public:
@ -664,13 +663,8 @@ public:
typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type;
typedef value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<value_type>
#else
rebind<value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename _HashIterator::pointer, value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_iterator() _NOEXCEPT {}
@ -712,7 +706,6 @@ class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
{
_HashIterator __i_;
typedef pointer_traits<typename _HashIterator::pointer> __pointer_traits;
typedef const typename _HashIterator::value_type::value_type::first_type key_type;
typedef typename _HashIterator::value_type::value_type::second_type mapped_type;
public:
@ -720,13 +713,8 @@ public:
typedef pair<key_type, mapped_type> value_type;
typedef typename _HashIterator::difference_type difference_type;
typedef const value_type& reference;
typedef typename __pointer_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<const value_type>
#else
rebind<const value_type>::other
#endif
pointer;
typedef typename __rebind_pointer<typename _HashIterator::pointer, const value_type>::type
pointer;
_LIBCPP_INLINE_VISIBILITY
__hash_map_const_iterator() _NOEXCEPT {}
@ -1511,7 +1499,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>

View File

@ -52,6 +52,9 @@ template <class T>
>::type
move_if_noexcept(T& x) noexcept; // constexpr in C++14
template <class T> constexpr add_const<T>_t& as_const(T& t) noexcept; // C++17
template <class T> void as_const(const T&&) = delete; // C++17
template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
template <class T1, class T2>
@ -110,22 +113,41 @@ template<size_t I, class T1, class T2>
get(pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
const typename const tuple_element<I, pair<T1, T2> >::type&
const typename tuple_element<I, pair<T1, T2> >::type&
get(const pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
typename tuple_element<I, pair<T1, T2> >::type&&
get(pair<T1, T2>&&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
const typename tuple_element<I, pair<T1, T2> >::type&&
get(const pair<T1, T2>&&) noexcept; // constexpr in C++14
template<class T1, class T2>
constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1 const& get(pair<T1, T2> const &) noexcept; // C++14
template<class T1, class T2>
constexpr const T1& get(const pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
template<class T1, class T2>
constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1&& get(const pair<T1, T2>&&) noexcept; // C++14
template<class T1, class T2>
constexpr T1& get(pair<T2, T1>&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1& get(const pair<T2, T1>&) noexcept; // C++14
template<class T1, class T2>
constexpr T1&& get(pair<T2, T1>&&) noexcept; // C++14
template<class T1, class T2>
constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14
// C++14
template<class T, T... I>
@ -242,6 +264,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
return _VSTD::move(__x);
}
#if _LIBCPP_STD_VER > 14
template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
template <class _Tp> void as_const(const _Tp&&) = delete;
#endif
struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
@ -261,6 +288,12 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
// pair(const pair&) = default;
// pair(pair&&) = default;
#ifndef _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
template <bool _Dummy = true, class = typename enable_if<
__dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
__dependent_type<is_default_constructible<_T2>, _Dummy>::value
>::type>
#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@ -388,8 +421,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
__is_nothrow_swappable<second_type>::value)
{
_VSTD::iter_swap(&first, &__p.first);
_VSTD::iter_swap(&second, &__p.second);
using _VSTD::swap;
swap(first, __p.first);
swap(second, __p.second);
}
private:
@ -551,6 +585,12 @@ struct __get_pair<0>
_T1&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T1&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@ -577,6 +617,12 @@ struct __get_pair<1>
_T2&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T2&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@ -606,6 +652,14 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT
{
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
@ -630,6 +684,13 @@ constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
return __get_pair<0>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT
{
return __get_pair<0>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
@ -651,6 +712,13 @@ constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
return __get_pair<1>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT
{
return __get_pair<1>::get(_VSTD::move(__p));
}
#endif
#if _LIBCPP_STD_VER > 11
@ -671,6 +739,16 @@ struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
template<size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
template <class _Tp, _Tp _Ep>
struct __make_integer_sequence
{
typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
};
#else
namespace __detail {
template<typename _Tp, size_t ..._Extra> struct __repeat;
@ -724,10 +802,14 @@ struct __make_integer_sequence
{
static_assert(is_integral<_Tp>::value,
"std::make_integer_sequence can only be instantiated with an integral type" );
static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
// Workaround GCC bug by preventing bad installations when 0 <= _Ep
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
#endif
template<class _Tp, _Tp _Np>
using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;

File diff suppressed because it is too large Load Diff

View File

@ -51,8 +51,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@ -175,8 +175,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
allocator_type::propagate_on_container_move_assignment::value ||
allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@ -562,9 +562,7 @@ public:
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@ -687,9 +685,11 @@ public:
_LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
void emplace_back(_Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void pop_back();
iterator insert(const_iterator __position, const_reference __x);
@ -768,6 +768,7 @@ private:
void deallocate() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n);
_LIBCPP_INLINE_VISIBILITY
void __construct_at_end(size_type __n, const_reference __x);
template <class _ForwardIterator>
typename enable_if
@ -787,7 +788,8 @@ private:
void __move_range(pointer __from_s, pointer __from_e, pointer __to);
void __move_assign(vector& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(vector& __c, false_type);
void __move_assign(vector& __c, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{
@ -991,7 +993,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
@ -1303,9 +1305,7 @@ template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__x, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@ -1315,6 +1315,7 @@ vector<_Tp, _Allocator>::operator=(vector&& __x)
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__base::__alloc() != __c.__alloc())
{
@ -1629,7 +1630,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
template <class _Tp, class _Allocator>
template <class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
@ -1650,7 +1651,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
inline
void
vector<_Tp, _Allocator>::pop_back()
{
@ -1897,9 +1898,11 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
pointer __old_last = this->__end_;
for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
{
__RAII_IncreaseAnnotator __annotator(*this);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
*__first);
++this->__end_;
__annotator.__done();
}
__split_buffer<value_type, allocator_type&> __v(__a);
if (__first != __last)
@ -2211,9 +2214,7 @@ public:
vector(vector&& __v, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __v)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@ -2836,9 +2837,7 @@ template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
_NOEXCEPT_(
__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__v, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());

View File

@ -0,0 +1,136 @@
// -*- C++ -*-
//===--------------------------- wchar.h ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#if defined(__need_wint_t) || defined(__need_mbstate_t)
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <wchar.h>
#elif !defined(_LIBCPP_WCHAR_H)
#define _LIBCPP_WCHAR_H
/*
wchar.h synopsis
Macros:
NULL
WCHAR_MAX
WCHAR_MIN
WEOF
Types:
mbstate_t
size_t
tm
wint_t
int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
int vwprintf(const wchar_t* restrict format, va_list arg);
int vwscanf(const wchar_t* restrict format, va_list arg); // C99
int wprintf(const wchar_t* restrict format, ...);
int wscanf(const wchar_t* restrict format, ...);
wint_t fgetwc(FILE* stream);
wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
wint_t fputwc(wchar_t c, FILE* stream);
int fputws(const wchar_t* restrict s, FILE* restrict stream);
int fwide(FILE* stream, int mode);
wint_t getwc(FILE* stream);
wint_t getwchar();
wint_t putwc(wchar_t c, FILE* stream);
wint_t putwchar(wchar_t c);
wint_t ungetwc(wint_t c, FILE* stream);
double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
int wcscmp(const wchar_t* s1, const wchar_t* s2);
int wcscoll(const wchar_t* s1, const wchar_t* s2);
int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
const wchar_t* wcschr(const wchar_t* s, wchar_t c);
wchar_t* wcschr( wchar_t* s, wchar_t c);
size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
size_t wcslen(const wchar_t* s);
const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
wchar_t* wcsrchr( wchar_t* s, wchar_t c);
size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
const tm* restrict timeptr);
wint_t btowc(int c);
int wctob(wint_t c);
int mbsinit(const mbstate_t* ps);
size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
mbstate_t* restrict ps);
size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
mbstate_t* restrict ps);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef __cplusplus
#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
#endif
#include_next <wchar.h>
// Let <cwchar> know if we have const-correct overloads for wcschr and friends.
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
#elif defined(__GLIBC_PREREQ)
# if __GLIBC_PREREQ(2, 10)
# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
# endif
#endif
#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
extern "C++" {
#include <support/win32/support.h> // pull in *swprintf defines
} // extern "C++"
#endif // __cplusplus && _LIBCPP_MSVCRT
#endif // _LIBCPP_WCHAR_H

View File

@ -0,0 +1,79 @@
// -*- C++ -*-
//===--------------------------- wctype.h ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_WCTYPE_H
#define _LIBCPP_WCTYPE_H
/*
wctype.h synopsis
Macros:
WEOF
Types:
wint_t
wctrans_t
wctype_t
int iswalnum(wint_t wc);
int iswalpha(wint_t wc);
int iswblank(wint_t wc); // C99
int iswcntrl(wint_t wc);
int iswdigit(wint_t wc);
int iswgraph(wint_t wc);
int iswlower(wint_t wc);
int iswprint(wint_t wc);
int iswpunct(wint_t wc);
int iswspace(wint_t wc);
int iswupper(wint_t wc);
int iswxdigit(wint_t wc);
int iswctype(wint_t wc, wctype_t desc);
wctype_t wctype(const char* property);
wint_t towlower(wint_t wc);
wint_t towupper(wint_t wc);
wint_t towctrans(wint_t wc, wctrans_t desc);
wctrans_t wctrans(const char* property);
*/
#include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#include_next <wctype.h>
#ifdef __cplusplus
#undef iswalnum
#undef iswalpha
#undef iswblank
#undef iswcntrl
#undef iswdigit
#undef iswgraph
#undef iswlower
#undef iswprint
#undef iswpunct
#undef iswspace
#undef iswupper
#undef iswxdigit
#undef iswctype
#undef wctype
#undef towlower
#undef towupper
#undef towctrans
#undef wctrans
#endif // __cplusplus
#endif // _LIBCPP_WCTYPE_H

View File

@ -0,0 +1,18 @@
//===---------------------------- any.cpp ---------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "experimental/any"
_LIBCPP_BEGIN_NAMESPACE_LFTS
const char* bad_any_cast::what() const _NOEXCEPT {
return "bad any cast";
}
_LIBCPP_END_NAMESPACE_LFTS

View File

@ -12,10 +12,6 @@
#include "exception"
#include "new"
#ifndef __has_include
#define __has_include(inc) 0
#endif
#if defined(__APPLE__) && !defined(LIBCXXRT)
#include <cxxabi.h>
@ -29,16 +25,16 @@
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#endif // _LIBCPPABI_VERSION
#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || __has_include(<cxxabi.h>)
#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h>
using namespace __cxxabiv1;
#if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
#define HAVE_DEPENDENT_EH_ABI 1
#endif
#elif !defined(__GLIBCXX__) // __has_include(<cxxabi.h>)
#elif !defined(__GLIBCXX__) // defined(LIBCXX_BUILDING_LIBCXXABI)
static std::terminate_handler __terminate_handler;
static std::unexpected_handler __unexpected_handler;
#endif // __has_include(<cxxabi.h>)
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
namespace std
{

View File

@ -221,10 +221,12 @@ promise<void>::~promise()
{
if (__state_)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__state_->__has_value() && __state_->use_count() > 1)
__state_->set_exception(make_exception_ptr(
future_error(make_error_code(future_errc::broken_promise))
));
#endif // _LIBCPP_NO_EXCEPTIONS
__state_->__release_shared();
}
}

View File

@ -1,3 +1,12 @@
//===----------------------------------------------------------------------===////
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===////
#ifndef ATOMIC_SUPPORT_H
#define ATOMIC_SUPPORT_H

View File

@ -15,7 +15,7 @@
#include "__locale"
#include "algorithm"
#include "config_elast.h"
#include "include/config_elast.h"
#include "istream"
#include "limits"
#include "memory"
@ -152,7 +152,7 @@ ios_base::getloc() const
}
// xalloc
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
#else
int ios_base::__xindex_ = 0;

View File

@ -812,7 +812,8 @@ ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
defined(__NetBSD__)
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
return (isascii(c) && iswlower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'a'+L'A' : c;
@ -825,7 +826,8 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
defined(__NetBSD__)
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
@ -839,7 +841,8 @@ ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
defined(__NetBSD__)
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
#else
return (isascii(c) && isupper_l(c, _LIBCPP_GET_C_LOCALE)) ? c-L'A'+'a' : c;
@ -852,7 +855,8 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || \
defined(__NetBSD__)
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
#else
@ -922,7 +926,7 @@ ctype<char>::do_toupper(char_type c) const
#elif defined(__NetBSD__)
return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
return isascii(c) ?
return isascii(c) ?
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
#else
return (isascii(c) && islower_l(c, _LIBCPP_GET_C_LOCALE)) ? c-'a'+'A' : c;
@ -955,7 +959,7 @@ ctype<char>::do_tolower(char_type c) const
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
return isascii(c) ?
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
#else
@ -1012,7 +1016,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
return low;
}
#ifdef __EMSCRIPTEN__
#if defined(__EMSCRIPTEN__)
extern "C" const unsigned short ** __ctype_b_loc();
extern "C" const int ** __ctype_tolower_loc();
extern "C" const int ** __ctype_toupper_loc();
@ -1169,7 +1173,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
{
return *__ctype_toupper_loc();
}
#endif // __GLIBC__ || __EMSCRIPTEN__ || __NETBSD__
#endif // __GLIBC__ || __NETBSD__ || __EMSCRIPTEN__
// template <> class ctype_byname<char>

View File

@ -13,7 +13,7 @@
#include "mutex"
#include "thread"
#endif
#include "support/atomic_support.h"
#include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
@ -124,7 +124,7 @@ __shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
#endif // _LIBCPP_NO_RTTI
#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
static const std::size_t __sp_mut_count = 16;
static pthread_mutex_t mut_back_imp[__sp_mut_count] =
@ -177,7 +177,7 @@ __get_sp_mut(const void* p)
return muts[hash<const void*>()(p) & (__sp_mut_count-1)];
}
#endif // __has_feature(cxx_atomic) && !_LIBCPP_HAS_NO_THREADS
#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
void
declare_reachable(void*)

View File

@ -12,7 +12,7 @@
#include "limits"
#include "system_error"
#include "cassert"
#include "support/atomic_support.h"
#include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS

View File

@ -13,10 +13,6 @@
#include "new"
#ifndef __has_include
#define __has_include(inc) 0
#endif
#if defined(__APPLE__) && !defined(LIBCXXRT)
#include <cxxabi.h>
@ -27,9 +23,9 @@
#define __new_handler __cxxabiapple::__cxa_new_handler
#endif
#else // __APPLE__
#if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h>
#endif // __has_include(<cxxabi.h>)
#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
static std::new_handler __new_handler;
#endif // _LIBCPPABI_VERSION
@ -38,7 +34,7 @@
#ifndef __GLIBCXX__
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// in this shared library, so that they can be overridden by programs
// that define non-weak copies of the functions.
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS

View File

@ -13,12 +13,8 @@
#include "string"
#include "system_error"
#ifndef __has_include
#define __has_include(inc) 0
#endif
/* For _LIBCPPABI_VERSION */
#if __has_include(<cxxabi.h>) || defined(__APPLE_) || defined(LIBCXXRT)
#if defined(LIBCXX_BUILDING_LIBCXXABI) || defined(__APPLE__) || defined(LIBCXXRT)
#include <cxxabi.h>
#endif

View File

@ -12,7 +12,7 @@
#define _LIBCPP_BUILDING_SYSTEM_ERROR
#include "system_error"
#include "config_elast.h"
#include "include/config_elast.h"
#include "cstring"
#include "string"

View File

@ -8,13 +8,8 @@
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#ifndef __has_include
#define __has_include(inc) 0
#endif
#ifdef __APPLE__
#include <cxxabi.h>
#elif defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#if defined(__APPLE__) || defined(LIBCXXRT) || \
defined(LIBCXX_BUILDING_LIBCXXABI)
#include <cxxabi.h>
#endif

View File

@ -18,6 +18,7 @@ SHLIB_MAJOR= 1
SHLIB_LDSCRIPT= libc++.ldscript
SRCS+= algorithm.cpp\
any.cpp\
bind.cpp\
chrono.cpp\
condition_variable.cpp\
@ -62,7 +63,7 @@ cxxrt_${_S}: ${_LIBCXXRTDIR}/${_S} .NOMETA
.endfor
WARNS= 0
CFLAGS+= -I${HDRDIR} -I${_LIBCXXRTDIR} -nostdlib -DLIBCXXRT
CFLAGS+= -I${HDRDIR} -I${_LIBCXXRTDIR} -nostdinc++ -nostdlib -DLIBCXXRT
.if empty(CXXFLAGS:M-std=*)
CXXFLAGS+= -std=c++11
.endif
@ -79,6 +80,7 @@ STD_HEADERS= __bit_reference\
__hash_table\
__locale\
__mutex_base\
__nullptr\
__refstring\
__split_buffer\
__sso_allocator\
@ -118,15 +120,19 @@ STD_HEADERS= __bit_reference\
cstring\
ctgmath\
ctime\
ctype.h\
cwchar\
cwctype\
deque\
errno.h\
exception\
float.h\
forward_list\
fstream\
functional\
future\
initializer_list\
inttypes.h\
iomanip\
ios\
iosfwd\
@ -137,6 +143,7 @@ STD_HEADERS= __bit_reference\
list\
locale\
map\
math.h\
memory\
mutex\
new\
@ -148,10 +155,14 @@ STD_HEADERS= __bit_reference\
regex\
scoped_allocator\
set\
setjmp.h\
shared_mutex\
sstream\
stack\
stddef.h\
stdexcept\
stdio.h\
stdlib.h\
streambuf\
string\
strstream\
@ -166,7 +177,9 @@ STD_HEADERS= __bit_reference\
unordered_set\
utility\
valarray\
vector
vector\
wchar.h\
wctype.h
RT_HEADERS= cxxabi.h\
unwind.h\
unwind-arm.h\
@ -183,8 +196,10 @@ STDDIR= ${CXXINCLUDEDIR}
EXP_HEADERS= __config\
algorithm\
any\
chrono\
dynarray\
functional\
optional\
ratio\
string_view\