aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Chisnall <theraven@FreeBSD.org>2012-03-13 14:09:15 +0000
committerDavid Chisnall <theraven@FreeBSD.org>2012-03-13 14:09:15 +0000
commit362d815b81e2b4b66c33b99203d821b8928607e1 (patch)
tree491848d33dbdf1751fd52f321d3fbf70a8e616f2
parent1828c5696f7bf5850943ea6c660a493a5e648669 (diff)
downloadsrc-362d815b81e2b4b66c33b99203d821b8928607e1.tar.gz
src-362d815b81e2b4b66c33b99203d821b8928607e1.zip
Import new version of libc++ into vendor branch.vendor/libc++/r152501
Approved by: dim (mentor)
Notes
Notes: svn path=/vendor/libc++/dist/; revision=232924 svn path=/vendor/libc++/r152501/; revision=232925; tag=vendor/libc++/r152501
-rw-r--r--include/__bit_reference355
-rw-r--r--include/__config38
-rw-r--r--include/__debug16
-rw-r--r--include/__functional_031220
-rw-r--r--include/__functional_base195
-rw-r--r--include/__functional_base_03542
-rw-r--r--include/__hash_table70
-rw-r--r--include/__locale30
-rw-r--r--include/__mutex_base2
-rw-r--r--include/__split_buffer30
-rw-r--r--include/__sso_allocator16
-rw-r--r--include/__std_stream10
-rw-r--r--include/__tree76
-rw-r--r--include/__tuple2
-rw-r--r--include/__undef_min_max19
-rw-r--r--include/algorithm141
-rw-r--r--include/atomic12
-rw-r--r--include/bitset24
-rw-r--r--include/chrono2
-rw-r--r--include/cmath34
-rw-r--r--include/complex12
-rw-r--r--include/cstddef1
-rw-r--r--include/cstdlib3
-rw-r--r--include/cstring2
-rw-r--r--include/deque28
-rw-r--r--include/exception18
-rw-r--r--include/ext/hash_map22
-rw-r--r--include/forward_list66
-rw-r--r--include/fstream4
-rw-r--r--include/functional565
-rw-r--r--include/future792
-rw-r--r--include/initializer_list32
-rw-r--r--include/iomanip52
-rw-r--r--include/ios15
-rw-r--r--include/istream93
-rw-r--r--include/iterator65
-rw-r--r--include/limits2
-rw-r--r--include/list62
-rw-r--r--include/locale137
-rw-r--r--include/map84
-rw-r--r--include/memory1477
-rw-r--r--include/mutex32
-rw-r--r--include/ostream124
-rw-r--r--include/random609
-rw-r--r--include/ratio18
-rw-r--r--include/regex83
-rw-r--r--include/sstream2
-rw-r--r--include/streambuf8
-rw-r--r--include/string36
-rw-r--r--include/support/win32/math_win32.h2
-rw-r--r--include/support/win32/support.h41
-rw-r--r--include/system_error47
-rw-r--r--include/thread49
-rw-r--r--include/tuple129
-rw-r--r--include/type_traits532
-rw-r--r--include/unordered_map154
-rw-r--r--include/utility8
-rw-r--r--include/valarray24
-rw-r--r--include/vector103
-rw-r--r--src/chrono.cpp2
-rw-r--r--src/condition_variable.cpp3
-rw-r--r--src/debug.cpp34
-rw-r--r--src/exception.cpp73
-rw-r--r--src/future.cpp6
-rw-r--r--src/hash.cpp3
-rw-r--r--src/locale.cpp584
-rw-r--r--src/memory.cpp5
-rw-r--r--src/mutex.cpp3
-rw-r--r--src/new.cpp24
-rw-r--r--src/random.cpp3
-rw-r--r--src/regex.cpp10
-rw-r--r--src/stdexcept.cpp9
-rw-r--r--src/string.cpp36
-rw-r--r--src/strstream.cpp8
-rw-r--r--src/thread.cpp4
-rw-r--r--src/typeinfo.cpp3
76 files changed, 5479 insertions, 3698 deletions
diff --git a/include/__bit_reference b/include/__bit_reference
index 46213332c3e8..906b9da462e6 100644
--- a/include/__bit_reference
+++ b/include/__bit_reference
@@ -14,14 +14,16 @@
#include <__config>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _C, bool _IsConst> class __bit_iterator;
-template <class _C> class __bit_const_reference;
+template <class _Cp, bool _IsConst> class __bit_iterator;
+template <class _Cp> class __bit_const_reference;
template <class _Tp>
struct __has_storage_type
@@ -29,22 +31,22 @@ struct __has_storage_type
static const bool value = false;
};
-template <class _C, bool = __has_storage_type<_C>::value>
+template <class _Cp, bool = __has_storage_type<_Cp>::value>
class __bit_reference
{
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::__storage_pointer __storage_pointer;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::__storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__)
- friend typename _C::__self;
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_const_reference<_C>;
- friend class __bit_iterator<_C, false>;
+ friend class __bit_const_reference<_Cp>;
+ friend class __bit_iterator<_Cp, false>;
public:
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
@@ -66,74 +68,74 @@ public:
{return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
- _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
- {return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+ _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT
+ {return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
};
-template <class _C>
-class __bit_reference<_C, false>
+template <class _Cp>
+class __bit_reference<_Cp, false>
{
};
-template <class _C, class _D>
+template <class _Cp, class _Dp>
_LIBCPP_INLINE_VISIBILITY inline
void
-swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
+swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
+template <class _Cp>
_LIBCPP_INLINE_VISIBILITY inline
void
-swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
+swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
+template <class _Cp>
_LIBCPP_INLINE_VISIBILITY inline
void
-swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
+swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
-template <class _C>
+template <class _Cp>
class __bit_const_reference
{
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::__const_storage_pointer __storage_pointer;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::__const_storage_pointer __storage_pointer;
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__)
- friend typename _C::__self;
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_iterator<_C, true>;
+ friend class __bit_iterator<_Cp, true>;
public:
_LIBCPP_INLINE_VISIBILITY
- __bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
+ __bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);}
- _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
- {return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
+ _LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT
+ {return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private:
_LIBCPP_INLINE_VISIBILITY
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
@@ -144,11 +146,11 @@ private:
// find
-template <class _C>
-__bit_iterator<_C, false>
-__find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp>
+__bit_iterator<_Cp, false>
+__find_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -178,11 +180,11 @@ __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _C>
-__bit_iterator<_C, false>
-__find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp>
+__bit_iterator<_Cp, false>
+__find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -215,23 +217,23 @@ __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _C, class _Tp>
+template <class _Cp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value_)
+__bit_iterator<_Cp, false>
+find(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_)
{
if (static_cast<bool>(__value_))
- return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
- return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
+ return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+ return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
}
// count
-template <class _C>
-typename __bit_iterator<_C, false>::difference_type
-__count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp>
+typename __bit_iterator<_Cp, false>::difference_type
+__count_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -258,11 +260,11 @@ __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
return __r;
}
-template <class _C>
-typename __bit_iterator<_C, false>::difference_type
-__count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+template <class _Cp>
+typename __bit_iterator<_Cp, false>::difference_type
+__count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -289,23 +291,23 @@ __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n
return __r;
}
-template <class _C, class _Tp>
+template <class _Cp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bit_iterator<_C, false>::difference_type
-count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value_)
+typename __bit_iterator<_Cp, false>::difference_type
+count(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_)
{
if (static_cast<bool>(__value_))
- return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
- return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
+ return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
+ return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first));
}
// fill_n
-template <class _C>
+template <class _Cp>
void
-__fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -331,11 +333,11 @@ __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
}
}
-template <class _C>
+template <class _Cp>
void
-__fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
+__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_C, false> _It;
+ typedef __bit_iterator<_Cp, false> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -361,10 +363,10 @@ __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
}
}
-template <class _C>
+template <class _Cp>
_LIBCPP_INLINE_VISIBILITY inline
void
-fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value_)
+fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
{
if (__n > 0)
{
@@ -377,22 +379,22 @@ fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __val
// fill
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
void
-fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value_)
+fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_)
{
- _VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value_);
+ _VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_);
}
// copy
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -434,12 +436,12 @@ __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst
return __result;
}
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -512,10 +514,10 @@ __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsCon
return __result;
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
if (__first.__ctz_ == __result.__ctz_)
return __copy_aligned(__first, __last, __result);
@@ -524,12 +526,12 @@ copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
// copy_backward
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -571,12 +573,12 @@ __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C,
return __result;
}
-template <class _C, bool _IsConst>
-__bit_iterator<_C, false>
-__copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
- __bit_iterator<_C, false> __result)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, false>
+__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last,
+ __bit_iterator<_Cp, false> __result)
{
- typedef __bit_iterator<_C, _IsConst> _In;
+ typedef __bit_iterator<_Cp, _IsConst> _In;
typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -635,7 +637,7 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
{
__m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m;
- unsigned __clz_r = __bits_per_word - __result.__ctz_;
+ __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m;
@@ -657,10 +659,10 @@ __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_
return __result;
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
if (__last.__ctz_ == __result.__ctz_)
return __copy_backward_aligned(__first, __last, __result);
@@ -669,20 +671,20 @@ copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst>
// move
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
return _VSTD::copy(__first, __last, __result);
}
// move_backward
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_C, false>
-move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
+__bit_iterator<_Cp, false>
+move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result)
{
return _VSTD::copy(__first, __last, __result);
}
@@ -852,34 +854,33 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
// rotate
-template <class _C>
+template <class _Cp>
struct __bit_array
{
- typedef typename _C::difference_type difference_type;
- typedef typename _C::__storage_type __storage_type;
- typedef typename _C::iterator iterator;
- static const unsigned __bits_per_word = _C::__bits_per_word;
- static const unsigned _N = 4;
+ typedef typename _Cp::difference_type difference_type;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename _Cp::iterator iterator;
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
+ static const unsigned _Np = 4;
difference_type __size_;
- __storage_type __word_[_N];
+ __storage_type __word_[_Np];
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
- {return static_cast<difference_type>(_N * __bits_per_word);}
+ {return static_cast<difference_type>(_Np * __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));}
};
-template <class _C>
-__bit_iterator<_C, false>
-rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
+template <class _Cp>
+__bit_iterator<_Cp, false>
+rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last)
{
- typedef __bit_iterator<_C, false> _I1;
+ typedef __bit_iterator<_Cp, false> _I1;
typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type;
- static const unsigned __bits_per_word = _I1::__bits_per_word;
difference_type __d1 = __middle - __first;
difference_type __d2 = __last - __middle;
_I1 __r = __first + __d2;
@@ -887,16 +888,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
{
if (__d1 <= __d2)
{
- if (__d1 <= __bit_array<_C>::capacity())
+ if (__d1 <= __bit_array<_Cp>::capacity())
{
- __bit_array<_C> __b(__d1);
+ __bit_array<_Cp> __b(__d1);
_VSTD::copy(__first, __middle, __b.begin());
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
break;
}
else
{
- __bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
+ __bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__first = __middle;
__middle = __mp;
__d2 -= __d1;
@@ -904,16 +905,16 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
}
else
{
- if (__d2 <= __bit_array<_C>::capacity())
+ if (__d2 <= __bit_array<_Cp>::capacity())
{
- __bit_array<_C> __b(__d2);
+ __bit_array<_Cp> __b(__d2);
_VSTD::copy(__middle, __last, __b.begin());
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
break;
}
else
{
- __bit_iterator<_C, false> __mp = __first + __d2;
+ __bit_iterator<_Cp, false> __mp = __first + __d2;
_VSTD::swap_ranges(__first, __mp, __middle);
__first = __mp;
__d1 -= __d2;
@@ -925,12 +926,12 @@ rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __
// equal
-template <class _C>
+template <class _Cp>
bool
-__equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
- __bit_iterator<_C, true> __first2)
+__equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1,
+ __bit_iterator<_Cp, true> __first2)
{
- typedef __bit_iterator<_C, true> _It;
+ typedef __bit_iterator<_Cp, true> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -1003,12 +1004,12 @@ __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __
return true;
}
-template <class _C>
+template <class _Cp>
bool
-__equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
- __bit_iterator<_C, true> __first2)
+__equal_aligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1,
+ __bit_iterator<_Cp, true> __first2)
{
- typedef __bit_iterator<_C, true> _It;
+ typedef __bit_iterator<_Cp, true> _It;
typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -1046,31 +1047,31 @@ __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __la
return true;
}
-template <class _C, bool _IC1, bool _IC2>
+template <class _Cp, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY
bool
-equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
+equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2)
{
if (__first1.__ctz_ == __first2.__ctz_)
return __equal_aligned(__first1, __last1, __first2);
return __equal_unaligned(__first1, __last1, __first2);
}
-template <class _C, bool _IsConst>
+template <class _Cp, bool _IsConst>
class __bit_iterator
{
public:
- typedef typename _C::difference_type difference_type;
+ typedef typename _Cp::difference_type difference_type;
typedef bool value_type;
typedef __bit_iterator pointer;
- typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
+ typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference;
typedef random_access_iterator_tag iterator_category;
private:
- typedef typename _C::__storage_type __storage_type;
- typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
- typename _C::__storage_pointer>::type __storage_pointer;
- static const unsigned __bits_per_word = _C::__bits_per_word;
+ typedef typename _Cp::__storage_type __storage_type;
+ typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer,
+ typename _Cp::__storage_pointer>::type __storage_pointer;
+ static const unsigned __bits_per_word = _Cp::__bits_per_word;
__storage_pointer __seg_;
unsigned __ctz_;
@@ -1079,7 +1080,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
- __bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
+ __bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
@@ -1187,34 +1188,34 @@ private:
: __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__)
- friend typename _C::__self;
+ friend typename _Cp::__self;
#else
- friend class _C::__self;
+ friend class _Cp::__self;
#endif
- friend class __bit_reference<_C>;
- friend class __bit_const_reference<_C>;
- friend class __bit_iterator<_C, true>;
- template <class _D> friend struct __bit_array;
- template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
- template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
- template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
- __bit_iterator<_D, _IC> __last,
- __bit_iterator<_D, false> __result);
+ friend class __bit_reference<_Cp>;
+ friend class __bit_const_reference<_Cp>;
+ friend class __bit_iterator<_Cp, true>;
+ template <class _Dp> friend struct __bit_array;
+ template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+ template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first,
+ __bit_iterator<_Dp, _IC> __last,
+ __bit_iterator<_Dp, false> __result);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
@@ -1224,22 +1225,22 @@ private:
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>,
__bit_iterator<__C2, false>);
- template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
- __bit_iterator<_D, false>,
- __bit_iterator<_D, false>);
- template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
- __bit_iterator<_D, true>,
- __bit_iterator<_D, true>);
- template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
- __bit_iterator<_D, true>,
- __bit_iterator<_D, true>);
- template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
- __bit_iterator<_D, _IC1>,
- __bit_iterator<_D, _IC2>);
- template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
- typename _D::size_type);
- template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
- typename _D::size_type);
+ template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>,
+ __bit_iterator<_Dp, false>,
+ __bit_iterator<_Dp, false>);
+ template <class _Dp> friend bool __equal_aligned(__bit_iterator<_Dp, true>,
+ __bit_iterator<_Dp, true>,
+ __bit_iterator<_Dp, true>);
+ template <class _Dp> friend bool __equal_unaligned(__bit_iterator<_Dp, true>,
+ __bit_iterator<_Dp, true>,
+ __bit_iterator<_Dp, true>);
+ template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
+ template <class _Dp> friend __bit_iterator<_Dp, false> __find_bool_true(__bit_iterator<_Dp, false>,
+ typename _Dp::size_type);
+ template <class _Dp> friend __bit_iterator<_Dp, false> __find_bool_false(__bit_iterator<_Dp, false>,
+ typename _Dp::size_type);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/__config b/include/__config
index 0f6c77dd9817..e0b9582cd08e 100644
--- a/include/__config
+++ b/include/__config
@@ -58,6 +58,17 @@
# endif
#endif // _WIN32
+#ifdef __sun__
+# include <sys/isa_defs.h>
+# ifdef _LITTLE_ENDIAN
+# define _LIBCPP_LITTLE_ENDIAN 1
+# define _LIBCPP_BIG_ENDIAN 0
+# else
+# define _LIBCPP_LITTLE_ENDIAN 0
+# define _LIBCPP_BIG_ENDIAN 1
+# endif
+#endif // __sun__
+
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -160,6 +171,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI
#endif
+#if !(__has_feature(cxx_strong_enums))
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#endif
+
#if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE
#endif
@@ -223,6 +238,7 @@ typedef __char32_t char32_t;
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
+#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
@@ -371,7 +387,25 @@ template <unsigned> struct __static_assert_check {};
#define __has_feature(__x) 0
#endif
-#if __APPLE__ || __FreeBSD__ || _WIN32
+#if __has_feature(cxx_explicit_conversions)
+# define _LIBCPP_EXPLICIT explicit
+#else
+# define _LIBCPP_EXPLICIT
+#endif
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum _
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
+ _ __v_; \
+ _LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
+ _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
+ };
+#else // _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
+#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
+#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
+
+#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#if __FreeBSD__
@@ -382,7 +416,7 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
-#if __APPLE__ || __FreeBSD__
+#if __APPLE__ || __FreeBSD__ || __sun__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
diff --git a/include/__debug b/include/__debug
index cd3bd3a98d98..4a0e3cecbb62 100644
--- a/include/__debug
+++ b/include/__debug
@@ -83,8 +83,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _C = static_cast<_Cont*>(__c_);
- return _C->__dereferenceable(__j);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__dereferenceable(__j);
}
template <class _Cont>
@@ -93,8 +93,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _C = static_cast<_Cont*>(__c_);
- return _C->__decrementable(__j);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__decrementable(__j);
}
template <class _Cont>
@@ -103,8 +103,8 @@ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _C = static_cast<_Cont*>(__c_);
- return _C->__addable(__j, __n);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__addable(__j, __n);
}
template <class _Cont>
@@ -113,8 +113,8 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
- _Cont* _C = static_cast<_Cont*>(__c_);
- return _C->__subscriptable(__j, __n);
+ _Cont* _Cp = static_cast<_Cont*>(__c_);
+ return _Cp->__subscriptable(__j, __n);
}
class _LIBCPP_VISIBLE __libcpp_db
diff --git a/include/__functional_03 b/include/__functional_03
index 5d30ce2b7502..3a5397d809d1 100644
--- a/include/__functional_03
+++ b/include/__functional_03
@@ -60,140 +60,140 @@ public:
}
};
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R _T::*>
-mem_fn(_R _T::* __pm)
+__mem_fn<_Rp _Tp::*>
+mem_fn(_Rp _Tp::* __pm)
{
- return __mem_fn<_R _T::*>(__pm);
+ return __mem_fn<_Rp _Tp::*>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)())
+__mem_fn<_Rp (_Tp::*)()>
+mem_fn(_Rp (_Tp::* __pm)())
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0))
+__mem_fn<_Rp (_Tp::*)(_A0)>
+mem_fn(_Rp (_Tp::* __pm)(_A0))
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1))
+__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1))
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2))
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() const)
+__mem_fn<_Rp (_Tp::*)()>
+mem_fn(_Rp (_Tp::* __pm)() const)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) const)
+__mem_fn<_Rp (_Tp::*)(_A0)>
+mem_fn(_Rp (_Tp::* __pm)(_A0) const)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) const)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() volatile)
+__mem_fn<_Rp (_Tp::*)()>
+mem_fn(_Rp (_Tp::* __pm)() volatile)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0)>
+mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)()>
-mem_fn(_R (_T::* __pm)() const volatile)
+__mem_fn<_Rp (_Tp::*)()>
+mem_fn(_Rp (_Tp::* __pm)() const volatile)
{
- return __mem_fn<_R (_T::*)()>(__pm);
+ return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
-template<class _R, class _T, class _A0>
+template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0)>
-mem_fn(_R (_T::* __pm)(_A0) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0)>
+mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1>
+template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1)>
-mem_fn(_R (_T::* __pm)(_A0, _A1) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
-template<class _R, class _T, class _A0, class _A1, class _A2>
+template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_A0, _A1, _A2)>
-mem_fn(_R (_T::* __pm)(_A0, _A1, _A2) const volatile)
+__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
+mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
{
- return __mem_fn<_R (_T::*)(_A0, _A1, _A2)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
// bad_function_call
@@ -208,32 +208,32 @@ template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
namespace __function
{
-template<class _F>
+template<class _Fp>
struct __maybe_derive_from_unary_function
{
};
-template<class _R, class _A1>
-struct __maybe_derive_from_unary_function<_R(_A1)>
- : public unary_function<_A1, _R>
+template<class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template<class _F>
+template<class _Fp>
struct __maybe_derive_from_binary_function
{
};
-template<class _R, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_R(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template<class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
template<class _Fp> class __base;
-template<class _R>
-class __base<_R()>
+template<class _Rp>
+class __base<_Rp()>
{
__base(const __base&);
__base& operator=(const __base&);
@@ -244,15 +244,15 @@ public:
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()() = 0;
+ virtual _Rp operator()() = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0>
-class __base<_R(_A0)>
+template<class _Rp, class _A0>
+class __base<_Rp(_A0)>
{
__base(const __base&);
__base& operator=(const __base&);
@@ -263,15 +263,15 @@ public:
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0) = 0;
+ virtual _Rp operator()(_A0) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1>
-class __base<_R(_A0, _A1)>
+template<class _Rp, class _A0, class _A1>
+class __base<_Rp(_A0, _A1)>
{
__base(const __base&);
__base& operator=(const __base&);
@@ -282,15 +282,15 @@ public:
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0, _A1) = 0;
+ virtual _Rp operator()(_A0, _A1) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1, class _A2>
-class __base<_R(_A0, _A1, _A2)>
+template<class _Rp, class _A0, class _A1, class _A2>
+class __base<_Rp(_A0, _A1, _A2)>
{
__base(const __base&);
__base& operator=(const __base&);
@@ -301,7 +301,7 @@ public:
virtual void __clone(__base*) const = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_A0, _A1, _A2) = 0;
+ virtual _Rp operator()(_A0, _A1, _A2) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const = 0;
virtual const std::type_info& target_type() const = 0;
@@ -310,360 +310,360 @@ public:
template<class _FD, class _Alloc, class _FB> class __func;
-template<class _F, class _Alloc, class _R>
-class __func<_F, _Alloc, _R()>
- : public __base<_R()>
+template<class _Fp, class _Alloc, class _Rp>
+class __func<_Fp, _Alloc, _Rp()>
+ : public __base<_Rp()>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
- explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_R()>* __clone() const;
- virtual void __clone(__base<_R()>*) const;
+ explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ explicit __func(_Fp __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
+ virtual __base<_Rp()>* __clone() const;
+ virtual void __clone(__base<_Rp()>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()();
+ virtual _Rp operator()();
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R>
-__base<_R()>*
-__func<_F, _Alloc, _R()>::__clone() const
+template<class _Fp, class _Alloc, class _Rp>
+__base<_Rp()>*
+__func<_Fp, _Alloc, _Rp()>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::__clone(__base<_R()>* __p) const
+__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::destroy()
+__func<_Fp, _Alloc, _Rp()>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
void
-__func<_F, _Alloc, _R()>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp()>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R>
-_R
-__func<_F, _Alloc, _R()>::operator()()
+template<class _Fp, class _Alloc, class _Rp>
+_Rp
+__func<_Fp, _Alloc, _Rp()>::operator()()
{
return __invoke(__f_.first());
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
const void*
-__func<_F, _Alloc, _R()>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp()>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R>
+template<class _Fp, class _Alloc, class _Rp>
const std::type_info&
-__func<_F, _Alloc, _R()>::target_type() const
+__func<_Fp, _Alloc, _Rp()>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0>
-class __func<_F, _Alloc, _R(_A0)>
- : public __base<_R(_A0)>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+class __func<_Fp, _Alloc, _Rp(_A0)>
+ : public __base<_Rp(_A0)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_R(_A0)>* __clone() const;
- virtual void __clone(__base<_R(_A0)>*) const;
+ virtual __base<_Rp(_A0)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0);
+ virtual _Rp operator()(_A0);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0>
-__base<_R(_A0)>*
-__func<_F, _Alloc, _R(_A0)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+__base<_Rp(_A0)>*
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::__clone(__base<_R(_A0)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
void
-__func<_F, _Alloc, _R(_A0)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0>
-_R
-__func<_F, _Alloc, _R(_A0)>::operator()(_A0 __a0)
+template<class _Fp, class _Alloc, class _Rp, class _A0>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0)>::operator()(_A0 __a0)
{
return __invoke(__f_.first(), __a0);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
const void*
-__func<_F, _Alloc, _R(_A0)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0>
+template<class _Fp, class _Alloc, class _Rp, class _A0>
const std::type_info&
-__func<_F, _Alloc, _R(_A0)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-class __func<_F, _Alloc, _R(_A0, _A1)>
- : public __base<_R(_A0, _A1)>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1)>
+ : public __base<_Rp(_A0, _A1)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_R(_A0, _A1)>* __clone() const;
- virtual void __clone(__base<_R(_A0, _A1)>*) const;
+ virtual __base<_Rp(_A0, _A1)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0, _A1)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0, _A1);
+ virtual _Rp operator()(_A0, _A1);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-__base<_R(_A0, _A1)>*
-__func<_F, _Alloc, _R(_A0, _A1)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+__base<_Rp(_A0, _A1)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::__clone(__base<_R(_A0, _A1)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
void
-__func<_F, _Alloc, _R(_A0, _A1)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
-_R
-__func<_F, _Alloc, _R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1)
{
return __invoke(__f_.first(), __a0, __a1);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
const void*
-__func<_F, _Alloc, _R(_A0, _A1)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
const std::type_info&
-__func<_F, _Alloc, _R(_A0, _A1)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0, _A1)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-class __func<_F, _Alloc, _R(_A0, _A1, _A2)>
- : public __base<_R(_A0, _A1, _A2)>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+class __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>
+ : public __base<_Rp(_A0, _A1, _A2)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __func(_F __f, _Alloc __a)
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f) : __f_(_VSTD::move(__f)) {}
+ _LIBCPP_INLINE_VISIBILITY explicit __func(_Fp __f, _Alloc __a)
: __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_R(_A0, _A1, _A2)>* __clone() const;
- virtual void __clone(__base<_R(_A0, _A1, _A2)>*) const;
+ virtual __base<_Rp(_A0, _A1, _A2)>* __clone() const;
+ virtual void __clone(__base<_Rp(_A0, _A1, _A2)>*) const;
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_A0, _A1, _A2);
+ virtual _Rp operator()(_A0, _A1, _A2);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const;
virtual const std::type_info& target_type() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-__base<_R(_A0, _A1, _A2)>*
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+__base<_Rp(_A0, _A1, _A2)>*
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::__clone(__base<_R(_A0, _A1, _A2)>* __p) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy()
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
void
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::destroy_deallocate()
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
-_R
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
+_Rp
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2)
{
return __invoke(__f_.first(), __a0, __a1, __a2);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
const void*
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target(const type_info& __ti) const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target(const type_info& __ti) const
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class _A0, class _A1, class _A2>
+template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
const std::type_info&
-__func<_F, _Alloc, _R(_A0, _A1, _A2)>::target_type() const
+__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
} // __function
-template<class _R>
-class _LIBCPP_VISIBLE function<_R()>
+template<class _Rp>
+class _LIBCPP_VISIBLE function<_Rp()>
{
- typedef __function::__base<_R()> __base;
+ typedef __function::__base<_Rp()> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
- static bool __not_null(const _F&) {return true;}
+ template <class _Fp>
+ static bool __not_null(const _Fp&) {return true;}
template <class _R2>
- static bool __not_null(const function<_R()>& __p) {return __p;}
+ static bool __not_null(const function<_Rp()>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
- template<class _F>
- function(_F,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -673,27 +673,27 @@ public:
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
@@ -707,18 +707,18 @@ private:
bool operator!=(const function<_R2()>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()() const;
+ _Rp operator()() const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R>
-function<_R()>::function(const function& __f)
+template<class _Rp>
+function<_Rp()>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -731,9 +731,9 @@ function<_R()>::function(const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R>
+template<class _Rp>
template<class _Alloc>
-function<_R()>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp()>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -746,15 +746,15 @@ function<_R()>::function(allocator_arg_t, const _Alloc&, const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R>
-template <class _F>
-function<_R()>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp>
+template <class _Fp>
+function<_Rp()>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R()> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -762,26 +762,26 @@ function<_R()>::function(_F __f,
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R>
-template <class _F, class _Alloc>
-function<_R()>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp>
+template <class _Fp, class _Alloc>
+function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R()> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -795,27 +795,27 @@ function<_R()>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R>
-function<_R()>&
-function<_R()>::operator=(const function& __f)
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R>
-function<_R()>&
-function<_R()>::operator=(nullptr_t)
+template<class _Rp>
+function<_Rp()>&
+function<_Rp()>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -824,21 +824,21 @@ function<_R()>::operator=(nullptr_t)
__f_ = 0;
}
-template<class _R>
-template <class _F>
+template<class _Rp>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R()>&
+ !is_integral<_Fp>::value,
+ function<_Rp()>&
>::type
-function<_R()>::operator=(_F __f)
+function<_Rp()>::operator=(_Fp __f)
{
function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R>
-function<_R()>::~function()
+template<class _Rp>
+function<_Rp()>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -846,9 +846,9 @@ function<_R()>::~function()
__f_->destroy_deallocate();
}
-template<class _R>
+template<class _Rp>
void
-function<_R()>::swap(function& __f)
+function<_Rp()>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -883,9 +883,9 @@ function<_R()>::swap(function& __f)
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R>
-_R
-function<_R()>::operator()() const
+template<class _Rp>
+_Rp
+function<_Rp()>::operator()() const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
@@ -896,76 +896,76 @@ function<_R()>::operator()() const
#ifndef _LIBCPP_NO_RTTI
-template<class _R>
+template<class _Rp>
const std::type_info&
-function<_R()>::target_type() const
+function<_Rp()>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R>
-template <typename _T>
-_T*
-function<_R()>::target()
+template<class _Rp>
+template <typename _Tp>
+_Tp*
+function<_Rp()>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R>
-template <typename _T>
-const _T*
-function<_R()>::target() const
+template<class _Rp>
+template <typename _Tp>
+const _Tp*
+function<_Rp()>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0>
-class _LIBCPP_VISIBLE function<_R(_A0)>
- : public unary_function<_A0, _R>
+template<class _Rp, class _A0>
+class _LIBCPP_VISIBLE function<_Rp(_A0)>
+ : public unary_function<_A0, _Rp>
{
- typedef __function::__base<_R(_A0)> __base;
+ typedef __function::__base<_Rp(_A0)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ 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 _C>
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)()) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)()) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() const) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() volatile) {return __p;}
- template <class _R2, class _C>
+ static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;}
+ template <class _R2, class _Cp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)() const volatile) {return __p;}
+ 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<_R(_B0)>& __p) {return __p;}
+ static bool __not_null(const function<_Rp(_B0)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
- template<class _F>
- function(_F,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -975,27 +975,27 @@ public:
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
@@ -1009,18 +1009,18 @@ private:
bool operator!=(const function<_R2(_B0)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0) const;
+ _Rp operator()(_A0) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0>
-function<_R(_A0)>::function(const function& __f)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1033,9 +1033,9 @@ function<_R(_A0)>::function(const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0>
+template<class _Rp, class _A0>
template<class _Alloc>
-function<_R(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1048,15 +1048,15 @@ function<_R(_A0)>::function(allocator_arg_t, const _Alloc&, const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0>
-template <class _F>
-function<_R(_A0)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0>
+template <class _Fp>
+function<_Rp(_A0)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1064,26 +1064,26 @@ function<_R(_A0)>::function(_F __f,
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0>
-template <class _F, class _Alloc>
-function<_R(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1097,27 +1097,27 @@ function<_R(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0>
-function<_R(_A0)>&
-function<_R(_A0)>::operator=(const function& __f)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0>
-function<_R(_A0)>&
-function<_R(_A0)>::operator=(nullptr_t)
+template<class _Rp, class _A0>
+function<_Rp(_A0)>&
+function<_Rp(_A0)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1126,21 +1126,21 @@ function<_R(_A0)>::operator=(nullptr_t)
__f_ = 0;
}
-template<class _R, class _A0>
-template <class _F>
+template<class _Rp, class _A0>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0)>&
>::type
-function<_R(_A0)>::operator=(_F __f)
+function<_Rp(_A0)>::operator=(_Fp __f)
{
function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0>
-function<_R(_A0)>::~function()
+template<class _Rp, class _A0>
+function<_Rp(_A0)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1148,9 +1148,9 @@ function<_R(_A0)>::~function()
__f_->destroy_deallocate();
}
-template<class _R, class _A0>
+template<class _Rp, class _A0>
void
-function<_R(_A0)>::swap(function& __f)
+function<_Rp(_A0)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1185,9 +1185,9 @@ function<_R(_A0)>::swap(function& __f)
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0>
-_R
-function<_R(_A0)>::operator()(_A0 __a0) const
+template<class _Rp, class _A0>
+_Rp
+function<_Rp(_A0)>::operator()(_A0 __a0) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
@@ -1198,76 +1198,76 @@ function<_R(_A0)>::operator()(_A0 __a0) const
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0>
+template<class _Rp, class _A0>
const std::type_info&
-function<_R(_A0)>::target_type() const
+function<_Rp(_A0)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0>
-template <typename _T>
-_T*
-function<_R(_A0)>::target()
+template<class _Rp, class _A0>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0>
-template <typename _T>
-const _T*
-function<_R(_A0)>::target() const
+template<class _Rp, class _A0>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1>
-class _LIBCPP_VISIBLE function<_R(_A0, _A1)>
- : public binary_function<_A0, _A1, _R>
+template<class _Rp, class _A0, class _A1>
+class _LIBCPP_VISIBLE function<_Rp(_A0, _A1)>
+ : public binary_function<_A0, _A1, _Rp>
{
- typedef __function::__base<_R(_A0, _A1)> __base;
+ typedef __function::__base<_Rp(_A0, _A1)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ 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 _C, class _B1>
+ template <class _R2, class _Cp, class _B1>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1)) {return __p;}
- template <class _R2, class _C, class _B1>
+ 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 (_C::*__p)(_B1) const) {return __p;}
- template <class _R2, class _C, class _B1>
+ 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 (_C::*__p)(_B1) volatile) {return __p;}
- template <class _R2, class _C, class _B1>
+ 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 (_C::*__p)(_B1) const volatile) {return __p;}
+ 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<_R(_B0, _B1)>& __p) {return __p;}
+ static bool __not_null(const function<_Rp(_B0, _B1)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
- template<class _F>
- function(_F,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -1277,27 +1277,27 @@ public:
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
@@ -1311,18 +1311,18 @@ private:
bool operator!=(const function<_R2(_B0, _B1)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0, _A1) const;
+ _Rp operator()(_A0, _A1) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>::function(const function& __f)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1335,9 +1335,9 @@ function<_R(_A0, _A1)>::function(const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
template<class _Alloc>
-function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1350,15 +1350,15 @@ function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc&, const function&
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1>
-template <class _F>
-function<_R(_A0, _A1)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
+function<_Rp(_A0, _A1)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1366,26 +1366,26 @@ function<_R(_A0, _A1)>::function(_F __f,
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1>
-template <class _F, class _Alloc>
-function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0, _A1)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1399,27 +1399,27 @@ function<_R(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>&
-function<_R(_A0, _A1)>::operator=(const function& __f)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>&
-function<_R(_A0, _A1)>::operator=(nullptr_t)
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>&
+function<_Rp(_A0, _A1)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1428,21 +1428,21 @@ function<_R(_A0, _A1)>::operator=(nullptr_t)
__f_ = 0;
}
-template<class _R, class _A0, class _A1>
-template <class _F>
+template<class _Rp, class _A0, class _A1>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0, _A1)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0, _A1)>&
>::type
-function<_R(_A0, _A1)>::operator=(_F __f)
+function<_Rp(_A0, _A1)>::operator=(_Fp __f)
{
function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1>
-function<_R(_A0, _A1)>::~function()
+template<class _Rp, class _A0, class _A1>
+function<_Rp(_A0, _A1)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1450,9 +1450,9 @@ function<_R(_A0, _A1)>::~function()
__f_->destroy_deallocate();
}
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
void
-function<_R(_A0, _A1)>::swap(function& __f)
+function<_Rp(_A0, _A1)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1487,9 +1487,9 @@ function<_R(_A0, _A1)>::swap(function& __f)
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0, class _A1>
-_R
-function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
+template<class _Rp, class _A0, class _A1>
+_Rp
+function<_Rp(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
@@ -1500,75 +1500,75 @@ function<_R(_A0, _A1)>::operator()(_A0 __a0, _A1 __a1) const
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1>
+template<class _Rp, class _A0, class _A1>
const std::type_info&
-function<_R(_A0, _A1)>::target_type() const
+function<_Rp(_A0, _A1)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0, class _A1>
-template <typename _T>
-_T*
-function<_R(_A0, _A1)>::target()
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0, class _A1>
-template <typename _T>
-const _T*
-function<_R(_A0, _A1)>::target() const
+template<class _Rp, class _A0, class _A1>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1, class _A2>
-class _LIBCPP_VISIBLE function<_R(_A0, _A1, _A2)>
+template<class _Rp, class _A0, class _A1, class _A2>
+class _LIBCPP_VISIBLE function<_Rp(_A0, _A1, _A2)>
{
- typedef __function::__base<_R(_A0, _A1, _A2)> __base;
+ typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
+ 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 _C, class _B1, class _B2>
+ template <class _R2, class _Cp, class _B1, class _B2>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_B1, _B2)) {return __p;}
- template <class _R2, class _C, class _B1, class _B2>
+ 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 (_C::*__p)(_B1, _B2) const) {return __p;}
- template <class _R2, class _C, class _B1, class _B2>
+ 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 (_C::*__p)(_B1, _B2) volatile) {return __p;}
- template <class _R2, class _C, class _B1, class _B2>
+ 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 (_C::*__p)(_B1, _B2) const volatile) {return __p;}
+ 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<_R(_B0, _B1, _B2)>& __p) {return __p;}
+ static bool __not_null(const function<_Rp(_B0, _B1, _B2)>& __p) {return __p;}
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// 20.7.16.2.1, construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY explicit function() : __f_(0) {}
_LIBCPP_INLINE_VISIBILITY function(nullptr_t) : __f_(0) {}
function(const function&);
- template<class _F>
- function(_F,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp>
+ function(_Fp,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -1578,27 +1578,27 @@ public:
function(allocator_arg_t, const _Alloc&, nullptr_t) : __f_(0) {}
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, const function&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<!is_integral<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(nullptr_t);
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
+ !is_integral<_Fp>::value,
function&
>::type
- operator=(_F);
+ operator=(_Fp);
~function();
// 20.7.16.2.2, function modifiers:
void swap(function&);
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F __f, const _Alloc& __a)
+ void assign(_Fp __f, const _Alloc& __a)
{function(allocator_arg, __a, __f).swap(*this);}
// 20.7.16.2.3, function capacity:
@@ -1612,18 +1612,18 @@ private:
bool operator!=(const function<_R2(_B0, _B1, _B2)>&) const;// = delete;
public:
// 20.7.16.2.4, function invocation:
- _R operator()(_A0, _A1, _A2) const;
+ _Rp operator()(_A0, _A1, _A2) const;
#ifndef _LIBCPP_NO_RTTI
// 20.7.16.2.5, function target access:
const std::type_info& target_type() const;
- template <typename _T> _T* target();
- template <typename _T> const _T* target() const;
+ template <typename _Tp> _Tp* target();
+ template <typename _Tp> const _Tp* target() const;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>::function(const function& __f)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1636,9 +1636,9 @@ function<_R(_A0, _A1, _A2)>::function(const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
template<class _Alloc>
-function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
const function& __f)
{
if (__f.__f_ == 0)
@@ -1652,15 +1652,15 @@ function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc&,
__f_ = __f.__f_->__clone();
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F>
-function<_R(_A0, _A1, _A2)>::function(_F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
+function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_A0, _A1, _A2)> _FF;
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1668,26 +1668,26 @@ function<_R(_A0, _A1, _A2)>::function(_F __f,
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(__f, allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F, class _Alloc>
-function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<!is_integral<_F>::value>::type*)
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp, class _Alloc>
+function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_A0, _A1, _A2)> _FF;
+ typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
@@ -1701,27 +1701,27 @@ function<_R(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _F __
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(__f, _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>&
-function<_R(_A0, _A1, _A2)>::operator=(const function& __f)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>&
-function<_R(_A0, _A1, _A2)>::operator=(nullptr_t)
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>&
+function<_Rp(_A0, _A1, _A2)>::operator=(nullptr_t)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1730,21 +1730,21 @@ function<_R(_A0, _A1, _A2)>::operator=(nullptr_t)
__f_ = 0;
}
-template<class _R, class _A0, class _A1, class _A2>
-template <class _F>
+template<class _Rp, class _A0, class _A1, class _A2>
+template <class _Fp>
typename enable_if
<
- !is_integral<_F>::value,
- function<_R(_A0, _A1, _A2)>&
+ !is_integral<_Fp>::value,
+ function<_Rp(_A0, _A1, _A2)>&
>::type
-function<_R(_A0, _A1, _A2)>::operator=(_F __f)
+function<_Rp(_A0, _A1, _A2)>::operator=(_Fp __f)
{
function(_VSTD::move(__f)).swap(*this);
return *this;
}
-template<class _R, class _A0, class _A1, class _A2>
-function<_R(_A0, _A1, _A2)>::~function()
+template<class _Rp, class _A0, class _A1, class _A2>
+function<_Rp(_A0, _A1, _A2)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1752,9 +1752,9 @@ function<_R(_A0, _A1, _A2)>::~function()
__f_->destroy_deallocate();
}
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
void
-function<_R(_A0, _A1, _A2)>::swap(function& __f)
+function<_Rp(_A0, _A1, _A2)>::swap(function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1789,9 +1789,9 @@ function<_R(_A0, _A1, _A2)>::swap(function& __f)
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class _A0, class _A1, class _A2>
-_R
-function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
+template<class _Rp, class _A0, class _A1, class _A2>
+_Rp
+function<_Rp(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
@@ -1802,61 +1802,61 @@ function<_R(_A0, _A1, _A2)>::operator()(_A0 __a0, _A1 __a1, _A2 __a2) const
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class _A0, class _A1, class _A2>
+template<class _Rp, class _A0, class _A1, class _A2>
const std::type_info&
-function<_R(_A0, _A1, _A2)>::target_type() const
+function<_Rp(_A0, _A1, _A2)>::target_type() const
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class _A0, class _A1, class _A2>
-template <typename _T>
-_T*
-function<_R(_A0, _A1, _A2)>::target()
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+_Tp*
+function<_Rp(_A0, _A1, _A2)>::target()
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class _A0, class _A1, class _A2>
-template <typename _T>
-const _T*
-function<_R(_A0, _A1, _A2)>::target() const
+template<class _Rp, class _A0, class _A1, class _A2>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_A0, _A1, _A2)>::target() const
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(const function<_F>& __f, nullptr_t) {return !__f;}
+operator==(const function<_Fp>& __f, nullptr_t) {return !__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(nullptr_t, const function<_F>& __f) {return !__f;}
+operator==(nullptr_t, const function<_Fp>& __f) {return !__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const function<_F>& __f, nullptr_t) {return (bool)__f;}
+operator!=(const function<_Fp>& __f, nullptr_t) {return (bool)__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(nullptr_t, const function<_F>& __f) {return (bool)__f;}
+operator!=(nullptr_t, const function<_Fp>& __f) {return (bool)__f;}
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(function<_F>& __x, function<_F>& __y)
+swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
@@ -1870,7 +1870,7 @@ template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
namespace placeholders
{
-template <int _N> struct __ph {};
+template <int _Np> struct __ph {};
extern __ph<1> _1;
extern __ph<2> _2;
@@ -1885,9 +1885,9 @@ extern __ph<10> _10;
} // placeholders
-template<int _N>
-struct __is_placeholder<placeholders::__ph<_N> >
- : public integral_constant<int, _N> {};
+template<int _Np>
+struct __is_placeholder<placeholders::__ph<_Np> >
+ : public integral_constant<int, _Np> {};
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2003,15 +2003,15 @@ struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
typedef _Ti& type;
};
-template <class _F, class _BoundArgs, class _TupleUj>
+template <class _Fp, class _BoundArgs, class _TupleUj>
struct __bind_return;
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
- _F&,
+ _Fp&,
typename __mu_return
<
_BoundArgs,
@@ -2020,12 +2020,12 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
>::type type;
};
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __ref_return
<
- _F&,
+ _Fp&,
typename __mu_return
<
const _BoundArgs,
@@ -2034,30 +2034,30 @@ struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
>::type type;
};
-template <class _F, class _BoundArgs, size_t ..._Indx, class _Args>
+template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bind_return<_F, _BoundArgs, _Args>::type
-__apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
+typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...);
}
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
class __bind
{
- _F __f_;
+ _Fp __f_;
tuple<_BoundArgs...> __bound_args_;
typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
public:
- template <class _G, class ..._BA>
- explicit __bind(_G&& __f, _BA&& ...__bound_args)
- : __f_(_VSTD::forward<_G>(__f)),
+ 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<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
+ typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
// compiler bug workaround
@@ -2066,7 +2066,7 @@ public:
}
template <class ..._Args>
- typename __bind_return<_F, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
+ typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
return __apply_functor(__f_, __bound_args_, __indices(),
@@ -2074,20 +2074,20 @@ public:
}
};
-template<class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind<_F, _BoundArgs...> > : public true_type {};
+template<class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-template<class _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
class __bind_r
- : public __bind<_F, _BoundArgs...>
+ : public __bind<_Fp, _BoundArgs...>
{
- typedef __bind<_F, _BoundArgs...> base;
+ typedef __bind<_Fp, _BoundArgs...> base;
public:
- typedef _R result_type;
+ typedef _Rp result_type;
- template <class _G, class ..._BA>
- explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
- : base(_VSTD::forward<_G>(__f),
+ 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>
@@ -2105,25 +2105,25 @@ public:
}
};
-template<class _R, class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type {};
+template<class _Rp, class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind<typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
- return type(_VSTD::forward<_F>(__f), _VSTD::forward<_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 _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind_r<_R, typename decay<_F>::type, typename decay<_BoundArgs>::type...> type;
- return type(_VSTD::forward<_F>(__f), _VSTD::forward<_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)...);
}
*/
diff --git a/include/__functional_base b/include/__functional_base
index 8d8e4b5e6e9a..63aa41d52555 100644
--- a/include/__functional_base
+++ b/include/__functional_base
@@ -50,6 +50,13 @@ public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
+template <class _Tp>
+struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
+{
+ _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
+ {return __x < __y;}
+};
+
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
@@ -64,9 +71,9 @@ struct __derives_from_unary_function
private:
struct __two {char _; char __;};
static __two __test(...);
- template <class _A, class _R>
- static unary_function<_A, _R>
- __test(const volatile unary_function<_A, _R>*);
+ template <class _Ap, class _Rp>
+ static unary_function<_Ap, _Rp>
+ __test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -78,9 +85,9 @@ struct __derives_from_binary_function
private:
struct __two {char _; char __;};
static __two __test(...);
- template <class _A1, class _A2, class _R>
- static binary_function<_A1, _A2, _R>
- __test(const volatile binary_function<_A1, _A2, _R>*);
+ template <class _A1, class _A2, class _Rp>
+ static binary_function<_A1, _A2, _Rp>
+ __test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -131,173 +138,173 @@ struct __weak_result_type
// 0 argument case
-template <class _R>
-struct __weak_result_type<_R ()>
+template <class _Rp>
+struct __weak_result_type<_Rp ()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (&)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (&)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (*)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (*)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// 1 argument case
-template <class _R, class _A1>
-struct __weak_result_type<_R (_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (&)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (&)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (*)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (*)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)()>
- : public unary_function<_C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)()>
+ : public unary_function<_Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const>
- : public unary_function<const _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const>
+ : public unary_function<const _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() volatile>
- : public unary_function<volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() volatile>
+ : public unary_function<volatile _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const volatile>
- : public unary_function<const volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const volatile>
+ : public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (*)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (&)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1)>
- : public binary_function<_C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1)>
+ : public binary_function<_Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const>
- : public binary_function<const _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
+ : public binary_function<const _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) volatile>
- : public binary_function<volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
+ : public binary_function<volatile _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const volatile>
- : public binary_function<const volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
+ : public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3, class ..._A4>
-struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
+template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2, class ..._A3>
-struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
+template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// __invoke
// bullets 1 and 2
-template <class _F, class _A0, class ..._Args>
+template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
-__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
-template <class _F, class _A0, class ..._Args>
+template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
-__invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
+__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
@@ -305,19 +312,19 @@ __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
// bullets 3 and 4
-template <class _F, class _A0>
+template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
-__invoke(_F&& __f, _A0&& __a0)
+__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f)
{
return _VSTD::forward<_A0>(__a0).*__f;
}
-template <class _F, class _A0>
+template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
-__invoke(_F&& __f, _A0&& __a0)
+__invoke(_Fp&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{
return (*_VSTD::forward<_A0>(__a0)).*__f;
@@ -325,13 +332,13 @@ __invoke(_F&& __f, _A0&& __a0)
// bullet 5
-template <class _F, class ..._Args>
+template <class _Fp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
-__invoke(_F&& __f, _Args&& ...__args)
- -> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
+__invoke(_Fp&& __f, _Args&& ...__args)
+ -> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...))
{
- return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
+ return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class ..._Args>
@@ -411,13 +418,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-template <class _Tp> void ref(const _Tp&& __t) = delete;
-template <class _Tp> void cref(const _Tp&& __t) = delete;
+template <class _Tp> void ref(const _Tp&&) = delete;
+template <class _Tp> void cref(const _Tp&&) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
-template <class _Tp> void ref(const _Tp&& __t);// = delete;
-template <class _Tp> void cref(const _Tp&& __t);// = delete;
+template <class _Tp> void ref(const _Tp&&);// = delete;
+template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
diff --git a/include/__functional_base_03 b/include/__functional_base_03
index fabda5bc3d4b..6c6ce53e6d25 100644
--- a/include/__functional_base_03
+++ b/include/__functional_base_03
@@ -21,9 +21,9 @@ struct __derives_from_unary_function
private:
struct __two {char _; char __;};
static __two __test(...);
- template <class _A, class _R>
- static unary_function<_A, _R>
- __test(const volatile unary_function<_A, _R>*);
+ template <class _Ap, class _Rp>
+ static unary_function<_Ap, _Rp>
+ __test(const volatile unary_function<_Ap, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -35,9 +35,9 @@ struct __derives_from_binary_function
private:
struct __two {char _; char __;};
static __two __test(...);
- template <class _A1, class _A2, class _R>
- static binary_function<_A1, _A2, _R>
- __test(const volatile binary_function<_A1, _A2, _R>*);
+ template <class _A1, class _A2, class _Rp>
+ static binary_function<_A1, _A2, _Rp>
+ __test(const volatile binary_function<_A1, _A2, _Rp>*);
public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type;
@@ -88,148 +88,148 @@ struct __weak_result_type
// 0 argument case
-template <class _R>
-struct __weak_result_type<_R ()>
+template <class _Rp>
+struct __weak_result_type<_Rp ()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (&)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (&)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R>
-struct __weak_result_type<_R (*)()>
+template <class _Rp>
+struct __weak_result_type<_Rp (*)()>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// 1 argument case
-template <class _R, class _A1>
-struct __weak_result_type<_R (_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (&)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (&)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _A1>
-struct __weak_result_type<_R (*)(_A1)>
- : public unary_function<_A1, _R>
+template <class _Rp, class _A1>
+struct __weak_result_type<_Rp (*)(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)()>
- : public unary_function<_C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)()>
+ : public unary_function<_Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const>
- : public unary_function<const _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const>
+ : public unary_function<const _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() volatile>
- : public unary_function<volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() volatile>
+ : public unary_function<volatile _Cp*, _Rp>
{
};
-template <class _R, class _C>
-struct __weak_result_type<_R (_C::*)() const volatile>
- : public unary_function<const volatile _C*, _R>
+template <class _Rp, class _Cp>
+struct __weak_result_type<_Rp (_Cp::*)() const volatile>
+ : public unary_function<const volatile _Cp*, _Rp>
{
};
// 2 argument case
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (*)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _A1, class _A2>
-struct __weak_result_type<_R (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template <class _Rp, class _A1, class _A2>
+struct __weak_result_type<_Rp (&)(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1)>
- : public binary_function<_C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1)>
+ : public binary_function<_Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const>
- : public binary_function<const _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
+ : public binary_function<const _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) volatile>
- : public binary_function<volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
+ : public binary_function<volatile _Cp*, _A1, _Rp>
{
};
-template <class _R, class _C, class _A1>
-struct __weak_result_type<_R (_C::*)(_A1) const volatile>
- : public binary_function<const volatile _C*, _A1, _R>
+template <class _Rp, class _Cp, class _A1>
+struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
+ : public binary_function<const volatile _Cp*, _A1, _Rp>
{
};
// 3 or more arguments
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (&)(_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (&)(_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _A1, class _A2, class _A3>
-struct __weak_result_type<_R (*)(_A1, _A2, _A3)>
+template <class _Rp, class _A1, class _A2, class _A3>
+struct __weak_result_type<_Rp (*)(_A1, _A2, _A3)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2)>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2)>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2) const>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) const>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
-template <class _R, class _C, class _A1, class _A2>
-struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
+template <class _Rp, class _Cp, class _A1, class _A2>
+struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) volatile>
{
- typedef _R result_type;
+ typedef _Rp result_type;
};
// __invoke
@@ -297,26 +297,26 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// template <class _Tp, class _A0, bool>
// struct __ref_return1_member_data1;
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data1<_R _C::*, _A0, true>
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, true>
// {
-// typedef typename __apply_cv<_A0, _R>::type& type;
+// typedef typename __apply_cv<_A0, _Rp>::type& type;
// };
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data1<_R _C::*, _A0, false>
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, false>
// {
// static _A0 __a;
-// typedef typename __apply_cv<decltype(*__a), _R>::type& type;
+// typedef typename __apply_cv<decltype(*__a), _Rp>::type& type;
// };
//
// template <class _Tp, class _A0>
// struct __ref_return1_member_data;
//
-// template <class _R, class _C, class _A0>
-// struct __ref_return1_member_data<_R _C::*, _A0>
-// : public __ref_return1_member_data1<_R _C::*, _A0,
-// is_same<typename remove_cv<_C>::type,
+// template <class _Rp, class _Cp, class _A0>
+// struct __ref_return1_member_data<_Rp _Cp::*, _A0>
+// : public __ref_return1_member_data1<_Rp _Cp::*, _A0,
+// is_same<typename remove_cv<_Cp>::type,
// typename remove_cv<typename remove_reference<_A0>::type>::type>::value>
// {
// };
@@ -413,528 +413,528 @@ struct __weak_result_type<_R (_C::*)(_A1, _A2) volatile>
// first bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(), _T1& __t1)
+__invoke(_Rp (_Tp::*__f)(), _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0), _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() const, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() volatile, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const volatile, _T1& __t1)
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1)
{
return (__t1.*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
{
return (__t1.*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
{
return (__t1.*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return (__t1.*__f)(__a0, __a1, __a2);
}
// second bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(), _T1 __t1)
+__invoke(_Rp (_Tp::*__f)(), _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0), _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() const, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() volatile, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)() const volatile, _T1 __t1)
+__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1)
{
return ((*__t1).*__f)();
}
-template <class _R, class _T, class _T1, class _A0>
+template <class _Rp, class _Tp, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
+__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
{
return ((*__t1).*__f)(__a0);
}
-template <class _R, class _T, class _T1, class _A0, class _A1>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
{
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _R, class _T, class _T1, class _A0, class _A1, class _A2>
+template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_base_of<_T, typename remove_reference<_T1>::type>::value,
- _R
+ !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ _Rp
>::type
-__invoke(_R (_T::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
+__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
{
return ((*__t1).*__f)(__a0, __a1, __a2);
}
// third bullet
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- is_base_of<_T, typename remove_reference<_T1>::type>::value,
- typename __apply_cv<_T1, _R>::type&
+ is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+ typename __apply_cv<_T1, _Rp>::type&
>::type
-__invoke(_R _T::* __f, _T1& __t1)
+__invoke(_Rp _Tp::* __f, _T1& __t1)
{
return __t1.*__f;
}
-template <class _R, class _T>
+template <class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
-__invoke(_R _T::*)
+__invoke(_Rp _Tp::*)
{
}
-// template <class _D, class _R, class _T, class _T1>
+// template <class _Dp, class _Rp, class _Tp, class _T1>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// is_base_of<_T, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_R _T::*, _T1>::type
+// is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+// typename __ref_return1<_Rp _Tp::*, _T1>::type
// >::type
-// __invoke(_R _T::* __f, _T1& __t1)
+// __invoke(_Rp _Tp::* __f, _T1& __t1)
// {
// return __t1.*__f;
// }
// forth bullet
-template <class _T1, class _R, bool>
+template <class _T1, class _Rp, bool>
struct __4th_helper
{
};
-template <class _T1, class _R>
-struct __4th_helper<_T1, _R, true>
+template <class _T1, class _Rp>
+struct __4th_helper<_T1, _Rp, true>
{
- typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _R>::type type;
+ typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Rp>::type type;
};
-template <class _R, class _T, class _T1>
+template <class _Rp, class _Tp, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename __4th_helper<_T1, _R,
- !is_base_of<_T,
+typename __4th_helper<_T1, _Rp,
+ !is_base_of<_Tp,
typename remove_reference<_T1>::type
>::value
>::type&
-__invoke(_R _T::* __f, _T1& __t1)
+__invoke(_Rp _Tp::* __f, _T1& __t1)
{
return (*__t1).*__f;
}
-// template <class _D, class _R, class _T, class _T1>
+// template <class _Dp, class _Rp, class _Tp, class _T1>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// !is_base_of<_T, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_R _T::*, _T1>::type
+// !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
+// typename __ref_return1<_Rp _Tp::*, _T1>::type
// >::type
-// __invoke(_R _T::* __f, _T1 __t1)
+// __invoke(_Rp _Tp::* __f, _T1 __t1)
// {
// return (*__t1).*__f;
// }
// fifth bullet
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()())
-__invoke(_F __f)
+decltype(declval<_Fp>()())
+__invoke(_Fp __f)
{
return __f();
}
-template <class _F, class _A0>
+template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>()))
-__invoke(_F __f, _A0& __a0)
+decltype(declval<_Fp>()(declval<_A0&>()))
+__invoke(_Fp __f, _A0& __a0)
{
return __f(__a0);
}
-template <class _F, class _A0, class _A1>
+template <class _Fp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>()))
-__invoke(_F __f, _A0& __a0, _A1& __a1)
+decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>()))
+__invoke(_Fp __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
}
-template <class _F, class _A0, class _A1, class _A2>
+template <class _Fp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_F>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
-__invoke(_F __f, _A0& __a0, _A1& __a1, _A2& __a2)
+decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
+__invoke(_Fp __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
}
-// template <class _R, class _F>
+// template <class _Rp, class _Fp>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f)
+// _Rp
+// __invoke(_Fp& __f)
// {
// return __f();
// }
//
-// template <class _R, class _F, class _A0>
+// template <class _Rp, class _Fp, class _A0>
// inline _LIBCPP_INLINE_VISIBILITY
// typename enable_if
// <
-// !is_member_pointer<_F>::value,
-// _R
+// !is_member_pointer<_Fp>::value,
+// _Rp
// >::type
-// __invoke(_F& __f, _A0& __a0)
+// __invoke(_Fp& __f, _A0& __a0)
// {
// return __f(__a0);
// }
//
-// template <class _R, class _F, class _A0, class _A1>
+// template <class _Rp, class _Fp, class _A0, class _A1>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f, _A0& __a0, _A1& __a1)
+// _Rp
+// __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
// {
// return __f(__a0, __a1);
// }
//
-// template <class _R, class _F, class _A0, class _A1, class _A2>
+// template <class _Rp, class _Fp, class _A0, class _A1, class _A2>
// inline _LIBCPP_INLINE_VISIBILITY
-// _R
-// __invoke(_F& __f, _A0& __a0, _A1& __a1, _A2& __a2)
+// _Rp
+// __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
// {
// return __f(__a0, __a1, __a2);
// }
@@ -950,16 +950,16 @@ public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
-template <class _F, bool = __has_result_type<__weak_result_type<_F> >::value>
+template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
struct __invoke_return
{
- typedef typename __weak_result_type<_F>::result_type type;
+ typedef typename __weak_result_type<_Fp>::result_type type;
};
-template <class _F>
-struct __invoke_return<_F, false>
+template <class _Fp>
+struct __invoke_return<_Fp, false>
{
- typedef decltype(__invoke(_VSTD::declval<_F>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Fp>())) type;
};
template <class _Tp, class _A0>
@@ -968,16 +968,16 @@ struct __invoke_return0
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type;
};
-template <class _R, class _T, class _A0>
-struct __invoke_return0<_R _T::*, _A0>
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0>
{
- typedef typename __apply_cv<_A0, _R>::type& type;
+ typedef typename __apply_cv<_A0, _Rp>::type& type;
};
-template <class _R, class _T, class _A0>
-struct __invoke_return0<_R _T::*, _A0*>
+template <class _Rp, class _Tp, class _A0>
+struct __invoke_return0<_Rp _Tp::*, _A0*>
{
- typedef typename __apply_cv<_A0, _R>::type& type;
+ typedef typename __apply_cv<_A0, _Rp>::type& type;
};
template <class _Tp, class _A0, class _A1>
diff --git a/include/__hash_table b/include/__hash_table
index 4399caad658b..fad4e0e6ad4a 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -18,6 +18,8 @@
#include <algorithm>
#include <cmath>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -473,7 +475,6 @@ public:
public:
// Create __node
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
- typedef typename __node::__first_node __first_node;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -484,6 +485,7 @@ public:
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
+ typedef __hash_node_base<__node_pointer> __first_node;
private:
@@ -602,15 +604,15 @@ public:
pair<iterator, bool> __insert_unique(const value_type& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P>
- pair<iterator, bool> __insert_unique(_P&& __x);
+ template <class _Pp>
+ pair<iterator, bool> __insert_unique(_Pp&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P>
- iterator __insert_multi(_P&& __x);
- template <class _P>
- iterator __insert_multi(const_iterator __p, _P&& __x);
+ template <class _Pp>
+ iterator __insert_multi(_Pp&& __x);
+ template <class _Pp>
+ iterator __insert_multi(const_iterator __p, _Pp&& __x);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator __insert_multi(const value_type& __x);
iterator __insert_multi(const_iterator __p, const value_type& __x);
@@ -642,8 +644,8 @@ public:
template <class _Key>
const_iterator find(const _Key& __x) const;
- typedef __hash_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __hash_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
iterator erase(const_iterator __p);
iterator erase(const_iterator __first, const_iterator __last);
@@ -721,7 +723,7 @@ private:
__node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __hash_table& __u, false_type) {}
+ void __copy_assign_alloc(const __hash_table&, false_type) {}
void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type)
@@ -750,37 +752,37 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y)
+ __swap_alloc(_Ap& __x, _Ap& __y)
_NOEXCEPT_(
- !allocator_traits<_A>::propagate_on_container_swap::value ||
- __is_nothrow_swappable<_A>::value)
+ !allocator_traits<_Ap>::propagate_on_container_swap::value ||
+ __is_nothrow_swappable<_Ap>::value)
{
__swap_alloc(__x, __y,
integral_constant<bool,
- allocator_traits<_A>::propagate_on_container_swap::value
+ allocator_traits<_Ap>::propagate_on_container_swap::value
>());
}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y, true_type)
- _NOEXCEPT_(__is_nothrow_swappable<_A>::value)
+ __swap_alloc(_Ap& __x, _Ap& __y, true_type)
+ _NOEXCEPT_(__is_nothrow_swappable<_Ap>::value)
{
using _VSTD::swap;
swap(__x, __y);
}
- template <class _A>
+ template <class _Ap>
_LIBCPP_INLINE_VISIBILITY
static
void
- __swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {}
+ __swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {}
void __deallocate(__node_pointer __np) _NOEXCEPT;
__node_pointer __detach() _NOEXCEPT;
@@ -1420,11 +1422,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
{
- __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1436,23 +1438,23 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
-__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
+__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x)
{
- __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-template <class _P>
+template <class _Pp>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
- _P&& __x)
+ _Pp&& __x)
{
- __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
+ __node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x));
iterator __r = __node_insert_multi(__p, __h.get());
__h.release();
return __r;
@@ -1614,7 +1616,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
@@ -1630,7 +1632,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
size_t __hash)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
@@ -1645,7 +1647,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
@@ -1661,7 +1663,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
size_t __hash)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
@@ -1756,7 +1758,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr;
--size();
- return __node_holder(__cn, _D(__node_alloc(), true));
+ return __node_holder(__cn, _Dp(__node_alloc(), true));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
diff --git a/include/__locale b/include/__locale
index 28cb3ef65292..b1e07113e7d4 100644
--- a/include/__locale
+++ b/include/__locale
@@ -21,7 +21,7 @@
#include <locale.h>
#if _WIN32
# include <support/win32/locale_win32.h>
-#elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
+#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
@@ -240,7 +240,7 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p)
{
- __h = (__h << 4) + *__p;
+ __h = (__h << 4) + static_cast<size_t>(*__p);
size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr);
}
@@ -348,7 +348,19 @@ public:
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B;
-#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
+#elif __sun__
+ typedef unsigned int mask;
+ static const mask space = _ISSPACE;
+ static const mask print = _ISPRINT;
+ static const mask cntrl = _ISCNTRL;
+ static const mask upper = _ISUPPER;
+ static const mask lower = _ISLOWER;
+ static const mask alpha = _ISALPHA;
+ static const mask digit = _ISDIGIT;
+ static const mask punct = _ISPUNCT;
+ static const mask xdigit = _ISXDIGIT;
+ static const mask blank = _ISBLANK;
+#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __sun__
typedef unsigned long mask;
static const mask space = 1<<0;
static const mask print = 1<<1;
@@ -485,14 +497,14 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
- return isascii(__c) ? __tab_[__c] & __m : false;
+ return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false;
}
_LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{
for (; __low != __high; ++__low, ++__vec)
- *__vec = isascii(*__low) ? __tab_[*__low] : 0;
+ *__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0;
return __low;
}
@@ -500,7 +512,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
- if (isascii(*__low) && (__tab_[*__low] & __m))
+ if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))
break;
return __low;
}
@@ -509,7 +521,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{
for (; __low != __high; ++__low)
- if (!(isascii(*__low) && (__tab_[*__low] & __m)))
+ if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)))
break;
return __low;
}
@@ -1123,7 +1135,7 @@ extern template class codecvt_byname<char32_t, char, mbstate_t>;
_LIBCPP_VISIBLE void __throw_runtime_error(const char*);
-template <size_t _N>
+template <size_t _Np>
struct __narrow_to_utf8
{
template <class _OutputIterator, class _CharT>
@@ -1213,7 +1225,7 @@ struct __narrow_to_utf8<32>
}
};
-template <size_t _N>
+template <size_t _Np>
struct __widen_from_utf8
{
template <class _OutputIterator>
diff --git a/include/__mutex_base b/include/__mutex_base
index 55687659a03a..5410272b4c99 100644
--- a/include/__mutex_base
+++ b/include/__mutex_base
@@ -207,7 +207,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
-// explicit
+ _LIBCPP_EXPLICIT
operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const {return __m_;}
diff --git a/include/__split_buffer b/include/__split_buffer
index 33ce42da31a4..e0aa13b89883 100644
--- a/include/__split_buffer
+++ b/include/__split_buffer
@@ -6,6 +6,8 @@
#include <type_traits>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -93,7 +95,7 @@ public:
void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
- void push_back(const_reference __x);
+ _LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x);
void push_back(value_type&& __x);
@@ -131,8 +133,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
- {__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
+ {__destruct_at_end(__new_last, false_type());}
+ _LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x)
@@ -150,7 +154,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
+ void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -169,7 +173,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
+ static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT
{}
};
@@ -285,7 +289,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
- while (__begin_ < __new_begin)
+ while (__begin_ != __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++);
}
@@ -302,7 +306,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
- while (__new_last < __end_)
+ while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), --__end_);
}
@@ -390,8 +394,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap;
- typedef move_iterator<iterator> _I;
- __construct_at_end(_I(__c.begin()), _I(__c.end()));
+ typedef move_iterator<iterator> _Ip;
+ __construct_at_end(_Ip(__c.begin()), _Ip(__c.end()));
}
}
@@ -488,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
}
else
{
- size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -519,7 +523,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
}
else
{
- size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -552,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
}
else
{
- size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -583,7 +587,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
}
else
{
- size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
@@ -616,7 +620,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
}
else
{
- size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
+ size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_));
diff --git a/include/__sso_allocator b/include/__sso_allocator
index 16354d83cc5b..7240072cafdf 100644
--- a/include/__sso_allocator
+++ b/include/__sso_allocator
@@ -21,20 +21,20 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
+template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator;
-template <size_t _N>
-class _LIBCPP_HIDDEN __sso_allocator<void, _N>
+template <size_t _Np>
+class _LIBCPP_HIDDEN __sso_allocator<void, _Np>
{
public:
typedef const void* const_pointer;
typedef void value_type;
};
-template <class _Tp, size_t _N>
+template <class _Tp, size_t _Np>
class _LIBCPP_HIDDEN __sso_allocator
{
- typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
+ typename aligned_storage<sizeof(_Tp) * _Np>::type buf_;
bool __allocated_;
public:
typedef size_t size_type;
@@ -43,14 +43,14 @@ public:
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
- template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
+ template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw()
: __allocated_(false) {}
private:
__sso_allocator& operator=(const __sso_allocator&);
public:
- _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _N>::const_pointer = 0)
+ _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
{
- if (!__allocated_ && __n <= _N)
+ if (!__allocated_ && __n <= _Np)
{
__allocated_ = true;
return (pointer)&buf_;
diff --git a/include/__std_stream b/include/__std_stream
index 6df6556da767..e562e2c47304 100644
--- a/include/__std_stream
+++ b/include/__std_stream
@@ -17,13 +17,15 @@
#include <__locale>
#include <cstdio>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-static const unsigned __limit = 8;
+static const int __limit = 8;
// __stdinbuf
@@ -102,7 +104,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
{
- char __c = getc(__file_);
+ int __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c);
@@ -129,7 +131,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
if (__nread == sizeof(__extbuf))
return traits_type::eof();
{
- char __c = getc(__file_);
+ int __c = getc(__file_);
if (__c == EOF)
return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c);
@@ -266,7 +268,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial)
{
this->setp((char_type*)__e, this->pptr());
- this->pbump(this->epptr() - this->pbase());
+ this->pbump(static_cast<int>(this->epptr() - this->pbase()));
}
}
else
diff --git a/include/__tree b/include/__tree
index ad5d2f4b8eaa..f57c80c850e2 100644
--- a/include/__tree
+++ b/include/__tree
@@ -932,14 +932,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
- template <class _V>
- pair<iterator, bool> __insert_unique(_V&& __v);
- template <class _V>
- iterator __insert_unique(const_iterator __p, _V&& __v);
- template <class _V>
- iterator __insert_multi(_V&& __v);
- template <class _V>
- iterator __insert_multi(const_iterator __p, _V&& __v);
+ template <class _Vp>
+ pair<iterator, bool> __insert_unique(_Vp&& __v);
+ template <class _Vp>
+ iterator __insert_unique(const_iterator __p, _Vp&& __v);
+ template <class _Vp>
+ iterator __insert_multi(_Vp&& __v);
+ template <class _Vp>
+ iterator __insert_multi(const_iterator __p, _Vp&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -1021,8 +1021,8 @@ public:
pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const;
- typedef __tree_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __tree_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
__node_holder remove(const_iterator __p) _NOEXCEPT;
private:
@@ -1711,7 +1711,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true;
return __h;
@@ -1781,11 +1781,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator>
-template <class _V>
+template <class _Vp>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
-__tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
{
- __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
+ __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1793,11 +1793,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _V>
+template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
+__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v)
{
- __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
+ __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get())
__h.release();
@@ -1805,11 +1805,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _V>
+template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
{
- __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
+ __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1817,11 +1817,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
}
template <class _Tp, class _Compare, class _Allocator>
-template <class _V>
+template <class _Vp>
typename __tree<_Tp, _Compare, _Allocator>::iterator
-__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
+__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
{
- __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
+ __node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get());
@@ -1835,7 +1835,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{
__node_allocator& __na = __node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_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);
@@ -2053,7 +2053,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
{
- typedef pair<const_iterator, const_iterator> _P;
+ typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2160,7 +2160,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
{
- typedef pair<iterator, iterator> _P;
+ typedef pair<iterator, iterator> _Pp;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2173,13 +2173,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
- return _P(iterator(__rt),
+ return _Pp(iterator(__rt),
iterator(
__rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result));
}
- return _P(iterator(__result), iterator(__result));
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2188,7 +2188,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
{
- typedef pair<const_iterator, const_iterator> _P;
+ typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2201,13 +2201,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
- return _P(const_iterator(__rt),
+ return _Pp(const_iterator(__rt),
const_iterator(
__rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result));
}
- return _P(const_iterator(__result), const_iterator(__result));
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2216,7 +2216,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
{
- typedef pair<iterator, iterator> _P;
+ typedef pair<iterator, iterator> _Pp;
__node_pointer __result = __end_node();
__node_pointer __rt = __root();
while (__rt != nullptr)
@@ -2229,10 +2229,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_);
else
- return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
+ return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
}
- return _P(iterator(__result), iterator(__result));
+ return _Pp(iterator(__result), iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2241,7 +2241,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
{
- typedef pair<const_iterator, const_iterator> _P;
+ typedef pair<const_iterator, const_iterator> _Pp;
__node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root();
while (__rt != nullptr)
@@ -2254,10 +2254,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_);
else
- return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
+ return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
}
- return _P(const_iterator(__result), const_iterator(__result));
+ return _Pp(const_iterator(__result), const_iterator(__result));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2275,7 +2275,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
--size();
__tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np));
- return __node_holder(__np, _D(__node_alloc()));
+ return __node_holder(__np, _Dp(__node_alloc()));
}
template <class _Tp, class _Compare, class _Allocator>
diff --git a/include/__tuple b/include/__tuple
index 15193b4d1074..3b2be1c5a74d 100644
--- a/include/__tuple
+++ b/include/__tuple
@@ -65,7 +65,7 @@ public:
};
template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
-template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
+template <class _T1, class _T2> struct _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {};
diff --git a/include/__undef_min_max b/include/__undef_min_max
new file mode 100644
index 000000000000..88bc53feaaf8
--- /dev/null
+++ b/include/__undef_min_max
@@ -0,0 +1,19 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef min
+#warning: macro min is incompatible with C++. #undef'ing min
+#undef min
+#endif
+
+#ifdef max
+#warning: macro max is incompatible with C++. #undef'ing max
+#undef max
+#endif
diff --git a/include/algorithm b/include/algorithm
index a89b9dd65eab..f9c6843a60a7 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -595,6 +595,8 @@ template <class BidirectionalIterator, class Compare>
#include <iterator>
#include <cstdlib>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -695,14 +697,48 @@ struct __debug_less
#endif // _LIBCPP_DEBUG2
// Precondition: __x != 0
-inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long __ctz(unsigned long __x) {return __builtin_ctzl (__x);}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long long __ctz(unsigned long long __x) {return __builtin_ctzll(__x);}
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned
+__ctz(unsigned __x)
+{
+ return static_cast<unsigned>(__builtin_ctz(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__ctz(unsigned long __x)
+{
+ return static_cast<unsigned long>(__builtin_ctzl(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__ctz(unsigned long long __x)
+{
+ return static_cast<unsigned long long>(__builtin_ctzll(__x));
+}
// Precondition: __x != 0
-inline _LIBCPP_INLINE_VISIBILITY unsigned __clz(unsigned __x) {return __builtin_clz (__x);}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long __clz(unsigned long __x) {return __builtin_clzl (__x);}
-inline _LIBCPP_INLINE_VISIBILITY unsigned long long __clz(unsigned long long __x) {return __builtin_clzll(__x);}
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned
+__clz(unsigned __x)
+{
+ return static_cast<unsigned>(__builtin_clz(__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long
+__clz(unsigned long __x)
+{
+ return static_cast<unsigned long>(__builtin_clzl (__x));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+unsigned long long
+__clz(unsigned long long __x)
+{
+ return static_cast<unsigned long long>(__builtin_clzll(__x));
+}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
@@ -2328,10 +2364,7 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
if (++__first != __last)
{
if (__comp(*__first, *__result.first))
- {
- __result.second = __result.first;
__result.first = __first;
- }
else
__result.second = __first;
while (++__first != __last)
@@ -2423,29 +2456,29 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
// __independent_bits_engine
-template <unsigned long long _X, size_t _R>
+template <unsigned long long _Xp, size_t _Rp>
struct __log2_imp
{
- static const size_t value = _X & ((unsigned long long)(1) << _R) ? _R
- : __log2_imp<_X, _R - 1>::value;
+ static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp
+ : __log2_imp<_Xp, _Rp - 1>::value;
};
-template <unsigned long long _X>
-struct __log2_imp<_X, 0>
+template <unsigned long long _Xp>
+struct __log2_imp<_Xp, 0>
{
static const size_t value = 0;
};
-template <size_t _R>
-struct __log2_imp<0, _R>
+template <size_t _Rp>
+struct __log2_imp<0, _Rp>
{
- static const size_t value = _R + 1;
+ static const size_t value = _Rp + 1;
};
-template <class _UI, _UI _X>
+template <class _UI, _UI _Xp>
struct __log2
{
- static const size_t value = __log2_imp<_X,
+ static const size_t value = __log2_imp<_Xp,
sizeof(_UI) * __CHAR_BIT__ - 1>::value;
};
@@ -2475,9 +2508,9 @@ private:
_Engine_result_type __mask0_;
_Engine_result_type __mask1_;
- static const _Working_result_type _R = _Engine::_Max - _Engine::_Min
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
- static const size_t __m = __log2<_Working_result_type, _R>::value;
+ static const size_t __m = __log2<_Working_result_type, _Rp>::value;
static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
@@ -2486,7 +2519,7 @@ public:
__independent_bits_engine(_Engine& __e, size_t __w);
// generating functions
- result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
+ result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
private:
result_type __eval(false_type);
@@ -2501,24 +2534,24 @@ __independent_bits_engine<_Engine, _UIntType>
{
__n_ = __w_ / __m + (__w_ % __m != 0);
__w0_ = __w_ / __n_;
- if (_R == 0)
- __y0_ = _R;
+ if (_Rp == 0)
+ __y0_ = _Rp;
else if (__w0_ < _WDt)
- __y0_ = (_R >> __w0_) << __w0_;
+ __y0_ = (_Rp >> __w0_) << __w0_;
else
__y0_ = 0;
- if (_R - __y0_ > __y0_ / __n_)
+ if (_Rp - __y0_ > __y0_ / __n_)
{
++__n_;
__w0_ = __w_ / __n_;
if (__w0_ < _WDt)
- __y0_ = (_R >> __w0_) << __w0_;
+ __y0_ = (_Rp >> __w0_) << __w0_;
else
__y0_ = 0;
}
__n0_ = __n_ - __w_ % __n_;
if (__w0_ < _WDt - 1)
- __y1_ = (_R >> (__w0_ + 1)) << (__w0_ + 1);
+ __y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1);
else
__y1_ = 0;
__mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
@@ -2540,7 +2573,7 @@ template<class _Engine, class _UIntType>
_UIntType
__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{
- result_type _S = 0;
+ result_type _Sp = 0;
for (size_t __k = 0; __k < __n0_; ++__k)
{
_Engine_result_type __u;
@@ -2549,10 +2582,10 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
__u = __e_() - _Engine::min();
} while (__u >= __y0_);
if (__w0_ < _WDt)
- _S <<= __w0_;
+ _Sp <<= __w0_;
else
- _S = 0;
- _S += __u & __mask0_;
+ _Sp = 0;
+ _Sp += __u & __mask0_;
}
for (size_t __k = __n0_; __k < __n_; ++__k)
{
@@ -2562,12 +2595,12 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
__u = __e_() - _Engine::min();
} while (__u >= __y1_);
if (__w0_ < _WDt - 1)
- _S <<= __w0_ + 1;
+ _Sp <<= __w0_ + 1;
else
- _S = 0;
- _S += __u & __mask1_;
+ _Sp = 0;
+ _Sp += __u & __mask1_;
}
- return _S;
+ return _Sp;
}
// uniform_int_distribution
@@ -2640,22 +2673,22 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
{
typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t),
uint32_t, uint64_t>::type _UIntType;
- const _UIntType _R = __p.b() - __p.a() + _UIntType(1);
- if (_R == 1)
+ const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1);
+ if (_Rp == 1)
return __p.a();
const size_t _Dt = numeric_limits<_UIntType>::digits;
typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
- if (_R == 0)
+ if (_Rp == 0)
return static_cast<result_type>(_Eng(__g, _Dt)());
- size_t __w = _Dt - __clz(_R) - 1;
- if ((_R & (_UIntType(~0) >> (_Dt - __w))) != 0)
+ size_t __w = _Dt - __clz(_Rp) - 1;
+ if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0)
++__w;
_Eng __e(__g, __w);
_UIntType __u;
do
{
__u = __e();
- } while (__u >= _R);
+ } while (__u >= _Rp);
return static_cast<result_type>(__u + __p.a());
}
@@ -2679,8 +2712,8 @@ public:
result_type operator()();
- static const/*expr*/ result_type min() {return _Min;}
- static const/*expr*/ result_type max() {return _Max;}
+ static constexpr result_type min() {return _Min;}
+ static constexpr result_type max() {return _Max;}
friend __rs_default __rs_get();
};
@@ -2692,16 +2725,16 @@ void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _D;
- typedef typename _D::param_type _P;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
difference_type __d = __last - __first;
if (__d > 1)
{
- _D __uid;
+ _Dp __uid;
__rs_default __g = __rs_get();
for (--__last, --__d; __first < __last; ++__first, --__d)
{
- difference_type __i = __uid(__g, _P(0, __d));
+ difference_type __i = __uid(__g, _Pp(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
@@ -2738,15 +2771,15 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
#endif
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
- typedef uniform_int_distribution<ptrdiff_t> _D;
- typedef typename _D::param_type _P;
+ typedef uniform_int_distribution<ptrdiff_t> _Dp;
+ typedef typename _Dp::param_type _Pp;
difference_type __d = __last - __first;
if (__d > 1)
{
- _D __uid;
+ _Dp __uid;
for (--__last, --__d; __first < __last; ++__first, --__d)
{
- difference_type __i = __uid(__g, _P(0, __d));
+ difference_type __i = __uid(__g, _Pp(0, __d));
if (__i != difference_type(0))
swap(*__first, *(__first + __i));
}
@@ -3722,7 +3755,7 @@ extern template bool __insertion_sort_incomplete<__less<long double>&, long doub
extern template unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&);
#ifdef _MSC_VER
#pragma warning( pop )
-#endif _MSC_VER
+#endif // _MSC_VER
// lower_bound
@@ -4718,6 +4751,8 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
while (true)
{
__restart:
+ if (__nth == __last)
+ return;
difference_type __len = __last - __first;
switch (__len)
{
diff --git a/include/atomic b/include/atomic
index 244f42d0aafa..f2e428a2611a 100644
--- a/include/atomic
+++ b/include/atomic
@@ -555,7 +555,7 @@ kill_dependency(_Tp __y)
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
struct __atomic_base // false
{
- _Tp __a_;
+ _Atomic(_Tp) __a_;
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile
@@ -621,7 +621,7 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
__atomic_base() {} // = default;
_LIBCPP_INLINE_VISIBILITY
- /*constexpr*/ __atomic_base(_Tp __d) : __a_(__d) {}
+ /*constexpr*/ __atomic_base(_Tp __d) { __atomic_store(&__a_, __d, memory_order_seq_cst); }
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
__atomic_base(const __atomic_base&) = delete;
__atomic_base& operator=(const __atomic_base&) = delete;
@@ -820,7 +820,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
atomic_init(volatile atomic<_Tp>* __o, _Tp __d)
{
- __o->__a_ = __d;
+ __atomic_store(&__o->__a_, __d, memory_order_seq_cst);
}
template <class _Tp>
@@ -828,7 +828,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void
atomic_init(atomic<_Tp>* __o, _Tp __d)
{
- __o->__a_ = __d;
+ __atomic_store(&__o->__a_, __d, memory_order_seq_cst);
}
// atomic_store
@@ -1348,7 +1348,7 @@ atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m)
typedef struct atomic_flag
{
- bool __a_;
+ _Atomic(bool) __a_;
_LIBCPP_INLINE_VISIBILITY
bool test_and_set(memory_order __m = memory_order_seq_cst) volatile
@@ -1366,7 +1366,7 @@ typedef struct atomic_flag
_LIBCPP_INLINE_VISIBILITY
atomic_flag() {} // = default;
_LIBCPP_INLINE_VISIBILITY
- atomic_flag(bool __b) : __a_(__b) {}
+ atomic_flag(bool __b) { __atomic_store(&__a_, __b, memory_order_seq_cst); }
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
atomic_flag(const atomic_flag&) = delete;
diff --git a/include/bitset b/include/bitset
index c970f3290717..6e12e5ccc515 100644
--- a/include/bitset
+++ b/include/bitset
@@ -129,6 +129,8 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <cassert>
#endif
+#include <__undef_min_max>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
@@ -211,7 +213,7 @@ __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
template <size_t _N_words, size_t _Size>
void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
+__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
{
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
@@ -224,7 +226,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
void
-__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
+__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
{
__first_[0] = __v;
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
@@ -558,7 +560,7 @@ protected:
friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>;
- friend class __bit_array<__bitset>;
+ friend struct __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference;
@@ -572,9 +574,9 @@ protected:
{return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);}
- _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
{return iterator(0, 0);}
- _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
{return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
@@ -693,11 +695,11 @@ bitset<_Size>::bitset(const _CharT* __str,
#else
assert(!"bitset string ctor has invalid argument");
#endif
- size_t _M = _VSTD::min(__rlen, _Size);
+ size_t _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0;
- for (; __i < _M; ++__i)
+ for (; __i < _Mp; ++__i)
{
- _CharT __c = __str[_M - 1 - __i];
+ _CharT __c = __str[_Mp - 1 - __i];
if (__c == __zero)
(*this)[__i] = false;
else
@@ -727,11 +729,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else
assert(!"bitset string ctor has invalid argument");
#endif
- size_t _M = _VSTD::min(__rlen, _Size);
+ size_t _Mp = _VSTD::min(__rlen, _Size);
size_t __i = 0;
- for (; __i < _M; ++__i)
+ for (; __i < _Mp; ++__i)
{
- _CharT __c = __str[__pos + _M - 1 - __i];
+ _CharT __c = __str[__pos + _Mp - 1 - __i];
if (_Traits::eq(__c, __zero))
(*this)[__i] = false;
else
diff --git a/include/chrono b/include/chrono
index 1c79f4bbe809..0571f9dff7e4 100644
--- a/include/chrono
+++ b/include/chrono
@@ -255,6 +255,8 @@ typedef steady_clock high_resolution_clock;
#include <ratio>
#include <limits>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/cmath b/include/cmath
index ab67112ef172..026889f81e5b 100644
--- a/include/cmath
+++ b/include/cmath
@@ -653,6 +653,8 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_floating_point<_A1>::value, _A1>::type
abs(_A1 __x) {return fabs(__x);}
+#ifndef __sun__
+
// acos
using ::acos;
@@ -769,16 +771,20 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
cosh(_A1 __x) {return cosh((double)__x);}
+#endif // __sun__
// exp
using ::exp;
using ::expf;
+#ifndef __sun__
+
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) {return expf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) {return expl(__x);}
#endif
+
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
@@ -816,8 +822,10 @@ floor(_A1 __x) {return floor((double)__x);}
// fmod
+#endif //__sun__
using ::fmod;
using ::fmodf;
+#ifndef __sun__
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);}
@@ -840,6 +848,7 @@ fmod(_A1 __x, _A2 __y)
return fmod((__result_type)__x, (__result_type)__y);
}
+
// frexp
using ::frexp;
@@ -872,8 +881,10 @@ ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
// log
+#endif // __sun__
using ::log;
using ::logf;
+#ifndef __sun__
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);}
@@ -885,6 +896,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
log(_A1 __x) {return log((double)__x);}
+
// log10
using ::log10;
@@ -912,9 +924,12 @@ inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double*
// pow
+#endif // __sun__
using ::pow;
using ::powf;
+#ifndef __sun__
+
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) {return powf(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) {return powl(__x, __y);}
@@ -936,6 +951,7 @@ pow(_A1 __x, _A2 __y)
return pow((__result_type)__x, (__result_type)__y);
}
+
// sin
using ::sin;
@@ -968,10 +984,12 @@ sinh(_A1 __x) {return sinh((double)__x);}
// sqrt
+#endif // __sun__
using ::sqrt;
using ::sqrtf;
-#ifndef _MSC_VER
+
+#if !(defined(_MSC_VER) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) {return sqrtf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) {return sqrtl(__x);}
#endif
@@ -985,6 +1003,7 @@ sqrt(_A1 __x) {return sqrt((double)__x);}
using ::tan;
using ::tanf;
+#ifndef __sun__
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);}
@@ -1294,11 +1313,13 @@ using ::lgammaf;
inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) {return lgammaf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) {return lgammal(__x);}
+
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
lgamma(_A1 __x) {return lgamma((double)__x);}
+
// llrint
using ::llrint;
@@ -1391,9 +1412,12 @@ typename enable_if<is_integral<_A1>::value, long>::type
lround(_A1 __x) {return lround((double)__x);}
// nan
-
+#endif // _MSC_VER
+#endif // __sun__
using ::nan;
using ::nanf;
+#ifndef __sun__
+#ifndef _MSC_VER
// nearbyint
@@ -1600,7 +1624,7 @@ using ::acoshl;
using ::asinhl;
using ::atanhl;
using ::cbrtl;
-#endif !_MSC_VER
+#endif // !_MSC_VER
using ::copysignl;
#ifndef _MSC_VER
using ::erfl;
@@ -1635,6 +1659,10 @@ using ::tgammal;
using ::truncl;
#endif // !_MSC_VER
+#else
+using ::lgamma;
+using ::lgammaf;
+#endif // __sun__
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CMATH
diff --git a/include/complex b/include/complex
index e7f63eac3a1e..3b660a35a9ab 100644
--- a/include/complex
+++ b/include/complex
@@ -282,7 +282,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
- _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
+ _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re)
+ {__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -340,7 +341,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
- _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
+ _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re)
+ {__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -395,7 +397,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
- _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
+ _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re)
+ {__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -450,7 +453,8 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
- _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
+ _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re)
+ {__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
diff --git a/include/cstddef b/include/cstddef
index 48317ba0063e..4a6b16e186b8 100644
--- a/include/cstddef
+++ b/include/cstddef
@@ -62,6 +62,7 @@ struct _LIBCPP_VISIBLE nullptr_t
struct __nat {int __for_bool_;};
+ _LIBCPP_ALWAYS_INLINE nullptr_t() {}
_LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
_LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
diff --git a/include/cstdlib b/include/cstdlib
index 5d8a9d73464b..1158db2c0aca 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -132,7 +132,8 @@ using ::wctomb;
using ::mbstowcs;
using ::wcstombs;
-#ifndef _MSC_VER // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
+// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
+#if !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
diff --git a/include/cstring b/include/cstring
index dd49d802d5e0..13bb11892dc3 100644
--- a/include/cstring
+++ b/include/cstring
@@ -94,7 +94,7 @@ using ::strspn;
using ::strstr;
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
-#if !defined(__GLIBC__) && !defined(_MSC_VER)
+#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}
diff --git a/include/deque b/include/deque
index ab9ba58b0286..e65acfc806d4 100644
--- a/include/deque
+++ b/include/deque
@@ -162,6 +162,8 @@ template <class T, class Allocator>
#include <algorithm>
#include <stdexcept>
+#include <__undef_min_max>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base;
@@ -278,10 +280,10 @@ public:
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
- template <class _P, class _R, class _MP>
+ template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
- __deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
- typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
+ __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
+ typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
@@ -407,9 +409,9 @@ private:
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
: __m_iter_(__m), __ptr_(__p) {}
- template <class _Tp, class _A> friend class __deque_base;
- template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
- template <class _V, class _P, class _R, class _MP, class _D, _D>
+ template <class _Tp, class _Ap> friend class __deque_base;
+ template <class _Tp, class _Ap> friend class _LIBCPP_VISIBLE deque;
+ template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
friend class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter,
@@ -986,7 +988,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
+ void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY
@@ -1005,7 +1007,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
+ static void __swap_alloc(allocator_type&, allocator_type&, false_type)
_NOEXCEPT
{}
};
@@ -1401,7 +1403,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const deque& __c, false_type)
+ void __copy_assign_alloc(const deque&, false_type)
{}
void __move_assign(deque& __c, true_type)
@@ -1508,8 +1510,8 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
{
if (__a != __c.__alloc())
{
- typedef move_iterator<iterator> _I;
- assign(_I(__c.begin()), _I(__c.end()));
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
}
}
@@ -1531,8 +1533,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
{
if (__base::__alloc() != __c.__alloc())
{
- typedef move_iterator<iterator> _I;
- assign(_I(__c.begin()), _I(__c.end()));
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
}
else
__move_assign(__c, true_type());
diff --git a/include/exception b/include/exception
index 0a747f50fb3d..f7c3b70b00ea 100644
--- a/include/exception
+++ b/include/exception
@@ -132,7 +132,7 @@ public:
~exception_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
- // explicit
+ _LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY
@@ -146,9 +146,9 @@ public:
_ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
};
-template<class _E>
+template<class _Ep>
exception_ptr
-make_exception_ptr(_E __e) _NOEXCEPT
+make_exception_ptr(_Ep __e) _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -224,11 +224,11 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif
}
-template <class _E>
+template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _E& __e, typename enable_if<
- is_polymorphic<_E>::value
+rethrow_if_nested(const _Ep& __e, typename enable_if<
+ is_polymorphic<_Ep>::value
>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
@@ -236,11 +236,11 @@ rethrow_if_nested(const _E& __e, typename enable_if<
__nep->rethrow_nested();
}
-template <class _E>
+template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _E& __e, typename enable_if<
- !is_polymorphic<_E>::value
+rethrow_if_nested(const _Ep&, typename enable_if<
+ !is_polymorphic<_Ep>::value
>::type* = 0)
{
}
diff --git a/include/ext/hash_map b/include/ext/hash_map
index 9e62e7a777d6..bebdccb3c41c 100644
--- a/include/ext/hash_map
+++ b/include/ext/hash_map
@@ -215,7 +215,11 @@ namespace __gnu_cxx {
using namespace std;
-template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
+template <class _Tp, class _Hash, bool = is_empty<_Hash>::value
+#if __has_feature(is_final)
+ && !__is_final(_Hash)
+#endif
+ >
class __hash_map_hasher
: private _Hash
{
@@ -247,7 +251,11 @@ public:
{return __hash_(__x);}
};
-template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
+template <class _Tp, class _Pred, bool = is_empty<_Pred>::value
+#if __has_feature(is_final)
+ && !__is_final(_Pred)
+#endif
+ >
class __hash_map_equal
: private _Pred
{
@@ -499,8 +507,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
@@ -671,7 +679,7 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -776,8 +784,8 @@ private:
typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node;
- typedef __hash_map_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __hash_map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits;
public:
typedef typename __alloc_traits::pointer pointer;
diff --git a/include/forward_list b/include/forward_list
index 61fe290d9e2f..19f748478f5d 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -174,6 +174,8 @@ template <class T, class Allocator>
#include <iterator>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -770,8 +772,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_)
{
@@ -846,8 +848,8 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
{
if (base::__alloc() != __x.__alloc())
{
- typedef move_iterator<iterator> _I;
- insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
+ typedef move_iterator<iterator> _Ip;
+ insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end()));
}
}
@@ -904,8 +906,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type());
else
{
- typedef move_iterator<iterator> _I;
- assign(_I(__x.begin()), _I(__x.end()));
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__x.begin()), _Ip(__x.end()));
}
}
@@ -993,8 +995,8 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_;
@@ -1008,8 +1010,8 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -1022,8 +1024,8 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release();
@@ -1050,8 +1052,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_;
@@ -1067,8 +1069,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -1083,8 +1085,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
{
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_;
__r->__next_ = __h.release();
@@ -1100,8 +1102,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
@@ -1150,8 +1152,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release();
__node_pointer __last = __first;
@@ -1242,8 +1244,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
@@ -1274,8 +1276,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_)
{
@@ -1567,12 +1569,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y)
{
- typedef forward_list<_Tp, _Alloc> _C;
- typedef typename _C::const_iterator _I;
- _I __ix = __x.begin();
- _I __ex = __x.end();
- _I __iy = __y.begin();
- _I __ey = __y.end();
+ typedef forward_list<_Tp, _Alloc> _Cp;
+ typedef typename _Cp::const_iterator _Ip;
+ _Ip __ix = __x.begin();
+ _Ip __ex = __x.end();
+ _Ip __iy = __y.begin();
+ _Ip __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy))
return false;
diff --git a/include/fstream b/include/fstream
index b6a2ab0e158a..8e1b1fb69e25 100644
--- a/include/fstream
+++ b/include/fstream
@@ -171,6 +171,8 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale>
#include <cstdio>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -547,7 +549,7 @@ basic_filebuf<_CharT, _Traits>::close()
{
__rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
- if ((__cm_ & ios_base::out) && sync())
+ if (sync())
__rt = 0;
if (fclose(__h.release()) == 0)
__file_ = 0;
diff --git a/include/functional b/include/functional
index 59b132c4515c..884a57773514 100644
--- a/include/functional
+++ b/include/functional
@@ -198,7 +198,7 @@ namespace placeholders {
.
.
.
- extern unspecified _M;
+ extern unspecified _Mp;
}
template <class Operation>
@@ -536,12 +536,7 @@ struct _LIBCPP_VISIBLE greater : binary_function<_Tp, _Tp, bool>
{return __x > __y;}
};
-template <class _Tp>
-struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
-{
- _LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
- {return __x < __y;}
-};
+// less in <__functional_base>
template <class _Tp>
struct _LIBCPP_VISIBLE greater_equal : binary_function<_Tp, _Tp, bool>
@@ -890,44 +885,44 @@ public:
}
};
-template<class _R, class _T>
+template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R _T::*>
-mem_fn(_R _T::* __pm)
+__mem_fn<_Rp _Tp::*>
+mem_fn(_Rp _Tp::* __pm)
{
- return __mem_fn<_R _T::*>(__pm);
+ return __mem_fn<_Rp _Tp::*>(__pm);
}
-template<class _R, class _T, class ..._Args>
+template<class _Rp, class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_Args...)>
-mem_fn(_R (_T::* __pm)(_Args...))
+__mem_fn<_Rp (_Tp::*)(_Args...)>
+mem_fn(_Rp (_Tp::* __pm)(_Args...))
{
- return __mem_fn<_R (_T::*)(_Args...)>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_Args...)>(__pm);
}
-template<class _R, class _T, class ..._Args>
+template<class _Rp, class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_Args...) const>
-mem_fn(_R (_T::* __pm)(_Args...) const)
+__mem_fn<_Rp (_Tp::*)(_Args...) const>
+mem_fn(_Rp (_Tp::* __pm)(_Args...) const)
{
- return __mem_fn<_R (_T::*)(_Args...) const>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_Args...) const>(__pm);
}
-template<class _R, class _T, class ..._Args>
+template<class _Rp, class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_Args...) volatile>
-mem_fn(_R (_T::* __pm)(_Args...) volatile)
+__mem_fn<_Rp (_Tp::*)(_Args...) volatile>
+mem_fn(_Rp (_Tp::* __pm)(_Args...) volatile)
{
- return __mem_fn<_R (_T::*)(_Args...) volatile>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_Args...) volatile>(__pm);
}
-template<class _R, class _T, class ..._Args>
+template<class _Rp, class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_R (_T::*)(_Args...) const volatile>
-mem_fn(_R (_T::* __pm)(_Args...) const volatile)
+__mem_fn<_Rp (_Tp::*)(_Args...) const volatile>
+mem_fn(_Rp (_Tp::* __pm)(_Args...) const volatile)
{
- return __mem_fn<_R (_T::*)(_Args...) const volatile>(__pm);
+ return __mem_fn<_Rp (_Tp::*)(_Args...) const volatile>(__pm);
}
// bad_function_call
@@ -942,32 +937,32 @@ template<class _Fp> class _LIBCPP_VISIBLE function; // undefined
namespace __function
{
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
struct __maybe_derive_from_unary_function
{
};
-template<class _R, class _A1>
-struct __maybe_derive_from_unary_function<_R(_A1)>
- : public unary_function<_A1, _R>
+template<class _Rp, class _A1>
+struct __maybe_derive_from_unary_function<_Rp(_A1)>
+ : public unary_function<_A1, _Rp>
{
};
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
struct __maybe_derive_from_binary_function
{
};
-template<class _R, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_R(_A1, _A2)>
- : public binary_function<_A1, _A2, _R>
+template<class _Rp, class _A1, class _A2>
+struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
+ : public binary_function<_A1, _A2, _Rp>
{
};
template<class _Fp> class __base;
-template<class _R, class ..._ArgTypes>
-class __base<_R(_ArgTypes...)>
+template<class _Rp, class ..._ArgTypes>
+class __base<_Rp(_ArgTypes...)>
{
__base(const __base&);
__base& operator=(const __base&);
@@ -978,7 +973,7 @@ public:
virtual void __clone(__base*) const = 0;
virtual void destroy() _NOEXCEPT = 0;
virtual void destroy_deallocate() _NOEXCEPT = 0;
- virtual _R operator()(_ArgTypes&& ...) = 0;
+ virtual _Rp operator()(_ArgTypes&& ...) = 0;
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const _NOEXCEPT = 0;
virtual const std::type_info& target_type() const _NOEXCEPT = 0;
@@ -987,139 +982,153 @@ public:
template<class _FD, class _Alloc, class _FB> class __func;
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
-class __func<_F, _Alloc, _R(_ArgTypes...)>
- : public __base<_R(_ArgTypes...)>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+class __func<_Fp, _Alloc, _Rp(_ArgTypes...)>
+ : public __base<_Rp(_ArgTypes...)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
_LIBCPP_INLINE_VISIBILITY
- explicit __func(_F __f) : __f_(_VSTD::move(__f)) {}
+ explicit __func(_Fp&& __f)
+ : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
+ _VSTD::forward_as_tuple()) {}
+ _LIBCPP_INLINE_VISIBILITY
+ explicit __func(const _Fp& __f, const _Alloc& __a)
+ : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f),
+ _VSTD::forward_as_tuple(__a)) {}
+
_LIBCPP_INLINE_VISIBILITY
- explicit __func(_F __f, _Alloc __a) : __f_(_VSTD::move(__f), _VSTD::move(__a)) {}
- virtual __base<_R(_ArgTypes...)>* __clone() const;
- virtual void __clone(__base<_R(_ArgTypes...)>*) const;
+ explicit __func(const _Fp& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, _VSTD::forward_as_tuple(__f),
+ _VSTD::forward_as_tuple(_VSTD::move(__a))) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ explicit __func(_Fp&& __f, _Alloc&& __a)
+ : __f_(piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__f)),
+ _VSTD::forward_as_tuple(_VSTD::move(__a))) {}
+ virtual __base<_Rp(_ArgTypes...)>* __clone() const;
+ virtual void __clone(__base<_Rp(_ArgTypes...)>*) const;
virtual void destroy() _NOEXCEPT;
virtual void destroy_deallocate() _NOEXCEPT;
- virtual _R operator()(_ArgTypes&& ... __arg);
+ virtual _Rp operator()(_ArgTypes&& ... __arg);
#ifndef _LIBCPP_NO_RTTI
virtual const void* target(const type_info&) const _NOEXCEPT;
virtual const std::type_info& target_type() const _NOEXCEPT;
#endif // _LIBCPP_NO_RTTI
};
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
-__base<_R(_ArgTypes...)>*
-__func<_F, _Alloc, _R(_ArgTypes...)>::__clone() const
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+__base<_Rp(_ArgTypes...)>*
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone() const
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__func, _D> __hold(__a.allocate(1), _D(__a, 1));
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
return __hold.release();
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__func<_F, _Alloc, _R(_ArgTypes...)>::__clone(__base<_R(_ArgTypes...)>* __p) const
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
{
::new (__p) __func(__f_.first(), __f_.second());
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__func<_F, _Alloc, _R(_ArgTypes...)>::destroy() _NOEXCEPT
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy() _NOEXCEPT
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate() _NOEXCEPT
{
- typedef typename _Alloc::template rebind<__func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
-_R
-__func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+_Rp
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
{
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
}
#ifndef _LIBCPP_NO_RTTI
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
const void*
-__func<_F, _Alloc, _R(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOEXCEPT
{
- if (__ti == typeid(_F))
+ if (__ti == typeid(_Fp))
return &__f_.first();
return (const void*)0;
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
const std::type_info&
-__func<_F, _Alloc, _R(_ArgTypes...)>::target_type() const _NOEXCEPT
+__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
{
- return typeid(_F);
+ return typeid(_Fp);
}
#endif // _LIBCPP_NO_RTTI
} // __function
-template<class _R, class ..._ArgTypes>
-class _LIBCPP_VISIBLE function<_R(_ArgTypes...)>
- : public __function::__maybe_derive_from_unary_function<_R(_ArgTypes...)>,
- public __function::__maybe_derive_from_binary_function<_R(_ArgTypes...)>
+template<class _Rp, class ..._ArgTypes>
+class _LIBCPP_VISIBLE function<_Rp(_ArgTypes...)>
+ : public __function::__maybe_derive_from_unary_function<_Rp(_ArgTypes...)>,
+ public __function::__maybe_derive_from_binary_function<_Rp(_ArgTypes...)>
{
- typedef __function::__base<_R(_ArgTypes...)> __base;
+ typedef __function::__base<_Rp(_ArgTypes...)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _F&) {return true;}
- template <class _R2, class ..._A>
+ static bool __not_null(const _Fp&) {return true;}
+ template <class _R2, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)(_A...)) {return __p;}
- template <class _R2, class _C, class ..._A>
+ static bool __not_null(_R2 (*__p)(_Ap...)) {return __p;}
+ template <class _R2, class _Cp, class ..._Ap>
_LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_C::*__p)(_A...)) {return __p;}
- template <class _R2, class _C, class ..._A>
+ 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 (_C::*__p)(_A...) const) {return __p;}
- template <class _R2, class _C, class ..._A>
+ 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 (_C::*__p)(_A...) volatile) {return __p;}
- template <class _R2, class _C, class ..._A>
+ 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 (_C::*__p)(_A...) const volatile) {return __p;}
- template <class _R2, class ..._A>
+ 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<_R(_A...)>& __p) {return __p;}
+ static bool __not_null(const function<_Rp(_Ap...)>& __p) {return __p;}
- template <class _F, bool = __invokable<_F&, _ArgTypes...>::value>
+ template <class _Fp, bool = __invokable<_Fp&, _ArgTypes...>::value>
struct __callable;
- template <class _F>
- struct __callable<_F, true>
+ template <class _Fp>
+ struct __callable<_Fp, true>
{
static const bool value =
- is_convertible<typename __invoke_of<_F&, _ArgTypes...>::type,
- _R>::value;
+ is_convertible<typename __invoke_of<_Fp&, _ArgTypes...>::type,
+ _Rp>::value;
};
- template <class _F>
- struct __callable<_F, false>
+ template <class _Fp>
+ struct __callable<_Fp, false>
{
static const bool value = false;
};
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
@@ -1128,9 +1137,9 @@ public:
function(nullptr_t) _NOEXCEPT : __f_(0) {}
function(const function&);
function(function&&) _NOEXCEPT;
- template<class _F>
- function(_F,
- typename enable_if<__callable<_F>::value>::type* = 0);
+ template<class _Fp>
+ function(_Fp,
+ typename enable_if<__callable<_Fp>::value>::type* = 0);
template<class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -1142,33 +1151,33 @@ public:
function(allocator_arg_t, const _Alloc&, const function&);
template<class _Alloc>
function(allocator_arg_t, const _Alloc&, function&&);
- template<class _F, class _Alloc>
- function(allocator_arg_t, const _Alloc& __a, _F __f,
- typename enable_if<__callable<_F>::value>::type* = 0);
+ template<class _Fp, class _Alloc>
+ function(allocator_arg_t, const _Alloc& __a, _Fp __f,
+ typename enable_if<__callable<_Fp>::value>::type* = 0);
function& operator=(const function&);
function& operator=(function&&) _NOEXCEPT;
function& operator=(nullptr_t) _NOEXCEPT;
- template<class _F>
+ template<class _Fp>
typename enable_if
<
- __callable<typename decay<_F>::type>::value,
+ __callable<typename decay<_Fp>::type>::value,
function&
>::type
- operator=(_F&&);
+ operator=(_Fp&&);
~function();
// function modifiers:
void swap(function&) _NOEXCEPT;
- template<class _F, class _Alloc>
+ template<class _Fp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- void assign(_F&& __f, const _Alloc& __a)
- {function(allocator_arg, __a, _VSTD::forward<_F>(__f)).swap(*this);}
+ void assign(_Fp&& __f, const _Alloc& __a)
+ {function(allocator_arg, __a, _VSTD::forward<_Fp>(__f)).swap(*this);}
// function capacity:
_LIBCPP_INLINE_VISIBILITY
- /*explicit*/ operator bool() const _NOEXCEPT {return __f_;}
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return __f_;}
// deleted overloads close possible hole in the type system
template<class _R2, class... _ArgTypes2>
@@ -1177,18 +1186,18 @@ public:
bool operator!=(const function<_R2(_ArgTypes2...)>&) const = delete;
public:
// function invocation:
- _R operator()(_ArgTypes...) const;
+ _Rp operator()(_ArgTypes...) const;
#ifndef _LIBCPP_NO_RTTI
// function target access:
const std::type_info& target_type() const _NOEXCEPT;
- template <typename _T> _T* target() _NOEXCEPT;
- template <typename _T> const _T* target() const _NOEXCEPT;
+ template <typename _Tp> _Tp* target() _NOEXCEPT;
+ template <typename _Tp> const _Tp* target() const _NOEXCEPT;
#endif // _LIBCPP_NO_RTTI
};
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>::function(const function& __f)
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::function(const function& __f)
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1201,9 +1210,9 @@ function<_R(_ArgTypes...)>::function(const function& __f)
__f_ = __f.__f_->__clone();
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
template <class _Alloc>
-function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
const function& __f)
{
if (__f.__f_ == 0)
@@ -1217,8 +1226,8 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
__f_ = __f.__f_->__clone();
}
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
{
if (__f.__f_ == 0)
__f_ = 0;
@@ -1234,9 +1243,9 @@ function<_R(_ArgTypes...)>::function(function&& __f) _NOEXCEPT
}
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
template <class _Alloc>
-function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
function&& __f)
{
if (__f.__f_ == 0)
@@ -1253,43 +1262,43 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc&,
}
}
-template<class _R, class ..._ArgTypes>
-template <class _F>
-function<_R(_ArgTypes...)>::function(_F __f,
- typename enable_if<__callable<_F>::value>::type*)
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
+function<_Rp(_ArgTypes...)>::function(_Fp __f,
+ typename enable_if<__callable<_Fp>::value>::type*)
: __f_(0)
{
if (__not_null(__f))
{
- typedef __function::__func<_F, allocator<_F>, _R(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value)
+ typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
{
__f_ = (__base*)&__buf_;
::new (__f_) _FF(_VSTD::move(__f));
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_F>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(_VSTD::move(__f), allocator<_Fp>(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class ..._ArgTypes>
-template <class _F, class _Alloc>
-function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f,
- typename enable_if<__callable<_F>::value>::type*)
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp, class _Alloc>
+function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
+ typename enable_if<__callable<_Fp>::value>::type*)
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
if (__not_null(__f))
{
- typedef __function::__func<_F, _Alloc, _R(_ArgTypes...)> _FF;
- if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_F>::value)
+ typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
+ if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
{
__f_ = (__base*)&__buf_;
::new (__f_) _FF(_VSTD::move(__f));
@@ -1302,27 +1311,27 @@ function<_R(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _F __f
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
::new (__hold.get()) _FF(_VSTD::move(__f), _Alloc(__a));
__f_ = __hold.release();
}
}
}
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>&
-function<_R(_ArgTypes...)>::operator=(const function& __f)
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(const function& __f)
{
function(__f).swap(*this);
return *this;
}
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>&
-function<_R(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1343,9 +1352,9 @@ function<_R(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
}
}
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>&
-function<_R(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>&
+function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1354,21 +1363,21 @@ function<_R(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
__f_ = 0;
}
-template<class _R, class ..._ArgTypes>
-template <class _F>
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
typename enable_if
<
- function<_R(_ArgTypes...)>::template __callable<typename decay<_F>::type>::value,
- function<_R(_ArgTypes...)>&
+ function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value,
+ function<_Rp(_ArgTypes...)>&
>::type
-function<_R(_ArgTypes...)>::operator=(_F&& __f)
+function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
{
- function(_VSTD::forward<_F>(__f)).swap(*this);
+ function(_VSTD::forward<_Fp>(__f)).swap(*this);
return *this;
}
-template<class _R, class ..._ArgTypes>
-function<_R(_ArgTypes...)>::~function()
+template<class _Rp, class ..._ArgTypes>
+function<_Rp(_ArgTypes...)>::~function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1376,9 +1385,9 @@ function<_R(_ArgTypes...)>::~function()
__f_->destroy_deallocate();
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
void
-function<_R(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
+function<_Rp(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1413,9 +1422,9 @@ function<_R(_ArgTypes...)>::swap(function& __f) _NOEXCEPT
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class ..._ArgTypes>
-_R
-function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
+template<class _Rp, class ..._ArgTypes>
+_Rp
+function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__f_ == 0)
@@ -1426,61 +1435,61 @@ function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
#ifndef _LIBCPP_NO_RTTI
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
const std::type_info&
-function<_R(_ArgTypes...)>::target_type() const _NOEXCEPT
+function<_Rp(_ArgTypes...)>::target_type() const _NOEXCEPT
{
if (__f_ == 0)
return typeid(void);
return __f_->target_type();
}
-template<class _R, class ..._ArgTypes>
-template <typename _T>
-_T*
-function<_R(_ArgTypes...)>::target() _NOEXCEPT
+template<class _Rp, class ..._ArgTypes>
+template <typename _Tp>
+_Tp*
+function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
{
if (__f_ == 0)
- return (_T*)0;
- return (_T*)__f_->target(typeid(_T));
+ return (_Tp*)0;
+ return (_Tp*)__f_->target(typeid(_Tp));
}
-template<class _R, class ..._ArgTypes>
-template <typename _T>
-const _T*
-function<_R(_ArgTypes...)>::target() const _NOEXCEPT
+template<class _Rp, class ..._ArgTypes>
+template <typename _Tp>
+const _Tp*
+function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
{
if (__f_ == 0)
- return (const _T*)0;
- return (const _T*)__f_->target(typeid(_T));
+ return (const _Tp*)0;
+ return (const _Tp*)__f_->target(typeid(_Tp));
}
#endif // _LIBCPP_NO_RTTI
-template <class _R, class... _ArgTypes>
+template <class _Rp, class... _ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
+operator==(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return !__f;}
-template <class _R, class... _ArgTypes>
+template <class _Rp, class... _ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
+operator==(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return !__f;}
-template <class _R, class... _ArgTypes>
+template <class _Rp, class... _ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const function<_R(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
+operator!=(const function<_Rp(_ArgTypes...)>& __f, nullptr_t) _NOEXCEPT {return (bool)__f;}
-template <class _R, class... _ArgTypes>
+template <class _Rp, class... _ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(nullptr_t, const function<_R(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
+operator!=(nullptr_t, const function<_Rp(_ArgTypes...)>& __f) _NOEXCEPT {return (bool)__f;}
-template <class _R, class... _ArgTypes>
+template <class _Rp, class... _ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(function<_R(_ArgTypes...)>& __x, function<_R(_ArgTypes...)>& __y) _NOEXCEPT
+swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
@@ -1494,7 +1503,7 @@ template<class _Tp> struct _LIBCPP_VISIBLE is_placeholder
namespace placeholders
{
-template <int _N> struct __ph {};
+template <int _Np> struct __ph {};
extern __ph<1> _1;
extern __ph<2> _2;
@@ -1509,9 +1518,9 @@ extern __ph<10> _10;
} // placeholders
-template<int _N>
-struct __is_placeholder<placeholders::__ph<_N> >
- : public integral_constant<int, _N> {};
+template<int _Np>
+struct __is_placeholder<placeholders::__ph<_Np> >
+ : public integral_constant<int, _Np> {};
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1573,7 +1582,7 @@ typename enable_if
!__is_reference_wrapper<_Ti>::value,
_Ti&
>::type
-__mu(_Ti& __ti, _Uj& __uj)
+__mu(_Ti& __ti, _Uj&)
{
return __ti;
}
@@ -1617,15 +1626,15 @@ struct __mu_return
{
};
-template <class _F, class _BoundArgs, class _TupleUj>
+template <class _Fp, class _BoundArgs, class _TupleUj>
struct __bind_return;
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_of
<
- _F&,
+ _Fp&,
typename __mu_return
<
_BoundArgs,
@@ -1634,12 +1643,12 @@ struct __bind_return<_F, tuple<_BoundArgs...>, _TupleUj>
>::type type;
};
-template <class _F, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
+template <class _Fp, class ..._BoundArgs, class _TupleUj>
+struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
{
typedef typename __invoke_of
<
- _F&,
+ _Fp&,
typename __mu_return
<
const _BoundArgs,
@@ -1648,20 +1657,20 @@ struct __bind_return<_F, const tuple<_BoundArgs...>, _TupleUj>
>::type type;
};
-template <class _F, class _BoundArgs, size_t ..._Indx, class _Args>
+template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bind_return<_F, _BoundArgs, _Args>::type
-__apply_functor(_F& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
+typename __bind_return<_Fp, _BoundArgs, _Args>::type
+__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
return __invoke(__f, __mu(get<_Indx>(__bound_args), __args)...);
}
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
class __bind
- : public __weak_result_type<typename decay<_F>::type>
+ : public __weak_result_type<typename decay<_Fp>::type>
{
- typedef typename decay<_F>::type _Fd;
+ typedef typename decay<_Fp>::type _Fd;
typedef tuple<typename decay<_BoundArgs>::type...> _Td;
_Fd __f_;
_Td __bound_args_;
@@ -1698,10 +1707,10 @@ public:
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
- template <class _G, class ..._BA>
+ template <class _Gp, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
- explicit __bind(_G&& __f, _BA&& ...__bound_args)
- : __f_(_VSTD::forward<_G>(__f)),
+ explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
+ : __f_(_VSTD::forward<_Gp>(__f)),
__bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
@@ -1723,16 +1732,16 @@ public:
}
};
-template<class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind<_F, _BoundArgs...> > : public true_type {};
+template<class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-template<class _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
class __bind_r
- : public __bind<_F, _BoundArgs...>
+ : public __bind<_Fp, _BoundArgs...>
{
- typedef __bind<_F, _BoundArgs...> base;
+ typedef __bind<_Fp, _BoundArgs...> base;
public:
- typedef _R result_type;
+ typedef _Rp result_type;
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -1760,10 +1769,10 @@ public:
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
- template <class _G, class ..._BA>
+ template <class _Gp, class ..._BA>
_LIBCPP_INLINE_VISIBILITY
- explicit __bind_r(_G&& __f, _BA&& ...__bound_args)
- : base(_VSTD::forward<_G>(__f),
+ explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
+ : base(_VSTD::forward<_Gp>(__f),
_VSTD::forward<_BA>(__bound_args)...) {}
template <class ..._Args>
@@ -1783,25 +1792,25 @@ public:
}
};
-template<class _R, class _F, class ..._BoundArgs>
-struct __is_bind_expression<__bind_r<_R, _F, _BoundArgs...> > : public true_type {};
+template<class _Rp, class _Fp, class ..._BoundArgs>
+struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-template<class _F, class ..._BoundArgs>
+template<class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind<_F, _BoundArgs...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind<_Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind<_F, _BoundArgs...> type;
- return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
+ typedef __bind<_Fp, _BoundArgs...> type;
+ return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
-template<class _R, class _F, class ..._BoundArgs>
+template<class _Rp, class _Fp, class ..._BoundArgs>
inline _LIBCPP_INLINE_VISIBILITY
-__bind_r<_R, _F, _BoundArgs...>
-bind(_F&& __f, _BoundArgs&&... __bound_args)
+__bind_r<_Rp, _Fp, _BoundArgs...>
+bind(_Fp&& __f, _BoundArgs&&... __bound_args)
{
- typedef __bind_r<_R, _F, _BoundArgs...> type;
- return type(_VSTD::forward<_F>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
+ typedef __bind_r<_Rp, _Fp, _BoundArgs...> type;
+ return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -1916,79 +1925,91 @@ struct _LIBCPP_VISIBLE hash<unsigned long>
template <>
struct _LIBCPP_VISIBLE hash<long long>
- : public unary_function<long long, size_t>
+ : public __scalar_hash<long long>
{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(long long __v) const _NOEXCEPT
- {
- size_t __r = 0;
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i)
- __r ^= __p[__i];
- return __r;
- }
};
template <>
struct _LIBCPP_VISIBLE hash<unsigned long long>
- : public unary_function<unsigned long long, size_t>
+ : public __scalar_hash<unsigned long long>
{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(unsigned long long __v) const _NOEXCEPT
- {
- size_t __r = 0;
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i)
- __r ^= __p[__i];
- return __r;
- }
};
template <>
struct _LIBCPP_VISIBLE hash<float>
- : public unary_function<float, size_t>
+ : public __scalar_hash<float>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(float __v) const _NOEXCEPT
{
- if (__v == 0)
- return 0;
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- return *__p;
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0)
+ return 0;
+ return __scalar_hash<float>::operator()(__v);
}
};
template <>
struct _LIBCPP_VISIBLE hash<double>
- : public unary_function<double, size_t>
+ : public __scalar_hash<double>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(double __v) const _NOEXCEPT
{
- if (__v == 0)
- return 0;
- size_t __r = 0;
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i)
- __r ^= __p[__i];
- return __r;
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0)
+ return 0;
+ return __scalar_hash<double>::operator()(__v);
}
};
template <>
struct _LIBCPP_VISIBLE hash<long double>
- : public unary_function<long double, size_t>
+ : public __scalar_hash<long double>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(long double __v) const _NOEXCEPT
{
+ // -0.0 and 0.0 should return same hash
if (__v == 0)
return 0;
- size_t __r = 0;
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- for (unsigned __i = 0; __i < sizeof(argument_type)/sizeof(size_t); ++__i)
- __r ^= __p[__i];
- return __r;
+#if defined(__i386__)
+ // Zero out padding bits
+ union
+ {
+ long double __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ };
+ } __u;
+ __u.__a = 0;
+ __u.__b = 0;
+ __u.__c = 0;
+ __u.__d = 0;
+ __u.__t = __v;
+ return __u.__a ^ __u.__b ^ __u.__c ^ __u.__d;
+#elif defined(__x86_64__)
+ // Zero out padding bits
+ union
+ {
+ long double __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ };
+ } __u;
+ __u.__a = 0;
+ __u.__b = 0;
+ __u.__t = __v;
+ return __u.__a ^ __u.__b;
+#else
+ return __scalar_hash<long double>::operator()(__v);
+#endif
}
};
diff --git a/include/future b/include/future
index f6896a3a0fce..aae707e1e4e8 100644
--- a/include/future
+++ b/include/future
@@ -377,56 +377,40 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
_LIBCPP_BEGIN_NAMESPACE_STD
//enum class future_errc
-struct _LIBCPP_VISIBLE future_errc
+_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
{
-enum _ {
broken_promise,
future_already_retrieved,
promise_already_satisfied,
no_state
};
-
- _ __v_;
-
- _LIBCPP_INLINE_VISIBILITY future_errc(_ __v) : __v_(__v) {}
- _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
-
-};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<future_errc> : public true_type {};
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
+template <>
+struct _LIBCPP_VISIBLE is_error_code_enum<future_errc::_> : public true_type { };
+#endif
+
//enum class launch
-struct _LIBCPP_VISIBLE launch
+_LIBCPP_DECLARE_STRONG_ENUM(launch)
{
-enum _ {
async = 1,
deferred = 2,
any = async | deferred
};
-
- _ __v_;
-
- _LIBCPP_INLINE_VISIBILITY launch(_ __v) : __v_(__v) {}
- _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
-
-};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
//enum class future_status
-struct _LIBCPP_VISIBLE future_status
+_LIBCPP_DECLARE_STRONG_ENUM(future_status)
{
-enum _ {
ready,
timeout,
deferred
};
-
- _ __v_;
-
- _LIBCPP_INLINE_VISIBILITY future_status(_ __v) : __v_(__v) {}
- _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
-
-};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
_LIBCPP_VISIBLE
const error_category& future_category();
@@ -538,14 +522,14 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c
return wait_until(chrono::steady_clock::now() + __rel_time);
}
-template <class _R>
+template <class _Rp>
class __assoc_state
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
- typedef typename aligned_storage<sizeof(_R), alignment_of<_R>::value>::type _U;
+ typedef typename aligned_storage<sizeof(_Rp), alignment_of<_Rp>::value>::type _Up;
protected:
- _U __value_;
+ _Up __value_;
virtual void __on_zero_shared() _NOEXCEPT;
public:
@@ -564,26 +548,26 @@ public:
void set_value_at_thread_exit(_Arg& __arg);
#endif
- _R move();
- typename add_lvalue_reference<_R>::type copy();
+ _Rp move();
+ typename add_lvalue_reference<_Rp>::type copy();
};
-template <class _R>
+template <class _Rp>
void
-__assoc_state<_R>::__on_zero_shared() _NOEXCEPT
+__assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
{
if (this->__state_ & base::__constructed)
- reinterpret_cast<_R*>(&__value_)->~_R();
+ reinterpret_cast<_Rp*>(&__value_)->~_Rp();
delete this;
}
-template <class _R>
+template <class _Rp>
template <class _Arg>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__assoc_state<_R>::set_value(_Arg&& __arg)
+__assoc_state<_Rp>::set_value(_Arg&& __arg)
#else
-__assoc_state<_R>::set_value(_Arg& __arg)
+__assoc_state<_Rp>::set_value(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
@@ -591,19 +575,19 @@ __assoc_state<_R>::set_value(_Arg& __arg)
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
- ::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
+ ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed | base::ready;
__lk.unlock();
__cv_.notify_all();
}
-template <class _R>
+template <class _Rp>
template <class _Arg>
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__assoc_state<_R>::set_value_at_thread_exit(_Arg&& __arg)
+__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
#else
-__assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg)
+__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
@@ -611,62 +595,62 @@ __assoc_state<_R>::set_value_at_thread_exit(_Arg& __arg)
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
- ::new(&__value_) _R(_VSTD::forward<_Arg>(__arg));
+ ::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
}
-template <class _R>
-_R
-__assoc_state<_R>::move()
+template <class _Rp>
+_Rp
+__assoc_state<_Rp>::move()
{
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
if (this->__exception_ != nullptr)
rethrow_exception(this->__exception_);
- return _VSTD::move(*reinterpret_cast<_R*>(&__value_));
+ return _VSTD::move(*reinterpret_cast<_Rp*>(&__value_));
}
-template <class _R>
-typename add_lvalue_reference<_R>::type
-__assoc_state<_R>::copy()
+template <class _Rp>
+typename add_lvalue_reference<_Rp>::type
+__assoc_state<_Rp>::copy()
{
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
if (this->__exception_ != nullptr)
rethrow_exception(this->__exception_);
- return *reinterpret_cast<_R*>(&__value_);
+ return *reinterpret_cast<_Rp*>(&__value_);
}
-template <class _R>
-class __assoc_state<_R&>
+template <class _Rp>
+class __assoc_state<_Rp&>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
- typedef _R* _U;
+ typedef _Rp* _Up;
protected:
- _U __value_;
+ _Up __value_;
virtual void __on_zero_shared() _NOEXCEPT;
public:
- void set_value(_R& __arg);
- void set_value_at_thread_exit(_R& __arg);
+ void set_value(_Rp& __arg);
+ void set_value_at_thread_exit(_Rp& __arg);
- _R& copy();
+ _Rp& copy();
};
-template <class _R>
+template <class _Rp>
void
-__assoc_state<_R&>::__on_zero_shared() _NOEXCEPT
+__assoc_state<_Rp&>::__on_zero_shared() _NOEXCEPT
{
delete this;
}
-template <class _R>
+template <class _Rp>
void
-__assoc_state<_R&>::set_value(_R& __arg)
+__assoc_state<_Rp&>::set_value(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -679,9 +663,9 @@ __assoc_state<_R&>::set_value(_R& __arg)
__cv_.notify_all();
}
-template <class _R>
+template <class _Rp>
void
-__assoc_state<_R&>::set_value_at_thread_exit(_R& __arg)
+__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -694,9 +678,9 @@ __assoc_state<_R&>::set_value_at_thread_exit(_R& __arg)
__lk.unlock();
}
-template <class _R>
-_R&
-__assoc_state<_R&>::copy()
+template <class _Rp>
+_Rp&
+__assoc_state<_Rp&>::copy()
{
unique_lock<mutex> __lk(this->__mut_);
this->__sub_wait(__lk);
@@ -705,11 +689,11 @@ __assoc_state<_R&>::copy()
return *__value_;
}
-template <class _R, class _Alloc>
+template <class _Rp, class _Alloc>
class __assoc_state_alloc
- : public __assoc_state<_R>
+ : public __assoc_state<_Rp>
{
- typedef __assoc_state<_R> base;
+ typedef __assoc_state<_Rp> base;
_Alloc __alloc_;
virtual void __on_zero_shared() _NOEXCEPT;
@@ -719,22 +703,22 @@ public:
: __alloc_(__a) {}
};
-template <class _R, class _Alloc>
+template <class _Rp, class _Alloc>
void
-__assoc_state_alloc<_R, _Alloc>::__on_zero_shared() _NOEXCEPT
+__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
{
if (this->__state_ & base::__constructed)
- reinterpret_cast<_R*>(&this->__value_)->~_R();
+ reinterpret_cast<_Rp*>(&this->__value_)->~_Rp();
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
this->~__assoc_state_alloc();
__a.deallocate(this, 1);
}
-template <class _R, class _Alloc>
-class __assoc_state_alloc<_R&, _Alloc>
- : public __assoc_state<_R&>
+template <class _Rp, class _Alloc>
+class __assoc_state_alloc<_Rp&, _Alloc>
+ : public __assoc_state<_Rp&>
{
- typedef __assoc_state<_R&> base;
+ typedef __assoc_state<_Rp&> base;
_Alloc __alloc_;
virtual void __on_zero_shared() _NOEXCEPT;
@@ -744,9 +728,9 @@ public:
: __alloc_(__a) {}
};
-template <class _R, class _Alloc>
+template <class _Rp, class _Alloc>
void
-__assoc_state_alloc<_R&, _Alloc>::__on_zero_shared() _NOEXCEPT
+__assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
{
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
this->~__assoc_state_alloc();
@@ -777,17 +761,17 @@ __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
__a.deallocate(this, 1);
}
-template <class _R, class _F>
+template <class _Rp, class _Fp>
class __deferred_assoc_state
- : public __assoc_state<_R>
+ : public __assoc_state<_Rp>
{
- typedef __assoc_state<_R> base;
+ typedef __assoc_state<_Rp> base;
- _F __func_;
+ _Fp __func_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- explicit __deferred_assoc_state(_F&& __f);
+ explicit __deferred_assoc_state(_Fp&& __f);
#endif
virtual void __execute();
@@ -795,19 +779,19 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R, class _F>
+template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-__deferred_assoc_state<_R, _F>::__deferred_assoc_state(_F&& __f)
- : __func_(_VSTD::forward<_F>(__f))
+__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
+ : __func_(_VSTD::forward<_Fp>(__f))
{
this->__set_deferred();
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R, class _F>
+template <class _Rp, class _Fp>
void
-__deferred_assoc_state<_R, _F>::__execute()
+__deferred_assoc_state<_Rp, _Fp>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -823,17 +807,17 @@ __deferred_assoc_state<_R, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template <class _F>
-class __deferred_assoc_state<void, _F>
+template <class _Fp>
+class __deferred_assoc_state<void, _Fp>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
- _F __func_;
+ _Fp __func_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- explicit __deferred_assoc_state(_F&& __f);
+ explicit __deferred_assoc_state(_Fp&& __f);
#endif
virtual void __execute();
@@ -841,19 +825,19 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-__deferred_assoc_state<void, _F>::__deferred_assoc_state(_F&& __f)
- : __func_(_VSTD::forward<_F>(__f))
+__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
+ : __func_(_VSTD::forward<_Fp>(__f))
{
this->__set_deferred();
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _F>
+template <class _Fp>
void
-__deferred_assoc_state<void, _F>::__execute()
+__deferred_assoc_state<void, _Fp>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -870,18 +854,18 @@ __deferred_assoc_state<void, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template <class _R, class _F>
+template <class _Rp, class _Fp>
class __async_assoc_state
- : public __assoc_state<_R>
+ : public __assoc_state<_Rp>
{
- typedef __assoc_state<_R> base;
+ typedef __assoc_state<_Rp> base;
- _F __func_;
+ _Fp __func_;
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- explicit __async_assoc_state(_F&& __f);
+ explicit __async_assoc_state(_Fp&& __f);
#endif
virtual void __execute();
@@ -889,18 +873,18 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R, class _F>
+template <class _Rp, class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-__async_assoc_state<_R, _F>::__async_assoc_state(_F&& __f)
- : __func_(_VSTD::forward<_F>(__f))
+__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
+ : __func_(_VSTD::forward<_Fp>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R, class _F>
+template <class _Rp, class _Fp>
void
-__async_assoc_state<_R, _F>::__execute()
+__async_assoc_state<_Rp, _Fp>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -916,26 +900,26 @@ __async_assoc_state<_R, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template <class _R, class _F>
+template <class _Rp, class _Fp>
void
-__async_assoc_state<_R, _F>::__on_zero_shared() _NOEXCEPT
+__async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
{
this->wait();
base::__on_zero_shared();
}
-template <class _F>
-class __async_assoc_state<void, _F>
+template <class _Fp>
+class __async_assoc_state<void, _Fp>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
- _F __func_;
+ _Fp __func_;
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- explicit __async_assoc_state(_F&& __f);
+ explicit __async_assoc_state(_Fp&& __f);
#endif
virtual void __execute();
@@ -943,18 +927,18 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _F>
+template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-__async_assoc_state<void, _F>::__async_assoc_state(_F&& __f)
- : __func_(_VSTD::forward<_F>(__f))
+__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
+ : __func_(_VSTD::forward<_Fp>(__f))
{
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _F>
+template <class _Fp>
void
-__async_assoc_state<void, _F>::__execute()
+__async_assoc_state<void, _Fp>::__execute()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -971,57 +955,57 @@ __async_assoc_state<void, _F>::__execute()
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template <class _F>
+template <class _Fp>
void
-__async_assoc_state<void, _F>::__on_zero_shared() _NOEXCEPT
+__async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
{
this->wait();
base::__on_zero_shared();
}
-template <class _R> class promise;
-template <class _R> class shared_future;
+template <class _Rp> class promise;
+template <class _Rp> class shared_future;
// future
-template <class _R> class future;
+template <class _Rp> class future;
-template <class _R, class _F>
-future<_R>
+template <class _Rp, class _Fp>
+future<_Rp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__make_deferred_assoc_state(_F&& __f);
+__make_deferred_assoc_state(_Fp&& __f);
#else
-__make_deferred_assoc_state(_F __f);
+__make_deferred_assoc_state(_Fp __f);
#endif
-template <class _R, class _F>
-future<_R>
+template <class _Rp, class _Fp>
+future<_Rp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__make_async_assoc_state(_F&& __f);
+__make_async_assoc_state(_Fp&& __f);
#else
-__make_async_assoc_state(_F __f);
+__make_async_assoc_state(_Fp __f);
#endif
-template <class _R>
+template <class _Rp>
class _LIBCPP_VISIBLE future
{
- __assoc_state<_R>* __state_;
+ __assoc_state<_Rp>* __state_;
- explicit future(__assoc_state<_R>* __state);
+ explicit future(__assoc_state<_Rp>* __state);
template <class> friend class promise;
template <class> friend class shared_future;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F&& __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
#else
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp __f);
#endif
public:
@@ -1046,10 +1030,10 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
- shared_future<_R> share();
+ shared_future<_Rp> share();
// retrieving the value
- _R get();
+ _Rp get();
_LIBCPP_INLINE_VISIBILITY
void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
@@ -1072,8 +1056,8 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
-future<_R>::future(__assoc_state<_R>* __state)
+template <class _Rp>
+future<_Rp>::future(__assoc_state<_Rp>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1089,43 +1073,43 @@ struct __release_shared_count
void operator()(__shared_count* p) {p->__release_shared();}
};
-template <class _R>
-future<_R>::~future()
+template <class _Rp>
+future<_Rp>::~future()
{
if (__state_)
__state_->__release_shared();
}
-template <class _R>
-_R
-future<_R>::get()
+template <class _Rp>
+_Rp
+future<_Rp>::get()
{
unique_ptr<__shared_count, __release_shared_count> __(__state_);
- __assoc_state<_R>* __s = __state_;
+ __assoc_state<_Rp>* __s = __state_;
__state_ = nullptr;
return __s->move();
}
-template <class _R>
-class _LIBCPP_VISIBLE future<_R&>
+template <class _Rp>
+class _LIBCPP_VISIBLE future<_Rp&>
{
- __assoc_state<_R&>* __state_;
+ __assoc_state<_Rp&>* __state_;
- explicit future(__assoc_state<_R&>* __state);
+ explicit future(__assoc_state<_Rp&>* __state);
template <class> friend class promise;
template <class> friend class shared_future;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F&& __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
#else
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp __f);
#endif
public:
@@ -1150,10 +1134,10 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
- shared_future<_R&> share();
+ shared_future<_Rp&> share();
// retrieving the value
- _R& get();
+ _Rp& get();
_LIBCPP_INLINE_VISIBILITY
void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
@@ -1176,8 +1160,8 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
-future<_R&>::future(__assoc_state<_R&>* __state)
+template <class _Rp>
+future<_Rp&>::future(__assoc_state<_Rp&>* __state)
: __state_(__state)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1188,19 +1172,19 @@ future<_R&>::future(__assoc_state<_R&>* __state)
__state_->__set_future_attached();
}
-template <class _R>
-future<_R&>::~future()
+template <class _Rp>
+future<_Rp&>::~future()
{
if (__state_)
__state_->__release_shared();
}
-template <class _R>
-_R&
-future<_R&>::get()
+template <class _Rp>
+_Rp&
+future<_Rp&>::get()
{
unique_ptr<__shared_count, __release_shared_count> __(__state_);
- __assoc_state<_R&>* __s = __state_;
+ __assoc_state<_Rp&>* __s = __state_;
__state_ = nullptr;
return __s->copy();
}
@@ -1216,15 +1200,15 @@ class _LIBCPP_VISIBLE future<void>
template <class> friend class shared_future;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F&& __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp&& __f);
#else
- template <class _R1, class _F>
- friend future<_R1> __make_deferred_assoc_state(_F __f);
- template <class _R1, class _F>
- friend future<_R1> __make_async_assoc_state(_F __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_deferred_assoc_state(_Fp __f);
+ template <class _R1, class _Fp>
+ friend future<_R1> __make_async_assoc_state(_Fp __f);
#endif
public:
@@ -1275,10 +1259,10 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
+template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(future<_R>& __x, future<_R>& __y)
+swap(future<_Rp>& __x, future<_Rp>& __y)
{
__x.swap(__y);
}
@@ -1287,10 +1271,10 @@ swap(future<_R>& __x, future<_R>& __y)
template <class _Callable> class packaged_task;
-template <class _R>
+template <class _Rp>
class _LIBCPP_VISIBLE promise
{
- __assoc_state<_R>* __state_;
+ __assoc_state<_Rp>* __state_;
_LIBCPP_INLINE_VISIBILITY
explicit promise(nullptr_t) : __state_(nullptr) {}
@@ -1330,43 +1314,43 @@ public:
void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
// retrieving the result
- future<_R> get_future();
+ future<_Rp> get_future();
// setting the result
- void set_value(const _R& __r);
+ void set_value(const _Rp& __r);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void set_value(_R&& __r);
+ void set_value(_Rp&& __r);
#endif
void set_exception(exception_ptr __p);
// setting the result with deferred notification
- void set_value_at_thread_exit(const _R& __r);
+ void set_value_at_thread_exit(const _Rp& __r);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void set_value_at_thread_exit(_R&& __r);
+ void set_value_at_thread_exit(_Rp&& __r);
#endif
void set_exception_at_thread_exit(exception_ptr __p);
};
-template <class _R>
-promise<_R>::promise()
- : __state_(new __assoc_state<_R>)
+template <class _Rp>
+promise<_Rp>::promise()
+ : __state_(new __assoc_state<_Rp>)
{
}
-template <class _R>
+template <class _Rp>
template <class _Alloc>
-promise<_R>::promise(allocator_arg_t, const _Alloc& __a0)
+promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
{
- typedef typename _Alloc::template rebind<__assoc_state_alloc<_R, _Alloc> >::other _A2;
+ typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp, _Alloc> >::other _A2;
typedef __allocator_destructor<_A2> _D2;
_A2 __a(__a0);
- unique_ptr<__assoc_state_alloc<_R, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new(__hold.get()) __assoc_state_alloc<_R, _Alloc>(__a0);
+ unique_ptr<__assoc_state_alloc<_Rp, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new(__hold.get()) __assoc_state_alloc<_Rp, _Alloc>(__a0);
__state_ = __hold.release();
}
-template <class _R>
-promise<_R>::~promise()
+template <class _Rp>
+promise<_Rp>::~promise()
{
if (__state_)
{
@@ -1378,20 +1362,20 @@ promise<_R>::~promise()
}
}
-template <class _R>
-future<_R>
-promise<_R>::get_future()
+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
- return future<_R>(__state_);
+ return future<_Rp>(__state_);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_value(const _R& __r)
+promise<_Rp>::set_value(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1402,9 +1386,9 @@ promise<_R>::set_value(const _R& __r)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_value(_R&& __r)
+promise<_Rp>::set_value(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1415,9 +1399,9 @@ promise<_R>::set_value(_R&& __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_exception(exception_ptr __p)
+promise<_Rp>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1426,9 +1410,9 @@ promise<_R>::set_exception(exception_ptr __p)
__state_->set_exception(__p);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_value_at_thread_exit(const _R& __r)
+promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1439,9 +1423,9 @@ promise<_R>::set_value_at_thread_exit(const _R& __r)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_value_at_thread_exit(_R&& __r)
+promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1452,9 +1436,9 @@ promise<_R>::set_value_at_thread_exit(_R&& __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _R>
+template <class _Rp>
void
-promise<_R>::set_exception_at_thread_exit(exception_ptr __p)
+promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1465,10 +1449,10 @@ promise<_R>::set_exception_at_thread_exit(exception_ptr __p)
// promise<R&>
-template <class _R>
-class _LIBCPP_VISIBLE promise<_R&>
+template <class _Rp>
+class _LIBCPP_VISIBLE promise<_Rp&>
{
- __assoc_state<_R&>* __state_;
+ __assoc_state<_Rp&>* __state_;
_LIBCPP_INLINE_VISIBILITY
explicit promise(nullptr_t) : __state_(nullptr) {}
@@ -1509,37 +1493,37 @@ public:
void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
// retrieving the result
- future<_R&> get_future();
+ future<_Rp&> get_future();
// setting the result
- void set_value(_R& __r);
+ void set_value(_Rp& __r);
void set_exception(exception_ptr __p);
// setting the result with deferred notification
- void set_value_at_thread_exit(_R&);
+ void set_value_at_thread_exit(_Rp&);
void set_exception_at_thread_exit(exception_ptr __p);
};
-template <class _R>
-promise<_R&>::promise()
- : __state_(new __assoc_state<_R&>)
+template <class _Rp>
+promise<_Rp&>::promise()
+ : __state_(new __assoc_state<_Rp&>)
{
}
-template <class _R>
+template <class _Rp>
template <class _Alloc>
-promise<_R&>::promise(allocator_arg_t, const _Alloc& __a0)
+promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
{
- typedef typename _Alloc::template rebind<__assoc_state_alloc<_R&, _Alloc> >::other _A2;
+ typedef typename _Alloc::template rebind<__assoc_state_alloc<_Rp&, _Alloc> >::other _A2;
typedef __allocator_destructor<_A2> _D2;
_A2 __a(__a0);
- unique_ptr<__assoc_state_alloc<_R&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
- ::new(__hold.get()) __assoc_state_alloc<_R&, _Alloc>(__a0);
+ unique_ptr<__assoc_state_alloc<_Rp&, _Alloc>, _D2> __hold(__a.allocate(1), _D2(__a, 1));
+ ::new(__hold.get()) __assoc_state_alloc<_Rp&, _Alloc>(__a0);
__state_ = __hold.release();
}
-template <class _R>
-promise<_R&>::~promise()
+template <class _Rp>
+promise<_Rp&>::~promise()
{
if (__state_)
{
@@ -1551,20 +1535,20 @@ promise<_R&>::~promise()
}
}
-template <class _R>
-future<_R&>
-promise<_R&>::get_future()
+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
- return future<_R&>(__state_);
+ return future<_Rp&>(__state_);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R&>::set_value(_R& __r)
+promise<_Rp&>::set_value(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1573,9 +1557,9 @@ promise<_R&>::set_value(_R& __r)
__state_->set_value(__r);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R&>::set_exception(exception_ptr __p)
+promise<_Rp&>::set_exception(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1584,9 +1568,9 @@ promise<_R&>::set_exception(exception_ptr __p)
__state_->set_exception(__p);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R&>::set_value_at_thread_exit(_R& __r)
+promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1595,9 +1579,9 @@ promise<_R&>::set_value_at_thread_exit(_R& __r)
__state_->set_value_at_thread_exit(__r);
}
-template <class _R>
+template <class _Rp>
void
-promise<_R&>::set_exception_at_thread_exit(exception_ptr __p)
+promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
@@ -1674,16 +1658,16 @@ promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
__state_ = __hold.release();
}
-template <class _R>
+template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(promise<_R>& __x, promise<_R>& __y)
+swap(promise<_Rp>& __x, promise<_Rp>& __y)
{
__x.swap(__y);
}
-template <class _R, class _Alloc>
- struct _LIBCPP_VISIBLE uses_allocator<promise<_R>, _Alloc>
+template <class _Rp, class _Alloc>
+ struct _LIBCPP_VISIBLE uses_allocator<promise<_Rp>, _Alloc>
: public true_type {};
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1692,8 +1676,8 @@ template <class _R, class _Alloc>
template<class _Fp> class __packaged_task_base;
-template<class _R, class ..._ArgTypes>
-class __packaged_task_base<_R(_ArgTypes...)>
+template<class _Rp, class ..._ArgTypes>
+class __packaged_task_base<_Rp(_ArgTypes...)>
{
__packaged_task_base(const __packaged_task_base&);
__packaged_task_base& operator=(const __packaged_task_base&);
@@ -1705,84 +1689,84 @@ public:
virtual void __move_to(__packaged_task_base*) = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
- virtual _R operator()(_ArgTypes&& ...) = 0;
+ virtual _Rp operator()(_ArgTypes&& ...) = 0;
};
template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
-class __packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>
- : public __packaged_task_base<_R(_ArgTypes...)>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
+ : public __packaged_task_base<_Rp(_ArgTypes...)>
{
- __compressed_pair<_F, _Alloc> __f_;
+ __compressed_pair<_Fp, _Alloc> __f_;
public:
_LIBCPP_INLINE_VISIBILITY
- explicit __packaged_task_func(const _F& __f) : __f_(__f) {}
+ explicit __packaged_task_func(const _Fp& __f) : __f_(__f) {}
_LIBCPP_INLINE_VISIBILITY
- explicit __packaged_task_func(_F&& __f) : __f_(_VSTD::move(__f)) {}
+ explicit __packaged_task_func(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
_LIBCPP_INLINE_VISIBILITY
- __packaged_task_func(const _F& __f, const _Alloc& __a)
+ __packaged_task_func(const _Fp& __f, const _Alloc& __a)
: __f_(__f, __a) {}
_LIBCPP_INLINE_VISIBILITY
- __packaged_task_func(_F&& __f, const _Alloc& __a)
+ __packaged_task_func(_Fp&& __f, const _Alloc& __a)
: __f_(_VSTD::move(__f), __a) {}
- virtual void __move_to(__packaged_task_base<_R(_ArgTypes...)>*);
+ virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*);
virtual void destroy();
virtual void destroy_deallocate();
- virtual _R operator()(_ArgTypes&& ... __args);
+ virtual _Rp operator()(_ArgTypes&& ... __args);
};
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::__move_to(
- __packaged_task_base<_R(_ArgTypes...)>* __p)
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
+ __packaged_task_base<_Rp(_ArgTypes...)>* __p)
{
::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::destroy()
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy()
{
- __f_.~__compressed_pair<_F, _Alloc>();
+ __f_.~__compressed_pair<_Fp, _Alloc>();
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
-__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::destroy_deallocate()
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::destroy_deallocate()
{
- typedef typename _Alloc::template rebind<__packaged_task_func>::other _A;
- _A __a(__f_.second());
- __f_.~__compressed_pair<_F, _Alloc>();
+ typedef typename _Alloc::template rebind<__packaged_task_func>::other _Ap;
+ _Ap __a(__f_.second());
+ __f_.~__compressed_pair<_Fp, _Alloc>();
__a.deallocate(this, 1);
}
-template<class _F, class _Alloc, class _R, class ..._ArgTypes>
-_R
-__packaged_task_func<_F, _Alloc, _R(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
+template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
+_Rp
+__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ... __arg)
{
return __invoke(__f_.first(), _VSTD::forward<_ArgTypes>(__arg)...);
}
template <class _Callable> class __packaged_task_function;
-template<class _R, class ..._ArgTypes>
-class __packaged_task_function<_R(_ArgTypes...)>
+template<class _Rp, class ..._ArgTypes>
+class __packaged_task_function<_Rp(_ArgTypes...)>
{
- typedef __packaged_task_base<_R(_ArgTypes...)> __base;
+ typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
public:
- typedef _R result_type;
+ typedef _Rp result_type;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
__packaged_task_function() : __f_(nullptr) {}
- template<class _F>
- __packaged_task_function(_F&& __f);
- template<class _F, class _Alloc>
- __packaged_task_function(allocator_arg_t, const _Alloc& __a, _F&& __f);
+ template<class _Fp>
+ __packaged_task_function(_Fp&& __f);
+ template<class _Fp, class _Alloc>
+ __packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
__packaged_task_function(__packaged_task_function&&);
__packaged_task_function& operator=(__packaged_task_function&&);
@@ -1794,11 +1778,11 @@ public:
void swap(__packaged_task_function&);
- _R operator()(_ArgTypes...) const;
+ _Rp operator()(_ArgTypes...) const;
};
-template<class _R, class ..._ArgTypes>
-__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f)
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f)
{
if (__f.__f_ == nullptr)
__f_ = nullptr;
@@ -1814,42 +1798,42 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(__packaged_
}
}
-template<class _R, class ..._ArgTypes>
-template <class _F>
-__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(_F&& __f)
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
: __f_(nullptr)
{
- typedef typename remove_reference<_F>::type _FR;
- typedef __packaged_task_func<_FR, allocator<_FR>, _R(_ArgTypes...)> _FF;
+ typedef typename remove_reference<_Fp>::type _FR;
+ typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
- ::new (__f_) _FF(_VSTD::forward<_F>(__f));
+ ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
}
else
{
- typedef allocator<_FF> _A;
- _A __a;
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), allocator<_FR>(__a));
+ typedef allocator<_FF> _Ap;
+ _Ap __a;
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a));
__f_ = __hold.release();
}
}
-template<class _R, class ..._ArgTypes>
-template <class _F, class _Alloc>
-__packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(
- allocator_arg_t, const _Alloc& __a0, _F&& __f)
+template<class _Rp, class ..._ArgTypes>
+template <class _Fp, class _Alloc>
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
+ allocator_arg_t, const _Alloc& __a0, _Fp&& __f)
: __f_(nullptr)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- typedef typename remove_reference<_F>::type _FR;
- typedef __packaged_task_func<_FR, _Alloc, _R(_ArgTypes...)> _FF;
+ typedef typename remove_reference<_Fp>::type _FR;
+ typedef __packaged_task_func<_FR, _Alloc, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
{
__f_ = (__base*)&__buf_;
- ::new (__f_) _FF(_VSTD::forward<_F>(__f));
+ ::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
}
else
{
@@ -1859,18 +1843,18 @@ __packaged_task_function<_R(_ArgTypes...)>::__packaged_task_function(
#else
rebind_alloc<_FF>::other
#endif
- _A;
- _A __a(__a0);
- typedef __allocator_destructor<_A> _D;
- unique_ptr<__base, _D> __hold(__a.allocate(1), _D(__a, 1));
- ::new (__hold.get()) _FF(_VSTD::forward<_F>(__f), _Alloc(__a));
+ _Ap;
+ _Ap __a(__a0);
+ typedef __allocator_destructor<_Ap> _Dp;
+ unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
+ ::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
__f_ = __hold.release();
}
}
-template<class _R, class ..._ArgTypes>
-__packaged_task_function<_R(_ArgTypes...)>&
-__packaged_task_function<_R(_ArgTypes...)>::operator=(__packaged_task_function&& __f)
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>&
+__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f)
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1891,8 +1875,8 @@ __packaged_task_function<_R(_ArgTypes...)>::operator=(__packaged_task_function&&
}
}
-template<class _R, class ..._ArgTypes>
-__packaged_task_function<_R(_ArgTypes...)>::~__packaged_task_function()
+template<class _Rp, class ..._ArgTypes>
+__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1900,9 +1884,9 @@ __packaged_task_function<_R(_ArgTypes...)>::~__packaged_task_function()
__f_->destroy_deallocate();
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
void
-__packaged_task_function<_R(_ArgTypes...)>::swap(__packaged_task_function& __f)
+__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f)
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1937,19 +1921,19 @@ __packaged_task_function<_R(_ArgTypes...)>::swap(__packaged_task_function& __f)
_VSTD::swap(__f_, __f.__f_);
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
inline _LIBCPP_INLINE_VISIBILITY
-_R
-__packaged_task_function<_R(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
+_Rp
+__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
return (*__f_)(_VSTD::forward<_ArgTypes>(__arg)...);
}
-template<class _R, class ..._ArgTypes>
-class _LIBCPP_VISIBLE packaged_task<_R(_ArgTypes...)>
+template<class _Rp, class ..._ArgTypes>
+class _LIBCPP_VISIBLE packaged_task<_Rp(_ArgTypes...)>
{
public:
- typedef _R result_type;
+ typedef _Rp result_type;
private:
__packaged_task_function<result_type(_ArgTypes...)> __f_;
@@ -1959,13 +1943,13 @@ public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() : __p_(nullptr) {}
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {}
- template <class _F, class _Allocator>
+ explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
- explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f)
- : __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)),
+ explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
__p_(allocator_arg, __a) {}
// ~packaged_task() = default;
@@ -2005,9 +1989,9 @@ public:
void reset();
};
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
void
-packaged_task<_R(_ArgTypes...)>::operator()(_ArgTypes... __args)
+packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
@@ -2027,9 +2011,9 @@ packaged_task<_R(_ArgTypes...)>::operator()(_ArgTypes... __args)
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
void
-packaged_task<_R(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
+packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
@@ -2049,9 +2033,9 @@ packaged_task<_R(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
#endif // _LIBCPP_NO_EXCEPTIONS
}
-template<class _R, class ..._ArgTypes>
+template<class _Rp, class ..._ArgTypes>
void
-packaged_task<_R(_ArgTypes...)>::reset()
+packaged_task<_Rp(_ArgTypes...)>::reset()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
@@ -2074,13 +2058,13 @@ public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() : __p_(nullptr) {}
- template <class _F>
+ template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
- explicit packaged_task(_F&& __f) : __f_(_VSTD::forward<_F>(__f)) {}
- template <class _F, class _Allocator>
+ explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
+ template <class _Fp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
- explicit packaged_task(allocator_arg_t, const _Allocator& __a, _F&& __f)
- : __f_(allocator_arg, __a, _VSTD::forward<_F>(__f)),
+ explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
+ : __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
__p_(allocator_arg, __a) {}
// ~packaged_task() = default;
@@ -2189,84 +2173,84 @@ template <class _Callable, class _Alloc>
struct _LIBCPP_VISIBLE uses_allocator<packaged_task<_Callable>, _Alloc>
: public true_type {};
-template <class _R, class _F>
-future<_R>
+template <class _Rp, class _Fp>
+future<_Rp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__make_deferred_assoc_state(_F&& __f)
+__make_deferred_assoc_state(_Fp&& __f)
#else
-__make_deferred_assoc_state(_F __f)
+__make_deferred_assoc_state(_Fp __f)
#endif
{
- unique_ptr<__deferred_assoc_state<_R, _F>, __release_shared_count>
- __h(new __deferred_assoc_state<_R, _F>(_VSTD::forward<_F>(__f)));
- return future<_R>(__h.get());
+ unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
+ __h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
+ return future<_Rp>(__h.get());
}
-template <class _R, class _F>
-future<_R>
+template <class _Rp, class _Fp>
+future<_Rp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-__make_async_assoc_state(_F&& __f)
+__make_async_assoc_state(_Fp&& __f)
#else
-__make_async_assoc_state(_F __f)
+__make_async_assoc_state(_Fp __f)
#endif
{
- unique_ptr<__async_assoc_state<_R, _F>, __release_shared_count>
- __h(new __async_assoc_state<_R, _F>(_VSTD::forward<_F>(__f)));
- _VSTD::thread(&__async_assoc_state<_R, _F>::__execute, __h.get()).detach();
- return future<_R>(__h.get());
+ unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
+ __h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
+ _VSTD::thread(&__async_assoc_state<_Rp, _Fp>::__execute, __h.get()).detach();
+ return future<_Rp>(__h.get());
}
-template <class _F, class... _Args>
+template <class _Fp, class... _Args>
class __async_func
{
- tuple<_F, _Args...> __f_;
+ tuple<_Fp, _Args...> __f_;
public:
- typedef typename __invoke_of<_F, _Args...>::type _R;
+ typedef typename __invoke_of<_Fp, _Args...>::type _Rp;
_LIBCPP_INLINE_VISIBILITY
- explicit __async_func(_F&& __f, _Args&&... __args)
+ explicit __async_func(_Fp&& __f, _Args&&... __args)
: __f_(_VSTD::move(__f), _VSTD::move(__args)...) {}
_LIBCPP_INLINE_VISIBILITY
__async_func(__async_func&& __f) : __f_(_VSTD::move(__f.__f_)) {}
- _R operator()()
+ _Rp operator()()
{
typedef typename __make_tuple_indices<1+sizeof...(_Args), 1>::type _Index;
return __execute(_Index());
}
private:
template <size_t ..._Indices>
- _R
+ _Rp
__execute(__tuple_indices<_Indices...>)
{
return __invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
}
};
-template <class _F, class... _Args>
-future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
-async(launch __policy, _F&& __f, _Args&&... __args)
+template <class _Fp, class... _Args>
+future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+async(launch __policy, _Fp&& __f, _Args&&... __args)
{
- typedef __async_func<typename decay<_F>::type, typename decay<_Args>::type...> _BF;
- typedef typename _BF::_R _R;
- future<_R> __r;
- if (__policy & launch::async)
- __r = _VSTD::__make_async_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)),
+ typedef __async_func<typename decay<_Fp>::type, typename decay<_Args>::type...> _BF;
+ typedef typename _BF::_Rp _Rp;
+ future<_Rp> __r;
+ if (int(__policy) & int(launch::async))
+ __r = _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
- else if (__policy & launch::deferred)
- __r = _VSTD::__make_deferred_assoc_state<_R>(_BF(__decay_copy(_VSTD::forward<_F>(__f)),
+ else if (int(__policy) & int(launch::deferred))
+ __r = _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
return __r;
}
-template <class _F, class... _Args>
+template <class _Fp, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
-future<typename __invoke_of<typename decay<_F>::type, typename decay<_Args>::type...>::type>
-async(_F&& __f, _Args&&... __args)
+future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
+async(_Fp&& __f, _Args&&... __args)
{
- return _VSTD::async(launch::any, _VSTD::forward<_F>(__f),
+ return _VSTD::async(launch::any, _VSTD::forward<_Fp>(__f),
_VSTD::forward<_Args>(__args)...);
}
@@ -2274,10 +2258,10 @@ async(_F&& __f, _Args&&... __args)
// shared_future
-template <class _R>
+template <class _Rp>
class _LIBCPP_VISIBLE shared_future
{
- __assoc_state<_R>* __state_;
+ __assoc_state<_Rp>* __state_;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -2287,7 +2271,7 @@ public:
{if (__state_) __state_->__add_shared();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future(future<_R>&& __f) : __state_(__f.__state_)
+ shared_future(future<_Rp>&& __f) : __state_(__f.__state_)
{__f.__state_ = nullptr;}
_LIBCPP_INLINE_VISIBILITY
shared_future(shared_future&& __rhs) : __state_(__rhs.__state_)
@@ -2306,7 +2290,7 @@ public:
// retrieving the value
_LIBCPP_INLINE_VISIBILITY
- const _R& get() const {return __state_->copy();}
+ const _Rp& get() const {return __state_->copy();}
_LIBCPP_INLINE_VISIBILITY
void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
@@ -2329,16 +2313,16 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
-shared_future<_R>::~shared_future()
+template <class _Rp>
+shared_future<_Rp>::~shared_future()
{
if (__state_)
__state_->__release_shared();
}
-template <class _R>
-shared_future<_R>&
-shared_future<_R>::operator=(const shared_future& __rhs)
+template <class _Rp>
+shared_future<_Rp>&
+shared_future<_Rp>::operator=(const shared_future& __rhs)
{
if (__rhs.__state_)
__rhs.__state_->__add_shared();
@@ -2348,10 +2332,10 @@ shared_future<_R>::operator=(const shared_future& __rhs)
return *this;
}
-template <class _R>
-class _LIBCPP_VISIBLE shared_future<_R&>
+template <class _Rp>
+class _LIBCPP_VISIBLE shared_future<_Rp&>
{
- __assoc_state<_R&>* __state_;
+ __assoc_state<_Rp&>* __state_;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -2361,7 +2345,7 @@ public:
{if (__state_) __state_->__add_shared();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future(future<_R&>&& __f) : __state_(__f.__state_)
+ shared_future(future<_Rp&>&& __f) : __state_(__f.__state_)
{__f.__state_ = nullptr;}
_LIBCPP_INLINE_VISIBILITY
shared_future(shared_future&& __rhs) : __state_(__rhs.__state_)
@@ -2380,7 +2364,7 @@ public:
// retrieving the value
_LIBCPP_INLINE_VISIBILITY
- _R& get() const {return __state_->copy();}
+ _Rp& get() const {return __state_->copy();}
_LIBCPP_INLINE_VISIBILITY
void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
@@ -2403,16 +2387,16 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
-shared_future<_R&>::~shared_future()
+template <class _Rp>
+shared_future<_Rp&>::~shared_future()
{
if (__state_)
__state_->__release_shared();
}
-template <class _R>
-shared_future<_R&>&
-shared_future<_R&>::operator=(const shared_future& __rhs)
+template <class _Rp>
+shared_future<_Rp&>&
+shared_future<_Rp&>::operator=(const shared_future& __rhs)
{
if (__rhs.__state_)
__rhs.__state_->__add_shared();
@@ -2477,28 +2461,28 @@ public:
{return __state_->wait_until(__abs_time);}
};
-template <class _R>
+template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(shared_future<_R>& __x, shared_future<_R>& __y)
+swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y)
{
__x.swap(__y);
}
-template <class _R>
+template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_future<_R>
-future<_R>::share()
+shared_future<_Rp>
+future<_Rp>::share()
{
- return shared_future<_R>(_VSTD::move(*this));
+ return shared_future<_Rp>(_VSTD::move(*this));
}
-template <class _R>
+template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_future<_R&>
-future<_R&>::share()
+shared_future<_Rp&>
+future<_Rp&>::share()
{
- return shared_future<_R&>(_VSTD::move(*this));
+ return shared_future<_Rp&>(_VSTD::move(*this));
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/include/initializer_list b/include/initializer_list
index 3263906d6374..2f88514b7f78 100644
--- a/include/initializer_list
+++ b/include/initializer_list
@@ -55,45 +55,45 @@ namespace std // purposefully not versioned
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-template<class _E>
+template<class _Ep>
class _LIBCPP_VISIBLE initializer_list
{
- const _E* __begin_;
+ const _Ep* __begin_;
size_t __size_;
_LIBCPP_ALWAYS_INLINE
- initializer_list(const _E* __b, size_t __s) _NOEXCEPT
+ initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
: __begin_(__b),
__size_(__s)
{}
public:
- typedef _E value_type;
- typedef const _E& reference;
- typedef const _E& const_reference;
+ typedef _Ep value_type;
+ typedef const _Ep& reference;
+ typedef const _Ep& const_reference;
typedef size_t size_type;
- typedef const _E* iterator;
- typedef const _E* const_iterator;
+ typedef const _Ep* iterator;
+ typedef const _Ep* const_iterator;
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
- _LIBCPP_ALWAYS_INLINE const _E* begin() const _NOEXCEPT {return __begin_;}
- _LIBCPP_ALWAYS_INLINE const _E* end() const _NOEXCEPT {return __begin_ + __size_;}
+ _LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
+ _LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
};
-template<class _E>
+template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
-const _E*
-begin(initializer_list<_E> __il) _NOEXCEPT
+const _Ep*
+begin(initializer_list<_Ep> __il) _NOEXCEPT
{
return __il.begin();
}
-template<class _E>
+template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
-const _E*
-end(initializer_list<_E> __il) _NOEXCEPT
+const _Ep*
+end(initializer_list<_Ep> __il) _NOEXCEPT
{
return __il.end();
}
diff --git a/include/iomanip b/include/iomanip
index 15704046227f..0c58e1980f3f 100644
--- a/include/iomanip
+++ b/include/iomanip
@@ -277,10 +277,10 @@ public:
__iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
- template <class _CharT, class _Traits, class _M>
+ template <class _CharT, class _Traits, class _Mp>
friend
basic_istream<_CharT, _Traits>&
- operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
+ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
@@ -294,11 +294,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
- typedef istreambuf_iterator<_CharT, _Traits> _I;
- typedef money_get<_CharT, _I> _F;
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef money_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- const _F& __mf = use_facet<_F>(__is.getloc());
- __mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
+ const _Fp& __mf = use_facet<_Fp>(__is.getloc());
+ __mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -337,10 +337,10 @@ public:
__iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {}
- template <class _CharT, class _Traits, class _M>
+ template <class _CharT, class _Traits, class _Mp>
friend
basic_ostream<_CharT, _Traits>&
- operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
+ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x);
};
template <class _CharT, class _Traits, class _MoneyT>
@@ -354,10 +354,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _O;
- typedef money_put<_CharT, _O> _F;
- const _F& __mf = use_facet<_F>(__os.getloc());
- if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef money_put<_CharT, _Op> _Fp;
+ const _Fp& __mf = use_facet<_Fp>(__os.getloc());
+ if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -396,10 +396,10 @@ public:
__iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
- template <class _C, class _Traits>
+ template <class _Cp, class _Traits>
friend
- basic_istream<_C, _Traits>&
- operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
+ basic_istream<_Cp, _Traits>&
+ operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x);
};
template <class _CharT, class _Traits>
@@ -413,11 +413,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s)
{
- typedef istreambuf_iterator<_CharT, _Traits> _I;
- typedef time_get<_CharT, _I> _F;
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef time_get<_CharT, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- const _F& __tf = use_facet<_F>(__is.getloc());
- __tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
+ const _Fp& __tf = use_facet<_Fp>(__is.getloc());
+ __tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err);
}
@@ -457,10 +457,10 @@ public:
__iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {}
- template <class _C, class _Traits>
+ template <class _Cp, class _Traits>
friend
- basic_ostream<_C, _Traits>&
- operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
+ basic_ostream<_Cp, _Traits>&
+ operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x);
};
template <class _CharT, class _Traits>
@@ -474,10 +474,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _O;
- typedef time_put<_CharT, _O> _F;
- const _F& __tf = use_facet<_F>(__os.getloc());
- if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ typedef time_put<_CharT, _Op> _Fp;
+ const _Fp& __tf = use_facet<_Fp>(__os.getloc());
+ if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
__os.setstate(ios_base::badbit);
}
diff --git a/include/ios b/include/ios
index 7ea63a31ca71..51d50870b607 100644
--- a/include/ios
+++ b/include/ios
@@ -373,21 +373,19 @@ private:
};
//enum class io_errc
-struct _LIBCPP_VISIBLE io_errc
+_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
{
-enum _ {
stream = 1
};
- _ __v_;
-
- _LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
- _LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
-};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
+
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
+#endif
_LIBCPP_VISIBLE
const error_category& iostream_category();
@@ -574,7 +572,8 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
- _LIBCPP_ALWAYS_INLINE // explicit
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_EXPLICIT
operator bool() const {return !fail();}
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
diff --git a/include/istream b/include/istream
index 24d9f3a9f63a..7312425eb070 100644
--- a/include/istream
+++ b/include/istream
@@ -155,6 +155,8 @@ template <class charT, class traits, class T>
#include <__config>
#include <ostream>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -254,7 +256,7 @@ public:
// ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY
- // explicit
+ _LIBCPP_EXPLICIT
operator bool() const {return __ok_;}
};
@@ -269,10 +271,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.tie()->flush();
if (!__noskipws && (__is.flags() & ios_base::skipws))
{
- typedef istreambuf_iterator<_CharT, _Traits> _I;
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
- _I __i(__is);
- _I __eof;
+ _Ip __i(__is);
+ _Ip __eof;
for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i))
break;
@@ -340,10 +342,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -367,10 +369,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -394,10 +396,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -421,10 +423,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -448,10 +450,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -475,10 +477,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -502,10 +504,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -529,10 +531,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -556,10 +558,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -583,10 +585,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -610,10 +612,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n);
this->setstate(__err);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -637,11 +639,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
long __temp;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
if (__temp < numeric_limits<short>::min())
{
__err |= ios_base::failbit;
@@ -677,11 +679,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
sentry __s(*this);
if (__s)
{
- typedef istreambuf_iterator<char_type, traits_type> _I;
- typedef num_get<char_type, _I> _F;
+ typedef istreambuf_iterator<char_type, traits_type> _Ip;
+ typedef num_get<char_type, _Ip> _Fp;
ios_base::iostate __err = ios_base::goodbit;
long __temp;
- use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
+ use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp);
if (__temp < numeric_limits<int>::min())
{
__err |= ios_base::failbit;
@@ -1143,7 +1145,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
+ if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break;
}
}
@@ -1159,7 +1161,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
- if (traits_type::eq(__ch, __dlm))
+ if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break;
}
}
@@ -1210,7 +1212,6 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true);
if (__sen)
{
- ios_base::iostate __err = ios_base::goodbit;
for (; __gc_ < __n; ++__gc_)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
diff --git a/include/iterator b/include/iterator
index 13c2c341e238..75fee4b9db55 100644
--- a/include/iterator
+++ b/include/iterator
@@ -823,7 +823,8 @@ public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {}
- _LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
+ _LIBCPP_INLINE_VISIBILITY char_type operator*() const
+ {return static_cast<char_type>(__sbuf_->sgetc());}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
@@ -1039,9 +1040,9 @@ template <class _Iter>
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
-template <class _I, class _O> _O copy(_I, _I, _O);
+template <class _Ip, class _Op> _Op copy(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
-template <class _I, class _O> _O move(_I, _I, _O);
+template <class _Ip, class _Op> _Op move(_Ip, _Ip, _Op);
template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
@@ -1212,9 +1213,9 @@ private:
__wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
- template <class _I, class _O> friend _O copy(_I, _I, _O);
+ template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
- template <class _I, class _O> friend _O move(_I, _I, _O);
+ template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
template <class _Tp>
@@ -1715,88 +1716,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
-begin(_C& __c) -> decltype(__c.begin())
+begin(_Cp& __c) -> decltype(__c.begin())
{
return __c.begin();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
-begin(const _C& __c) -> decltype(__c.begin())
+begin(const _Cp& __c) -> decltype(__c.begin())
{
return __c.begin();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
-end(_C& __c) -> decltype(__c.end())
+end(_Cp& __c) -> decltype(__c.end())
{
return __c.end();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto
-end(const _C& __c) -> decltype(__c.end())
+end(const _Cp& __c) -> decltype(__c.end())
{
return __c.end();
}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-typename _C::iterator
-begin(_C& __c)
+typename _Cp::iterator
+begin(_Cp& __c)
{
return __c.begin();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-typename _C::const_iterator
-begin(const _C& __c)
+typename _Cp::const_iterator
+begin(const _Cp& __c)
{
return __c.begin();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-typename _C::iterator
-end(_C& __c)
+typename _Cp::iterator
+end(_Cp& __c)
{
return __c.end();
}
-template <class _C>
+template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
-typename _C::const_iterator
-end(const _C& __c)
+typename _Cp::const_iterator
+end(const _Cp& __c)
{
return __c.end();
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
-template <class _T, size_t _N>
+template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
-_T*
-begin(_T (&__array)[_N])
+_Tp*
+begin(_Tp (&__array)[_Np])
{
return __array;
}
-template <class _T, size_t _N>
+template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
-_T*
-end(_T (&__array)[_N])
+_Tp*
+end(_Tp (&__array)[_Np])
{
- return __array + _N;
+ return __array + _Np;
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/limits b/include/limits
index 14b49b1385b3..ea579ad31361 100644
--- a/include/limits
+++ b/include/limits
@@ -109,6 +109,8 @@ template<> class numeric_limits<cv long double>;
#include <__config>
#include <type_traits>
+#include <__undef_min_max>
+
#if defined(_MSC_VER)
#include "support/win32/limits_win32.h"
#endif // _MSC_VER
diff --git a/include/list b/include/list
index 345f24dbbe4d..b486e8313411 100644
--- a/include/list
+++ b/include/list
@@ -176,6 +176,8 @@ template <class T, class Alloc>
#include <iterator>
#include <algorithm>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -1193,8 +1195,8 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
splice(end(), __c);
else
{
- typedef move_iterator<iterator> _I;
- assign(_I(__c.begin()), _I(__c.end()));
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
}
}
@@ -1217,8 +1219,8 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
{
if (base::__node_alloc() != __c.__node_alloc())
{
- typedef move_iterator<iterator> _I;
- assign(_I(__c.begin()), _I(__c.end()));
+ typedef move_iterator<iterator> _Ip;
+ assign(_Ip(__c.begin()), _Ip(__c.end()));
}
else
__move_assign(__c, true_type());
@@ -1284,8 +1286,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
" referring to this list");
#endif
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
@@ -1309,8 +1311,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{
size_type __ds = 0;
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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);
++__ds;
@@ -1377,8 +1379,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{
size_type __ds = 0;
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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_), *__f);
++__ds;
@@ -1432,8 +1434,8 @@ void
list<_Tp, _Alloc>::push_front(const value_type& __x)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
@@ -1445,8 +1447,8 @@ void
list<_Tp, _Alloc>::push_back(const value_type& __x)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
@@ -1460,8 +1462,8 @@ void
list<_Tp, _Alloc>::push_front(value_type&& __x)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
@@ -1473,8 +1475,8 @@ void
list<_Tp, _Alloc>::push_back(value_type&& __x)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
@@ -1489,8 +1491,8 @@ void
list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
@@ -1503,8 +1505,8 @@ void
list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ 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(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
@@ -1517,8 +1519,8 @@ typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
{
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
@@ -1542,8 +1544,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
" referring to this list");
#endif
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
@@ -1706,8 +1708,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
__n -= base::__sz();
size_type __ds = 0;
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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_));
++__ds;
@@ -1765,8 +1767,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
__n -= base::__sz();
size_type __ds = 0;
__node_allocator& __na = base::__node_alloc();
- typedef __allocator_destructor<__node_allocator> _D;
- unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
+ typedef __allocator_destructor<__node_allocator> _Dp;
+ 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);
++__ds;
diff --git a/include/locale b/include/locale
index b2afbd40e07b..bec27f6d9eb2 100644
--- a/include/locale
+++ b/include/locale
@@ -192,6 +192,8 @@ template <class charT> class messages_byname;
#include <nl_types.h>
#endif // !_WIN32
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -209,7 +211,9 @@ _LIBCPP_BEGIN_NAMESPACE_STD
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
+#ifndef _LIBCPP_LOCALE__L_EXTENSIONS
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
+#endif
// OSX has nice foo_l() functions that let you turn off use of the global
// locale. Linux, not so much. The following functions avoid the locale when
@@ -431,7 +435,7 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
bool __case_sensitive = true)
{
typedef typename iterator_traits<_InputIterator>::value_type _CharT;
- size_t __nkw = _VSTD::distance(__kb, __ke);
+ size_t __nkw = static_cast<size_t>(_VSTD::distance(__kb, __ke));
const unsigned char __doesnt_match = '\0';
const unsigned char __might_match = '\1';
const unsigned char __does_match = '\2';
@@ -596,7 +600,7 @@ __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*&
__dc = 0;
return 0;
}
- if (__ct == __thousands_sep && __grouping.size() != 0)
+ if (__grouping.size() != 0 && __ct == __thousands_sep)
{
if (__g_end-__g < __num_get_buf_sz)
{
@@ -663,6 +667,15 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
if (__f >= 32)
return -1;
char __x = __src[__f];
+ if (__x == '-' || __x == '+')
+ {
+ if (__a_end == __a || (__a_end[-1] & 0xDF) == __exp)
+ {
+ *__a_end++ = __x;
+ return 0;
+ }
+ return -1;
+ }
if (__a_end-__a < __num_get_buf_sz - 1)
*__a_end++ = __x;
if (__x == 'x' || __x == 'X')
@@ -679,8 +692,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
return 0;
}
-extern template class __num_get<char>;
-extern template class __num_get<wchar_t>;
+extern template struct __num_get<char>;
+extern template struct __num_get<wchar_t>;
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_get
@@ -1273,7 +1286,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
int __base = 16;
// Stage 2
char_type __atoms[26];
- char_type __thousands_sep;
+ char_type __thousands_sep = 0;
string __grouping;
use_facet<ctype<_CharT> >(__iob.getloc()).widen(__num_get_base::__src,
__num_get_base::__src + 26, __atoms);
@@ -1451,8 +1464,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
__op = __ob + (__np - __nb);
}
-extern template class __num_put<char>;
-extern template class __num_put<wchar_t>;
+extern template struct __num_put<char>;
+extern template struct __num_put<wchar_t>;
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
class _LIBCPP_VISIBLE num_put
@@ -1764,7 +1777,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
unique_ptr<char_type, void(*)(void*)> __obh(0, free);
if (__nb != __nar)
{
- __ob = (char_type*)malloc((2*__nc)*sizeof(char_type));
+ __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
if (__ob == 0)
__throw_bad_alloc();
__obh.reset(__ob);
@@ -1833,7 +1846,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
unique_ptr<char_type, void(*)(void*)> __obh(0, free);
if (__nb != __nar)
{
- __ob = (char_type*)malloc((2*__nc)*sizeof(char_type));
+ __ob = (char_type*)malloc(2*static_cast<size_t>(__nc)*sizeof(char_type));
if (__ob == 0)
__throw_bad_alloc();
__obh.reset(__ob);
@@ -2100,7 +2113,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
{
// Note: ignoring case comes from the POSIX strptime spec
const string_type* __wk = this->__weeks();
- int __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
+ ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
if (__i < 14)
__w = __i % 7;
}
@@ -2114,7 +2127,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
{
// Note: ignoring case comes from the POSIX strptime spec
const string_type* __month = this->__months();
- int __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
+ ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
if (__i < 24)
__m = __i % 12;
}
@@ -2286,7 +2299,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
__err |= ios_base::failbit;
return;
}
- int __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
+ ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
if (__i == 0 && __h == 12)
__h = 0;
else if (__i == 1 && __h < 12)
@@ -2395,7 +2408,6 @@ time_get<_CharT, _InputIterator>::do_get_date(iter_type __b, iter_type __e,
ios_base::iostate& __err,
tm* __tm) const
{
- const ctype<char_type>& __ct = use_facet<ctype<char_type> >(__iob.getloc());
const string_type& __fmt = this->__x();
return get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
}
@@ -2458,8 +2470,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
case 'c':
{
- const string_type& __fmt = this->__c();
- __b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
+ const string_type& __fm = this->__c();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
}
break;
case 'd':
@@ -2468,14 +2480,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
case 'D':
{
- const char_type __fmt[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
- __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+ const char_type __fm[] = {'%', 'm', '/', '%', 'd', '/', '%', 'y'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
}
break;
case 'F':
{
- const char_type __fmt[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
- __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+ const char_type __fm[] = {'%', 'Y', '-', '%', 'm', '-', '%', 'd'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
}
break;
case 'H':
@@ -2502,14 +2514,14 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
case 'r':
{
- const char_type __fmt[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
- __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+ const char_type __fm[] = {'%', 'I', ':', '%', 'M', ':', '%', 'S', ' ', '%', 'p'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
}
break;
case 'R':
{
- const char_type __fmt[] = {'%', 'H', ':', '%', 'M'};
- __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
}
break;
case 'S':
@@ -2517,8 +2529,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
break;
case 'T':
{
- const char_type __fmt[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
- __b = get(__b, __e, __iob, __err, __tm, __fmt, __fmt + sizeof(__fmt)/sizeof(__fmt[0]));
+ const char_type __fm[] = {'%', 'H', ':', '%', 'M', ':', '%', 'S'};
+ __b = get(__b, __e, __iob, __err, __tm, __fm, __fm + sizeof(__fm)/sizeof(__fm[0]));
}
break;
case 'w':
@@ -2528,8 +2540,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
return do_get_date(__b, __e, __iob, __err, __tm);
case 'X':
{
- const string_type& __fmt = this->__X();
- __b = get(__b, __e, __iob, __err, __tm, __fmt.data(), __fmt.data() + __fmt.size());
+ const string_type& __fm = this->__X();
+ __b = get(__b, __e, __iob, __err, __tm, __fm.data(), __fm.data() + __fm.size());
}
break;
case 'y':
@@ -2732,7 +2744,7 @@ time_put<_CharT, _OutputIterator>::put(iter_type __s, ios_base& __iob,
template <class _CharT, class _OutputIterator>
_OutputIterator
-time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
+time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
char_type, const tm* __tm,
char __fmt, char __mod) const
{
@@ -3009,10 +3021,10 @@ void
__double_or_nothing(unique_ptr<_Tp, void(*)(void*)>& __b, _Tp*& __n, _Tp*& __e)
{
bool __owns = __b.get_deleter() != __do_nothing;
- size_t __cur_cap = (__e-__b.get()) * sizeof(_Tp);
+ size_t __cur_cap = static_cast<size_t>(__e-__b.get()) * sizeof(_Tp);
size_t __new_cap = __cur_cap < numeric_limits<size_t>::max() / 2 ?
2 * __cur_cap : numeric_limits<size_t>::max();
- size_t __n_off = __n - __b.get();
+ size_t __n_off = static_cast<size_t>(__n - __b.get());
_Tp* __t = (_Tp*)realloc(__owns ? __b.get() : 0, __new_cap);
if (__t == 0)
__throw_bad_alloc();
@@ -3048,6 +3060,9 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
string_type __sym;
string_type __psn;
string_type __nsn;
+ // Capture the spaces read into money_base::{space,none} so they
+ // can be compared to initial spaces in __sym.
+ string_type __spaces;
int __fd;
__money_get<_CharT>::__gather_info(__intl, __loc, __pat, __dp, __ts, __grp,
__sym, __psn, __nsn, __fd);
@@ -3061,7 +3076,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
if (__p != 3)
{
if (__ct.is(ctype_base::space, *__b))
- ++__b;
+ __spaces.push_back(*__b++);
else
{
__err |= ios_base::failbit;
@@ -3073,7 +3088,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
if (__p != 3)
{
while (__b != __e && __ct.is(ctype_base::space, *__b))
- ++__b;
+ __spaces.push_back(*__b++);
}
break;
case money_base::sign:
@@ -3132,9 +3147,31 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
if (__sb || __more_needed)
{
ios_base::iostate __et = ios_base::goodbit;
- string_type* __k = __scan_keyword(__b, __e, &__sym, &__sym+1,
- __ct, __et);
- if (__sb && __k != &__sym)
+ typename string_type::const_iterator __sym_space_end = __sym.begin();
+ if (__p > 0 && (__pat.field[__p - 1] == money_base::none ||
+ __pat.field[__p - 1] == money_base::space)) {
+ // Match spaces we've already read against spaces at
+ // the beginning of __sym.
+ while (__sym_space_end != __sym.end() &&
+ __ct.is(ctype_base::space, *__sym_space_end))
+ ++__sym_space_end;
+ const size_t __num_spaces = __sym_space_end - __sym.begin();
+ if (__num_spaces > __spaces.size() ||
+ !equal(__spaces.end() - __num_spaces, __spaces.end(),
+ __sym.begin())) {
+ // No match. Put __sym_space_end back at the
+ // beginning of __sym, which will prevent a
+ // match in the next loop.
+ __sym_space_end = __sym.begin();
+ }
+ }
+ typename string_type::const_iterator __sym_curr_char = __sym_space_end;
+ while (__sym_curr_char != __sym.end() && __b != __e &&
+ *__b == *__sym_curr_char) {
+ ++__b;
+ ++__sym_curr_char;
+ }
+ if (__sb && __sym_curr_char != __sym.end())
{
__err |= ios_base::failbit;
return false;
@@ -3230,7 +3267,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
ios_base::iostate& __err,
long double& __v) const
{
- const unsigned __bz = 100;
+ const int __bz = 100;
char_type __wbuf[__bz];
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
char_type* __wn;
@@ -3249,7 +3286,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
unique_ptr<char, void(*)(void*)> __h(0, free);
if (__wn - __wb.get() > __bz-2)
{
- __h.reset((char*)malloc(__wn - __wb.get() + 2));
+ __h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
if (__h.get() == 0)
__throw_bad_alloc();
__nc = __h.get();
@@ -3274,7 +3311,7 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
ios_base::iostate& __err,
string_type& __v) const
{
- const unsigned __bz = 100;
+ const int __bz = 100;
char_type __wbuf[__bz];
unique_ptr<char_type, void(*)(void*)> __wb(__wbuf, __do_nothing);
char_type* __wn;
@@ -3534,14 +3571,14 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char* __bb = __buf;
char_type __digits[__bs];
char_type* __db = __digits;
- size_t __n = snprintf(__bb, __bs, "%.0Lf", __units);
+ size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
unique_ptr<char, void(*)(void*)> __hn(0, free);
unique_ptr<char_type, void(*)(void*)> __hd(0, free);
// secure memory for digit storage
if (__n > __bs-1)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- __n = asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units);
+ __n = static_cast<size_t>(asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
#else
__n = __asprintf_l(&__bb, __cloc(), "%.0Lf", __units);
#endif
@@ -3549,7 +3586,7 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
__throw_bad_alloc();
__hn.reset(__bb);
__hd.reset((char_type*)malloc(__n * sizeof(char_type)));
- if (__hd == 0)
+ if (__hd == nullptr)
__throw_bad_alloc();
__db = __hd.get();
}
@@ -3571,8 +3608,9 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char_type* __mb = __mbuf;
unique_ptr<char_type, void(*)(void*)> __hw(0, free);
size_t __exn = static_cast<int>(__n) > __fd ?
- (__n - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1
- : __sn.size() + __sym.size() + __fd + 2;
+ (__n - static_cast<size_t>(__fd)) * 2 + __sn.size() +
+ __sym.size() + static_cast<size_t>(__fd) + 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
if (__exn > __bs)
{
__hw.reset((char_type*)malloc(__exn * sizeof(char_type)));
@@ -3611,9 +3649,10 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
char_type __mbuf[100];
char_type* __mb = __mbuf;
unique_ptr<char_type, void(*)(void*)> __h(0, free);
- size_t __exn = __digits.size() > __fd ?
- (__digits.size() - __fd) * 2 + __sn.size() + __sym.size() + __fd + 1
- : __sn.size() + __sym.size() + __fd + 2;
+ size_t __exn = static_cast<int>(__digits.size()) > __fd ?
+ (__digits.size() - static_cast<size_t>(__fd)) * 2 +
+ __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 1
+ : __sn.size() + __sym.size() + static_cast<size_t>(__fd) + 2;
if (__exn > 100)
{
__h.reset((char_type*)malloc(__exn * sizeof(char_type)));
@@ -4003,9 +4042,9 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
else if (__r == codecvt_base::partial)
{
- ptrdiff_t __s = __to_nxt - &__bs[0];
- __bs.resize(2 * __s);
- __to = &__bs[0] + __s;
+ ptrdiff_t __sp = __to_nxt - &__bs[0];
+ __bs.resize(2 * __sp);
+ __to = &__bs[0] + __sp;
__to_end = &__bs[0] + __bs.size();
}
} while (__r == codecvt_base::partial);
diff --git a/include/map b/include/map
index 8bb75550dbaa..633579b7ee06 100644
--- a/include/map
+++ b/include/map
@@ -381,11 +381,15 @@ swap(multimap<Key, T, Compare, Allocator>& x,
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value>
+template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value
+#if __has_feature(is_final)
+ && !__is_final(_Compare)
+#endif
+ >
class __map_value_compare
: private _Compare
{
- typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
+ typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -402,25 +406,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _CP& __x, const _P& __y) const
+ bool operator()(const _CP& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _CP& __y) const
+ bool operator()(const _Pp& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _P& __y) const
+ bool operator()(const _Pp& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _Key& __y) const
+ bool operator()(const _Pp& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _P& __y) const
+ bool operator()(const _Key& __x, const _Pp& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
@@ -432,7 +436,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{
_Compare comp;
- typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
+ typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp;
typedef pair<const _Key, _Tp> _CP;
public:
@@ -451,25 +455,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _CP& __x, const _P& __y) const
+ bool operator()(const _CP& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _CP& __y) const
+ bool operator()(const _Pp& __x, const _CP& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _P& __y) const
+ bool operator()(const _Pp& __x, const _Pp& __y) const
{return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _P& __x, const _Key& __y) const
+ bool operator()(const _Pp& __x, const _Key& __y) const
{return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Key& __x, const _P& __y) const
+ bool operator()(const _Key& __x, const _Pp& __y) const
{return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const
@@ -918,17 +922,17 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
- template <class _P,
- class = typename enable_if<is_constructible<value_type, _P>::value>::type>
+ template <class _Pp,
+ class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(_P&& __p)
- {return __tree_.__insert_unique(_VSTD::forward<_P>(__p));}
+ pair<iterator, bool> insert(_Pp&& __p)
+ {return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));}
- template <class _P,
- class = typename enable_if<is_constructible<value_type, _P>::value>::type>
+ template <class _Pp,
+ class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __pos, _P&& __p)
- {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));}
+ iterator insert(const_iterator __pos, _Pp&& __p)
+ {return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1006,8 +1010,8 @@ private:
typedef typename __base::__node_const_pointer __node_const_pointer;
typedef typename __base::__node_base_pointer __node_base_pointer;
typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
- typedef __map_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
@@ -1202,7 +1206,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1217,7 +1221,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
@@ -1233,7 +1237,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
@@ -1250,7 +1254,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1665,17 +1669,17 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
- template <class _P,
- class = typename enable_if<is_constructible<value_type, _P>::value>::type>
+ template <class _Pp,
+ class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- iterator insert(_P&& __p)
- {return __tree_.__insert_multi(_VSTD::forward<_P>(__p));}
+ iterator insert(_Pp&& __p)
+ {return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));}
- template <class _P,
- class = typename enable_if<is_constructible<value_type, _P>::value>::type>
+ template <class _Pp,
+ class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __pos, _P&& __p)
- {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));}
+ iterator insert(const_iterator __pos, _Pp&& __p)
+ {return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1748,8 +1752,8 @@ private:
typedef typename __base::__node_allocator __node_allocator;
typedef typename __base::__node_pointer __node_pointer;
typedef typename __base::__node_const_pointer __node_const_pointer;
- typedef __map_node_destructor<__node_allocator> _D;
- typedef unique_ptr<__node, _D> __node_holder;
+ typedef __map_node_destructor<__node_allocator> _Dp;
+ typedef unique_ptr<__node, _Dp> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
@@ -1784,7 +1788,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1800,7 +1804,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true;
@@ -1817,7 +1821,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
diff --git a/include/memory b/include/memory
index 878dda8730d9..aa24f960aecf 100644
--- a/include/memory
+++ b/include/memory
@@ -596,22 +596,20 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <iterator>
#include <__functional_base>
#include <iosfwd>
+#include <tuple>
+#include <cstring>
#if defined(_LIBCPP_NO_EXCEPTIONS)
#include <cassert>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-// allocator_arg_t
-
-struct _LIBCPP_VISIBLE allocator_arg_t { };
-
-extern const allocator_arg_t allocator_arg;
-
// addressof
template <class _Tp>
@@ -675,6 +673,17 @@ public:
template <class _Up> struct rebind {typedef allocator<_Up> other;};
};
+template <>
+class _LIBCPP_VISIBLE allocator<const void>
+{
+public:
+ typedef const void* pointer;
+ typedef const void* const_pointer;
+ typedef const void value_type;
+
+ template <class _Up> struct rebind {typedef allocator<_Up> other;};
+};
+
// pointer_traits
template <class _Tp>
@@ -1062,10 +1071,10 @@ struct __const_void_pointer<_Ptr, _Alloc, false>
#endif
};
-template <class _T>
+template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-_T*
-__to_raw_pointer(_T* __p) _NOEXCEPT
+_Tp*
+__to_raw_pointer(_Tp* __p) _NOEXCEPT
{
return __p;
}
@@ -1387,6 +1396,14 @@ struct __has_construct
{
};
+#else // _LIBCPP_HAS_NO_VARIADICS
+
+template <class _Alloc, class _Pointer, class _Args>
+struct __has_construct
+ : false_type
+{
+};
+
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Alloc, class _Pointer>
@@ -1516,6 +1533,60 @@ struct _LIBCPP_VISIBLE allocator_traits
__has_select_on_container_copy_construction<const allocator_type>(),
__a);}
+ template <class _Ptr>
+ _LIBCPP_INLINE_VISIBILITY
+ static
+ void
+ __construct_forward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __begin2)
+ {
+ for (; __begin1 != __end1; ++__begin1, ++__begin2)
+ construct(__a, _VSTD::__to_raw_pointer(__begin2), _VSTD::move_if_noexcept(*__begin1));
+ }
+
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY
+ static
+ typename enable_if
+ <
+ (is_same<allocator_type, allocator<_Tp> >::value
+ || !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
+ is_trivially_move_constructible<_Tp>::value,
+ void
+ >::type
+ __construct_forward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __begin2)
+ {
+ ptrdiff_t _Np = __end1 - __begin1;
+ _VSTD::memcpy(__begin2, __begin1, _Np * sizeof(_Tp));
+ __begin2 += _Np;
+ }
+
+ template <class _Ptr>
+ _LIBCPP_INLINE_VISIBILITY
+ static
+ void
+ __construct_backward(allocator_type& __a, _Ptr __begin1, _Ptr __end1, _Ptr& __end2)
+ {
+ while (__end1 != __begin1)
+ construct(__a, _VSTD::__to_raw_pointer(--__end2), _VSTD::move_if_noexcept(*--__end1));
+ }
+
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY
+ static
+ typename enable_if
+ <
+ (is_same<allocator_type, allocator<_Tp> >::value
+ || !__has_construct<allocator_type, _Tp*, _Tp>::value) &&
+ is_trivially_move_constructible<_Tp>::value,
+ void
+ >::type
+ __construct_backward(allocator_type& __a, _Tp* __begin1, _Tp* __end1, _Tp*& __end2)
+ {
+ ptrdiff_t _Np = __end1 - __begin1;
+ __end2 -= _Np;
+ _VSTD::memcpy(__end2, __begin1, _Np * sizeof(_Tp));
+ }
+
private:
_LIBCPP_INLINE_VISIBILITY
@@ -1524,7 +1595,7 @@ private:
{return __a.allocate(__n, __hint);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n,
- const_void_pointer __hint, false_type)
+ const_void_pointer, false_type)
{return __a.allocate(__n);}
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1568,69 +1639,127 @@ private:
{return __a;}
};
-// uses_allocator
+// allocator
template <class _Tp>
-struct __has_allocator_type
+class _LIBCPP_VISIBLE allocator
{
-private:
- struct __two {char _; char __;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::allocator_type* = 0);
public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
-
-template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
-struct __uses_allocator
- : public integral_constant<bool,
- is_convertible<_Alloc, typename _Tp::allocator_type>::value>
-{
-};
-
-template <class _Tp, class _Alloc>
-struct __uses_allocator<_Tp, _Alloc, false>
- : public false_type
-{
-};
-
-template <class _Tp, class _Alloc>
-struct _LIBCPP_VISIBLE uses_allocator
- : public __uses_allocator<_Tp, _Alloc>
-{
-};
+ typedef size_t size_type;
+ typedef ptrdiff_t difference_type;
+ typedef _Tp* pointer;
+ typedef const _Tp* const_pointer;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp value_type;
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ typedef true_type propagate_on_container_move_assignment;
-// uses-allocator construction
+ template <class _Up> struct rebind {typedef allocator<_Up> other;};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor_imp
-{
- static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
- static const bool __ic =
- is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
- static const int value = __ua ? 2 - __ic : 0;
+ _LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
+ template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
+ _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT
+ {return _VSTD::addressof(__x);}
+ _LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
+ {return _VSTD::addressof(__x);}
+ _LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
+ {return static_cast<pointer>(::operator new(__n * sizeof(_Tp)));}
+ _LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
+ {::operator delete((void*)__p);}
+ _LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
+ {return size_type(~0) / sizeof(_Tp);}
+#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+ template <class _Up, class... _Args>
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(_Up* __p, _Args&&... __args)
+ {
+ ::new((void*)__p) _Up(_VSTD::forward<_Args>(__args)...);
+ }
+#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(pointer __p)
+ {
+ ::new((void*)__p) _Tp();
+ }
+# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if
+ <
+ !is_convertible<_A0, __rv<_A0> >::value,
+ void
+ >::type
+ construct(pointer __p, _A0& __a0)
+ {
+ ::new((void*)__p) _Tp(__a0);
+ }
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if
+ <
+ !is_convertible<_A0, __rv<_A0> >::value,
+ void
+ >::type
+ construct(pointer __p, const _A0& __a0)
+ {
+ ::new((void*)__p) _Tp(__a0);
+ }
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if
+ <
+ is_convertible<_A0, __rv<_A0> >::value,
+ void
+ >::type
+ construct(pointer __p, _A0 __a0)
+ {
+ ::new((void*)__p) _Tp(_VSTD::move(__a0));
+ }
+# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(pointer __p, _A0& __a0, _A1& __a1)
+ {
+ ::new((void*)__p) _Tp(__a0, __a1);
+ }
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(pointer __p, const _A0& __a0, _A1& __a1)
+ {
+ ::new((void*)__p) _Tp(__a0, __a1);
+ }
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(pointer __p, _A0& __a0, const _A1& __a1)
+ {
+ ::new((void*)__p) _Tp(__a0, __a1);
+ }
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ void
+ construct(pointer __p, const _A0& __a0, const _A1& __a1)
+ {
+ ::new((void*)__p) _Tp(__a0, __a1);
+ }
+#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+ _LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
};
-template <class _Tp, class _Alloc, class ..._Args>
-struct __uses_alloc_ctor
- : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
- {};
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-// allocator
-
template <class _Tp>
-class _LIBCPP_VISIBLE allocator
+class _LIBCPP_VISIBLE allocator<const _Tp>
{
public:
typedef size_t size_type;
typedef ptrdiff_t difference_type;
- typedef _Tp* pointer;
+ typedef const _Tp* pointer;
typedef const _Tp* const_pointer;
- typedef _Tp& reference;
+ typedef const _Tp& reference;
typedef const _Tp& const_reference;
typedef _Tp value_type;
@@ -1640,8 +1769,6 @@ public:
_LIBCPP_INLINE_VISIBILITY allocator() _NOEXCEPT {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY allocator(const allocator<_Up>&) _NOEXCEPT {}
- _LIBCPP_INLINE_VISIBILITY pointer address(reference __x) const _NOEXCEPT
- {return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY const_pointer address(const_reference __x) const _NOEXCEPT
{return _VSTD::addressof(__x);}
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, allocator<void>::const_pointer = 0)
@@ -1846,8 +1973,16 @@ public:
template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
typename remove_cv<_T2>::type>::value,
- bool = is_empty<_T1>::value,
- bool = is_empty<_T2>::value>
+ bool = is_empty<_T1>::value
+#if __has_feature(is_final)
+ && !__is_final(_T1)
+#endif
+ ,
+ bool = is_empty<_T2>::value
+#if __has_feature(is_final)
+ && !__is_final(_T2)
+#endif
+ >
struct __libcpp_compressed_pair_switch;
template <class _T1, class _T2, bool IsSame>
@@ -1885,9 +2020,9 @@ public:
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1, int = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
: __first_(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2, int* = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
@@ -1930,6 +2065,21 @@ public:
return *this;
}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_INLINE_VISIBILITY
+ __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+ tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...),
+ __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
+ {}
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -1967,9 +2117,9 @@ public:
typedef const typename remove_reference<_T2>::type& _T2_const_reference;
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1, int = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
: _T1(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2, int* = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
: __second_(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
@@ -2010,6 +2160,21 @@ public:
return *this;
}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_INLINE_VISIBILITY
+ __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+ tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...),
+ __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
+ {}
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2091,6 +2256,22 @@ public:
return *this;
}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_INLINE_VISIBILITY
+ __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+ tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...),
+ __first_(_VSTD::forward<_Args1>(get<_I1>(__first_args))...)
+
+ {}
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2169,6 +2350,21 @@ public:
return *this;
}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+ template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ _LIBCPP_INLINE_VISIBILITY
+ __libcpp_compressed_pair_imp(piecewise_construct_t __pc,
+ tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args,
+ __tuple_indices<_I1...>,
+ __tuple_indices<_I2...>)
+ : _T1(_VSTD::forward<_Args1>(get<_I1>(__first_args))...),
+ _T2(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
+ {}
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2179,7 +2375,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;}
_LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
+ _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&)
_NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
__is_nothrow_swappable<_T1>::value)
{
@@ -2202,9 +2398,9 @@ public:
typedef typename base::_T2_const_reference _T2_const_reference;
_LIBCPP_INLINE_VISIBILITY __compressed_pair() {}
- _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1, int = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
: base(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2, int* = 0)
+ _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
: base(_VSTD::forward<_T2_param>(__t2)) {}
_LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
: base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {}
@@ -2241,6 +2437,20 @@ public:
base::operator=(_VSTD::move(__p));
return *this;
}
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+ template <class... _Args1, class... _Args2>
+ _LIBCPP_INLINE_VISIBILITY
+ __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args)
+ : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
+ typename __make_tuple_indices<sizeof...(_Args1)>::type(),
+ typename __make_tuple_indices<sizeof...(_Args2) >::type())
+ {}
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2265,6 +2475,31 @@ swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
__is_nothrow_swappable<_T1>::value)
{__x.swap(__y);}
+// __same_or_less_cv_qualified
+
+template <class _Ptr1, class _Ptr2,
+ bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
+ typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
+ >::value
+ >
+struct __same_or_less_cv_qualified_imp
+ : is_convertible<_Ptr1, _Ptr2> {};
+
+template <class _Ptr1, class _Ptr2>
+struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
+ : false_type {};
+
+template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value &&
+ !is_pointer<_Ptr1>::value>
+struct __same_or_less_cv_qualified
+ : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
+
+template <class _Ptr1, class _Ptr2>
+struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
+ : false_type {};
+
+// default_delete
+
template <class _Tp>
struct _LIBCPP_VISIBLE default_delete
{
@@ -2282,13 +2517,19 @@ struct _LIBCPP_VISIBLE default_delete
template <class _Tp>
struct _LIBCPP_VISIBLE default_delete<_Tp[]>
{
- _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT
+public:
+ _LIBCPP_INLINE_VISIBILITY default_delete() _NOEXCEPT {}
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&,
+ typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ void operator() (_Up* __ptr,
+ typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT
{
static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
delete [] __ptr;
}
-private:
- template <class _Up> void operator() (_Up*) const;
};
template <class _Tp, class _Dp = default_delete<_Tp> >
@@ -2301,14 +2542,7 @@ public:
private:
__compressed_pair<pointer, deleter_type> __ptr_;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- unique_ptr(const unique_ptr&);
- unique_ptr& operator=(const unique_ptr&);
- template <class _Up, class _Ep>
- unique_ptr(const unique_ptr<_Up, _Ep>&);
- template <class _Up, class _Ep>
- unique_ptr& operator=(const unique_ptr<_Up, _Ep>&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
unique_ptr(unique_ptr&);
template <class _Up, class _Ep>
unique_ptr(unique_ptr<_Up, _Ep>&);
@@ -2395,7 +2629,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- !is_array<_Up>::value,
+ !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) _NOEXCEPT
@@ -2452,9 +2688,9 @@ public:
{return __ptr_.second();}
_LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
{return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY operator int __nat::*() const
- _NOEXCEPT
- {return __ptr_.first() ? &__nat::__for_bool_ : 0;}
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+ {return __ptr_.first() != nullptr;}
_LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
{
@@ -2485,10 +2721,7 @@ public:
private:
__compressed_pair<pointer, deleter_type> __ptr_;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- unique_ptr(const unique_ptr&);
- unique_ptr& operator=(const unique_ptr&);
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
unique_ptr(unique_ptr&);
template <class _Up>
unique_ptr(unique_ptr<_Up>&);
@@ -2515,20 +2748,20 @@ public:
"unique_ptr constructed with null function pointer deleter");
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_same<_P, pointer>::value>::type
+ template <class _Pp,
+ class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
- _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_P __p) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p) _NOEXCEPT
: __ptr_(__p)
{
static_assert(!is_pointer<deleter_type>::value,
"unique_ptr constructed with null function pointer deleter");
}
- template <class _P,
- class = typename enable_if<is_same<_P, pointer>::value>::type
+ template <class _Pp,
+ class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
- _LIBCPP_INLINE_VISIBILITY unique_ptr(_P __p, typename conditional<
+ _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional<
is_reference<deleter_type>::value,
deleter_type,
typename add_lvalue_reference<const deleter_type>::type>::type __d)
@@ -2542,11 +2775,10 @@ public:
_NOEXCEPT
: __ptr_(pointer(), __d) {}
- template <class _P,
- class = typename enable_if<is_same<_P, pointer>::value ||
- is_same<_P, nullptr_t>::value>::type
+ template <class _Pp,
+ class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
- _LIBCPP_INLINE_VISIBILITY unique_ptr(_P __p, typename remove_reference<deleter_type>::type&& __d)
+ _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename remove_reference<deleter_type>::type&& __d)
_NOEXCEPT
: __ptr_(__p, _VSTD::move(__d))
{
@@ -2569,6 +2801,40 @@ public:
__ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
return *this;
}
+
+ template <class _Up, class _Ep>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(unique_ptr<_Up, _Ep>&& __u,
+ typename enable_if
+ <
+ is_array<_Up>::value &&
+ __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value
+ && is_convertible<_Ep, deleter_type>::value &&
+ (
+ !is_reference<deleter_type>::value ||
+ is_same<deleter_type, _Ep>::value
+ ),
+ __nat
+ >::type = __nat()
+ ) _NOEXCEPT
+ : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
+
+
+ template <class _Up, class _Ep>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if
+ <
+ is_array<_Up>::value &&
+ __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
+ is_assignable<deleter_type&, _Ep&&>::value,
+ unique_ptr&
+ >::type
+ operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
+ {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+ return *this;
+ }
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p)
@@ -2615,8 +2881,9 @@ public:
{return __ptr_.second();}
_LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
{return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY operator int __nat::*() const _NOEXCEPT
- {return __ptr_.first() ? &__nat::__for_bool_ : 0;}
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+ {return __ptr_.first() != nullptr;}
_LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
{
@@ -2626,10 +2893,10 @@ public:
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_same<_P, pointer>::value>::type
+ template <class _Pp,
+ class = typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value>::type
>
- _LIBCPP_INLINE_VISIBILITY void reset(_P __p) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY void reset(_Pp __p) _NOEXCEPT
{
pointer __tmp = __ptr_.first();
__ptr_.first() = __p;
@@ -2698,7 +2965,13 @@ operator!=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {re
template <class _T1, class _D1, class _T2, class _D2>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return __x.get() < __y.get();}
+operator< (const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y)
+{
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+ typedef typename unique_ptr<_T2, _D2>::pointer _P2;
+ typedef typename common_type<_P1, _P2>::type _V;
+ return less<_V>()(__x.get(), __y.get());
+}
template <class _T1, class _D1, class _T2, class _D2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2715,20 +2988,425 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {return !(__x < __y);}
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ return !__x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ return !__x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ return static_cast<bool>(__x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ return static_cast<bool>(__x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+ return less<_P1>()(__x.get(), nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ typedef typename unique_ptr<_T1, _D1>::pointer _P1;
+ return less<_P1>()(nullptr, __x.get());
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ return nullptr < __x;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ return __x < nullptr;
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ return !(nullptr < __x);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ return !(__x < nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+{
+ return !(__x < nullptr);
+}
+
+template <class _T1, class _D1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+{
+ return !(nullptr < __x);
+}
+
template <class _Tp> struct hash;
-template<class _Tp>
-struct _LIBCPP_VISIBLE hash<_Tp*>
- : public unary_function<_Tp*, size_t>
+// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
+// is 64 bits. This is because cityhash64 uses 64bit x 64bit
+// multiplication, which can be very slow on 32-bit systems.
+template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
+struct __murmur2_or_cityhash;
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 32>
+{
+ _Size operator()(const void* __key, _Size __len);
+};
+
+// murmur2
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
+{
+ const _Size __m = 0x5bd1e995;
+ const _Size __r = 24;
+ _Size __h = __len;
+ const unsigned char* __data = static_cast<const unsigned char*>(__key);
+ for (; __len >= 4; __data += 4, __len -= 4)
+ {
+ _Size __k = *(const _Size*)__data;
+ __k *= __m;
+ __k ^= __k >> __r;
+ __k *= __m;
+ __h *= __m;
+ __h ^= __k;
+ }
+ switch (__len)
+ {
+ case 3:
+ __h ^= __data[2] << 16;
+ case 2:
+ __h ^= __data[1] << 8;
+ case 1:
+ __h ^= __data[0];
+ __h *= __m;
+ }
+ __h ^= __h >> 13;
+ __h *= __m;
+ __h ^= __h >> 15;
+ return __h;
+}
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 64>
+{
+ _Size operator()(const void* __key, _Size __len);
+
+ private:
+ // Some primes between 2^63 and 2^64.
+ static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
+ static const _Size __k1 = 0xb492b66fbe98f273ULL;
+ static const _Size __k2 = 0x9ae16a3b2f90404fULL;
+ static const _Size __k3 = 0xc949d7c7509e6557ULL;
+
+ static _Size __rotate(_Size __val, int __shift) {
+ return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
+ }
+
+ static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
+ return (__val >> __shift) | (__val << (64 - __shift));
+ }
+
+ static _Size __shift_mix(_Size __val) {
+ return __val ^ (__val >> 47);
+ }
+
+ static _Size __hash_len_16(_Size __u, _Size __v) {
+ const _Size __mul = 0x9ddfea08eb382d69ULL;
+ _Size __a = (__u ^ __v) * __mul;
+ __a ^= (__a >> 47);
+ _Size __b = (__v ^ __a) * __mul;
+ __b ^= (__b >> 47);
+ __b *= __mul;
+ return __b;
+ }
+
+ static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
+ if (__len > 8) {
+ const _Size __a = *(const _Size*)__s;
+ const _Size __b = *(const _Size*)(__s + __len - 8);
+ return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
+ }
+ if (__len >= 4) {
+ const uint32_t __a = *(const uint32_t*)(__s);
+ const uint32_t __b = *(const uint32_t*)(__s + __len - 4);
+ return __hash_len_16(__len + (__a << 3), __b);
+ }
+ if (__len > 0) {
+ const unsigned char __a = __s[0];
+ const unsigned char __b = __s[__len >> 1];
+ const unsigned char __c = __s[__len - 1];
+ const uint32_t __y = static_cast<uint32_t>(__a) +
+ (static_cast<uint32_t>(__b) << 8);
+ const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
+ return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
+ }
+ return __k2;
+ }
+
+ static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
+ const _Size __a = *(const _Size*)(__s) * __k1;
+ const _Size __b = *(const _Size*)(__s + 8);
+ const _Size __c = *(const _Size*)(__s + __len - 8) * __k2;
+ const _Size __d = *(const _Size*)(__s + __len - 16) * __k0;
+ return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
+ __a + __rotate(__b ^ __k3, 20) - __c + __len);
+ }
+
+ // Return a 16-byte hash for 48 bytes. Quick and dirty.
+ // Callers do best to use "random-looking" values for a and b.
+ static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+ _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
+ __a += __w;
+ __b = __rotate(__b + __a + __z, 21);
+ const _Size __c = __a;
+ __a += __x;
+ __a += __y;
+ __b += __rotate(__a, 44);
+ return pair<_Size, _Size>(__a + __z, __b + __c);
+ }
+
+ // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
+ static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+ const char* __s, _Size __a, _Size __b) {
+ return __weak_hash_len_32_with_seeds(*(const _Size*)(__s),
+ *(const _Size*)(__s + 8),
+ *(const _Size*)(__s + 16),
+ *(const _Size*)(__s + 24),
+ __a,
+ __b);
+ }
+
+ // Return an 8-byte hash for 33 to 64 bytes.
+ static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
+ _Size __z = *(const _Size*)(__s + 24);
+ _Size __a = *(const _Size*)(__s) +
+ (__len + *(const _Size*)(__s + __len - 16)) * __k0;
+ _Size __b = __rotate(__a + __z, 52);
+ _Size __c = __rotate(__a, 37);
+ __a += *(const _Size*)(__s + 8);
+ __c += __rotate(__a, 7);
+ __a += *(const _Size*)(__s + 16);
+ _Size __vf = __a + __z;
+ _Size __vs = __b + __rotate(__a, 31) + __c;
+ __a = *(const _Size*)(__s + 16) + *(const _Size*)(__s + __len - 32);
+ __z += *(const _Size*)(__s + __len - 8);
+ __b = __rotate(__a + __z, 52);
+ __c = __rotate(__a, 37);
+ __a += *(const _Size*)(__s + __len - 24);
+ __c += __rotate(__a, 7);
+ __a += *(const _Size*)(__s + __len - 16);
+ _Size __wf = __a + __z;
+ _Size __ws = __b + __rotate(__a, 31) + __c;
+ _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
+ return __shift_mix(__r * __k0 + __vs) * __k2;
+ }
+};
+
+// cityhash64
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
+{
+ const char* __s = static_cast<const char*>(__key);
+ if (__len <= 32) {
+ if (__len <= 16) {
+ return __hash_len_0_to_16(__s, __len);
+ } else {
+ return __hash_len_17_to_32(__s, __len);
+ }
+ } else if (__len <= 64) {
+ return __hash_len_33_to_64(__s, __len);
+ }
+
+ // For strings over 64 bytes we hash the end first, and then as we
+ // loop we keep 56 bytes of state: v, w, x, y, and z.
+ _Size __x = *(const _Size*)(__s + __len - 40);
+ _Size __y = *(const _Size*)(__s + __len - 16) +
+ *(const _Size*)(__s + __len - 56);
+ _Size __z = __hash_len_16(*(const _Size*)(__s + __len - 48) + __len,
+ *(const _Size*)(__s + __len - 24));
+ pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
+ pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
+ __x = __x * __k1 + *(const _Size*)(__s);
+
+ // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
+ __len = (__len - 1) & ~static_cast<_Size>(63);
+ do {
+ __x = __rotate(__x + __y + __v.first + *(const _Size*)(__s + 8), 37) * __k1;
+ __y = __rotate(__y + __v.second + *(const _Size*)(__s + 48), 42) * __k1;
+ __x ^= __w.second;
+ __y += __v.first + *(const _Size*)(__s + 40);
+ __z = __rotate(__z + __w.first, 33) * __k1;
+ __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
+ __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
+ __y + *(const _Size*)(__s + 16));
+ std::swap(__z, __x);
+ __s += 64;
+ __len -= 64;
+ } while (__len != 0);
+ return __hash_len_16(
+ __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
+ __hash_len_16(__v.second, __w.second) + __x);
+}
+
+template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
+struct __scalar_hash;
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 0>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__a = 0;
+ __u.__t = __v;
+ return __u.__a;
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 1>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __u.__a;
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 2>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ };
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 3>
+ : public unary_function<_Tp, size_t>
{
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp* __v) const _NOEXCEPT
+ size_t operator()(_Tp __v) const _NOEXCEPT
{
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- return *__p;
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ };
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
}
};
+template <class _Tp>
+struct __scalar_hash<_Tp, 4>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ };
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+template<class _Tp>
+struct _LIBCPP_VISIBLE hash<_Tp*>
+ : public __scalar_hash<_Tp*>
+{
+};
+
template <class _Tp, class _Dp>
struct _LIBCPP_VISIBLE hash<unique_ptr<_Tp, _Dp> >
{
@@ -2804,12 +3482,23 @@ template <class _InputIterator, class _ForwardIterator>
_ForwardIterator
uninitialized_copy(_InputIterator __f, _InputIterator __l, _ForwardIterator __r)
{
- __destruct_n __d(0);
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- unique_ptr<value_type, __destruct_n&> __h(&*__r, __d);
- for (; __f != __l; ++__f, ++__r, __d.__incr((value_type*)0))
- ::new(&*__r) value_type(*__f);
- __h.release();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ _ForwardIterator __s = __r;
+ try
+ {
+#endif
+ for (; __f != __l; ++__f, ++__r)
+ ::new(&*__r) value_type(*__f);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (; __s != __r; ++__s)
+ __s->~value_type();
+ throw;
+ }
+#endif
return __r;
}
@@ -2817,12 +3506,23 @@ template <class _InputIterator, class _Size, class _ForwardIterator>
_ForwardIterator
uninitialized_copy_n(_InputIterator __f, _Size __n, _ForwardIterator __r)
{
- __destruct_n __d(0);
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- unique_ptr<value_type, __destruct_n&> __h(&*__r, __d);
- for (; __n > 0; ++__f, ++__r, __d.__incr((value_type*)0), --__n)
- ::new(&*__r) value_type(*__f);
- __h.release();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ _ForwardIterator __s = __r;
+ try
+ {
+#endif
+ for (; __n > 0; ++__f, ++__r, --__n)
+ ::new(&*__r) value_type(*__f);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (; __s != __r; ++__s)
+ __s->~value_type();
+ throw;
+ }
+#endif
return __r;
}
@@ -2830,24 +3530,46 @@ template <class _ForwardIterator, class _Tp>
void
uninitialized_fill(_ForwardIterator __f, _ForwardIterator __l, const _Tp& __x)
{
- __destruct_n __d(0);
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- unique_ptr<value_type, __destruct_n&> __h(&*__f, __d);
- for (; __f != __l; ++__f, __d.__incr((value_type*)0))
- ::new(&*__f) value_type(__x);
- __h.release();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ _ForwardIterator __s = __f;
+ try
+ {
+#endif
+ for (; __f != __l; ++__f)
+ ::new(&*__f) value_type(__x);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (; __s != __f; ++__s)
+ __s->~value_type();
+ throw;
+ }
+#endif
}
template <class _ForwardIterator, class _Size, class _Tp>
_ForwardIterator
uninitialized_fill_n(_ForwardIterator __f, _Size __n, const _Tp& __x)
{
- __destruct_n __d(0);
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
- unique_ptr<value_type, __destruct_n&> __h(&*__f, __d);
- for (; __n > 0; ++__f, --__n, __d.__incr((value_type*)0))
- ::new(&*__f) value_type(__x);
- __h.release();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ _ForwardIterator __s = __f;
+ try
+ {
+#endif
+ for (; __n > 0; ++__f, --__n)
+ ::new(&*__f) value_type(__x);
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ for (; __s != __f; ++__s)
+ __s->~value_type();
+ throw;
+ }
+#endif
return __f;
}
@@ -2972,7 +3694,8 @@ public:
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
__shared_ptr_emplace(_Alloc __a, _Args&& ...__args)
- : __data_(_VSTD::move(__a), _Tp(_VSTD::forward<_Args>(__args)...)) {}
+ : __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
+ _VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)) {}
#else // _LIBCPP_HAS_NO_VARIADICS
@@ -3036,9 +3759,27 @@ private:
public:
shared_ptr() _NOEXCEPT;
shared_ptr(nullptr_t) _NOEXCEPT;
- template<class _Yp> explicit shared_ptr(_Yp* __p);
- template<class _Yp, class _Dp> shared_ptr(_Yp* __p, _Dp __d);
- template<class _Yp, class _Dp, class _Alloc> shared_ptr(_Yp* __p, _Dp __d, _Alloc __a);
+ template<class _Yp,
+ class = typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value
+ >::type
+ >
+ explicit shared_ptr(_Yp* __p);
+ template<class _Yp, class _Dp,
+ class = typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value
+ >::type
+ >
+ shared_ptr(_Yp* __p, _Dp __d);
+ template<class _Yp, class _Dp, class _Alloc,
+ class = typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value
+ >::type
+ >
+ shared_ptr(_Yp* __p, _Dp __d, _Alloc __a);
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;
@@ -3056,50 +3797,134 @@ public:
template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type= __nat());
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template<class _Yp> shared_ptr(auto_ptr<_Yp>&& __r);
+ template<class _Yp,
+ class = typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value
+ >::type
+ >
+ shared_ptr(auto_ptr<_Yp>&& __r);
#else
- template<class _Yp> shared_ptr(auto_ptr<_Yp> __r);
+ template<class _Yp,
+ class = typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value
+ >::type
+ >
+ shared_ptr(auto_ptr<_Yp> __r);
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-private:
- template <class _Yp, class _Dp> shared_ptr(const unique_ptr<_Yp, _Dp>& __r);// = delete;
-public:
- template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&,
+ template <class _Yp, class _Dp,
+ class = typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
+ >::type
+ >
+ shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
- template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>&&,
+ template <class _Yp, class _Dp,
+ class = typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
+ >::type
+ >
+ shared_ptr(unique_ptr<_Yp, _Dp>&&,
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>,
+ template <class _Yp, class _Dp,
+ class = typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
+ >::type
+ > shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if<!is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
- template <class _Yp, class _Dp> shared_ptr(unique_ptr<_Yp, _Dp>,
+ template <class _Yp, class _Dp,
+ class = typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value
+ >::type
+ >
+ shared_ptr(unique_ptr<_Yp, _Dp>,
typename enable_if<is_lvalue_reference<_Dp>::value, __nat>::type = __nat());
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~shared_ptr();
shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
- template<class _Yp> shared_ptr& operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ shared_ptr&
+ >::type
+ operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
- template<class _Yp> shared_ptr& operator=(shared_ptr<_Yp>&& __r);
- template<class _Yp> shared_ptr& operator=(auto_ptr<_Yp>&& __r);
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ shared_ptr<_Tp>&
+ >::type
+ operator=(shared_ptr<_Yp>&& __r);
+ template<class _Yp>
+ typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<_Yp*, element_type*>::value,
+ shared_ptr&
+ >::type
+ operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template<class _Yp> shared_ptr& operator=(auto_ptr<_Yp> __r);
+ template<class _Yp>
+ typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<_Yp*, element_type*>::value,
+ shared_ptr&
+ >::type
+ operator=(auto_ptr<_Yp> __r);
#endif
+ template <class _Yp, class _Dp>
+ typename enable_if
+ <
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, element_type*>::value,
+ shared_ptr&
+ >::type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-private:
- template <class _Yp, class _Dp> shared_ptr& operator=(const unique_ptr<_Yp, _Dp>& __r);// = delete;
-public:
- template <class _Yp, class _Dp> shared_ptr& operator=(unique_ptr<_Yp, _Dp>&& __r);
+ operator=(unique_ptr<_Yp, _Dp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _Yp, class _Dp> shared_ptr& operator=(unique_ptr<_Yp, _Dp> __r);
+ operator=(unique_ptr<_Yp, _Dp> __r);
#endif
void swap(shared_ptr& __r) _NOEXCEPT;
void reset() _NOEXCEPT;
- template<class _Yp> void reset(_Yp* __p) _NOEXCEPT;
- template<class _Yp, class _Dp> void reset(_Yp* __p, _Dp __d);
- template<class _Yp, class _Dp, class _Alloc> void reset(_Yp* __p, _Dp __d, _Alloc __a);
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ void
+ >::type
+ reset(_Yp* __p);
+ template<class _Yp, class _Dp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ void
+ >::type
+ reset(_Yp* __p, _Dp __d);
+ template<class _Yp, class _Dp, class _Alloc>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ void
+ >::type
+ reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
element_type* get() const _NOEXCEPT {return __ptr_;}
@@ -3113,14 +3938,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool unique() const _NOEXCEPT {return use_count() == 1;}
_LIBCPP_INLINE_VISIBILITY
- /*explicit*/ operator bool() const _NOEXCEPT {return get() != 0;}
- template <class _U>
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
+ template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(shared_ptr<_U> const& __p) const
+ bool owner_before(shared_ptr<_Up> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
- template <class _U>
+ template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(weak_ptr<_U> const& __p) const
+ bool owner_before(weak_ptr<_Up> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
#ifndef _LIBCPP_NO_RTTI
@@ -3208,7 +4033,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
}
template<class _Tp>
-template<class _Yp>
+template<class _Yp, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p)
: __ptr_(__p)
{
@@ -3220,7 +4045,7 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p)
}
template<class _Tp>
-template<class _Yp, class _Dp>
+template<class _Yp, class _Dp, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d)
: __ptr_(__p)
{
@@ -3263,7 +4088,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
}
template<class _Tp>
-template<class _Yp, class _Dp, class _Alloc>
+template<class _Yp, class _Dp, class _Alloc, class>
shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d, _Alloc __a)
: __ptr_(__p)
{
@@ -3377,7 +4202,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-template<class _Yp>
+template<class _Yp, class>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp>&& __r)
#else
@@ -3392,7 +4217,7 @@ shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r)
}
template<class _Tp>
-template <class _Yp, class _Dp>
+template <class _Yp, class _Dp, class>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
#else
@@ -3408,7 +4233,7 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
}
template<class _Tp>
-template <class _Yp, class _Dp>
+template <class _Yp, class _Dp, class>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp>&& __r,
#else
@@ -3629,7 +4454,11 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
{
shared_ptr(__r).swap(*this);
@@ -3650,7 +4479,11 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -3660,7 +4493,12 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ !is_array<_Yp>::value &&
+ is_convertible<_Yp*, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -3670,7 +4508,12 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
template<class _Tp>
template <class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -3682,7 +4525,12 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ !is_array<_Yp>::value &&
+ is_convertible<_Yp*, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r)
{
shared_ptr(__r).swap(*this);
@@ -3692,7 +4540,12 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r)
template<class _Tp>
template <class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>&
+typename enable_if
+<
+ !is_array<_Yp>::value &&
+ is_convertible<typename unique_ptr<_Yp, _Dp>::pointer, _Tp*>::value,
+ shared_ptr<_Tp>&
+>::type
shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -3721,7 +4574,11 @@ shared_ptr<_Tp>::reset() _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-void
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ void
+>::type
shared_ptr<_Tp>::reset(_Yp* __p)
{
shared_ptr(__p).swap(*this);
@@ -3730,7 +4587,11 @@ shared_ptr<_Tp>::reset(_Yp* __p)
template<class _Tp>
template<class _Yp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
-void
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ void
+>::type
shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
{
shared_ptr(__p, __d).swap(*this);
@@ -3739,7 +4600,11 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
-void
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ void
+>::type
shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
{
shared_ptr(__p, __d, __a).swap(*this);
@@ -3749,7 +4614,11 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d, _Alloc __a)
template<class _Tp, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>
+typename enable_if
+<
+ !is_array<_Tp>::value,
+ shared_ptr<_Tp>
+>::type
make_shared(_Args&& ...__args)
{
return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
@@ -3757,7 +4626,11 @@ make_shared(_Args&& ...__args)
template<class _Tp, class _Alloc, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>
+typename enable_if
+<
+ !is_array<_Tp>::value,
+ shared_ptr<_Tp>
+>::type
allocate_shared(const _Alloc& __a, _Args&& ...__args)
{
return shared_ptr<_Tp>::allocate_shared(__a, _VSTD::forward<_Args>(__args)...);
@@ -3852,7 +4725,128 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
{
- return __x.get() < __y.get();
+ typedef typename common_type<_Tp*, _Up*>::type _V;
+ return less<_V>()(__x.get(), __y.get());
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+ return __y < __x;
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+ return !(__y < __x);
+}
+
+template<class _Tp, class _Up>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const shared_ptr<_Tp>& __x, const shared_ptr<_Up>& __y) _NOEXCEPT
+{
+ return !(__x < __y);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return !__x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator==(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return !__x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return static_cast<bool>(__x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return static_cast<bool>(__x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return less<_Tp*>()(__x.get(), nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return less<_Tp*>()(nullptr, __x.get());
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return nullptr < __x;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return __x < nullptr;
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return !(nullptr < __x);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return !(__x < nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
+{
+ return !(__x < nullptr);
+}
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(nullptr_t, const shared_ptr<_Tp>& __x) _NOEXCEPT
+{
+ return !(nullptr < __x);
}
template<class _Tp>
@@ -3865,7 +4859,11 @@ swap(shared_ptr<_Tp>& __x, shared_ptr<_Tp>& __y) _NOEXCEPT
template<class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>
+typename enable_if
+<
+ !is_array<_Tp>::value && !is_array<_Up>::value,
+ shared_ptr<_Tp>
+>::type
static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
{
return shared_ptr<_Tp>(__r, static_cast<_Tp*>(__r.get()));
@@ -3873,7 +4871,11 @@ static_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
template<class _Tp, class _Up>
inline _LIBCPP_INLINE_VISIBILITY
-shared_ptr<_Tp>
+typename enable_if
+<
+ !is_array<_Tp>::value && !is_array<_Up>::value,
+ shared_ptr<_Tp>
+>::type
dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
{
_Tp* __p = dynamic_cast<_Tp*>(__r.get());
@@ -3881,10 +4883,15 @@ dynamic_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
}
template<class _Tp, class _Up>
-shared_ptr<_Tp>
+typename enable_if
+<
+ is_array<_Tp>::value == is_array<_Up>::value,
+ shared_ptr<_Tp>
+>::type
const_pointer_cast(const shared_ptr<_Up>& __r) _NOEXCEPT
{
- return shared_ptr<_Tp>(__r, const_cast<_Tp*>(__r.get()));
+ typedef typename remove_extent<_Tp>::type _RTp;
+ return shared_ptr<_Tp>(__r, const_cast<_RTp*>(__r.get()));
}
#ifndef _LIBCPP_NO_RTTI
@@ -3918,11 +4925,43 @@ public:
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ weak_ptr(weak_ptr&& __r) _NOEXCEPT;
+ template<class _Yp> 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();
weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr& operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr& operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ weak_ptr&
+ >::type
+ operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
+
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ weak_ptr&
+ >::type
+ operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ template<class _Yp>
+ typename enable_if
+ <
+ is_convertible<_Yp*, element_type*>::value,
+ weak_ptr&
+ >::type
+ operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
void swap(weak_ptr& __r) _NOEXCEPT;
void reset() _NOEXCEPT;
@@ -3991,6 +5030,33 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
__cntrl_->__add_weak();
}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
+ : __ptr_(__r.__ptr_),
+ __cntrl_(__r.__cntrl_)
+{
+ __r.__ptr_ = 0;
+ __r.__cntrl_ = 0;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
+ typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
+ _NOEXCEPT
+ : __ptr_(__r.__ptr_),
+ __cntrl_(__r.__cntrl_)
+{
+ __r.__ptr_ = 0;
+ __r.__cntrl_ = 0;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
template<class _Tp>
weak_ptr<_Tp>::~weak_ptr()
{
@@ -4010,17 +5076,52 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
-weak_ptr<_Tp>&
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ weak_ptr<_Tp>&
+>::type
weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
{
weak_ptr(__r).swap(*this);
return *this;
}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
template<class _Tp>
-template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
weak_ptr<_Tp>&
+weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
+{
+ weak_ptr(_VSTD::move(__r)).swap(*this);
+ return *this;
+}
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ weak_ptr<_Tp>&
+>::type
+weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
+{
+ weak_ptr(_VSTD::move(__r)).swap(*this);
+ return *this;
+}
+
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+template<class _Tp>
+template<class _Yp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+ is_convertible<_Yp*, _Tp*>::value,
+ weak_ptr<_Tp>&
+>::type
weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
{
weak_ptr(__r).swap(*this);
@@ -4149,10 +5250,10 @@ struct _LIBCPP_VISIBLE hash<shared_ptr<_Tp> >
}
};
-template<class _CharT, class _Traits, class _Y>
+template<class _CharT, class _Traits, class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p);
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
//enum class
struct _LIBCPP_VISIBLE pointer_safety
diff --git a/include/mutex b/include/mutex
index 37e74d6d5752..62b733f4122e 100644
--- a/include/mutex
+++ b/include/mutex
@@ -179,6 +179,8 @@ template<class Callable, class ...Args>
#include <tuple>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -462,23 +464,23 @@ private:
#ifndef _LIBCPP_HAS_NO_VARIADICS
-template <class _F>
+template <class _Fp>
class __call_once_param
{
- _F __f_;
+ _Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
+ explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
- explicit __call_once_param(const _F& __f) : __f_(__f) {}
+ explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
- typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
+ typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
__execute(_Index());
}
@@ -493,17 +495,17 @@ private:
#else
-template <class _F>
+template <class _Fp>
class __call_once_param
{
- _F __f_;
+ _Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
+ explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
- explicit __call_once_param(const _F& __f) : __f_(__f) {}
+ explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
@@ -515,11 +517,11 @@ public:
#endif
-template <class _F>
+template <class _Fp>
void
__call_once_proxy(void* __vp)
{
- __call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
+ __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp);
(*__p)();
}
@@ -532,12 +534,12 @@ inline _LIBCPP_INLINE_VISIBILITY
void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{
- if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
+ if (__flag.__state_ != ~0ul)
{
- typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
- __call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
+ typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp;
+ __call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
- __call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
+ __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>);
}
}
diff --git a/include/ostream b/include/ostream
index 53064961ca9b..e6dd4b578bea 100644
--- a/include/ostream
+++ b/include/ostream
@@ -220,7 +220,7 @@ public:
~sentry();
_LIBCPP_ALWAYS_INLINE
- // explicit
+ _LIBCPP_EXPLICIT
operator bool() const {return __ok_;}
};
@@ -342,11 +342,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- typedef istreambuf_iterator<_CharT, _Traits> _I;
- typedef ostreambuf_iterator<_CharT, _Traits> _O;
- _I __i(__sb);
- _I __eof;
- _O __o(*this);
+ typedef istreambuf_iterator<_CharT, _Traits> _Ip;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Ip __i(__sb);
+ _Ip __eof;
+ _Op __o(*this);
size_t __c = 0;
for (; __i != __eof; ++__i, ++__o, ++__c)
{
@@ -388,8 +388,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -415,8 +415,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
if (__s)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -444,8 +444,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -471,8 +471,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
if (__s)
{
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -500,8 +500,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -526,8 +526,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -552,8 +552,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -578,8 +578,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -604,8 +604,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -630,8 +630,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -656,8 +656,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -682,8 +682,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -708,8 +708,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
sentry __s(*this);
if (__s)
{
- typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
- const _F& __f = use_facet<_F>(this->getloc());
+ typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp;
+ const _Fp& __f = use_facet<_Fp>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit);
}
@@ -734,8 +734,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _I;
- if (__pad_and_output(_I(__os),
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (__pad_and_output(_Ip(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -767,8 +767,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
if (__s)
{
_CharT __c = __os.widen(__cn);
- typedef ostreambuf_iterator<_CharT, _Traits> _I;
- if (__pad_and_output(_I(__os),
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
+ if (__pad_and_output(_Ip(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -799,8 +799,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
- if (__pad_and_output(_I(__os),
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
+ if (__pad_and_output(_Ip(__os),
&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 :
@@ -831,8 +831,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
- if (__pad_and_output(_I(__os),
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
+ if (__pad_and_output(_Ip(__os),
(char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 :
@@ -863,8 +863,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
- if (__pad_and_output(_I(__os),
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
+ if (__pad_and_output(_Ip(__os),
(char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 :
@@ -895,9 +895,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _I;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = _Traits::length(__str);
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len :
@@ -928,7 +928,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _I;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = char_traits<char>::length(__strn);
const int __bs = 100;
_CharT __wbb[__bs];
@@ -943,7 +943,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
}
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn);
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
__wb,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__wb + __len :
@@ -974,9 +974,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length(__str);
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len :
@@ -1007,9 +1007,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length((const char*)__str);
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
(const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len :
@@ -1040,9 +1040,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<char, _Traits> _I;
+ typedef ostreambuf_iterator<char, _Traits> _Ip;
size_t __len = _Traits::length((const char*)__str);
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
(const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len :
@@ -1073,8 +1073,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
sentry __s(*this);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _O;
- _O __o(*this);
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Op __o(*this);
*__o = __c;
if (__o.failed())
this->setstate(ios_base::badbit);
@@ -1100,8 +1100,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
sentry __sen(*this);
if (__sen && __n)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _O;
- _O __o(*this);
+ typedef ostreambuf_iterator<_CharT, _Traits> _Op;
+ _Op __o(*this);
for (; __n; --__n, ++__o, ++__s)
{
*__o = *__s;
@@ -1218,12 +1218,12 @@ typename enable_if
<
!is_lvalue_reference<_Stream>::value &&
is_base_of<ios_base, _Stream>::value,
- _Stream&
+ _Stream&&
>::type
operator<<(_Stream&& __os, const _Tp& __x)
{
__os << __x;
- return __os;
+ return _VSTD::move(__os);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1240,9 +1240,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s)
{
- typedef ostreambuf_iterator<_CharT, _Traits> _I;
+ typedef ostreambuf_iterator<_CharT, _Traits> _Ip;
size_t __len = __str.size();
- if (__pad_and_output(_I(__os),
+ if (__pad_and_output(_Ip(__os),
__str.data(),
(__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str.data() + __len :
@@ -1270,10 +1270,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
return __os << __ec.category().name() << ':' << __ec.value();
}
-template<class _CharT, class _Traits, class _Y>
+template<class _CharT, class _Traits, class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
-operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
+operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
{
return __os << __p.get();
}
diff --git a/include/random b/include/random
index c5c33c0fb323..02ea9b630112 100644
--- a/include/random
+++ b/include/random
@@ -1646,6 +1646,8 @@ class piecewise_linear_distribution
#include <ostream>
#include <cmath>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -1665,8 +1667,8 @@ struct __is_seed_sequence
// linear_congruential_engine
template <unsigned long long __a, unsigned long long __c,
- unsigned long long __m, unsigned long long _M,
- bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_M-__c)/__a)>
+ unsigned long long __m, unsigned long long _Mp,
+ bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a)>
struct __lce_ta;
// 64
@@ -1730,16 +1732,16 @@ struct __lce_ta<__a, __c, 0, (unsigned long long)(~0), false>
// 32
-template <unsigned long long _A, unsigned long long _C, unsigned long long _M>
-struct __lce_ta<_A, _C, _M, unsigned(~0), true>
+template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), true>
{
typedef unsigned result_type;
_LIBCPP_INLINE_VISIBILITY
static result_type next(result_type __x)
{
- const result_type __a = static_cast<result_type>(_A);
- const result_type __c = static_cast<result_type>(_C);
- const result_type __m = static_cast<result_type>(_M);
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
// Schrage's algorithm
const result_type __q = __m / __a;
const result_type __r = __m % __a;
@@ -1751,15 +1753,15 @@ struct __lce_ta<_A, _C, _M, unsigned(~0), true>
}
};
-template <unsigned long long _A, unsigned long long _M>
-struct __lce_ta<_A, 0, _M, unsigned(~0), true>
+template <unsigned long long _Ap, unsigned long long _Mp>
+struct __lce_ta<_Ap, 0, _Mp, unsigned(~0), true>
{
typedef unsigned result_type;
_LIBCPP_INLINE_VISIBILITY
static result_type next(result_type __x)
{
- const result_type __a = static_cast<result_type>(_A);
- const result_type __m = static_cast<result_type>(_M);
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __m = static_cast<result_type>(_Mp);
// Schrage's algorithm
const result_type __q = __m / __a;
const result_type __r = __m % __a;
@@ -1770,29 +1772,29 @@ struct __lce_ta<_A, 0, _M, unsigned(~0), true>
}
};
-template <unsigned long long _A, unsigned long long _C, unsigned long long _M>
-struct __lce_ta<_A, _C, _M, unsigned(~0), false>
+template <unsigned long long _Ap, unsigned long long _Cp, unsigned long long _Mp>
+struct __lce_ta<_Ap, _Cp, _Mp, unsigned(~0), false>
{
typedef unsigned result_type;
_LIBCPP_INLINE_VISIBILITY
static result_type next(result_type __x)
{
- const result_type __a = static_cast<result_type>(_A);
- const result_type __c = static_cast<result_type>(_C);
- const result_type __m = static_cast<result_type>(_M);
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
+ const result_type __m = static_cast<result_type>(_Mp);
return (__a * __x + __c) % __m;
}
};
-template <unsigned long long _A, unsigned long long _C>
-struct __lce_ta<_A, _C, 0, unsigned(~0), false>
+template <unsigned long long _Ap, unsigned long long _Cp>
+struct __lce_ta<_Ap, _Cp, 0, unsigned(~0), false>
{
typedef unsigned result_type;
_LIBCPP_INLINE_VISIBILITY
static result_type next(result_type __x)
{
- const result_type __a = static_cast<result_type>(_A);
- const result_type __c = static_cast<result_type>(_C);
+ const result_type __a = static_cast<result_type>(_Ap);
+ const result_type __c = static_cast<result_type>(_Cp);
return __a * __x + __c;
}
};
@@ -1814,16 +1816,16 @@ template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class linear_congruential_engine;
template <class _CharT, class _Traits,
- class _U, _U _A, _U _C, _U _N>
+ class _Up, _Up _Ap, _Up _Cp, _Up _Np>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_U, _A, _C, _N>&);
+ const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
template <class _CharT, class _Traits,
- class _U, _U _A, _U _C, _U _N>
+ class _Up, _Up _Ap, _Up _Cp, _Up _Np>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_U, _A, _C, _N>& __x);
+ linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class _LIBCPP_VISIBLE linear_congruential_engine
@@ -1835,7 +1837,7 @@ public:
private:
result_type __x_;
- static const result_type _M = result_type(~0);
+ static const result_type _Mp = result_type(~0);
static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
@@ -1858,8 +1860,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit linear_congruential_engine(result_type __s = default_seed)
{seed(__s);}
- template<class _Sseq> explicit linear_congruential_engine(_Sseq& __q,
+ template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
+ explicit linear_congruential_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, linear_congruential_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
@@ -1881,7 +1884,7 @@ public:
// generating functions
_LIBCPP_INLINE_VISIBILITY
result_type operator()()
- {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _M>::next(__x_));}
+ {return __x_ = static_cast<result_type>(__lce_ta<__a, __c, __m, _Mp>::next(__x_));}
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
@@ -1912,18 +1915,18 @@ private:
void __seed(_Sseq& __q, integral_constant<unsigned, 2>);
template <class _CharT, class _Traits,
- class _U, _U _A, _U _C, _U _N>
+ class _Up, _Up _Ap, _Up _Cp, _Up _Np>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const linear_congruential_engine<_U, _A, _C, _N>&);
+ const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
template <class _CharT, class _Traits,
- class _U, _U _A, _U _C, _U _N>
+ class _Up, _Up _Ap, _Up _Cp, _Up _Np>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- linear_congruential_engine<_U, _A, _C, _N>& __x);
+ linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
@@ -2020,41 +2023,41 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
class mersenne_twister_engine;
-template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
bool
-operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y);
-
-template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
bool
-operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y);
+operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x);
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x);
+ mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
@@ -2114,8 +2117,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit mersenne_twister_engine(result_type __sd = default_seed)
{seed(__sd);}
- template<class _Sseq> explicit mersenne_twister_engine(_Sseq& __q,
+ template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
+ explicit mersenne_twister_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, mersenne_twister_engine>::value>::type* = 0)
{seed(__q);}
void seed(result_type __sd = default_seed);
@@ -2134,45 +2138,45 @@ public:
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
- template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
friend
bool
- operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y);
-
- template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
+
+ template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
friend
bool
- operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y);
+ operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x);
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x);
+ mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x);
private:
template<class _Sseq>
@@ -2198,7 +2202,7 @@ private:
(__count >= __w),
result_type
>::type
- __lshift(result_type __x) {return result_type(0);}
+ __lshift(result_type) {return result_type(0);}
template <size_t __count>
_LIBCPP_INLINE_VISIBILITY
@@ -2218,7 +2222,7 @@ private:
(__count >= _Dt),
result_type
>::type
- __rshift(result_type __x) {return result_type(0);}
+ __rshift(result_type) {return result_type(0);}
};
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2295,9 +2299,9 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
const size_t __j = (__i_ + 1) % __n;
const result_type __mask = __r == _Dt ? result_type(~0) :
(result_type(1) << __r) - result_type(1);
- const result_type _Y = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
+ const result_type _Yp = (__x_[__i_] & ~__mask) | (__x_[__j] & __mask);
const size_t __k = (__i_ + __m) % __n;
- __x_[__i_] = __x_[__k] ^ __rshift<1>(_Y) ^ (__a * (_Y & 1));
+ __x_[__i_] = __x_[__k] ^ __rshift<1>(_Yp) ^ (__a * (_Yp & 1));
result_type __z = __x_[__i_] ^ (__rshift<__u>(__x_[__i_]) & __d);
__i_ = __j;
__z ^= __lshift<__s>(__z) & __b;
@@ -2305,78 +2309,78 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
return __z ^ __rshift<__l>(__z);
}
-template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
bool
-operator==(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y)
+operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
{
if (__x.__i_ == __y.__i_)
- return _VSTD::equal(__x.__x_, __x.__x_ + _N, __y.__x_);
+ return _VSTD::equal(__x.__x_, __x.__x_ + _Np, __y.__x_);
if (__x.__i_ == 0 || __y.__i_ == 0)
{
- size_t __j = _VSTD::min(_N - __x.__i_, _N - __y.__i_);
+ size_t __j = _VSTD::min(_Np - __x.__i_, _Np - __y.__i_);
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
__y.__x_ + __y.__i_))
return false;
if (__x.__i_ == 0)
- return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_);
- return _VSTD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j);
+ return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Np, __y.__x_);
+ return _VSTD::equal(__x.__x_, __x.__x_ + (_Np - __j), __y.__x_ + __j);
}
if (__x.__i_ < __y.__i_)
{
- size_t __j = _N - __y.__i_;
+ size_t __j = _Np - __y.__i_;
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
__y.__x_ + __y.__i_))
return false;
- if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N,
+ if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Np,
__y.__x_))
return false;
return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_N - (__x.__i_ + __j)));
+ __y.__x_ + (_Np - (__x.__i_ + __j)));
}
- size_t __j = _N - __x.__i_;
+ size_t __j = _Np - __x.__i_;
if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
__x.__x_ + __x.__i_))
return false;
- if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N,
+ if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Np,
__x.__x_))
return false;
return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_N - (__y.__i_ + __j)));
+ __x.__x_ + (_Np - (__y.__i_ + __j)));
}
-template <class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __y)
+operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x,
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x)
+ const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
__save_flags<_CharT, _Traits> _(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
__os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _N; ++__j)
+ for (size_t __j = __x.__i_ + 1; __j < _Np; ++__j)
__os << __sp << __x.__x_[__j];
for (size_t __j = 0; __j < __x.__i_; ++__j)
__os << __sp << __x.__x_[__j];
@@ -2384,22 +2388,22 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _N, size_t _M, size_t _R,
- _UI _A, size_t _U, _UI _D, size_t _S,
- _UI _B, size_t _T, _UI _C, size_t _L, _UI _F>
+ class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
+ _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _W, _N, _M, _R, _A, _U, _D, _S,
- _B, _T, _C, _L, _F>& __x)
+ mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ _Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
__save_flags<_CharT, _Traits> _(__is);
__is.flags(ios_base::dec | ios_base::skipws);
- _UI __t[_N];
- for (size_t __i = 0; __i < _N; ++__i)
+ _UI __t[_Np];
+ for (size_t __i = 0; __i < _Np; ++__i)
__is >> __t[__i];
if (!__is.fail())
{
- for (size_t __i = 0; __i < _N; ++__i)
+ for (size_t __i = 0; __i < _Np; ++__i)
__x.__x_[__i] = __t[__i];
__x.__i_ = 0;
}
@@ -2422,29 +2426,29 @@ typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class subtract_with_carry_engine;
-template<class _UI, size_t _W, size_t _S, size_t _R>
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
bool
operator==(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
-template<class _UI, size_t _W, size_t _S, size_t _R>
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
bool
operator!=(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _W, _S, _R>& __x);
+ subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_VISIBLE subtract_with_carry_engine
@@ -2483,8 +2487,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit subtract_with_carry_engine(result_type __sd = default_seed)
{seed(__sd);}
- template<class _Sseq> explicit subtract_with_carry_engine(_Sseq& __q,
+ template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
+ explicit subtract_with_carry_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, subtract_with_carry_engine>::value>::type* = 0)
{seed(__q);}
_LIBCPP_INLINE_VISIBILITY
@@ -2505,33 +2510,33 @@ public:
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
- template<class _UI, size_t _W, size_t _S, size_t _R>
+ template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
friend
bool
operator==(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
- template<class _UI, size_t _W, size_t _S, size_t _R>
+ template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
friend
bool
operator!=(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x);
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _W, _S, _R>& __x);
+ subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
private:
@@ -2617,71 +2622,71 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
return __xr;
}
-template<class _UI, size_t _W, size_t _S, size_t _R>
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
bool
operator==(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y)
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
{
if (__x.__c_ != __y.__c_)
return false;
if (__x.__i_ == __y.__i_)
- return _VSTD::equal(__x.__x_, __x.__x_ + _R, __y.__x_);
+ return _VSTD::equal(__x.__x_, __x.__x_ + _Rp, __y.__x_);
if (__x.__i_ == 0 || __y.__i_ == 0)
{
- size_t __j = _VSTD::min(_R - __x.__i_, _R - __y.__i_);
+ size_t __j = _VSTD::min(_Rp - __x.__i_, _Rp - __y.__i_);
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j,
__y.__x_ + __y.__i_))
return false;
if (__x.__i_ == 0)
- return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_);
- return _VSTD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j);
+ return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _Rp, __y.__x_);
+ return _VSTD::equal(__x.__x_, __x.__x_ + (_Rp - __j), __y.__x_ + __j);
}
if (__x.__i_ < __y.__i_)
{
- size_t __j = _R - __y.__i_;
+ size_t __j = _Rp - __y.__i_;
if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j),
__y.__x_ + __y.__i_))
return false;
- if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R,
+ if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _Rp,
__y.__x_))
return false;
return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_,
- __y.__x_ + (_R - (__x.__i_ + __j)));
+ __y.__x_ + (_Rp - (__x.__i_ + __j)));
}
- size_t __j = _R - __x.__i_;
+ size_t __j = _Rp - __x.__i_;
if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j),
__x.__x_ + __x.__i_))
return false;
- if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R,
+ if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _Rp,
__x.__x_))
return false;
return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_,
- __x.__x_ + (_R - (__y.__i_ + __j)));
+ __x.__x_ + (_Rp - (__y.__i_ + __j)));
}
-template<class _UI, size_t _W, size_t _S, size_t _R>
+template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __y)
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _W, _S, _R>& __x)
+ const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> _(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
__os << __x.__x_[__x.__i_];
- for (size_t __j = __x.__i_ + 1; __j < _R; ++__j)
+ for (size_t __j = __x.__i_ + 1; __j < _Rp; ++__j)
__os << __sp << __x.__x_[__j];
for (size_t __j = 0; __j < __x.__i_; ++__j)
__os << __sp << __x.__x_[__j];
@@ -2690,21 +2695,21 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits,
- class _UI, size_t _W, size_t _S, size_t _R>
+ class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _W, _S, _R>& __x)
+ subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> _(__is);
__is.flags(ios_base::dec | ios_base::skipws);
- _UI __t[_R+1];
- for (size_t __i = 0; __i < _R+1; ++__i)
+ _UI __t[_Rp+1];
+ for (size_t __i = 0; __i < _Rp+1; ++__i)
__is >> __t[__i];
if (!__is.fail())
{
- for (size_t __i = 0; __i < _R; ++__i)
+ for (size_t __i = 0; __i < _Rp; ++__i)
__x.__x_[__i] = __t[__i];
- __x.__c_ = __t[_R];
+ __x.__c_ = __t[_Rp];
__x.__i_ = 0;
}
return __is;
@@ -2781,33 +2786,33 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Engine& base() const {return __e_;}
- template<class _Eng, size_t _P, size_t _R>
+ template<class _Eng, size_t _Pp, size_t _Rp>
friend
bool
operator==(
- const discard_block_engine<_Eng, _P, _R>& __x,
- const discard_block_engine<_Eng, _P, _R>& __y);
+ const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+ const discard_block_engine<_Eng, _Pp, _Rp>& __y);
- template<class _Eng, size_t _P, size_t _R>
+ template<class _Eng, size_t _Pp, size_t _Rp>
friend
bool
operator!=(
- const discard_block_engine<_Eng, _P, _R>& __x,
- const discard_block_engine<_Eng, _P, _R>& __y);
+ const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+ const discard_block_engine<_Eng, _Pp, _Rp>& __y);
template <class _CharT, class _Traits,
- class _Eng, size_t _P, size_t _R>
+ class _Eng, size_t _Pp, size_t _Rp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _P, _R>& __x);
+ const discard_block_engine<_Eng, _Pp, _Rp>& __x);
template <class _CharT, class _Traits,
- class _Eng, size_t _P, size_t _R>
+ class _Eng, size_t _Pp, size_t _Rp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _P, _R>& __x);
+ discard_block_engine<_Eng, _Pp, _Rp>& __x);
};
template<class _Engine, size_t __p, size_t __r>
@@ -2823,29 +2828,29 @@ discard_block_engine<_Engine, __p, __r>::operator()()
return __e_();
}
-template<class _Eng, size_t _P, size_t _R>
+template<class _Eng, size_t _Pp, size_t _Rp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(const discard_block_engine<_Eng, _P, _R>& __x,
- const discard_block_engine<_Eng, _P, _R>& __y)
+operator==(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+ const discard_block_engine<_Eng, _Pp, _Rp>& __y)
{
return __x.__n_ == __y.__n_ && __x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _P, size_t _R>
+template<class _Eng, size_t _Pp, size_t _Rp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const discard_block_engine<_Eng, _P, _R>& __x,
- const discard_block_engine<_Eng, _P, _R>& __y)
+operator!=(const discard_block_engine<_Eng, _Pp, _Rp>& __x,
+ const discard_block_engine<_Eng, _Pp, _Rp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _Eng, size_t _P, size_t _R>
+ class _Eng, size_t _Pp, size_t _Rp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const discard_block_engine<_Eng, _P, _R>& __x)
+ const discard_block_engine<_Eng, _Pp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> _(__os);
__os.flags(ios_base::dec | ios_base::left);
@@ -2855,10 +2860,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits,
- class _Eng, size_t _P, size_t _R>
+ class _Eng, size_t _Pp, size_t _Rp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- discard_block_engine<_Eng, _P, _R>& __x)
+ discard_block_engine<_Eng, _Pp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> _(__is);
__is.flags(ios_base::dec | ios_base::skipws);
@@ -2881,15 +2886,15 @@ typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
template<class _Engine, size_t __w, class _UIntType>
class _LIBCPP_VISIBLE independent_bits_engine
{
- template <class _UI, _UI _R0, size_t _W, size_t _M>
+ template <class _UI, _UI _R0, size_t _Wp, size_t _Mp>
class __get_n
{
static const size_t _Dt = numeric_limits<_UI>::digits;
- static const size_t _N = _W / _M + (_W % _M != 0);
- static const size_t _W0 = _W / _N;
+ static const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
+ static const size_t _W0 = _Wp / _Np;
static const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
public:
- static const size_t value = _R0 - _Y0 > _Y0 / _N ? _N + 1 : _N;
+ static const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
};
public:
// types
@@ -2910,18 +2915,18 @@ private:
_Engine_result_type
>::type _Working_result_type;
// Temporary work around for lack of constexpr
- static const _Working_result_type _R = _Engine::_Max - _Engine::_Min
+ static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
- static const size_t __m = __log2<_Working_result_type, _R>::value;
- static const size_t __n = __get_n<_Working_result_type, _R, __w, __m>::value;
+ static const size_t __m = __log2<_Working_result_type, _Rp>::value;
+ static const size_t __n = __get_n<_Working_result_type, _Rp, __w, __m>::value;
static const size_t __w0 = __w / __n;
static const size_t __n0 = __n - __w % __n;
static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
static const _Working_result_type __y0 = __w0 >= _WDt ? 0 :
- (_R >> __w0) << __w0;
+ (_Rp >> __w0) << __w0;
static const _Working_result_type __y1 = __w0 >= _WDt - 1 ? 0 :
- (_R >> (__w0+1)) << (__w0+1);
+ (_Rp >> (__w0+1)) << (__w0+1);
static const _Engine_result_type __mask0 = __w0 > 0 ?
_Engine_result_type(~0) >> (_EDt - __w0) :
_Engine_result_type(0);
@@ -2953,8 +2958,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
- template<class _Sseq> explicit independent_bits_engine(_Sseq& __q,
+ template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
+ explicit independent_bits_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, independent_bits_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {}
@@ -2973,7 +2979,7 @@ public:
// generating functions
_LIBCPP_INLINE_VISIBILITY
- result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
+ result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
@@ -2981,33 +2987,33 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Engine& base() const {return __e_;}
- template<class _Eng, size_t _W, class _UI>
+ template<class _Eng, size_t _Wp, class _UI>
friend
bool
operator==(
- const independent_bits_engine<_Eng, _W, _UI>& __x,
- const independent_bits_engine<_Eng, _W, _UI>& __y);
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UI>& __y);
- template<class _Eng, size_t _W, class _UI>
+ template<class _Eng, size_t _Wp, class _UI>
friend
bool
operator!=(
- const independent_bits_engine<_Eng, _W, _UI>& __x,
- const independent_bits_engine<_Eng, _W, _UI>& __y);
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UI>& __y);
template <class _CharT, class _Traits,
- class _Eng, size_t _W, class _UI>
+ class _Eng, size_t _Wp, class _UI>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _W, _UI>& __x);
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x);
template <class _CharT, class _Traits,
- class _Eng, size_t _W, class _UI>
+ class _Eng, size_t _Wp, class _UI>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _W, _UI>& __x);
+ independent_bits_engine<_Eng, _Wp, _UI>& __x);
private:
result_type __eval(false_type);
@@ -3031,7 +3037,7 @@ private:
(__count >= _Dt),
result_type
>::type
- __lshift(result_type __x) {return result_type(0);}
+ __lshift(result_type) {return result_type(0);}
};
template<class _Engine, size_t __w, class _UIntType>
@@ -3046,7 +3052,7 @@ template<class _Engine, size_t __w, class _UIntType>
_UIntType
independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
{
- result_type _S = 0;
+ result_type _Sp = 0;
for (size_t __k = 0; __k < __n0; ++__k)
{
_Engine_result_type __u;
@@ -3054,7 +3060,7 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
{
__u = __e_() - _Engine::min();
} while (__u >= __y0);
- _S = static_cast<result_type>(__lshift<__w0>(_S) + (__u & __mask0));
+ _Sp = static_cast<result_type>(__lshift<__w0>(_Sp) + (__u & __mask0));
}
for (size_t __k = __n0; __k < __n; ++__k)
{
@@ -3063,45 +3069,45 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
{
__u = __e_() - _Engine::min();
} while (__u >= __y1);
- _S = static_cast<result_type>(__lshift<__w0+1>(_S) + (__u & __mask1));
+ _Sp = static_cast<result_type>(__lshift<__w0+1>(_Sp) + (__u & __mask1));
}
- return _S;
+ return _Sp;
}
-template<class _Eng, size_t _W, class _UI>
+template<class _Eng, size_t _Wp, class _UI>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(
- const independent_bits_engine<_Eng, _W, _UI>& __x,
- const independent_bits_engine<_Eng, _W, _UI>& __y)
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UI>& __y)
{
return __x.base() == __y.base();
}
-template<class _Eng, size_t _W, class _UI>
+template<class _Eng, size_t _Wp, class _UI>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const independent_bits_engine<_Eng, _W, _UI>& __x,
- const independent_bits_engine<_Eng, _W, _UI>& __y)
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UI>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _Eng, size_t _W, class _UI>
+ class _Eng, size_t _Wp, class _UI>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _W, _UI>& __x)
+ const independent_bits_engine<_Eng, _Wp, _UI>& __x)
{
return __os << __x.base();
}
template <class _CharT, class _Traits,
- class _Eng, size_t _W, class _UI>
+ class _Eng, size_t _Wp, class _UI>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _W, _UI>& __x)
+ independent_bits_engine<_Eng, _Wp, _UI>& __x)
{
_Eng __e;
__is >> __e;
@@ -3124,14 +3130,14 @@ struct __ugcd<_Xp, 0>
static const uint64_t value = _Xp;
};
-template <uint64_t _N, uint64_t _D>
+template <uint64_t _Np, uint64_t _Dp>
class __uratio
{
- static_assert(_D != 0, "__uratio divide by 0");
- static const uint64_t __gcd = __ugcd<_N, _D>::value;
+ static_assert(_Dp != 0, "__uratio divide by 0");
+ static const uint64_t __gcd = __ugcd<_Np, _Dp>::value;
public:
- static const uint64_t num = _N / __gcd;
- static const uint64_t den = _D / __gcd;
+ static const uint64_t num = _Np / __gcd;
+ static const uint64_t den = _Dp / __gcd;
typedef __uratio<num, den> type;
};
@@ -3161,7 +3167,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
static const/*expr*/ result_type max() { return _Max; }
- static const unsigned long long _R = _Max - _Min + 1ull;
+ static const unsigned long long _Rp = _Max - _Min + 1ull;
// constructors and seeding functions
_LIBCPP_INLINE_VISIBILITY
@@ -3176,8 +3182,9 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
- template<class _Sseq> explicit shuffle_order_engine(_Sseq& __q,
+ template<class _Sseq>
_LIBCPP_INLINE_VISIBILITY
+ explicit shuffle_order_engine(_Sseq& __q,
typename enable_if<__is_seed_sequence<_Sseq, shuffle_order_engine>::value &&
!is_convertible<_Sseq, _Engine>::value>::type* = 0)
: __e_(__q) {__init();}
@@ -3196,7 +3203,7 @@ public:
// generating functions
_LIBCPP_INLINE_VISIBILITY
- result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
+ result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());}
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
@@ -3205,33 +3212,33 @@ public:
const _Engine& base() const {return __e_;}
private:
- template<class _Eng, size_t _K>
+ template<class _Eng, size_t _Kp>
friend
bool
operator==(
- const shuffle_order_engine<_Eng, _K>& __x,
- const shuffle_order_engine<_Eng, _K>& __y);
+ const shuffle_order_engine<_Eng, _Kp>& __x,
+ const shuffle_order_engine<_Eng, _Kp>& __y);
- template<class _Eng, size_t _K>
+ template<class _Eng, size_t _Kp>
friend
bool
operator!=(
- const shuffle_order_engine<_Eng, _K>& __x,
- const shuffle_order_engine<_Eng, _K>& __y);
+ const shuffle_order_engine<_Eng, _Kp>& __x,
+ const shuffle_order_engine<_Eng, _Kp>& __y);
template <class _CharT, class _Traits,
- class _Eng, size_t _K>
+ class _Eng, size_t _Kp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _K>& __x);
+ const shuffle_order_engine<_Eng, _Kp>& __x);
template <class _CharT, class _Traits,
- class _Eng, size_t _K>
+ class _Eng, size_t _Kp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _K>& __x);
+ shuffle_order_engine<_Eng, _Kp>& __x);
_LIBCPP_INLINE_VISIBILITY
void __init()
@@ -3244,34 +3251,34 @@ private:
_LIBCPP_INLINE_VISIBILITY
result_type __eval(false_type) {return __eval2(integral_constant<bool, __k & 1>());}
_LIBCPP_INLINE_VISIBILITY
- result_type __eval(true_type) {return __eval(__uratio<__k, _R>());}
+ result_type __eval(true_type) {return __eval(__uratio<__k, _Rp>());}
_LIBCPP_INLINE_VISIBILITY
result_type __eval2(false_type) {return __eval(__uratio<__k/2, 0x8000000000000000ull>());}
_LIBCPP_INLINE_VISIBILITY
result_type __eval2(true_type) {return __evalf<__k, 0>();}
- template <uint64_t _N, uint64_t _D>
+ template <uint64_t _Np, uint64_t _Dp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- (__uratio<_N, _D>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)),
+ (__uratio<_Np, _Dp>::num > 0xFFFFFFFFFFFFFFFFull / (_Max - _Min)),
result_type
>::type
- __eval(__uratio<_N, _D>)
- {return __evalf<__uratio<_N, _D>::num, __uratio<_N, _D>::den>();}
+ __eval(__uratio<_Np, _Dp>)
+ {return __evalf<__uratio<_Np, _Dp>::num, __uratio<_Np, _Dp>::den>();}
- template <uint64_t _N, uint64_t _D>
+ template <uint64_t _Np, uint64_t _Dp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
- __uratio<_N, _D>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min),
+ __uratio<_Np, _Dp>::num <= 0xFFFFFFFFFFFFFFFFull / (_Max - _Min),
result_type
>::type
- __eval(__uratio<_N, _D>)
+ __eval(__uratio<_Np, _Dp>)
{
- const size_t __j = static_cast<size_t>(__uratio<_N, _D>::num * (_Y_ - _Min)
- / __uratio<_N, _D>::den);
+ const size_t __j = static_cast<size_t>(__uratio<_Np, _Dp>::num * (_Y_ - _Min)
+ / __uratio<_Np, _Dp>::den);
_Y_ = _V_[__j];
_V_[__j] = __e_();
return _Y_;
@@ -3281,72 +3288,72 @@ private:
_LIBCPP_INLINE_VISIBILITY
result_type __evalf()
{
- const double _F = __d == 0 ?
+ const double _Fp = __d == 0 ?
__n / (2. * 0x8000000000000000ull) :
__n / (double)__d;
- const size_t __j = static_cast<size_t>(_F * (_Y_ - _Min));
+ const size_t __j = static_cast<size_t>(_Fp * (_Y_ - _Min));
_Y_ = _V_[__j];
_V_[__j] = __e_();
return _Y_;
}
};
-template<class _Eng, size_t _K>
+template<class _Eng, size_t _Kp>
bool
operator==(
- const shuffle_order_engine<_Eng, _K>& __x,
- const shuffle_order_engine<_Eng, _K>& __y)
+ const shuffle_order_engine<_Eng, _Kp>& __x,
+ const shuffle_order_engine<_Eng, _Kp>& __y)
{
- return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _K, __y._V_) &&
+ return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _Kp, __y._V_) &&
__x.__e_ == __y.__e_;
}
-template<class _Eng, size_t _K>
+template<class _Eng, size_t _Kp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const shuffle_order_engine<_Eng, _K>& __x,
- const shuffle_order_engine<_Eng, _K>& __y)
+ const shuffle_order_engine<_Eng, _Kp>& __x,
+ const shuffle_order_engine<_Eng, _Kp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _Eng, size_t _K>
+ class _Eng, size_t _Kp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const shuffle_order_engine<_Eng, _K>& __x)
+ const shuffle_order_engine<_Eng, _Kp>& __x)
{
__save_flags<_CharT, _Traits> _(__os);
__os.flags(ios_base::dec | ios_base::left);
_CharT __sp = __os.widen(' ');
__os.fill(__sp);
__os << __x.__e_ << __sp << __x._V_[0];
- for (size_t __i = 1; __i < _K; ++__i)
+ for (size_t __i = 1; __i < _Kp; ++__i)
__os << __sp << __x._V_[__i];
return __os << __sp << __x._Y_;
}
template <class _CharT, class _Traits,
- class _Eng, size_t _K>
+ class _Eng, size_t _Kp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- shuffle_order_engine<_Eng, _K>& __x)
+ shuffle_order_engine<_Eng, _Kp>& __x)
{
- typedef typename shuffle_order_engine<_Eng, _K>::result_type result_type;
+ typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
__save_flags<_CharT, _Traits> _(__is);
__is.flags(ios_base::dec | ios_base::skipws);
_Eng __e;
- result_type _V[_K+1];
+ result_type _Vp[_Kp+1];
__is >> __e;
- for (size_t __i = 0; __i < _K+1; ++__i)
- __is >> _V[__i];
+ for (size_t __i = 0; __i < _Kp+1; ++__i)
+ __is >> _Vp[__i];
if (!__is.fail())
{
__x.__e_ = __e;
- for (size_t __i = 0; __i < _K; ++__i)
- __x._V_[__i] = _V[__i];
- __x._Y_ = _V[_K];
+ for (size_t __i = 0; __i < _Kp; ++__i)
+ __x._V_[__i] = _Vp[__i];
+ __x._Y_ = _Vp[_Kp];
}
return __is;
}
@@ -3367,9 +3374,9 @@ public:
static const result_type _Max = 0xFFFFFFFFu;
_LIBCPP_INLINE_VISIBILITY
- static const/*expr*/ result_type min() { return _Min;}
+ static constexpr result_type min() { return _Min;}
_LIBCPP_INLINE_VISIBILITY
- static const/*expr*/ result_type max() { return _Max;}
+ static constexpr result_type max() { return _Max;}
// constructors
explicit random_device(const string& __token = "/dev/urandom");
@@ -3433,7 +3440,7 @@ private:
void operator=(const seed_seq&); // = delete;
_LIBCPP_INLINE_VISIBILITY
- static result_type _T(result_type __x) {return __x ^ (__x >> 27);}
+ static result_type _Tp(result_type __x) {return __x ^ (__x >> 27);}
};
template<class _InputIterator>
@@ -3463,7 +3470,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
const size_t __m = _VSTD::max(__s + 1, __n);
// __k = 0;
{
- result_type __r = 1664525 * _T(__first[0] ^ __first[__p]
+ result_type __r = 1664525 * _Tp(__first[0] ^ __first[__p]
^ __first[__n - 1]);
__first[__p] += __r;
__r += __s;
@@ -3474,7 +3481,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
const size_t __kmodn = __k % __n;
const size_t __kpmodn = (__k + __p) % __n;
- result_type __r = 1664525 * _T(__first[__kmodn] ^ __first[__kpmodn]
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn]
^ __first[(__k - 1) % __n]);
__first[__kpmodn] += __r;
__r += __kmodn + __v_[__k-1];
@@ -3485,7 +3492,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
const size_t __kmodn = __k % __n;
const size_t __kpmodn = (__k + __p) % __n;
- result_type __r = 1664525 * _T(__first[__kmodn] ^ __first[__kpmodn]
+ result_type __r = 1664525 * _Tp(__first[__kmodn] ^ __first[__kpmodn]
^ __first[(__k - 1) % __n]);
__first[__kpmodn] += __r;
__r += __kmodn;
@@ -3496,7 +3503,7 @@ seed_seq::generate(_RandomAccessIterator __first, _RandomAccessIterator __last)
{
const size_t __kmodn = __k % __n;
const size_t __kpmodn = (__k + __p) % __n;
- result_type __r = 1566083941 * _T(__first[__kmodn] +
+ result_type __r = 1566083941 * _Tp(__first[__kmodn] +
__first[__kpmodn] +
__first[(__k - 1) % __n]);
__first[__kpmodn] ^= __r;
@@ -3517,12 +3524,12 @@ generate_canonical(_URNG& __g)
const size_t __b = _Dt < __bits ? _Dt : __bits;
const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
const size_t __k = __b / __logR + (__b % __logR != 0) + (__b == 0);
- const _RealType _R = _URNG::_Max - _URNG::_Min + _RealType(1);
- _RealType __base = _R;
- _RealType _S = __g() - _URNG::_Min;
- for (size_t __i = 1; __i < __k; ++__i, __base *= _R)
- _S += (__g() - _URNG::_Min) * __base;
- return _S / __base;
+ const _RealType _Rp = _URNG::_Max - _URNG::_Min + _RealType(1);
+ _RealType __base = _Rp;
+ _RealType _Sp = __g() - _URNG::_Min;
+ for (size_t __i = 1; __i < __k; ++__i, __base *= _Rp)
+ _Sp += (__g() - _URNG::_Min) * __base;
+ return _Sp / __base;
}
// uniform_int_distribution
@@ -4169,11 +4176,11 @@ template<class _URNG>
_RealType
normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
- result_type _U;
+ result_type _Up;
if (_V_hot_)
{
_V_hot_ = false;
- _U = _V_;
+ _Up = _V_;
}
else
{
@@ -4187,12 +4194,12 @@ normal_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
__v = _Uni(__g);
__s = __u * __u + __v * __v;
} while (__s > 1 || __s == 0);
- result_type _F = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
- _V_ = __v * _F;
+ result_type _Fp = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s);
+ _V_ = __v * _Fp;
_V_hot_ = true;
- _U = __u * _F;
+ _Up = __u * _Fp;
}
- return _U * __p.stddev() + __p.mean();
+ return _Up * __p.stddev() + __p.mean();
}
template <class _CharT, class _Traits, class _RT>
@@ -4223,16 +4230,16 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
__is.flags(ios_base::dec | ios_base::skipws);
result_type __mean;
result_type __stddev;
- result_type _V = 0;
+ result_type _Vp = 0;
bool _V_hot = false;
__is >> __mean >> __stddev >> _V_hot;
if (_V_hot)
- __is >> _V;
+ __is >> _Vp;
if (!__is.fail())
{
__x.param(param_type(__mean, __stddev));
__x._V_hot_ = _V_hot;
- __x._V_ = _V;
+ __x._V_ = _Vp;
}
return __is;
}
@@ -6419,23 +6426,23 @@ void
piecewise_linear_distribution<_RealType>::param_type::__init()
{
__areas_.assign(__densities_.size() - 1, result_type());
- result_type _S = 0;
+ result_type _Sp = 0;
for (size_t __i = 0; __i < __areas_.size(); ++__i)
{
__areas_[__i] = (__densities_[__i+1] + __densities_[__i]) *
(__b_[__i+1] - __b_[__i]) * .5;
- _S += __areas_[__i];
+ _Sp += __areas_[__i];
}
for (size_t __i = __areas_.size(); __i > 1;)
{
--__i;
- __areas_[__i] = __areas_[__i-1] / _S;
+ __areas_[__i] = __areas_[__i-1] / _Sp;
}
__areas_[0] = 0;
for (size_t __i = 1; __i < __areas_.size(); ++__i)
__areas_[__i] += __areas_[__i-1];
for (size_t __i = 0; __i < __densities_.size(); ++__i)
- __densities_[__i] /= _S;
+ __densities_[__i] /= _Sp;
}
template<class _RealType>
diff --git a/include/ratio b/include/ratio
index 654cb3312e94..23f226794621 100644
--- a/include/ratio
+++ b/include/ratio
@@ -70,6 +70,8 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits>
#include <type_traits>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -412,27 +414,27 @@ struct __ratio_less1
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Q>
-struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0>
{
static const bool value = false;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2>
{
static const bool value = !_Odd;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
-struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0>
{
static const bool value = _Odd;
};
-template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
+template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1,
intmax_t _M2>
-struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
+struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2>
{
static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
ratio<_R2::den, _M2>, !_Odd>::value;
diff --git a/include/regex b/include/regex
index 048fbefc9e9c..2ebb0f1d5bca 100644
--- a/include/regex
+++ b/include/regex
@@ -732,6 +732,8 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <vector>
#include <deque>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -2792,49 +2794,49 @@ private:
match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const;
- template <class _B, class _A, class _C, class _T>
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
friend
bool
- regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
+ regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_constants::match_flag_type);
- template <class _A, class _C, class _T>
+ template <class _Ap, class _Cp, class _Tp>
friend
bool
- regex_search(const _C*, const _C*, match_results<const _C*, _A>&,
- const basic_regex<_C, _T>&, regex_constants::match_flag_type);
+ regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&,
+ const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
- template <class _B, class _C, class _T>
+ template <class _Bp, class _Cp, class _Tp>
friend
bool
- regex_search(_B, _B, const basic_regex<_C, _T>&,
+ regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&,
regex_constants::match_flag_type);
- template <class _C, class _T>
+ template <class _Cp, class _Tp>
friend
bool
- regex_search(const _C*, const _C*,
- const basic_regex<_C, _T>&, regex_constants::match_flag_type);
+ regex_search(const _Cp*, const _Cp*,
+ const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type);
- template <class _C, class _A, class _T>
+ template <class _Cp, class _Ap, class _Tp>
friend
bool
- regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&,
+ regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_constants::match_flag_type);
- template <class _ST, class _SA, class _C, class _T>
+ template <class _ST, class _SA, class _Cp, class _Tp>
friend
bool
- regex_search(const basic_string<_C, _ST, _SA>& __s,
- const basic_regex<_C, _T>& __e,
+ regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags);
- template <class _ST, class _SA, class _A, class _C, class _T>
+ template <class _ST, class _SA, class _Ap, class _Cp, class _Tp>
friend
bool
- regex_search(const basic_string<_C, _ST, _SA>& __s,
- match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&,
- const basic_regex<_C, _T>& __e,
+ regex_search(const basic_string<_Cp, _ST, _SA>& __s,
+ match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&,
+ const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags);
template <class, class> friend class __lookahead;
@@ -4402,7 +4404,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
- __sum = 16 * __sum + __hd;
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
@@ -4413,7 +4415,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
- __sum = 16 * __sum + __hd;
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
// drop through
case 'x':
++__first;
@@ -4426,7 +4428,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
- __sum = 16 * __sum + __hd;
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
@@ -4437,7 +4439,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
- __sum = 16 * __sum + __hd;
+ __sum = 16 * __sum + static_cast<unsigned>(__hd);
if (__str)
*__str = _CharT(__sum);
else
@@ -5261,12 +5263,12 @@ public:
// swap:
void swap(match_results& __m);
- template <class _B, class _A>
+ template <class _Bp, class _Ap>
_LIBCPP_INLINE_VISIBILITY
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
- const match_results<_B, _A>& __m, bool __no_update_pos)
+ const match_results<_Bp, _Ap>& __m, bool __no_update_pos)
{
- _B __mf = __m.prefix().first;
+ _Bp __mf = __m.prefix().first;
__matches_.resize(__m.size());
for (size_type __i = 0; __i < __matches_.size(); ++__i)
{
@@ -5295,16 +5297,16 @@ private:
template <class, class> friend class basic_regex;
- template <class _B, class _A, class _C, class _T>
+ template <class _Bp, class _Ap, class _Cp, class _Tp>
friend
bool
- regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
+ regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&,
regex_constants::match_flag_type);
- template <class _B, class _A>
+ template <class _Bp, class _Ap>
friend
bool
- operator==(const match_results<_B, _A>&, const match_results<_B, _A>&);
+ operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&);
template <class, class> friend class __lookahead;
};
@@ -5494,8 +5496,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
regex_constants::match_flag_type __flags, bool __at_first) const
{
vector<__state> __states;
- ptrdiff_t __j = 0;
- ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5509,7 +5509,6 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__node_ = __st;
__states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first;
- bool __matched = false;
do
{
__state& __s = __states.back();
@@ -5561,7 +5560,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
{
deque<__state> __states;
ptrdiff_t __highest_j = 0;
- ptrdiff_t _N = _VSTD::distance(__first, __last);
+ ptrdiff_t _Np = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5586,7 +5585,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
if (!__matched || __highest_j < __s.__current_ - __s.__first_)
__highest_j = __s.__current_ - __s.__first_;
__matched = true;
- if (__highest_j == _N)
+ if (__highest_j == _Np)
__states.clear();
else
__states.pop_back();
@@ -5641,7 +5640,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__state __best_state;
ptrdiff_t __j = 0;
ptrdiff_t __highest_j = 0;
- ptrdiff_t _N = _VSTD::distance(__first, __last);
+ ptrdiff_t _Np = _VSTD::distance(__first, __last);
__node* __st = __start_.get();
if (__st)
{
@@ -5671,7 +5670,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__best_state = __s;
}
__matched = true;
- if (__highest_j == _N)
+ if (__highest_j == _Np)
__states.clear();
else
__states.pop_back();
@@ -6086,11 +6085,11 @@ public:
regex_constants::match_flag_type __m =
regex_constants::match_default);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- template <size_t _N>
+ template <size_t _Np>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
const regex_type& __re,
- const int (&__submatches)[_N],
+ const int (&__submatches)[_Np],
regex_constants::match_flag_type __m =
regex_constants::match_default);
regex_token_iterator(const regex_token_iterator&);
@@ -6192,15 +6191,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits>
-template <size_t _N>
+template <size_t _Np>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
- const int (&__submatches)[_N],
+ const int (&__submatches)[_Np],
regex_constants::match_flag_type __m)
: __position_(__a, __b, __re, __m),
_N_(0),
- __subs_(__submatches, __submatches + _N)
+ __subs_(__submatches, __submatches + _Np)
{
__init(__a, __b);
}
diff --git a/include/sstream b/include/sstream
index 1b27195f901e..22450f0adb2b 100644
--- a/include/sstream
+++ b/include/sstream
@@ -175,6 +175,8 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream>
#include <string>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
diff --git a/include/streambuf b/include/streambuf
index 5dcb597d96fd..e128be5d59c3 100644
--- a/include/streambuf
+++ b/include/streambuf
@@ -461,15 +461,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
- ios_base::openmode __which)
+basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir,
+ ios_base::openmode)
{
return pos_type(off_type(-1));
}
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type
-basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
+basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode)
{
return pos_type(off_type(-1));
}
@@ -548,7 +548,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type
-basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
+basic_streambuf<_CharT, _Traits>::overflow(int_type)
{
return traits_type::eof();
}
diff --git a/include/string b/include/string
index 5f5a347c6340..620e6f828eae 100644
--- a/include/string
+++ b/include/string
@@ -446,6 +446,8 @@ template <> struct hash<wstring>;
#include <cassert>
#endif
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -1077,7 +1079,7 @@ private:
enum {__long_mask = ~(size_type(~0) >> 1)};
#else // _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x01};
- enum {__long_mask = 0x1};
+ enum {__long_mask = 0x1ul};
#endif // _LIBCPP_BIG_ENDIAN
enum {__mask = size_type(~0) >> 1};
@@ -1499,7 +1501,7 @@ private:
{__r_.first().__l.__cap_ = __long_mask | __s;}
_LIBCPP_INLINE_VISIBILITY
size_type __get_long_cap() const _NOEXCEPT
- {return __r_.first().__l.__cap_ & ~__long_mask;}
+ {return __r_.first().__l.__cap_ & size_type(~__long_mask);}
_LIBCPP_INLINE_VISIBILITY
void __set_long_pointer(pointer __p) _NOEXCEPT
@@ -1589,7 +1591,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT
+ void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1617,7 +1619,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(basic_string& __c, false_type)
+ void __move_assign_alloc(basic_string&, false_type)
_NOEXCEPT
{}
@@ -1636,7 +1638,7 @@ private:
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT
+ static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
@@ -1667,7 +1669,11 @@ template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
#endif
void
-basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
+basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
+#ifdef _LIBCPP_DEBUG
+ __pos
+#endif
+ )
{
#ifdef _LIBCPP_DEBUG
const_iterator __beg = begin();
@@ -2783,7 +2789,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1);
- return __b + __r;
+ return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -2794,7 +2800,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first));
- return __b + __r;
+ return __b + static_cast<difference_type>(__r);
}
template <class _CharT, class _Traits, class _Allocator>
@@ -3481,7 +3487,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator>
int
-basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const
+basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT
{
#ifdef _LIBCPP_DEBUG
assert(__s != 0);
@@ -3909,16 +3915,8 @@ template<class _CharT, class _Traits, class _Allocator>
template<class _Ptr>
size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
{
- size_t __r = 0;
- const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
- const size_t __m = size_t(0xF) << (__sr + 4);
- for (; __p != __e; ++__p)
- {
- __r = (__r << 4) + *__p;
- size_t __g = __r & __m;
- __r ^= __g | (__g >> __sr);
- }
- return __r;
+ typedef typename iterator_traits<_Ptr>::value_type value_type;
+ return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type));
}
template<class _CharT, class _Traits, class _Allocator>
diff --git a/include/support/win32/math_win32.h b/include/support/win32/math_win32.h
index 80eabc1353d6..41c50d624744 100644
--- a/include/support/win32/math_win32.h
+++ b/include/support/win32/math_win32.h
@@ -110,4 +110,4 @@ _LIBCPP_ALWAYS_INLINE int fpclassify( double num )
#endif // _MSC_VER
-#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H \ No newline at end of file
+#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
index 6ffd3d258908..0b8a912ac176 100644
--- a/include/support/win32/support.h
+++ b/include/support/win32/support.h
@@ -31,7 +31,7 @@ size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
size_t nmc, size_t len, mbstate_t *__restrict ps );
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
size_t nwc, size_t len, mbstate_t *__restrict ps );
-
+
#if defined(_MSC_VER)
#define snprintf _snprintf
@@ -52,9 +52,32 @@ _LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
#include <intrin.h>
-#define __builtin_popcount __popcnt
-#define __builtin_popcountl __popcnt
-#define __builtin_popcountll(__i) static_cast<int>(__popcnt64(__i))
+
+_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
+ static const unsigned int m1 = 0x55555555; //binary: 0101...
+ static const unsigned int m2 = 0x33333333; //binary: 00110011..
+ static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
+ static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
+ x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
+ x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
+ x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
+ return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
+}
+
+_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
+ return __builtin_popcount(static_cast<int>(x));
+}
+
+_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
+ static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
+ static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
+ static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
+ static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
+ x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
+ x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
+ x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
+ return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
+}
_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
{
@@ -68,8 +91,8 @@ _LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
{
DWORD r = 0;
- _BitScanReverse64(&r, x);
- return static_cast<int>(r);
+ _BitScanReverse64(&r, x);
+ return static_cast<int>(r);
}
_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
{
@@ -83,10 +106,10 @@ _LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
{
DWORD r = 0;
- _BitScanForward64(&r, x);
- return static_cast<int>(r);
+ _BitScanForward64(&r, x);
+ return static_cast<int>(r);
}
#endif // !__clang__
#endif // _MSC_VER
-#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H \ No newline at end of file
+#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
diff --git a/include/system_error b/include/system_error
index ea96a66c0dbd..805c64648833 100644
--- a/include/system_error
+++ b/include/system_error
@@ -245,9 +245,8 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
// for them:
//enum class errc
-struct errc
+_LIBCPP_DECLARE_STRONG_ENUM(errc)
{
-enum _ {
address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL,
@@ -343,23 +342,17 @@ enum _ {
value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE
};
-
- _ __v_;
-
- _LIBCPP_ALWAYS_INLINE
- errc(_ __v) : __v_(__v) {}
- _LIBCPP_ALWAYS_INLINE
- operator int() const {return __v_;}
-
-};
+_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { };
+#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { };
+#endif
class error_condition;
class error_code;
@@ -419,10 +412,10 @@ public:
error_condition(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
- template <class _E>
+ template <class _Ep>
_LIBCPP_ALWAYS_INLINE
- error_condition(_E __e,
- typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
+ error_condition(_Ep __e,
+ typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_condition(__e);}
@@ -433,14 +426,14 @@ public:
__cat_ = &__cat;
}
- template <class _E>
+ template <class _Ep>
_LIBCPP_ALWAYS_INLINE
typename enable_if
<
- is_error_condition_enum<_E>::value,
+ is_error_condition_enum<_Ep>::value,
error_condition&
>::type
- operator=(_E __e) _NOEXCEPT
+ operator=(_Ep __e) _NOEXCEPT
{*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
@@ -458,7 +451,7 @@ public:
string message() const;
_LIBCPP_ALWAYS_INLINE
- //explicit
+ _LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
@@ -474,7 +467,7 @@ bool
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{
return __x.category() < __y.category()
- || __x.category() == __y.category() && __x.value() < __y.value();
+ || (__x.category() == __y.category() && __x.value() < __y.value());
}
// error_code
@@ -491,10 +484,10 @@ public:
error_code(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {}
- template <class _E>
+ template <class _Ep>
_LIBCPP_ALWAYS_INLINE
- error_code(_E __e,
- typename enable_if<is_error_code_enum<_E>::value>::type* = 0
+ error_code(_Ep __e,
+ typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_code(__e);}
@@ -505,14 +498,14 @@ public:
__cat_ = &__cat;
}
- template <class _E>
+ template <class _Ep>
_LIBCPP_ALWAYS_INLINE
typename enable_if
<
- is_error_code_enum<_E>::value,
+ is_error_code_enum<_Ep>::value,
error_code&
>::type
- operator=(_E __e) _NOEXCEPT
+ operator=(_Ep __e) _NOEXCEPT
{*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE
@@ -535,7 +528,7 @@ public:
string message() const;
_LIBCPP_ALWAYS_INLINE
- //explicit
+ _LIBCPP_EXPLICIT
operator bool() const _NOEXCEPT {return __val_ != 0;}
};
@@ -551,7 +544,7 @@ bool
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{
return __x.category() < __y.category()
- || __x.category() == __y.category() && __x.value() < __y.value();
+ || (__x.category() == __y.category() && __x.value() < __y.value());
}
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/include/thread b/include/thread
index 4db4f61b981b..23b191589998 100644
--- a/include/thread
+++ b/include/thread
@@ -183,6 +183,9 @@ __thread_id get_id();
} // this_thread
+class _LIBCPP_VISIBLE __thread_id;
+template<> struct _LIBCPP_VISIBLE hash<__thread_id>;
+
class _LIBCPP_VISIBLE __thread_id
{
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
@@ -226,10 +229,9 @@ private:
friend __thread_id this_thread::get_id();
friend class _LIBCPP_VISIBLE thread;
+ friend struct _LIBCPP_VISIBLE hash<__thread_id>;
};
-template<class _Tp> struct hash;
-
template<>
struct _LIBCPP_VISIBLE hash<__thread_id>
: public unary_function<__thread_id, size_t>
@@ -237,8 +239,7 @@ struct _LIBCPP_VISIBLE hash<__thread_id>
_LIBCPP_INLINE_VISIBILITY
size_t operator()(__thread_id __v) const
{
- const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
- return *__p;
+ return hash<pthread_t>()(__v.__id_);
}
};
@@ -267,15 +268,15 @@ public:
_LIBCPP_INLINE_VISIBILITY
thread() : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _F, class ..._Args,
+ template <class _Fp, class ..._Args,
class = typename enable_if
<
- !is_same<typename decay<_F>::type, thread>::value
+ !is_same<typename decay<_Fp>::type, thread>::value
>::type
>
- explicit thread(_F&& __f, _Args&&... __args);
+ explicit thread(_Fp&& __f, _Args&&... __args);
#else // _LIBCPP_HAS_NO_VARIADICS
- template <class _F> explicit thread(_F __f);
+ template <class _Fp> explicit thread(_Fp __f);
#endif
~thread();
@@ -322,34 +323,34 @@ __thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
-template <class _F, class ..._Args, size_t ..._Indices>
+template <class _Fp, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
-__threaad_execute(tuple<_F, _Args...>& __t, __tuple_indices<_Indices...>)
+__threaad_execute(tuple<_Fp, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
}
-template <class _F>
+template <class _Fp>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
- std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
- typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
+ std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
+ typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
__threaad_execute(*__p, _Index());
return nullptr;
}
-template <class _F, class ..._Args,
+template <class _Fp, class ..._Args,
class
>
-thread::thread(_F&& __f, _Args&&... __args)
+thread::thread(_Fp&& __f, _Args&&... __args)
{
- typedef tuple<typename decay<_F>::type, typename decay<_Args>::type...> _G;
- _VSTD::unique_ptr<_G> __p(new _G(__decay_copy(_VSTD::forward<_F>(__f)),
+ typedef tuple<typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp;
+ _VSTD::unique_ptr<_Gp> __p(new _Gp(__decay_copy(_VSTD::forward<_Fp>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
- int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
+ int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get());
if (__ec == 0)
__p.release();
else
@@ -358,21 +359,21 @@ thread::thread(_F&& __f, _Args&&... __args)
#else // _LIBCPP_HAS_NO_VARIADICS
-template <class _F>
+template <class _Fp>
void*
__thread_proxy(void* __vp)
{
__thread_local_data().reset(new __thread_struct);
- std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
+ std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
(*__p)();
return nullptr;
}
-template <class _F>
-thread::thread(_F __f)
+template <class _Fp>
+thread::thread(_Fp __f)
{
- std::unique_ptr<_F> __p(new _F(__f));
- int __ec = pthread_create(&__t_, 0, &__thread_proxy<_F>, __p.get());
+ std::unique_ptr<_Fp> __p(new _Fp(__f));
+ int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Fp>, __p.get());
if (__ec == 0)
__p.release();
else
diff --git a/include/tuple b/include/tuple
index cc6792966788..2bdb05fbc091 100644
--- a/include/tuple
+++ b/include/tuple
@@ -116,8 +116,9 @@ template <class... Types>
#include <__config>
#include <__tuple>
#include <cstddef>
-#include <memory>
#include <type_traits>
+#include <__functional_base>
+#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -125,6 +126,64 @@ template <class... Types>
_LIBCPP_BEGIN_NAMESPACE_STD
+// allocator_arg_t
+
+struct _LIBCPP_VISIBLE allocator_arg_t { };
+
+extern const allocator_arg_t allocator_arg;
+
+// uses_allocator
+
+template <class _Tp>
+struct __has_allocator_type
+{
+private:
+ struct __two {char _; char __;};
+ template <class _Up> static __two __test(...);
+ template <class _Up> static char __test(typename _Up::allocator_type* = 0);
+public:
+ static const bool value = sizeof(__test<_Tp>(0)) == 1;
+};
+
+template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
+struct __uses_allocator
+ : public integral_constant<bool,
+ is_convertible<_Alloc, typename _Tp::allocator_type>::value>
+{
+};
+
+template <class _Tp, class _Alloc>
+struct __uses_allocator<_Tp, _Alloc, false>
+ : public false_type
+{
+};
+
+template <class _Tp, class _Alloc>
+struct _LIBCPP_VISIBLE uses_allocator
+ : public __uses_allocator<_Tp, _Alloc>
+{
+};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+// uses-allocator construction
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor_imp
+{
+ static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
+ static const bool __ic =
+ is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
+ static const int value = __ua ? 2 - __ic : 0;
+};
+
+template <class _Tp, class _Alloc, class ..._Args>
+struct __uses_alloc_ctor
+ : integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
+ {};
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
// tuple_size
@@ -146,7 +205,11 @@ public:
// __tuple_leaf
-template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value>
+template <size_t _Ip, class _Hp, bool=is_empty<_Hp>::value
+#if __has_feature(is_final)
+ && !__is_final(_Hp)
+#endif
+ >
class __tuple_leaf;
template <size_t _Ip, class _Hp, bool _Ep>
@@ -195,13 +258,13 @@ public:
explicit __tuple_leaf(_Tp&& __t)
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
- is_lvalue_reference<_Hp>::value &&
+ (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
- >::value) ||
+ >::value)) ||
(is_rvalue_reference<_Hp>::value &&
!is_lvalue_reference<_Tp>::value),
"Attempted to construct a reference element in a tuple with an rvalue");}
@@ -211,13 +274,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
- is_lvalue_reference<_Hp>::value &&
+ (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
- >::value),
+ >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc>
@@ -225,13 +288,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
: value(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t))
{static_assert(!is_lvalue_reference<_Hp>::value ||
- is_lvalue_reference<_Hp>::value &&
+ (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
- >::value),
+ >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
template <class _Tp, class _Alloc>
@@ -239,13 +302,13 @@ public:
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: value(_VSTD::forward<_Tp>(__t), __a)
{static_assert(!is_lvalue_reference<_Hp>::value ||
- is_lvalue_reference<_Hp>::value &&
+ (is_lvalue_reference<_Hp>::value &&
(is_lvalue_reference<_Tp>::value ||
is_same<typename remove_reference<_Tp>::type,
reference_wrapper<
typename remove_reference<_Hp>::type
>
- >::value),
+ >::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
__tuple_leaf(const __tuple_leaf& __t)
@@ -359,10 +422,10 @@ struct __all<>
static const bool value = true;
};
-template <bool _B0, bool ... _B>
-struct __all<_B0, _B...>
+template <bool _B0, bool ... _Bp>
+struct __all<_B0, _Bp...>
{
- static const bool value = _B0 && __all<_B...>::value;
+ static const bool value = _B0 && __all<_Bp...>::value;
};
// __tuple_impl
@@ -437,6 +500,14 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
return *this;
}
+ _LIBCPP_INLINE_VISIBILITY
+ __tuple_impl&
+ operator=(const __tuple_impl& __t)
+ {
+ __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
+ return *this;
+ }
+
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)
_NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value)
@@ -453,11 +524,11 @@ class _LIBCPP_VISIBLE tuple
base base_;
template <size_t _Jp, class ..._Up> friend
- typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&);
+ typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend
- const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&);
+ const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend
- typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&);
+ typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
public:
_LIBCPP_INLINE_VISIBILITY
@@ -577,12 +648,12 @@ public:
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
- template <class _U>
+ template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(array<_U, 0>) {}
- template <class _Alloc, class _U>
+ tuple(array<_Up, 0>) {}
+ template <class _Alloc, class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&, array<_U, 0>) {}
+ tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) _NOEXCEPT {}
};
@@ -603,7 +674,7 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(tuple<_Tp...>& __t)
+get(tuple<_Tp...>& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<__tuple_leaf<_Ip, type>&>(__t.base_).get();
@@ -612,7 +683,7 @@ get(tuple<_Tp...>& __t)
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
-get(const tuple<_Tp...>& __t)
+get(const tuple<_Tp...>& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
@@ -621,7 +692,7 @@ get(const tuple<_Tp...>& __t)
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
-get(tuple<_Tp...>&& __t)
+get(tuple<_Tp...>&& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
@@ -684,14 +755,14 @@ forward_as_tuple(_Tp&&... __t)
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
}
-template <size_t _I>
+template <size_t _Ip>
struct __tuple_equal
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
- return __tuple_equal<_I - 1>()(__x, __y) && get<_I-1>(__x) == get<_I-1>(__y);
+ return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y);
}
};
@@ -722,15 +793,15 @@ operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
return !(__x == __y);
}
-template <size_t _I>
+template <size_t _Ip>
struct __tuple_less
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
- return __tuple_less<_I-1>()(__x, __y) ||
- (!__tuple_less<_I-1>()(__y, __x) && get<_I-1>(__x) < get<_I-1>(__y));
+ return __tuple_less<_Ip-1>()(__x, __y) ||
+ (!__tuple_less<_Ip-1>()(__y, __x) && get<_Ip-1>(__x) < get<_Ip-1>(__y));
}
};
@@ -835,7 +906,7 @@ tuple_cat()
return tuple<>();
}
-template <class _R, class _Indices, class _Tuple0, class ..._Tuples>
+template <class _Rp, class _Indices, class _Tuple0, class ..._Tuples>
struct __tuple_cat_return_ref_imp;
template <class ..._Types, size_t ..._I0, class _Tuple0>
diff --git a/include/type_traits b/include/type_traits
index 90d56df37438..13129f31d665 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -148,7 +148,7 @@ namespace std
_LIBCPP_BEGIN_NAMESPACE_STD
-template <bool _B, class _If, class _Then>
+template <bool _Bp, class _If, class _Then>
struct _LIBCPP_VISIBLE conditional {typedef _If type;};
template <class _If, class _Then>
struct _LIBCPP_VISIBLE conditional<false, _If, _Then> {typedef _Then type;};
@@ -741,6 +741,14 @@ struct _LIBCPP_VISIBLE is_base_of
// is_empty
+#if __has_feature(is_empty)
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_empty
+ : public integral_constant<bool, __is_empty(_Tp)> {};
+
+#else // __has_feature(is_empty)
+
template <class _Tp>
struct __is_empty1
: public _Tp
@@ -760,8 +768,18 @@ template <class _Tp> struct __libcpp_empty<_Tp, false> : public false_type {};
template <class _Tp> struct _LIBCPP_VISIBLE is_empty : public __libcpp_empty<_Tp> {};
+#endif // __has_feature(is_empty)
+
// is_polymorphic
+#if __has_feature(is_polymorphic)
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_polymorphic
+ : public integral_constant<bool, __is_polymorphic(_Tp)> {};
+
+#else
+
template <class _Tp> struct __is_polymorphic1 : public _Tp {};
template <class _Tp> struct __is_polymorphic2 : public _Tp {virtual ~__is_polymorphic2() throw();};
@@ -774,6 +792,8 @@ template <class _Tp> struct __libcpp_polymorphic<_Tp, false> : public false_type
template <class _Tp> struct _LIBCPP_VISIBLE is_polymorphic
: public __libcpp_polymorphic<_Tp> {};
+#endif // __has_feature(is_polymorphic)
+
// has_virtual_destructor
#if __has_feature(has_virtual_destructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
@@ -1134,7 +1154,7 @@ private:
static _Up __u();
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
public:
- typedef decltype(true ? __t() : __u()) type;
+ typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
};
#else // _LIBCPP_HAS_NO_VARIADICS
@@ -1155,7 +1175,7 @@ private:
static _Up&& __u();
static bool __f();
public:
- typedef decltype(__f() ? __t() : __u()) type;
+ typedef typename remove_reference<decltype(__f() ? __t() : __u())>::type type;
};
template <class _Tp, class _Up, class ..._Vp>
@@ -1312,6 +1332,18 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
+ !is_convertible<_Tp, __rv<_Tp> >::value,
+ const _Tp&
+>::type
+move(const _Tp& __t)
+{
+ return __t;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
is_convertible<_Tp, __rv<_Tp> >::value,
_Tp
>::type
@@ -1418,215 +1450,215 @@ struct __member_pointer_traits_imp
#ifndef _LIBCPP_HAS_NO_VARIADICS
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...), true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
{
typedef _Class _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false>
{
typedef _Class const _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, false>
{
typedef _Class volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
#if __has_feature(cxx_reference_qualified_functions)
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
{
typedef _Class& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, false>
{
typedef _Class const& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, false>
{
typedef _Class volatile& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, true, false>
{
typedef _Class const volatile& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) &&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
{
typedef _Class&& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const&&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, false>
{
typedef _Class const&& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) volatile&&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true, false>
{
typedef _Class volatile&& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class ..._Param>
-struct __member_pointer_traits_imp<_R (_Class::*)(_Param...) const volatile&&, true, false>
+template <class _Rp, class _Class, class ..._Param>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&, true, false>
{
typedef _Class const volatile&& _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
#endif // __has_feature(cxx_reference_qualified_functions)
#else // _LIBCPP_HAS_NO_VARIADICS
-template <class _R, class _Class>
-struct __member_pointer_traits_imp<_R (_Class::*)(), true, false>
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
{
typedef _Class _ClassType;
- typedef _R _Re