aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0), true, false>
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
{
typedef _Class _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1), true, false>
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
{
typedef _Class _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1, class _P2>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2), true, false>
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
{
typedef _Class _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class>
-struct __member_pointer_traits_imp<_R (_Class::*)() const, true, false>
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
{
typedef _Class const _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const, true, false>
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
{
typedef _Class const _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const, true, false>
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
{
typedef _Class const _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1, class _P2>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const, true, false>
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, false>
{
typedef _Class const _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class>
-struct __member_pointer_traits_imp<_R (_Class::*)() volatile, true, false>
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
{
typedef _Class volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0) volatile, true, false>
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
{
typedef _Class volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) volatile, true, false>
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, false>
{
typedef _Class volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1, class _P2>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) volatile, true, false>
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true, false>
{
typedef _Class volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class>
-struct __member_pointer_traits_imp<_R (_Class::*)() const volatile, true, false>
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false>
{
typedef _Class const volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0) const volatile, true, false>
+template <class _Rp, class _Class, class _P0>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1) const volatile, true, false>
+template <class _Rp, class _Class, class _P0, class _P1>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
-template <class _R, class _Class, class _P0, class _P1, class _P2>
-struct __member_pointer_traits_imp<_R (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
+template <class _Rp, class _Class, class _P0, class _P1, class _P2>
+struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile, true, false>
{
typedef _Class const volatile _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
#endif // _LIBCPP_HAS_NO_VARIADICS
-template <class _R, class _Class>
-struct __member_pointer_traits_imp<_R _Class::*, false, true>
+template <class _Rp, class _Class>
+struct __member_pointer_traits_imp<_Rp _Class::*, false, true>
{
typedef _Class _ClassType;
- typedef _R _ReturnType;
+ typedef _Rp _ReturnType;
};
template <class _MP>
@@ -1673,21 +1705,21 @@ struct __result_of_mp<_MP, _Tp, true>
template <class _MP, class _Tp, bool>
struct __result_of_mdp;
-template <class _R, class _Class, class _Tp>
-struct __result_of_mdp<_R _Class::*, _Tp, false>
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
- typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _R>::type&& type;
+ typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type;
};
-template <class _R, class _Class, class _Tp>
-struct __result_of_mdp<_R _Class::*, _Tp, true>
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
- typedef typename __apply_cv<_Tp, _R>::type&& type;
+ typedef typename __apply_cv<_Tp, _Rp>::type&& type;
};
-template <class _R, class _Class, class _Tp>
-struct __result_of_mp<_R _Class::*, _Tp, false>
- : public __result_of_mdp<_R _Class::*, _Tp,
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mp<_Rp _Class::*, _Tp, false>
+ : public __result_of_mdp<_Rp _Class::*, _Tp,
is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};
@@ -1758,21 +1790,21 @@ struct __result_of_mp<_MP, _Tp, true>
template <class _MP, class _Tp, bool>
struct __result_of_mdp;
-template <class _R, class _Class, class _Tp>
-struct __result_of_mdp<_R _Class::*, _Tp, false>
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, false>
{
- typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _R>::type& type;
+ typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
};
-template <class _R, class _Class, class _Tp>
-struct __result_of_mdp<_R _Class::*, _Tp, true>
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mdp<_Rp _Class::*, _Tp, true>
{
- typedef typename __apply_cv<_Tp, _R>::type& type;
+ typedef typename __apply_cv<_Tp, _Rp>::type& type;
};
-template <class _R, class _Class, class _Tp>
-struct __result_of_mp<_R _Class::*, _Tp, false>
- : public __result_of_mdp<_R _Class::*, _Tp,
+template <class _Rp, class _Class, class _Tp>
+struct __result_of_mp<_Rp _Class::*, _Tp, false>
+ : public __result_of_mdp<_Rp _Class::*, _Tp,
is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
{
};
@@ -1879,8 +1911,8 @@ struct __is_constructible // false, _Tp is not a scalar
// function types are not constructible
-template <class _R, class... _A1, class... _A2>
-struct __is_constructible<false, _R(_A1...), _A2...>
+template <class _Rp, class... _A1, class... _A2>
+struct __is_constructible<false, _Rp(_A1...), _A2...>
: public false_type
{};
@@ -1956,22 +1988,22 @@ struct _LIBCPP_VISIBLE is_constructible
// Array types are default constructible if their element type
// is default constructible
-template <class _A, size_t _N>
-struct __is_constructible<false, _A[_N]>
- : public is_constructible<typename remove_all_extents<_A>::type>
+template <class _Ap, size_t _Np>
+struct __is_constructible<false, _Ap[_Np]>
+ : public is_constructible<typename remove_all_extents<_Ap>::type>
{};
// Otherwise array types are not constructible by this syntax
-template <class _A, size_t _N, class ..._Args>
-struct __is_constructible<false, _A[_N], _Args...>
+template <class _Ap, size_t _Np, class ..._Args>
+struct __is_constructible<false, _Ap[_Np], _Args...>
: public false_type
{};
// Incomplete array types are not constructible
-template <class _A, class ..._Args>
-struct __is_constructible<false, _A[], _Args...>
+template <class _Ap, class ..._Args>
+struct __is_constructible<false, _Ap[], _Args...>
: public false_type
{};
@@ -2124,35 +2156,35 @@ struct _LIBCPP_VISIBLE is_constructible<_Tp, _A0, __is_construct::__nat>
// Array types are default constructible if their element type
// is default constructible
-template <class _A, size_t _N>
-struct __is_constructible0_imp<false, _A[_N]>
- : public is_constructible<typename remove_all_extents<_A>::type>
+template <class _Ap, size_t _Np>
+struct __is_constructible0_imp<false, _Ap[_Np]>
+ : public is_constructible<typename remove_all_extents<_Ap>::type>
{};
-template <class _A, size_t _N, class _A0>
-struct __is_constructible1_imp<false, _A[_N], _A0>
+template <class _Ap, size_t _Np, class _A0>
+struct __is_constructible1_imp<false, _Ap[_Np], _A0>
: public false_type
{};
-template <class _A, size_t _N, class _A0, class _A1>
-struct __is_constructible2_imp<false, _A[_N], _A0, _A1>
+template <class _Ap, size_t _Np, class _A0, class _A1>
+struct __is_constructible2_imp<false, _Ap[_Np], _A0, _A1>
: public false_type
{};
// Incomplete array types are not constructible
-template <class _A>
-struct __is_constructible0_imp<false, _A[]>
+template <class _Ap>
+struct __is_constructible0_imp<false, _Ap[]>
: public false_type
{};
-template <class _A, class _A0>
-struct __is_constructible1_imp<false, _A[], _A0>
+template <class _Ap, class _A0>
+struct __is_constructible1_imp<false, _Ap[], _A0>
: public false_type
{};
-template <class _A, class _A0, class _A1>
-struct __is_constructible2_imp<false, _A[], _A0, _A1>
+template <class _Ap, class _A0, class _A1>
+struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
: public false_type
{};
@@ -2187,6 +2219,16 @@ struct _LIBCPP_VISIBLE is_move_constructible
#ifndef _LIBCPP_HAS_NO_VARIADICS
+#if __has_feature(is_trivially_constructible)
+
+template <class _Tp, class... _Args>
+struct _LIBCPP_VISIBLE is_trivially_constructible
+ : integral_constant<bool, __is_trivially_constructible(_Tp, _Args...)>
+{
+};
+
+#else // !__has_feature(is_trivially_constructible)
+
template <class _Tp, class... _Args>
struct _LIBCPP_VISIBLE is_trivially_constructible
: false_type
@@ -2209,34 +2251,24 @@ struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&&>
#else
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp>
#endif
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
+#endif // !__has_feature(is_trivially_constructible)
+
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _A0 = __is_construct::__nat,
@@ -2246,50 +2278,68 @@ struct _LIBCPP_VISIBLE is_trivially_constructible
{
};
+#if __has_feature(is_trivially_constructible)
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
+ __is_construct::__nat>
+ : integral_constant<bool, __is_trivially_constructible(_Tp)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
+ __is_construct::__nat>
+ : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
+ __is_construct::__nat>
+ : integral_constant<bool, __is_trivially_constructible(_Tp, const _Tp&)>
+{
+};
+
+template <class _Tp>
+struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
+ __is_construct::__nat>
+ : integral_constant<bool, __is_trivially_constructible(_Tp, _Tp&)>
+{
+};
+
+#else // !__has_feature(is_trivially_constructible)
+
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, __is_construct::__nat,
__is_construct::__nat>
-#if __has_feature(has_trivial_constructor) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_constructor(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, const _Tp&,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
template <class _Tp>
struct _LIBCPP_VISIBLE is_trivially_constructible<_Tp, _Tp&,
__is_construct::__nat>
-#if __has_feature(has_trivial_copy) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_copy(_Tp)>
-#else
: integral_constant<bool, is_scalar<_Tp>::value>
-#endif
{
};
+#endif // !__has_feature(is_trivially_constructible)
+
#endif // _LIBCPP_HAS_NO_VARIADICS
// is_trivially_default_constructible
@@ -2316,46 +2366,42 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_move_constructible
// is_trivially_assignable
+#if __has_feature(is_trivially_constructible)
+
+template <class _Tp, class _Arg>
+struct is_trivially_assignable
+ : integral_constant<bool, __is_trivially_assignable(_Tp, _Arg)>
+{
+};
+
+#else // !__has_feature(is_trivially_constructible)
+
template <class _Tp, class _Arg>
struct is_trivially_assignable
: public false_type {};
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_assign(_Tp)> {};
-#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_assign(_Tp)> {};
-#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
template <class _Tp>
struct is_trivially_assignable<_Tp&, const _Tp&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_assign(_Tp)> {};
-#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
struct is_trivially_assignable<_Tp&, _Tp&&>
-#if __has_feature(has_trivial_assign) || (__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
- : integral_constant<bool, __has_trivial_assign(_Tp)> {};
-#else
: integral_constant<bool, is_scalar<_Tp>::value> {};
-#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !__has_feature(is_trivially_constructible)
+
// is_trivially_copy_assignable
template <class _Tp> struct _LIBCPP_VISIBLE is_trivially_copy_assignable
@@ -2761,134 +2807,134 @@ template <class _Tp> struct _LIBCPP_VISIBLE is_trivial
// Check for complete types
-template <class ..._T> struct __check_complete;
+template <class ..._Tp> struct __check_complete;
template <>
struct __check_complete<>
{
};
-template <class _H, class _T0, class ..._T>
-struct __check_complete<_H, _T0, _T...>
- : private __check_complete<_H>,
- private __check_complete<_T0, _T...>
+template <class _Hp, class _T0, class ..._Tp>
+struct __check_complete<_Hp, _T0, _Tp...>
+ : private __check_complete<_Hp>,
+ private __check_complete<_T0, _Tp...>
{
};
-template <class _H>
-struct __check_complete<_H, _H>
- : private __check_complete<_H>
+template <class _Hp>
+struct __check_complete<_Hp, _Hp>
+ : private __check_complete<_Hp>
{
};
-template <class _T>
-struct __check_complete<_T>
+template <class _Tp>
+struct __check_complete<_Tp>
{
- static_assert(sizeof(_T) > 0, "Type must be complete.");
+ static_assert(sizeof(_Tp) > 0, "Type must be complete.");
};
-template <class _T>
-struct __check_complete<_T&>
- : private __check_complete<_T>
+template <class _Tp>
+struct __check_complete<_Tp&>
+ : private __check_complete<_Tp>
{
};
-template <class _T>
-struct __check_complete<_T&&>
- : private __check_complete<_T>
+template <class _Tp>
+struct __check_complete<_Tp&&>
+ : private __check_complete<_Tp>
{
};
-template <class _R, class ..._Param>
-struct __check_complete<_R (*)(_Param...)>
+template <class _Rp, class ..._Param>
+struct __check_complete<_Rp (*)(_Param...)>
: private __check_complete<_Param...>
{
};
-template <class _R, class ..._Param>
-struct __check_complete<_R (_Param...)>
+template <class _Rp, class ..._Param>
+struct __check_complete<_Rp (_Param...)>
: private __check_complete<_Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...)>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...)>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) volatile>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const volatile>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
: private __check_complete<_Class, _Param...>
{
};
#if __has_feature(cxx_reference_qualified_functions)
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) &>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) &>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) volatile&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const volatile&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) &&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) &&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const&&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) volatile&&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
: private __check_complete<_Class, _Param...>
{
};
-template <class _R, class _Class, class ..._Param>
-struct __check_complete<_R (_Class::*)(_Param...) const volatile&&>
+template <class _Rp, class _Class, class ..._Param>
+struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
: private __check_complete<_Class, _Param...>
{
};
#endif
-template <class _R, class _Class>
-struct __check_complete<_R _Class::*>
+template <class _Rp, class _Class>
+struct __check_complete<_Rp _Class::*>
: private __check_complete<_Class>
{
};
@@ -2904,70 +2950,70 @@ __invoke(__any, _Args&& ...__args)
// bullets 1 and 2
-template <class _F, class _A0, class ..._Args>
+template <class _Fp, class _A0, class ..._Args>
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)...));
-template <class _F, class _A0, class ..._Args>
+template <class _Fp, class _A0, class ..._Args>
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)...));
// bullets 3 and 4
-template <class _F, class _A0>
+template <class _Fp, class _A0>
auto
-__invoke(_F&& __f, _A0&& __a0)
+__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f);
-template <class _F, class _A0>
+template <class _Fp, class _A0>
auto
-__invoke(_F&& __f, _A0&& __a0)
+__invoke(_Fp&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
// bullet 5
-template <class _F, class ..._Args>
+template <class _Fp, class ..._Args>
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)...));
// __invokable
-template <class _F, class ..._Args>
+template <class _Fp, class ..._Args>
struct __invokable_imp
- : private __check_complete<_F, _Args...>
+ : private __check_complete<_Fp, _Args...>
{
typedef decltype(
- __invoke(_VSTD::declval<_F>(), _VSTD::declval<_Args>()...)
+ __invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
) type;
static const bool value = !is_same<type, __nat>::value;
};
-template <class _F, class ..._Args>
+template <class _Fp, class ..._Args>
struct __invokable
: public integral_constant<bool,
- __invokable_imp<_F, _Args...>::value>
+ __invokable_imp<_Fp, _Args...>::value>
{
};
// __invoke_of
-template <bool _Invokable, class _F, class ..._Args>
+template <bool _Invokable, class _Fp, class ..._Args>
struct __invoke_of_imp // false
{
};
-template <class _F, class ..._Args>
-struct __invoke_of_imp<true, _F, _Args...>
+template <class _Fp, class ..._Args>
+struct __invoke_of_imp<true, _Fp, _Args...>
{
- typedef typename __invokable_imp<_F, _Args...>::type type;
+ typedef typename __invokable_imp<_Fp, _Args...>::type type;
};
-template <class _F, class ..._Args>
+template <class _Fp, class ..._Args>
struct __invoke_of
- : public __invoke_of_imp<__invokable<_F, _Args...>::value, _F, _Args...>
+ : public __invoke_of_imp<__invokable<_Fp, _Args...>::value, _Fp, _Args...>
{
};
diff --git a/include/unordered_map b/include/unordered_map
index 56645e09b924..15243f6fe082 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -325,10 +325,16 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
+template <class _Key, class _Tp, class _Hash, bool = is_empty<_Hash>::value
+#if __has_feature(is_final)
+ && !__is_final(_Hash)
+#endif
+ >
class __unordered_map_hasher
: private _Hash
{
+ typedef pair<typename remove_const<_Key>::type, _Tp> _Pp;
+ typedef pair<const _Key, _Tp> _Cp;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher()
@@ -341,17 +347,23 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const _NOEXCEPT {return *this;}
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Tp& __x) const
+ size_t operator()(const _Pp& __x) const
{return static_cast<const _Hash&>(*this)(__x.first);}
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(const typename _Tp::first_type& __x) const
+ size_t operator()(const _Cp& __x) const
+ {return static_cast<const _Hash&>(*this)(__x.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(const _Key& __x) const
{return static_cast<const _Hash&>(*this)(__x);}
};
-template <class _Tp, class _Hash>
-class __unordered_map_hasher<_Tp, _Hash, false>
+template <class _Key, class _Tp, class _Hash>
+class __unordered_map_hasher<_Key, _Tp, _Hash, false>
{
_Hash __hash_;
+
+ typedef pair<typename remove_const<_Key>::type, _Tp> _Pp;
+ typedef pair<const _Key, _Tp> _Cp;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_hasher()
@@ -364,17 +376,26 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Hash& hash_function() const _NOEXCEPT {return __hash_;}
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(const _Tp& __x) const
+ size_t operator()(const _Pp& __x) const
{return __hash_(__x.first);}
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(const typename _Tp::first_type& __x) const
+ size_t operator()(const _Cp& __x) const
+ {return __hash_(__x.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(const _Key& __x) const
{return __hash_(__x);}
};
-template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
+template <class _Key, class _Tp, class _Pred, bool = is_empty<_Pred>::value
+#if __has_feature(is_final)
+ && !__is_final(_Pred)
+#endif
+ >
class __unordered_map_equal
: private _Pred
{
+ typedef pair<typename remove_const<_Key>::type, _Tp> _Pp;
+ typedef pair<const _Key, _Tp> _Cp;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal()
@@ -387,24 +408,41 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const _NOEXCEPT {return *this;}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
+ bool operator()(const _Pp& __x, const _Pp& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return static_cast<const _Pred&>(*this)(__x, __y.first);}
+ bool operator()(const _Pp& __x, const _Cp& __y) const
+ {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Pp& __x, const _Key& __y) const
+ {return static_cast<const _Pred&>(*this)(__x.first, __y);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Cp& __x, const _Pp& __y) const
+ {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Cp& __x, const _Cp& __y) const
+ {return static_cast<const _Pred&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
+ bool operator()(const _Cp& __x, const _Key& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
+ bool operator()(const _Key& __x, const _Pp& __y) const
+ {return static_cast<const _Pred&>(*this)(__x, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Key& __x, const _Cp& __y) const
+ {return static_cast<const _Pred&>(*this)(__x, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Key& __x, const _Key& __y) const
{return static_cast<const _Pred&>(*this)(__x, __y);}
};
-template <class _Tp, class _Pred>
-class __unordered_map_equal<_Tp, _Pred, false>
+template <class _Key, class _Tp, class _Pred>
+class __unordered_map_equal<_Key, _Tp, _Pred, false>
{
_Pred __pred_;
+
+ typedef pair<typename remove_const<_Key>::type, _Tp> _Pp;
+ typedef pair<const _Key, _Tp> _Cp;
public:
_LIBCPP_INLINE_VISIBILITY
__unordered_map_equal()
@@ -417,17 +455,31 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Pred& key_eq() const _NOEXCEPT {return __pred_;}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const _Tp& __y) const
+ bool operator()(const _Pp& __x, const _Pp& __y) const
{return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const typename _Tp::first_type& __x, const _Tp& __y) const
- {return __pred_(__x, __y.first);}
+ bool operator()(const _Pp& __x, const _Cp& __y) const
+ {return __pred_(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const _Tp& __x, const typename _Tp::first_type& __y) const
+ bool operator()(const _Pp& __x, const _Key& __y) const
{return __pred_(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(const typename _Tp::first_type& __x,
- const typename _Tp::first_type& __y) const
+ bool operator()(const _Cp& __x, const _Pp& __y) const
+ {return __pred_(__x.first, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Cp& __x, const _Cp& __y) const
+ {return __pred_(__x.first, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Cp& __x, const _Key& __y) const
+ {return __pred_(__x.first, __y);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Key& __x, const _Pp& __y) const
+ {return __pred_(__x, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Key& __x, const _Cp& __y) const
+ {return __pred_(__x, __y.first);}
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()(const _Key& __x, const _Key& __y) const
{return __pred_(__x, __y);}
};
@@ -624,8 +676,8 @@ public:
private:
typedef pair<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<__value_type, hasher> __hasher;
- typedef __unordered_map_equal<__value_type, key_equal> __key_equal;
+ typedef __unordered_map_hasher<key_type, mapped_type, hasher> __hasher;
+ typedef __unordered_map_equal<key_type, mapped_type, key_equal> __key_equal;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__value_type>
@@ -644,8 +696,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;
@@ -776,21 +828,21 @@ public:
pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_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&& __x)
- {return __table_.__insert_unique(_VSTD::forward<_P>(__x));}
+ pair<iterator, bool> insert(_Pp&& __x)
+ {return __table_.__insert_unique(_VSTD::forward<_Pp>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_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, _P&& __x)
- {return insert(_VSTD::forward<_P>(__x)).first;}
+ iterator insert(const_iterator, _Pp&& __x)
+ {return insert(_VSTD::forward<_Pp>(__x)).first;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -1065,7 +1117,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
_Args&&... __args)
{
__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),
_VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
@@ -1085,7 +1137,7 @@ typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_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;
@@ -1118,7 +1170,7 @@ typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_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));
@@ -1248,8 +1300,8 @@ public:
private:
typedef pair<key_type, mapped_type> __value_type;
- typedef __unordered_map_hasher<__value_type, hasher> __hasher;
- typedef __unordered_map_equal<__value_type, key_equal> __key_equal;
+ typedef __unordered_map_hasher<key_type, mapped_type, hasher> __hasher;
+ typedef __unordered_map_equal<key_type, mapped_type, key_equal> __key_equal;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__value_type>
@@ -1266,8 +1318,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;
@@ -1395,21 +1447,21 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_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&& __x)
- {return __table_.__insert_multi(_VSTD::forward<_P>(__x));}
+ iterator insert(_Pp&& __x)
+ {return __table_.__insert_multi(_VSTD::forward<_Pp>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __x)
{return __table_.__insert_multi(__p.__i_, __x);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _P,
- class = typename enable_if<is_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 __p, _P&& __x)
- {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_P>(__x));}
+ iterator insert(const_iterator __p, _Pp&& __x)
+ {return __table_.__insert_multi(__p.__i_, _VSTD::forward<_Pp>(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -1675,7 +1727,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
_A0&& __a0, _Args&&... __args)
{
__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),
_VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
@@ -1695,7 +1747,7 @@ typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
+ __node_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;
diff --git a/include/utility b/include/utility
index dd9ff33d7128..7facea3a649e 100644
--- a/include/utility
+++ b/include/utility
@@ -180,12 +180,12 @@ swap_ranges(_ForwardIterator1 __first1, _ForwardIterator1 __last1, _ForwardItera
return __first2;
}
-template<class _Tp, size_t _N>
+template<class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(_Tp (&__a)[_N], _Tp (&__b)[_N]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
+swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{
- _VSTD::swap_ranges(__a, __a + _N, __b);
+ _VSTD::swap_ranges(__a, __a + _Np, __b);
}
template <class _Tp>
@@ -306,7 +306,7 @@ struct _LIBCPP_VISIBLE pair
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
+ template <class... _Args1, class... _Args2>
_LIBCPP_INLINE_VISIBILITY
pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
tuple<_Args2...> __second_args)
diff --git a/include/valarray b/include/valarray
index 5d3154cc9f8a..3c0422a1b5b6 100644
--- a/include/valarray
+++ b/include/valarray
@@ -346,6 +346,8 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <algorithm>
#include <functional>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -493,14 +495,14 @@ struct __bit_shift_right : binary_function<_Tp, _Tp, _Tp>
{return __x >> __y;}
};
-template <class _Tp, class _F>
+template <class _Tp, class _Fp>
struct __apply_expr : unary_function<_Tp, _Tp>
{
private:
- _F __f_;
+ _Fp __f_;
public:
_LIBCPP_INLINE_VISIBILITY
- explicit __apply_expr(_F __f) : __f_(__f) {}
+ explicit __apply_expr(_Fp __f) : __f_(__f) {}
_LIBCPP_INLINE_VISIBILITY
_Tp operator()(const _Tp& __x) const
@@ -688,7 +690,7 @@ private:
ptrdiff_t __ul_;
ptrdiff_t __sn_;
ptrdiff_t __n_;
- static const ptrdiff_t _N = static_cast<ptrdiff_t>(
+ static const ptrdiff_t _Np = static_cast<ptrdiff_t>(
sizeof(ptrdiff_t) * __CHAR_BIT__ - 1);
_LIBCPP_INLINE_VISIBILITY
@@ -697,8 +699,8 @@ private:
__size_(__e.size()),
__n_(__n)
{
- ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _N);
- __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _N);
+ ptrdiff_t __neg_n = static_cast<ptrdiff_t>(__n_ >> _Np);
+ __sn_ = __neg_n | static_cast<ptrdiff_t>(static_cast<size_t>(-__n_) >> _Np);
__ul_ = ((__size_ - __n_) & ~__neg_n) | ((__n_ + 1) & __neg_n);
}
public:
@@ -706,8 +708,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator[](size_t __j) const
{
- ptrdiff_t __i = static_cast<size_t>(__j);
- ptrdiff_t __m = (__sn_ * __i - __ul_) >> _N;
+ ptrdiff_t __i = static_cast<ptrdiff_t>(__j);
+ ptrdiff_t __m = (__sn_ * __i - __ul_) >> _Np;
return (__expr_[(__i + __n_) & __m] & __m) | (value_type() & ~__m);
}
@@ -957,7 +959,7 @@ public:
void swap(valarray& __v);
_LIBCPP_INLINE_VISIBILITY
- size_t size() const {return __end_ - __begin_;}
+ size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
value_type sum() const;
value_type min() const;
@@ -1895,7 +1897,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
mask_array(const valarray<bool>& __vb, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)),
- __1d_(count(__vb.__begin_, __vb.__end_, true))
+ __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
{
size_t __j = 0;
for (size_t __i = 0; __i < __vb.size(); ++__i)
@@ -2106,7 +2108,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
__mask_expr(const valarray<bool>& __vb, const _RmExpr& __e)
: __expr_(__e),
- __1d_(count(__vb.__begin_, __vb.__end_, true))
+ __1d_(static_cast<size_t>(count(__vb.__begin_, __vb.__end_, true)))
{
size_t __j = 0;
for (size_t __i = 0; __i < __vb.size(); ++__i)
diff --git a/include/vector b/include/vector
index 7f7e3d361b90..61f0aef748f9 100644
--- a/include/vector
+++ b/include/vector
@@ -270,6 +270,8 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <__split_buffer>
#include <__functional_base>
+#include <__undef_min_max>
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -364,7 +366,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(const_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(const_pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@@ -404,7 +406,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const __vector_base& __c, false_type)
+ void __copy_assign_alloc(const __vector_base&, false_type)
{}
_LIBCPP_INLINE_VISIBILITY
@@ -415,7 +417,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(__vector_base& __c, false_type)
+ void __move_assign_alloc(__vector_base&, false_type)
_NOEXCEPT
{}
@@ -427,7 +429,7 @@ private:
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
+ static void __swap_alloc(allocator_type&, allocator_type&, false_type)
_NOEXCEPT
{}
};
@@ -437,7 +439,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void
__vector_base<_Tp, _Allocator>::__destruct_at_end(const_pointer __new_last, false_type) _NOEXCEPT
{
- while (__new_last < __end_)
+ while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), const_cast<pointer>(--__end_));
}
@@ -674,7 +676,7 @@ public:
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void push_back(value_type&& __x);
+ _LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
void emplace_back(_Args&&... __args);
@@ -787,14 +789,25 @@ private:
#endif
__base::__destruct_at_end(__new_last);
}
+ template <class _Up>
+ void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ __push_back_slow_path(_Up&& __x);
+#else
+ __push_back_slow_path(_Up& __x);
+#endif
+#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+ template <class... _Args>
+ void
+ __emplace_back_slow_path(_Args&&... __args);
+#endif
};
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v)
{
- for (pointer __p = this->__end_; this->__begin_ < __p;)
- __v.push_front(_VSTD::move_if_noexcept(*--__p));
+ __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
_VSTD::swap(this->__begin_, __v.__begin_);
_VSTD::swap(this->__end_, __v.__end_);
_VSTD::swap(this->__end_cap(), __v.__end_cap());
@@ -807,10 +820,8 @@ typename vector<_Tp, _Allocator>::pointer
vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, allocator_type&>& __v, pointer __p)
{
pointer __r = __v.__begin_;
- for (pointer __i = __p; this->__begin_ < __i;)
- __v.push_front(_VSTD::move_if_noexcept(*--__i));
- for (pointer __i = __p; __i < this->__end_; ++__i)
- __v.push_back(_VSTD::move_if_noexcept(*__i));
+ __alloc_traits::__construct_backward(this->__alloc(), this->__begin_, __p, __v.__begin_);
+ __alloc_traits::__construct_forward(this->__alloc(), __p, this->__end_, __v.__end_);
_VSTD::swap(this->__begin_, __v.__begin_);
_VSTD::swap(this->__end_, __v.__end_);
_VSTD::swap(this->__end_cap(), __v.__end_cap());
@@ -1144,8 +1155,8 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
}
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()));
}
}
@@ -1201,8 +1212,8 @@ vector<_Tp, _Allocator>::__move_assign(vector& __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());
@@ -1436,27 +1447,40 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
}
template <class _Tp, class _Allocator>
+template <class _Up>
+void
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
+#else
+vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
+#endif
+{
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+ // __v.push_back(_VSTD::forward<_Up>(__x));
+ __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_++), _VSTD::forward<_Up>(__x));
+ __swap_out_circular_buffer(__v);
+}
+
+template <class _Tp, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::push_back(const_reference __x)
{
- if (this->__end_ < this->__end_cap())
+ if (this->__end_ != this->__end_cap())
{
__alloc_traits::construct(this->__alloc(),
_VSTD::__to_raw_pointer(this->__end_), __x);
++this->__end_;
}
else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
- __v.push_back(__x);
- __swap_out_circular_buffer(__v);
- }
+ __push_back_slow_path(__x);
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
+_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::push_back(value_type&& __x)
{
@@ -1468,12 +1492,7 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
++this->__end_;
}
else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
- __v.push_back(_VSTD::move(__x));
- __swap_out_circular_buffer(__v);
- }
+ __push_back_slow_path(_VSTD::move(__x));
}
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -1481,6 +1500,19 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
template <class _Tp, class _Allocator>
template <class... _Args>
void
+vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
+{
+ allocator_type& __a = this->__alloc();
+ __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
+// __v.emplace_back(_VSTD::forward<_Args>(__args)...);
+ __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(__v.__end_++), _VSTD::forward<_Args>(__args)...);
+ __swap_out_circular_buffer(__v);
+}
+
+template <class _Tp, class _Allocator>
+template <class... _Args>
+_LIBCPP_INLINE_VISIBILITY inline
+void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
if (this->__end_ < this->__end_cap())
@@ -1491,12 +1523,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
++this->__end_;
}
else
- {
- allocator_type& __a = this->__alloc();
- __split_buffer<value_type, allocator_type&> __v(__recommend(size() + 1), size(), __a);
- __v.emplace_back(_VSTD::forward<_Args>(__args)...);
- __swap_out_circular_buffer(__v);
- }
+ __emplace_back_slow_path(_VSTD::forward<_Args>(__args)...);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -2239,7 +2266,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __copy_assign_alloc(const vector& __c, false_type)
+ void __copy_assign_alloc(const vector&, false_type)
{}
void __move_assign(vector& __c, false_type);
@@ -2260,7 +2287,7 @@ private:
}
_LIBCPP_INLINE_VISIBILITY
- void __move_assign_alloc(vector& __c, false_type)
+ void __move_assign_alloc(vector&, false_type)
_NOEXCEPT
{}
@@ -2280,7 +2307,7 @@ private:
swap(__x, __y);
}
_LIBCPP_INLINE_VISIBILITY
- static void __swap_alloc(__storage_allocator& __x, __storage_allocator& __y, false_type)
+ static void __swap_alloc(__storage_allocator&, __storage_allocator&, false_type)
_NOEXCEPT
{}
diff --git a/src/chrono.cpp b/src/chrono.cpp
index 416b95013ef2..73c83ee084e9 100644
--- a/src/chrono.cpp
+++ b/src/chrono.cpp
@@ -61,7 +61,7 @@ static
steady_clock::rep
steady_simplified()
{
- return mach_absolute_time();
+ return static_cast<steady_clock::rep>(mach_absolute_time());
}
static
diff --git a/src/condition_variable.cpp b/src/condition_variable.cpp
index ca1dca3280e9..b53b836bfe7f 100644
--- a/src/condition_variable.cpp
+++ b/src/condition_variable.cpp
@@ -16,8 +16,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
condition_variable::~condition_variable()
{
- int e = pthread_cond_destroy(&__cv_);
-// assert(e == 0);
+ pthread_cond_destroy(&__cv_);
}
void
diff --git a/src/debug.cpp b/src/debug.cpp
index 8b660f5f39ab..406b247b7fec 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -125,7 +125,7 @@ __libcpp_db::__insert_ic(void* __i, const void* __c)
" But it is being used in a translation unit with debug mode enabled."
" Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1";
_LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg);
- size_t hc = hash<const void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* c = __cbeg_[hc];
_LIBCPP_ASSERT(c != nullptr, errmsg);
while (c->__c_ != __c)
@@ -141,9 +141,9 @@ __c_node*
__libcpp_db::__insert_c(void* __c)
{
WLock _(mut());
- if (__csz_ + 1 > __cend_ - __cbeg_)
+ if (__csz_ + 1 > static_cast<size_t>(__cend_ - __cbeg_))
{
- size_t nc = __next_prime(2*(__cend_ - __cbeg_) + 1);
+ size_t nc = __next_prime(2*static_cast<size_t>(__cend_ - __cbeg_) + 1);
__c_node** cbeg = (__c_node**)calloc(nc, sizeof(void*));
if (cbeg == nullptr)
throw bad_alloc();
@@ -163,7 +163,7 @@ __libcpp_db::__insert_c(void* __c)
__cbeg_ = cbeg;
__cend_ = __cbeg_ + nc;
}
- size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
__c_node* r = __cbeg_[hc] = (__c_node*)malloc(sizeof(__c_node));
if (__cbeg_[hc] == nullptr)
@@ -180,7 +180,7 @@ __libcpp_db::__erase_i(void* __i)
WLock _(mut());
if (__ibeg_ != __iend_)
{
- size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
+ size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi];
if (p != nullptr)
{
@@ -209,7 +209,7 @@ void
__libcpp_db::__invalidate_all(void* __c)
{
WLock _(mut());
- size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A");
while (p->__c_ != __c)
@@ -228,7 +228,7 @@ __c_node*
__libcpp_db::__find_c_and_lock(void* __c) const
{
mut().lock();
- size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A");
while (p->__c_ != __c)
@@ -242,7 +242,7 @@ __libcpp_db::__find_c_and_lock(void* __c) const
__c_node*
__libcpp_db::__find_c(void* __c) const
{
- size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c A");
while (p->__c_ != __c)
@@ -263,7 +263,7 @@ void
__libcpp_db::__erase_c(void* __c)
{
WLock _(mut());
- size_t hc = hash<void*>()(__c) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
__c_node* q = nullptr;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
@@ -360,7 +360,7 @@ void
__libcpp_db::swap(void* c1, void* c2)
{
WLock _(mut());
- size_t hc = hash<void*>()(c1) % (__cend_ - __cbeg_);
+ size_t hc = hash<void*>()(c1) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p1 = __cbeg_[hc];
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap A");
while (p1->__c_ != c1)
@@ -368,7 +368,7 @@ __libcpp_db::swap(void* c1, void* c2)
p1 = p1->__next_;
_LIBCPP_ASSERT(p1 != nullptr, "debug mode internal logic error swap B");
}
- hc = hash<void*>()(c2) % (__cend_ - __cbeg_);
+ hc = hash<void*>()(c2) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p2 = __cbeg_[hc];
_LIBCPP_ASSERT(p2 != nullptr, "debug mode internal logic error swap C");
while (p2->__c_ != c2)
@@ -397,7 +397,7 @@ __c_node::__add(__i_node* i)
{
if (end_ == cap_)
{
- size_t nc = 2*(cap_ - beg_);
+ size_t nc = 2*static_cast<size_t>(cap_ - beg_);
if (nc == 0)
nc = 1;
__i_node** beg = (__i_node**)malloc(nc * sizeof(__i_node*));
@@ -419,9 +419,9 @@ _LIBCPP_HIDDEN
__i_node*
__libcpp_db::__insert_iterator(void* __i)
{
- if (__isz_ + 1 > __iend_ - __ibeg_)
+ if (__isz_ + 1 > static_cast<size_t>(__iend_ - __ibeg_))
{
- size_t nc = __next_prime(2*(__iend_ - __ibeg_) + 1);
+ size_t nc = __next_prime(2*static_cast<size_t>(__iend_ - __ibeg_) + 1);
__i_node** ibeg = (__i_node**)calloc(nc, sizeof(void*));
if (ibeg == nullptr)
throw bad_alloc();
@@ -441,7 +441,7 @@ __libcpp_db::__insert_iterator(void* __i)
__ibeg_ = ibeg;
__iend_ = __ibeg_ + nc;
}
- size_t hi = hash<void*>()(__i) % (__iend_ - __ibeg_);
+ size_t hi = hash<void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
__i_node* p = __ibeg_[hi];
__i_node* r = __ibeg_[hi] = (__i_node*)malloc(sizeof(__i_node));
if (r == nullptr)
@@ -458,7 +458,7 @@ __libcpp_db::__find_iterator(const void* __i) const
__i_node* r = nullptr;
if (__ibeg_ != __iend_)
{
- size_t h = hash<const void*>()(__i) % (__iend_ - __ibeg_);
+ size_t h = hash<const void*>()(__i) % static_cast<size_t>(__iend_ - __ibeg_);
for (__i_node* nd = __ibeg_[h]; nd != nullptr; nd = nd->__next_)
{
if (nd->__i_ == __i)
@@ -478,7 +478,7 @@ __c_node::__remove(__i_node* p)
__i_node** r = find(beg_, end_, p);
_LIBCPP_ASSERT(r != end_, "debug mode internal logic error __c_node::__remove");
if (--end_ != r)
- memmove(r, r+1, (end_ - r)*sizeof(__i_node*));
+ memmove(r, r+1, static_cast<size_t>(end_ - r)*sizeof(__i_node*));
}
_LIBCPP_END_NAMESPACE_STD
diff --git a/src/exception.cpp b/src/exception.cpp
index 26d97a960825..6b5e6984a606 100644
--- a/src/exception.cpp
+++ b/src/exception.cpp
@@ -12,14 +12,17 @@
#if __APPLE__
#include <cxxabi.h>
+
using namespace __cxxabiv1;
- using namespace __cxxabiapple;
- // On Darwin, there are two STL shared libraries and a lower level ABI
- // shared libray. The globals holding the current terminate handler and
- // current unexpected handler are in the ABI library.
- #define __terminate_handler __cxxabiapple::__cxa_terminate_handler
- #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
#define HAVE_DEPENDENT_EH_ABI 1
+ #ifndef _LIBCPPABI_VERSION
+ using namespace __cxxabiapple;
+ // On Darwin, there are two STL shared libraries and a lower level ABI
+ // shared libray. The globals holding the current terminate handler and
+ // current unexpected handler are in the ABI library.
+ #define __terminate_handler __cxxabiapple::__cxa_terminate_handler
+ #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
+ #endif // _LIBCPPABI_VERSION
#elif defined(LIBCXXRT)
#include <cxxabi.h>
using namespace __cxxabiv1;
@@ -29,50 +32,54 @@
static std::unexpected_handler __unexpected_handler;
#endif // __APPLE__
-#ifndef LIBCXXRT
+namespace std
+{
+
+#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
+
// libcxxrt provides implementations of these functions itself.
-std::unexpected_handler
-std::set_unexpected(std::unexpected_handler func) _NOEXCEPT
+unexpected_handler
+set_unexpected(unexpected_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__unexpected_handler, func);
}
-std::unexpected_handler
-std::get_unexpected() _NOEXCEPT
+unexpected_handler
+get_unexpected() _NOEXCEPT
{
- return __sync_fetch_and_add(&__unexpected_handler, (std::unexpected_handler)0);
+ return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
}
_ATTRIBUTE(noreturn)
void
-std::unexpected()
+unexpected()
{
- (*std::get_unexpected())();
+ (*get_unexpected())();
// unexpected handler should not return
- std::terminate();
+ terminate();
}
-std::terminate_handler
-std::set_terminate(std::terminate_handler func) _NOEXCEPT
+terminate_handler
+set_terminate(terminate_handler func) _NOEXCEPT
{
return __sync_lock_test_and_set(&__terminate_handler, func);
}
-std::terminate_handler
-std::get_terminate() _NOEXCEPT
+terminate_handler
+get_terminate() _NOEXCEPT
{
- return __sync_fetch_and_add(&__terminate_handler, (std::terminate_handler)0);
+ return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
}
_ATTRIBUTE(noreturn)
void
-std::terminate() _NOEXCEPT
+terminate() _NOEXCEPT
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- (*std::get_terminate())();
+ (*get_terminate())();
// handler should not return
::abort ();
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -84,13 +91,14 @@ std::terminate() _NOEXCEPT
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
-#endif // LIBCXXRT
+#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
-bool std::uncaught_exception() _NOEXCEPT
+#ifndef LIBCXXRT
+bool uncaught_exception() _NOEXCEPT
{
#if __APPLE__
// on Darwin, there is a helper function so __cxa_get_globals is private
- return __cxxabiapple::__cxa_uncaught_exception();
+ return __cxa_uncaught_exception();
#elif LIBCXXRT
__cxa_eh_globals * globals = __cxa_get_globals();
return (globals->uncaughtExceptions != 0);
@@ -100,8 +108,7 @@ bool std::uncaught_exception() _NOEXCEPT
#endif // __APPLE__
}
-namespace std
-{
+#ifndef _LIBCPPABI_VERSION
exception::~exception() _NOEXCEPT
{
@@ -121,6 +128,9 @@ const char* bad_exception::what() const _NOEXCEPT
return "std::bad_exception";
}
+#endif // _LIBCPPABI_VERSION
+#endif //LIBCXXRT
+
exception_ptr::~exception_ptr() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
@@ -176,15 +186,14 @@ nested_exception::rethrow_nested() const
rethrow_exception(__ptr_);
}
-} // std
-std::exception_ptr std::current_exception() _NOEXCEPT
+exception_ptr current_exception() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
// be nicer if there was a constructor that took a ptr, then
// this whole function would be just:
// return exception_ptr(__cxa_current_primary_exception());
- std::exception_ptr ptr;
+ exception_ptr ptr;
ptr.__ptr_ = __cxa_current_primary_exception();
return ptr;
#else // __APPLE__
@@ -193,7 +202,8 @@ std::exception_ptr std::current_exception() _NOEXCEPT
#endif // __APPLE__
}
-void std::rethrow_exception(exception_ptr p)
+_ATTRIBUTE(noreturn)
+void rethrow_exception(exception_ptr p)
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_rethrow_primary_exception(p.__ptr_);
@@ -204,3 +214,4 @@ void std::rethrow_exception(exception_ptr p)
::abort();
#endif // __APPLE__
}
+} // std
diff --git a/src/future.cpp b/src/future.cpp
index ff59110593b2..29357112df98 100644
--- a/src/future.cpp
+++ b/src/future.cpp
@@ -29,7 +29,7 @@ __future_error_category::name() const _NOEXCEPT
string
__future_error_category::message(int ev) const
{
- switch (ev)
+ switch (static_cast<future_errc>(ev))
{
case future_errc::broken_promise:
return string("The associated promise has been destructed prior "
@@ -152,9 +152,9 @@ __assoc_sub_state::__sub_wait(unique_lock<mutex>& __lk)
{
if (!__is_ready())
{
- if (__state_ & deferred)
+ if (__state_ & static_cast<unsigned>(deferred))
{
- __state_ &= ~deferred;
+ __state_ &= ~static_cast<unsigned>(deferred);
__lk.unlock();
__execute();
}
diff --git a/src/hash.cpp b/src/hash.cpp
index 728b9bd3831b..6f30d5a60581 100644
--- a/src/hash.cpp
+++ b/src/hash.cpp
@@ -181,7 +181,8 @@ __next_prime(size_t n)
// Select first potential prime >= n
// Known a-priori n >= L
size_t k0 = n / L;
- size_t in = std::lower_bound(indices, indices + M, n - k0 * L) - indices;
+ size_t in = static_cast<size_t>(std::lower_bound(indices, indices + M, n - k0 * L)
+ - indices);
n = L * k0 + indices[in];
while (true)
{
diff --git a/src/locale.cpp b/src/locale.cpp
index b90e163a02a9..fe994881d462 100644
--- a/src/locale.cpp
+++ b/src/locale.cpp
@@ -7,6 +7,12 @@
//
//===----------------------------------------------------------------------===//
+// On Solaris, we need to define something to make the C99 parts of localeconv
+// visible.
+#ifdef __sun__
+#define _LCONV_C99
+#endif
+
#include "string"
#include "locale"
#include "codecvt"
@@ -77,12 +83,15 @@ make(A0 a0, A1 a1, A2 a2)
}
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+
class _LIBCPP_HIDDEN locale::__imp
: public facet
{
enum {N = 28};
- string name_;
vector<facet*, __sso_allocator<facet*, N> > facets_;
+ string name_;
public:
explicit __imp(size_t refs = 0);
explicit __imp(const string& name, size_t refs = 0);
@@ -93,7 +102,8 @@ public:
~__imp();
const string& name() const {return name_;}
- bool has_facet(long id) const {return id < facets_.size() && facets_[id];}
+ bool has_facet(long id) const
+ {return static_cast<size_t>(id) < facets_.size() && facets_[static_cast<size_t>(id)];}
const locale::facet* use_facet(long id) const;
static const locale& make_classic();
@@ -104,46 +114,48 @@ private:
template <class F> void install_from(const __imp& other);
};
+#pragma clang diagnostic pop
+
locale::__imp::__imp(size_t refs)
: facet(refs),
- name_("C"),
- facets_(N)
+ facets_(N),
+ name_("C")
{
facets_.clear();
- install(&make<_VSTD::collate<char> >(1));
- install(&make<_VSTD::collate<wchar_t> >(1));
- install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1));
- install(&make<_VSTD::ctype<wchar_t> >(1));
- install(&make<codecvt<char, char, mbstate_t> >(1));
- install(&make<codecvt<wchar_t, char, mbstate_t> >(1));
- install(&make<codecvt<char16_t, char, mbstate_t> >(1));
- install(&make<codecvt<char32_t, char, mbstate_t> >(1));
- install(&make<numpunct<char> >(1));
- install(&make<numpunct<wchar_t> >(1));
- install(&make<num_get<char> >(1));
- install(&make<num_get<wchar_t> >(1));
- install(&make<num_put<char> >(1));
- install(&make<num_put<wchar_t> >(1));
- install(&make<moneypunct<char, false> >(1));
- install(&make<moneypunct<char, true> >(1));
- install(&make<moneypunct<wchar_t, false> >(1));
- install(&make<moneypunct<wchar_t, true> >(1));
- install(&make<money_get<char> >(1));
- install(&make<money_get<wchar_t> >(1));
- install(&make<money_put<char> >(1));
- install(&make<money_put<wchar_t> >(1));
- install(&make<time_get<char> >(1));
- install(&make<time_get<wchar_t> >(1));
- install(&make<time_put<char> >(1));
- install(&make<time_put<wchar_t> >(1));
- install(&make<_VSTD::messages<char> >(1));
- install(&make<_VSTD::messages<wchar_t> >(1));
+ install(&make<_VSTD::collate<char> >(1u));
+ install(&make<_VSTD::collate<wchar_t> >(1u));
+ install(&make<_VSTD::ctype<char> >((ctype_base::mask*)0, false, 1u));
+ install(&make<_VSTD::ctype<wchar_t> >(1u));
+ install(&make<codecvt<char, char, mbstate_t> >(1u));
+ install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
+ install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
+ install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
+ install(&make<numpunct<char> >(1u));
+ install(&make<numpunct<wchar_t> >(1u));
+ install(&make<num_get<char> >(1u));
+ install(&make<num_get<wchar_t> >(1u));
+ install(&make<num_put<char> >(1u));
+ install(&make<num_put<wchar_t> >(1u));
+ install(&make<moneypunct<char, false> >(1u));
+ install(&make<moneypunct<char, true> >(1u));
+ install(&make<moneypunct<wchar_t, false> >(1u));
+ install(&make<moneypunct<wchar_t, true> >(1u));
+ install(&make<money_get<char> >(1u));
+ install(&make<money_get<wchar_t> >(1u));
+ install(&make<money_put<char> >(1u));
+ install(&make<money_put<wchar_t> >(1u));
+ install(&make<time_get<char> >(1u));
+ install(&make<time_get<wchar_t> >(1u));
+ install(&make<time_put<char> >(1u));
+ install(&make<time_put<wchar_t> >(1u));
+ install(&make<_VSTD::messages<char> >(1u));
+ install(&make<_VSTD::messages<wchar_t> >(1u));
}
locale::__imp::__imp(const string& name, size_t refs)
: facet(refs),
- name_(name),
- facets_(N)
+ facets_(N),
+ name_(name)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
try
@@ -186,8 +198,8 @@ locale::__imp::__imp(const string& name, size_t refs)
}
locale::__imp::__imp(const __imp& other)
- : name_(other.name_),
- facets_(max<size_t>(N, other.facets_.size()))
+ : facets_(max<size_t>(N, other.facets_.size())),
+ name_(other.name_)
{
facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i)
@@ -196,8 +208,8 @@ locale::__imp::__imp(const __imp& other)
}
locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
- : name_("*"),
- facets_(N)
+ : facets_(N),
+ name_("*")
{
facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i)
@@ -267,8 +279,8 @@ locale::__imp::install_from(const locale::__imp& one)
}
locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
- : name_("*"),
- facets_(N)
+ : facets_(N),
+ name_("*")
{
facets_ = other.facets_;
for (unsigned i = 0; i < facets_.size(); ++i)
@@ -337,8 +349,8 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
}
locale::__imp::__imp(const __imp& other, facet* f, long id)
- : name_("*"),
- facets_(max<size_t>(N, other.facets_.size()+1))
+ : facets_(max<size_t>(N, other.facets_.size()+1)),
+ name_("*")
{
f->__add_shared();
unique_ptr<facet, release> hold(f);
@@ -361,11 +373,11 @@ locale::__imp::install(facet* f, long id)
{
f->__add_shared();
unique_ptr<facet, release> hold(f);
- if (id >= facets_.size())
- facets_.resize(id+1);
- if (facets_[id])
- facets_[id]->__release_shared();
- facets_[id] = hold.release();
+ if (static_cast<size_t>(id) >= facets_.size())
+ facets_.resize(static_cast<size_t>(id+1));
+ if (facets_[static_cast<size_t>(id)])
+ facets_[static_cast<size_t>(id)]->__release_shared();
+ facets_[static_cast<size_t>(id)] = hold.release();
}
const locale::facet*
@@ -375,7 +387,7 @@ locale::__imp::use_facet(long id) const
if (!has_facet(id))
throw bad_cast();
#endif // _LIBCPP_NO_EXCEPTIONS
- return facets_[id];
+ return facets_[static_cast<size_t>(id)];
}
// locale
@@ -386,7 +398,7 @@ locale::__imp::make_classic()
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
locale* c = (locale*)&buf;
- c->__locale_ = &make<__imp>(1);
+ c->__locale_ = &make<__imp>(1u);
return *c;
}
@@ -402,7 +414,6 @@ locale::__imp::make_global()
{
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
- locale* g = (locale*)&buf;
::new (&buf) locale(locale::classic());
return *(locale*)&buf;
}
@@ -800,7 +811,7 @@ ctype<wchar_t>::do_narrow(const char_type* low, const char_type* high, char dfau
{
for (; low != high; ++low, ++dest)
if (isascii(*low))
- *dest = *low;
+ *dest = static_cast<char>(*low);
else
*dest = dfault;
return low;
@@ -829,7 +840,8 @@ char
ctype<char>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
+ return isascii(c) ?
+ static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__GLIBC__)
return isascii(c) ? __classic_upper_table()[c] : c;
#else
@@ -842,7 +854,8 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
+ *low = isascii(*low) ?
+ static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__GLIBC__)
*low = isascii(*low) ? __classic_upper_table()[*low] : *low;
#else
@@ -855,7 +868,8 @@ char
ctype<char>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
+ return isascii(c) ?
+ static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__GLIBC__)
return isascii(c) ? __classic_lower_table()[c] : c;
#else
@@ -868,7 +882,7 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
- *low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
+ *low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__GLIBC__)
*low = isascii(*low) ? __classic_lower_table()[*low] : *low;
#else
@@ -917,11 +931,17 @@ ctype<char>::classic_table() _NOEXCEPT
return _DefaultRuneLocale.__runetype;
#elif defined(__GLIBC__)
return __cloc()->__ctype_b;
+#elif __sun__
+ return __ctype_mask;
#elif _WIN32
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
#else
+ // Platform not supported: abort so the person doing the port knows what to
+ // fix
+# warning ctype<char>::classic_table() is not implemented
+ abort();
return NULL;
#endif
}
@@ -972,28 +992,28 @@ ctype_byname<char>::~ctype_byname()
char
ctype_byname<char>::do_toupper(char_type c) const
{
- return toupper_l(c, __l);
+ return static_cast<char>(toupper_l(c, __l));
}
const char*
ctype_byname<char>::do_toupper(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
- *low = toupper_l(*low, __l);
+ *low = static_cast<char>(toupper_l(*low, __l));
return low;
}
char
ctype_byname<char>::do_tolower(char_type c) const
{
- return tolower_l(c, __l);
+ return static_cast<char>(tolower_l(c, __l));
}
const char*
ctype_byname<char>::do_tolower(char_type* low, const char_type* high) const
{
for (; low != high; ++low)
- *low = tolower_l(*low, __l);
+ *low = static_cast<char>(tolower_l(*low, __l));
return low;
}
@@ -1258,7 +1278,7 @@ int
codecvt<char, char, mbstate_t>::do_length(state_type&,
const extern_type* frm, const extern_type* end, size_t mx) const
{
- return static_cast<int>(min<size_t>(mx, end-frm));
+ return static_cast<int>(min<size_t>(mx, static_cast<size_t>(end-frm)));
}
int
@@ -1311,7 +1331,8 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- size_t n = wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+ size_t n = wcsnrtombs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
+ static_cast<size_t>(to_end-to), &st, __l);
#else
size_t n = __wcsnrtombs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif
@@ -1348,7 +1369,7 @@ codecvt<wchar_t, char, mbstate_t>::do_out(state_type& st,
#endif
if (n == size_t(-1)) // on error
return error;
- if (n > to_end-to_nxt) // is there room?
+ if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
return partial;
for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++;
@@ -1379,7 +1400,8 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
// save state in case needed to reover to_nxt on error
mbstate_t save_state = st;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- size_t n = mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
+ size_t n = mbsnrtowcs_l(to, &frm_nxt, static_cast<size_t>(fend-frm),
+ static_cast<size_t>(to_end-to), &st, __l);
#else
size_t n = __mbsnrtowcs_l(to, &frm_nxt, fend-frm, to_end-to, &st, __l);
#endif
@@ -1389,7 +1411,8 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
for (to_nxt = to; frm != frm_nxt; ++to_nxt)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- n = mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
+ n = mbrtowc_l(to_nxt, frm, static_cast<size_t>(fend-frm),
+ &save_state, __l);
#else
n = __mbrtowc_l(to_nxt, frm, fend-frm, &save_state, __l);
#endif
@@ -1398,10 +1421,10 @@ codecvt<wchar_t, char, mbstate_t>::do_in(state_type& st,
case 0:
++frm;
break;
- case -1:
+ case size_t(-1):
frm_nxt = frm;
return error;
- case -2:
+ case size_t(-2):
frm_nxt = frm;
return partial;
default:
@@ -1452,7 +1475,7 @@ codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type& st,
if (n == size_t(-1) || n == 0) // on error
return error;
--n;
- if (n > to_end-to_nxt) // is there room?
+ if (n > static_cast<size_t>(to_end-to_nxt)) // is there room?
return partial;
for (extern_type* p = tmp; n; --n) // write it
*to_nxt++ = *p++;
@@ -1494,7 +1517,7 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
for (size_t nwchar_t = 0; nwchar_t < mx && frm != frm_end; ++nwchar_t)
{
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- size_t n = mbrlen_l(frm, frm_end-frm, &st, __l);
+ size_t n = mbrlen_l(frm, static_cast<size_t>(frm_end-frm), &st, __l);
#else
size_t n = __mbrlen_l(frm, frm_end-frm, &st, __l);
#endif
@@ -1504,8 +1527,8 @@ codecvt<wchar_t, char, mbstate_t>::do_length(state_type& st,
++nbytes;
++frm;
break;
- case -1:
- case -2:
+ case size_t(-1):
+ case size_t(-2):
return nbytes;
default:
nbytes += n;
@@ -1977,9 +2000,6 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
break;
uint8_t c2 = frm_nxt[1];
uint8_t c3 = frm_nxt[2];
- uint16_t t = static_cast<uint16_t>(((c1 & 0x0F) << 12)
- | ((c2 & 0x3F) << 6)
- | (c3 & 0x3F));
switch (c1)
{
case 0xE0:
@@ -1997,7 +2017,7 @@ utf8_to_utf16_length(const uint8_t* frm, const uint8_t* frm_end,
}
if ((c3 & 0xC0) != 0x80)
break;
- if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break;
frm_nxt += 3;
}
@@ -2239,7 +2259,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{
if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
break;
- if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode)
+ if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
break;
frm_nxt += 2;
}
@@ -2266,7 +2286,7 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
}
if ((c3 & 0xC0) != 0x80)
break;
- if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break;
frm_nxt += 3;
}
@@ -2294,12 +2314,8 @@ utf8_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
}
if ((c3 & 0xC0) != 0x80 || (c4 & 0xC0) != 0x80)
break;
- uint32_t t = static_cast<uint32_t>(((c1 & 0x07) << 18)
- | ((c2 & 0x3F) << 12)
- | ((c3 & 0x3F) << 6)
- | (c4 & 0x3F));
- if ((((c1 & 0x07) << 18) | ((c2 & 0x3F) << 12) |
- ((c3 & 0x3F) << 6) | (c4 & 0x3F)) > Maxcode)
+ if ((((c1 & 0x07u) << 18) | ((c2 & 0x3Fu) << 12) |
+ ((c3 & 0x3Fu) << 6) | (c4 & 0x3Fu)) > Maxcode)
break;
frm_nxt += 4;
}
@@ -2468,7 +2484,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
{
if ((frm_end-frm_nxt < 2) || ((frm_nxt[1] & 0xC0) != 0x80))
break;
- if ((((c1 & 0x1F) << 6) | (frm_nxt[1] & 0x3F)) > Maxcode)
+ if ((((c1 & 0x1Fu) << 6) | (frm_nxt[1] & 0x3Fu)) > Maxcode)
break;
frm_nxt += 2;
}
@@ -2495,7 +2511,7 @@ utf8_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
}
if ((c3 & 0xC0) != 0x80)
break;
- if ((((c1 & 0x0F) << 12) | ((c2 & 0x3F) << 6) | (c3 & 0x3F)) > Maxcode)
+ if ((((c1 & 0x0Fu) << 12) | ((c2 & 0x3Fu) << 6) | (c3 & 0x3Fu)) > Maxcode)
break;
frm_nxt += 3;
}
@@ -2567,7 +2583,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
}
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{
- uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xFC00) == 0xDC00)
return codecvt_base::error;
if ((c1 & 0xFC00) != 0xD800)
@@ -2581,7 +2597,7 @@ utf16be_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
{
if (frm_end-frm_nxt < 4)
return codecvt_base::partial;
- uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3];
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
if ((c2 & 0xFC00) != 0xDC00)
return codecvt_base::error;
uint32_t t = static_cast<uint32_t>(
@@ -2612,7 +2628,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
}
for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
{
- uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xFC00) == 0xDC00)
break;
if ((c1 & 0xFC00) != 0xD800)
@@ -2625,7 +2641,7 @@ utf16be_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{
if (frm_end-frm_nxt < 4)
break;
- uint16_t c2 = frm_nxt[2] << 8 | frm_nxt[3];
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[2] << 8 | frm_nxt[3]);
if ((c2 & 0xFC00) != 0xDC00)
break;
uint32_t t = static_cast<uint32_t>(
@@ -2700,7 +2716,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
}
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{
- uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xFC00) == 0xDC00)
return codecvt_base::error;
if ((c1 & 0xFC00) != 0xD800)
@@ -2714,7 +2730,7 @@ utf16le_to_ucs4(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
{
if (frm_end-frm_nxt < 4)
return codecvt_base::partial;
- uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2];
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
if ((c2 & 0xFC00) != 0xDC00)
return codecvt_base::error;
uint32_t t = static_cast<uint32_t>(
@@ -2745,7 +2761,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
}
for (size_t nchar32_t = 0; frm_nxt < frm_end - 1 && nchar32_t < mx; ++nchar32_t)
{
- uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xFC00) == 0xDC00)
break;
if ((c1 & 0xFC00) != 0xD800)
@@ -2758,7 +2774,7 @@ utf16le_to_ucs4_length(const uint8_t* frm, const uint8_t* frm_end,
{
if (frm_end-frm_nxt < 4)
break;
- uint16_t c2 = frm_nxt[3] << 8 | frm_nxt[2];
+ uint16_t c2 = static_cast<uint16_t>(frm_nxt[3] << 8 | frm_nxt[2]);
if ((c2 & 0xFC00) != 0xDC00)
break;
uint32_t t = static_cast<uint32_t>(
@@ -2816,7 +2832,7 @@ utf16be_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
}
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{
- uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
return codecvt_base::error;
*to_nxt = c1;
@@ -2840,7 +2856,7 @@ utf16be_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
}
for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
{
- uint16_t c1 = frm_nxt[0] << 8 | frm_nxt[1];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[0] << 8 | frm_nxt[1]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
break;
frm_nxt += 2;
@@ -2891,7 +2907,7 @@ utf16le_to_ucs2(const uint8_t* frm, const uint8_t* frm_end, const uint8_t*& frm_
}
for (; frm_nxt < frm_end - 1 && to_nxt < to_end; ++to_nxt)
{
- uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
return codecvt_base::error;
*to_nxt = c1;
@@ -2915,7 +2931,7 @@ utf16le_to_ucs2_length(const uint8_t* frm, const uint8_t* frm_end,
}
for (size_t nchar16_t = 0; frm_nxt < frm_end - 1 && nchar16_t < mx; ++nchar16_t)
{
- uint16_t c1 = frm_nxt[1] << 8 | frm_nxt[0];
+ uint16_t c1 = static_cast<uint16_t>(frm_nxt[1] << 8 | frm_nxt[0]);
if ((c1 & 0xF800) == 0xD800 || c1 > Maxcode)
break;
frm_nxt += 2;
@@ -4068,7 +4084,7 @@ numpunct_byname<char>::__init(const char* nm)
{
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -4111,7 +4127,7 @@ numpunct_byname<wchar_t>::__init(const char* nm)
{
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -4159,7 +4175,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
{
if (0 < *__ig && *__ig < numeric_limits<char>::max())
{
- if (*__ig != *__r)
+ if (static_cast<unsigned>(*__ig) != *__r)
{
__err = ios_base::failbit;
return;
@@ -4170,7 +4186,7 @@ __check_grouping(const string& __grouping, unsigned* __g, unsigned* __g_end,
}
if (0 < *__ig && *__ig < numeric_limits<char>::max())
{
- if (*__ig < __g_end[-1] || __g_end[-1] == 0)
+ if (static_cast<unsigned>(*__ig) < __g_end[-1] || __g_end[-1] == 0)
__err = ios_base::failbit;
}
}
@@ -4543,11 +4559,13 @@ __time_get::~__time_get()
freelocale(__loc_);
}
+#pragma clang diagnostic ignored "-Wmissing-field-initializers"
+
template <>
string
__time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
{
- tm t;
+ tm t = {0};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -4576,7 +4594,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
}
char* w = bb;
ios_base::iostate err = ios_base::goodbit;
- int i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14,
+ ptrdiff_t i = __scan_keyword(w, be, this->__weeks_, this->__weeks_+14,
ct, err, false)
- this->__weeks_;
if (i < 14)
@@ -4687,11 +4705,13 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
return result;
}
+#pragma clang diagnostic ignored "-Wmissing-braces"
+
template <>
wstring
__time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
{
- tm t;
+ tm t = {0};
t.tm_sec = 59;
t.tm_min = 55;
t.tm_hour = 23;
@@ -4705,19 +4725,19 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
char f[3] = {0};
f[0] = '%';
f[1] = fmt;
- size_t be = strftime_l(buf, 100, f, &t, __loc_);
+ strftime_l(buf, 100, f, &t, __loc_);
wchar_t wbuf[100];
wchar_t* wbb = wbuf;
mbstate_t mb = {0};
const char* bb = buf;
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
- size_t i = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+ size_t j = mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#else
- size_t i = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
+ size_t j = __mbsrtowcs_l( wbb, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (i == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
- wchar_t* wbe = wbb + i;
+ wchar_t* wbe = wbb + j;
wstring result;
while (wbb != wbe)
{
@@ -4730,7 +4750,7 @@ __time_get_storage<wchar_t>::__analyze(char fmt, const ctype<wchar_t>& ct)
}
wchar_t* w = wbb;
ios_base::iostate err = ios_base::goodbit;
- int i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14,
+ ptrdiff_t i = __scan_keyword(w, wbe, this->__weeks_, this->__weeks_+14,
ct, err, false)
- this->__weeks_;
if (i < 14)
@@ -4900,7 +4920,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__weeks_[i].assign(wbuf, wbe);
@@ -4912,7 +4932,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__weeks_[i+7].assign(wbuf, wbe);
@@ -4929,7 +4949,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__months_[i].assign(wbuf, wbe);
@@ -4941,7 +4961,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__months_[i+12].assign(wbuf, wbe);
@@ -4956,7 +4976,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__am_pm_[0].assign(wbuf, wbe);
@@ -4969,7 +4989,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__am_pm_[1].assign(wbuf, wbe);
@@ -5230,7 +5250,7 @@ __time_put::__do_put(char* __nb, char*& __ne, const tm* __tm,
char fmt[] = {'%', __fmt, __mod, 0};
if (__mod != 0)
swap(fmt[1], fmt[2]);
- size_t n = strftime_l(__nb, __ne-__nb, fmt, __tm, __loc_);
+ size_t n = strftime_l(__nb, static_cast<size_t>(__ne-__nb), fmt, __tm, __loc_);
__ne = __nb + n;
}
@@ -5248,123 +5268,207 @@ __time_put::__do_put(wchar_t* __wb, wchar_t*& __we, const tm* __tm,
#else
size_t j = __mbsrtowcs_l(__wb, &__nb, 100, &mb, __loc_);
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
__we = __wb + j;
}
// moneypunct_byname
+template <class charT>
static
void
-__init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char sign_posn)
+__init_pat(money_base::pattern& pat, basic_string<charT>& __curr_symbol_,
+ bool intl, char cs_precedes, char sep_by_space, char sign_posn,
+ charT space_char)
{
const char sign = static_cast<char>(money_base::sign);
const char space = static_cast<char>(money_base::space);
const char none = static_cast<char>(money_base::none);
const char symbol = static_cast<char>(money_base::symbol);
const char value = static_cast<char>(money_base::value);
+ const bool symbol_contains_sep = intl && __curr_symbol_.size() == 4;
+
+ // Comments on case branches reflect 'C11 7.11.2.1 The localeconv
+ // function'. "Space between sign and symbol or value" means that
+ // if the sign is adjacent to the symbol, there's a space between
+ // them, and otherwise there's a space between the sign and value.
+ //
+ // C11's localeconv specifies that the fourth character of an
+ // international curr_symbol is used to separate the sign and
+ // value when sep_by_space says to do so. C++ can't represent
+ // that, so we just use a space. When sep_by_space says to
+ // separate the symbol and value-or-sign with a space, we rearrange the
+ // curr_symbol to put its spacing character on the correct side of
+ // the symbol.
+ //
+ // We also need to avoid adding an extra space between the sign
+ // and value when the currency symbol is suppressed (by not
+ // setting showbase). We match glibc's strfmon by interpreting
+ // sep_by_space==1 as "omit the space when the currency symbol is
+ // absent".
+ //
+ // Users who want to get this right should use ICU instead.
+
switch (cs_precedes)
{
- case 0:
+ case 0: // value before curr_symbol
+ if (symbol_contains_sep) {
+ // Move the separator to before the symbol, to place it
+ // between the value and symbol.
+ rotate(__curr_symbol_.begin(), __curr_symbol_.begin() + 3,
+ __curr_symbol_.end());
+ }
switch (sign_posn)
{
- case 0:
+ case 0: // Parentheses surround the quantity and currency symbol.
pat.field[0] = sign;
pat.field[1] = value;
+ pat.field[2] = none; // Any space appears in the symbol.
pat.field[3] = symbol;
switch (sep_by_space)
{
- case 0:
- pat.field[2] = none;
+ case 0: // No space separates the currency symbol and value.
+ // This case may have changed between C99 and C11;
+ // assume the currency symbol matches the intention.
+ case 2: // Space between sign and currency or value.
+ // The "sign" is two parentheses, so no space here either.
return;
- case 1:
- case 2:
- pat.field[2] = space;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
return;
default:
break;
}
break;
- case 1:
+ case 1: // The sign string precedes the quantity and currency symbol.
pat.field[0] = sign;
pat.field[3] = symbol;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = value;
pat.field[2] = none;
return;
- case 1:
+ case 1: // Space between currency-and-sign or currency and value.
pat.field[1] = value;
- pat.field[2] = space;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = space;
pat.field[2] = value;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
return;
default:
break;
}
break;
- case 2:
+ case 2: // The sign string succeeds the quantity and currency symbol.
pat.field[0] = value;
pat.field[3] = sign;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = none;
pat.field[2] = symbol;
return;
- case 1:
- pat.field[1] = space;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
+ pat.field[1] = none;
pat.field[2] = symbol;
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = symbol;
pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not be removed if showbase is absent.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
return;
default:
break;
}
break;
- case 3:
+ case 3: // The sign string immediately precedes the currency symbol.
pat.field[0] = value;
pat.field[3] = symbol;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = none;
pat.field[2] = sign;
return;
- case 1:
+ case 1: // Space between currency-and-sign or currency and value.
pat.field[1] = space;
pat.field[2] = sign;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared before the sign.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = sign;
- pat.field[2] = space;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
return;
default:
break;
}
break;
- case 4:
+ case 4: // The sign string immediately succeeds the currency symbol.
pat.field[0] = value;
pat.field[3] = sign;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = none;
pat.field[2] = symbol;
return;
- case 1:
- pat.field[1] = space;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = none;
pat.field[2] = symbol;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = symbol;
pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not disappear when showbase is absent.
+ __curr_symbol_.erase(__curr_symbol_.begin());
+ }
return;
default:
break;
@@ -5374,105 +5478,157 @@ __init_pat(money_base::pattern& pat, char cs_precedes, char sep_by_space, char s
break;
}
break;
- case 1:
+ case 1: // curr_symbol before value
switch (sign_posn)
{
- case 0:
+ case 0: // Parentheses surround the quantity and currency symbol.
pat.field[0] = sign;
pat.field[1] = symbol;
+ pat.field[2] = none; // Any space appears in the symbol.
pat.field[3] = value;
switch (sep_by_space)
{
- case 0:
- pat.field[2] = none;
+ case 0: // No space separates the currency symbol and value.
+ // This case may have changed between C99 and C11;
+ // assume the currency symbol matches the intention.
+ case 2: // Space between sign and currency or value.
+ // The "sign" is two parentheses, so no space here either.
return;
- case 1:
- case 2:
- pat.field[2] = space;
+ case 1: // Space between currency-and-sign or currency and value.
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.insert(0, 1, space_char);
+ }
return;
default:
break;
}
break;
- case 1:
+ case 1: // The sign string precedes the quantity and currency symbol.
pat.field[0] = sign;
pat.field[3] = value;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = symbol;
pat.field[2] = none;
return;
- case 1:
+ case 1: // Space between currency-and-sign or currency and value.
pat.field[1] = symbol;
- pat.field[2] = space;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = space;
pat.field[2] = symbol;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.pop_back();
+ }
return;
default:
break;
}
break;
- case 2:
+ case 2: // The sign string succeeds the quantity and currency symbol.
pat.field[0] = symbol;
pat.field[3] = sign;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = none;
pat.field[2] = value;
return;
- case 1:
- pat.field[1] = space;
+ case 1: // Space between currency-and-sign or currency and value.
+ pat.field[1] = none;
pat.field[2] = value;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = value;
pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // will appear before the sign.
+ __curr_symbol_.pop_back();
+ }
return;
default:
break;
}
break;
- case 3:
+ case 3: // The sign string immediately precedes the currency symbol.
pat.field[0] = sign;
pat.field[3] = value;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = symbol;
pat.field[2] = none;
return;
- case 1:
+ case 1: // Space between currency-and-sign or currency and value.
pat.field[1] = symbol;
- pat.field[2] = space;
+ pat.field[2] = none;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[2]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
return;
- case 2:
+ case 2: // Space between sign and currency or value.
pat.field[1] = space;
pat.field[2] = symbol;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // has already appeared after the sign.
+ __curr_symbol_.pop_back();
+ }
return;
default:
break;
}
break;
- case 4:
+ case 4: // The sign string immediately succeeds the currency symbol.
pat.field[0] = symbol;
pat.field[3] = value;
switch (sep_by_space)
{
- case 0:
+ case 0: // No space separates the currency symbol and value.
pat.field[1] = sign;
pat.field[2] = none;
return;
- case 1:
+ case 1: // Space between currency-and-sign or currency and value.
pat.field[1] = sign;
pat.field[2] = space;
+ if (symbol_contains_sep) {
+ // Remove the separator from the symbol, since it
+ // should not disappear when showbase is absent.
+ __curr_symbol_.pop_back();
+ }
return;
- case 2:
- pat.field[1] = space;
+ case 2: // Space between sign and currency or value.
+ pat.field[1] = none;
pat.field[2] = sign;
+ if (!symbol_contains_sep) {
+ // We insert the space into the symbol instead of
+ // setting pat.field[1]=space so that when
+ // showbase is not set, the space goes away too.
+ __curr_symbol_.push_back(space_char);
+ }
return;
default:
break;
@@ -5498,7 +5654,7 @@ moneypunct_byname<char, false>::init(const char* nm)
typedef moneypunct<char, false> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -5529,8 +5685,14 @@ moneypunct_byname<char, false>::init(const char* nm)
__negative_sign_ = "()";
else
__negative_sign_ = lc->negative_sign;
- __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
- __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
+ __init_pat(__pos_format_, __dummy_curr_symbol, false,
+ lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
+ __init_pat(__neg_format_, __curr_symbol_, false,
+ lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
}
template<>
@@ -5540,7 +5702,7 @@ moneypunct_byname<char, true>::init(const char* nm)
typedef moneypunct<char, true> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -5579,12 +5741,22 @@ moneypunct_byname<char, true>::init(const char* nm)
__negative_sign_ = "()";
else
__negative_sign_ = lc->negative_sign;
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
#if _WIN32
- __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
- __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+ __init_pat(__pos_format_, __dummy_curr_symbol, true,
+ lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
+ __init_pat(__neg_format_, __curr_symbol_, true,
+ lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
#else
- __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
- __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
+ __init_pat(__pos_format_, __dummy_curr_symbol, true,
+ lc->int_p_cs_precedes, lc->int_p_sep_by_space,
+ lc->int_p_sign_posn, ' ');
+ __init_pat(__neg_format_, __curr_symbol_, true,
+ lc->int_n_cs_precedes, lc->int_n_sep_by_space,
+ lc->int_n_sign_posn, ' ');
#endif // _WIN32
}
@@ -5595,7 +5767,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
typedef moneypunct<wchar_t, false> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -5621,7 +5793,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
__curr_symbol_.assign(wbuf, wbe);
@@ -5640,7 +5812,7 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
@@ -5656,13 +5828,19 @@ moneypunct_byname<wchar_t, false>::init(const char* nm)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__negative_sign_.assign(wbuf, wbe);
}
- __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
- __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
+ __init_pat(__pos_format_, __dummy_curr_symbol, false,
+ lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
+ __init_pat(__neg_format_, __curr_symbol_, false,
+ lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
}
template<>
@@ -5672,7 +5850,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
typedef moneypunct<wchar_t, true> base;
__locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
#ifndef _LIBCPP_NO_EXCEPTIONS
- if (loc == 0)
+ if (loc == nullptr)
throw runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -5698,7 +5876,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else
size_t j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wchar_t* wbe = wbuf + j;
__curr_symbol_.assign(wbuf, wbe);
@@ -5721,7 +5899,7 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
@@ -5741,17 +5919,27 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
#else
j = __mbsrtowcs_l(wbuf, &bb, sizeof(wbuf)/sizeof(wbuf[0]), &mb, loc.get());
#endif
- if (j == -1)
+ if (j == size_t(-1))
__throw_runtime_error("locale not supported");
wbe = wbuf + j;
__negative_sign_.assign(wbuf, wbe);
}
+ // Assume the positive and negative formats will want spaces in
+ // the same places in curr_symbol since there's no way to
+ // represent anything else.
+ string_type __dummy_curr_symbol = __curr_symbol_;
#if _WIN32
- __init_pat(__pos_format_, lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn);
- __init_pat(__neg_format_, lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn);
+ __init_pat(__pos_format_, __dummy_curr_symbol, true,
+ lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
+ __init_pat(__neg_format_, __curr_symbol_, true,
+ lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
#else // _WIN32
- __init_pat(__pos_format_, lc->int_p_cs_precedes, lc->int_p_sep_by_space, lc->int_p_sign_posn);
- __init_pat(__neg_format_, lc->int_n_cs_precedes, lc->int_n_sep_by_space, lc->int_n_sign_posn);
+ __init_pat(__pos_format_, __dummy_curr_symbol, true,
+ lc->int_p_cs_precedes, lc->int_p_sep_by_space,
+ lc->int_p_sign_posn, L' ');
+ __init_pat(__neg_format_, __curr_symbol_, true,
+ lc->int_n_cs_precedes, lc->int_n_sep_by_space,
+ lc->int_n_sign_posn, L' ');
#endif // _WIN32
}
@@ -5770,14 +5958,14 @@ template class collate<wchar_t>;
template class num_get<char>;
template class num_get<wchar_t>;
-template class __num_get<char>;
-template class __num_get<wchar_t>;
+template struct __num_get<char>;
+template struct __num_get<wchar_t>;
template class num_put<char>;
template class num_put<wchar_t>;
-template class __num_put<char>;
-template class __num_put<wchar_t>;
+template struct __num_put<char>;
+template struct __num_put<wchar_t>;
template class time_get<char>;
template class time_get<wchar_t>;
diff --git a/src/memory.cpp b/src/memory.cpp
index cb5e5e7b06ad..a892e75c86d0 100644
--- a/src/memory.cpp
+++ b/src/memory.cpp
@@ -100,10 +100,7 @@ __shared_weak_count::lock() _NOEXCEPT
if (__sync_bool_compare_and_swap(&__shared_owners_,
object_owners,
object_owners+1))
- {
- __add_weak();
return this;
- }
object_owners = __shared_owners_;
}
return 0;
@@ -154,7 +151,7 @@ align(size_t alignment, size_t size, void*& ptr, size_t& space)
{
char* p1 = static_cast<char*>(ptr);
char* p2 = (char*)((size_t)(p1 + (alignment - 1)) & -alignment);
- ptrdiff_t d = p2 - p1;
+ size_t d = static_cast<size_t>(p2 - p1);
if (d <= space - size)
{
r = p2;
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 16817198b37c..9aa051be37f2 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -20,8 +20,7 @@ const adopt_lock_t adopt_lock = {};
mutex::~mutex()
{
- int e = pthread_mutex_destroy(&__m_);
-// assert(e == 0);
+ pthread_mutex_destroy(&__m_);
}
void
diff --git a/src/new.cpp b/src/new.cpp
index 1e8ed88dc4c1..1c171a871b9b 100644
--- a/src/new.cpp
+++ b/src/new.cpp
@@ -13,14 +13,19 @@
#if __APPLE__
#include <cxxabi.h>
- // On Darwin, there are two STL shared libraries and a lower level ABI
- // shared libray. The global holding the current new handler is
- // in the ABI library and named __cxa_new_handler.
- #define __new_handler __cxxabiapple::__cxa_new_handler
+
+ #ifndef _LIBCPPABI_VERSION
+ // On Darwin, there are two STL shared libraries and a lower level ABI
+ // shared libray. The global holding the current new handler is
+ // in the ABI library and named __cxa_new_handler.
+ #define __new_handler __cxxabiapple::__cxa_new_handler
+ #endif
#else // __APPLE__
static std::new_handler __new_handler;
#endif
+#if !defined (LIBCXXRT) // && !defined(_LIBCPPABI_VERSION)
+
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// that define non-weak copies of the functions.
@@ -83,7 +88,7 @@ operator new[](size_t size)
__attribute__((__weak__, __visibility__("default")))
void*
-operator new[](size_t size, const std::nothrow_t& nothrow) _NOEXCEPT
+operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
{
void* p = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -129,11 +134,15 @@ operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
::operator delete[](ptr);
}
+#endif // !_LIBCPPABI_VERSION && !LIBCXXRT
+
namespace std
{
const nothrow_t nothrow = {};
+#ifndef _LIBCPPABI_VERSION
+
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
@@ -146,6 +155,8 @@ get_new_handler() _NOEXCEPT
return __sync_fetch_and_add(&__new_handler, (new_handler)0);
}
+#ifndef LIBCXXRT
+
bad_alloc::bad_alloc() _NOEXCEPT
{
}
@@ -174,6 +185,9 @@ bad_array_new_length::what() const _NOEXCEPT
return "bad_array_new_length";
}
+#endif
+#endif //LIBCXXRT
+
void
__throw_bad_alloc()
{
diff --git a/src/random.cpp b/src/random.cpp
index eca97bc81943..6140b74ecb5f 100644
--- a/src/random.cpp
+++ b/src/random.cpp
@@ -10,6 +10,9 @@
#include "random"
#include "system_error"
+#ifdef __sun__
+#define rename solaris_headers_are_broken
+#endif
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
diff --git a/src/regex.cpp b/src/regex.cpp
index 65e9f886dfb8..e3ec2810c774 100644
--- a/src/regex.cpp
+++ b/src/regex.cpp
@@ -69,12 +69,17 @@ regex_error::~regex_error() throw() {}
namespace {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+
struct collationnames
{
const char* elem_;
char char_;
};
+#pragma clang diagnostic pop
+
const collationnames collatenames[] =
{
{"A", 0x41},
@@ -190,12 +195,17 @@ const collationnames collatenames[] =
{"zero", 0x30}
};
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wpadded"
+
struct classnames
{
const char* elem_;
ctype_base::mask mask_;
};
+#pragma clang diagnostic pop
+
const classnames ClassNames[] =
{
{"alnum", ctype_base::alnum},
diff --git a/src/stdexcept.cpp b/src/stdexcept.cpp
index 28917887587e..b516b0ca68b3 100644
--- a/src/stdexcept.cpp
+++ b/src/stdexcept.cpp
@@ -15,6 +15,7 @@
#include <cstdint>
#include <cstddef>
#include "system_error"
+#include <cxxabi.h>
// Note: optimize for size
@@ -113,6 +114,8 @@ logic_error::operator=(const logic_error& le) _NOEXCEPT
return *this;
}
+#ifndef _LIBCPPABI_VERSION
+
logic_error::~logic_error() _NOEXCEPT
{
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
@@ -126,6 +129,8 @@ logic_error::what() const _NOEXCEPT
return s.c_str();
}
+#endif
+
runtime_error::runtime_error(const string& msg)
{
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
@@ -153,6 +158,8 @@ runtime_error::operator=(const runtime_error& le) _NOEXCEPT
return *this;
}
+#ifndef _LIBCPPABI_VERSION
+
runtime_error::~runtime_error() _NOEXCEPT
{
__libcpp_nmstr& s = (__libcpp_nmstr&)__imp_;
@@ -175,4 +182,6 @@ range_error::~range_error() _NOEXCEPT {}
overflow_error::~overflow_error() _NOEXCEPT {}
underflow_error::~underflow_error() _NOEXCEPT {}
+#endif
+
} // std
diff --git a/src/string.cpp b/src/string.cpp
index 1f58e3657a89..750ba284e366 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -346,7 +346,7 @@ string to_string(int val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%d", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%d", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -363,7 +363,7 @@ string to_string(unsigned val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%u", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%u", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -380,7 +380,7 @@ string to_string(long val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%ld", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%ld", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -397,7 +397,7 @@ string to_string(unsigned long val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%lu", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%lu", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -414,7 +414,7 @@ string to_string(long long val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%lld", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%lld", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -431,7 +431,7 @@ string to_string(unsigned long long val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%llu", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%llu", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -448,7 +448,7 @@ string to_string(float val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%f", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%f", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -465,7 +465,7 @@ string to_string(double val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%f", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%f", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -482,7 +482,7 @@ string to_string(long double val)
s.resize(s.capacity());
while (true)
{
- int n2 = snprintf(&s[0], s.size()+1, "%Lf", val);
+ size_t n2 = static_cast<size_t>(snprintf(&s[0], s.size()+1, "%Lf", val));
if (n2 <= s.size())
{
s.resize(n2);
@@ -505,7 +505,7 @@ wstring to_wstring(int val)
int n2 = swprintf(&s[0], s.size()+1, L"%d", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -526,7 +526,7 @@ wstring to_wstring(unsigned val)
int n2 = swprintf(&s[0], s.size()+1, L"%u", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -547,7 +547,7 @@ wstring to_wstring(long val)
int n2 = swprintf(&s[0], s.size()+1, L"%ld", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -568,7 +568,7 @@ wstring to_wstring(unsigned long val)
int n2 = swprintf(&s[0], s.size()+1, L"%lu", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -589,7 +589,7 @@ wstring to_wstring(long long val)
int n2 = swprintf(&s[0], s.size()+1, L"%lld", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -610,7 +610,7 @@ wstring to_wstring(unsigned long long val)
int n2 = swprintf(&s[0], s.size()+1, L"%llu", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -629,7 +629,7 @@ wstring to_wstring(float val)
int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -648,7 +648,7 @@ wstring to_wstring(double val)
int n2 = swprintf(&s[0], s.size()+1, L"%f", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
@@ -667,7 +667,7 @@ wstring to_wstring(long double val)
int n2 = swprintf(&s[0], s.size()+1, L"%Lf", val);
if (n2 > 0)
{
- s.resize(n2);
+ s.resize(static_cast<size_t>(n2));
break;
}
s.resize(2*s.size());
diff --git a/src/strstream.cpp b/src/strstream.cpp
index 53139509edfa..8cd19e6a353c 100644
--- a/src/strstream.cpp
+++ b/src/strstream.cpp
@@ -34,7 +34,7 @@ void
strstreambuf::__init(char* __gnext, streamsize __n, char* __pbeg)
{
if (__n == 0)
- __n = strlen(__gnext);
+ __n = static_cast<streamsize>(strlen(__gnext));
else if (__n < 0)
__n = INT_MAX;
if (__pbeg == nullptr)
@@ -160,12 +160,12 @@ strstreambuf::overflow(int_type __c)
streamsize new_size = max<streamsize>(__alsize_, 2*old_size);
char* buf = nullptr;
if (__palloc_)
- buf = static_cast<char*>(__palloc_(new_size));
+ buf = static_cast<char*>(__palloc_(static_cast<size_t>(new_size)));
else
buf = new char[new_size];
if (buf == nullptr)
return int_type(EOF);
- memcpy(buf, eback(), old_size);
+ memcpy(buf, eback(), static_cast<size_t>(old_size));
ptrdiff_t ninp = gptr() - eback();
ptrdiff_t einp = egptr() - eback();
ptrdiff_t nout = pptr() - pbase();
@@ -179,7 +179,7 @@ strstreambuf::overflow(int_type __c)
}
setg(buf, buf + ninp, buf + einp);
setp(buf + einp, buf + einp + eout);
- pbump(nout);
+ pbump(static_cast<int>(nout));
__strmode_ |= __allocated;
}
*pptr() = static_cast<char>(__c);
diff --git a/src/thread.cpp b/src/thread.cpp
index b07f8f851072..f27136a53d05 100644
--- a/src/thread.cpp
+++ b/src/thread.cpp
@@ -12,7 +12,7 @@
#include "vector"
#include "future"
#include <sys/types.h>
-#if !_WIN32
+#if !_WIN32 && !__sun__
#include <sys/sysctl.h>
#endif // _WIN32
@@ -55,7 +55,7 @@ unsigned
thread::hardware_concurrency()
{
#if defined(CTL_HW) && defined(HW_NCPU)
- int n;
+ unsigned n;
int mib[2] = {CTL_HW, HW_NCPU};
std::size_t s = sizeof(n);
sysctl(mib, 2, &n, &s, 0, 0);
diff --git a/src/typeinfo.cpp b/src/typeinfo.cpp
index 9ca03a183e9c..cfc64ef57a61 100644
--- a/src/typeinfo.cpp
+++ b/src/typeinfo.cpp
@@ -13,6 +13,8 @@
#include "typeinfo"
+#if !(defined(_LIBCPPABI_VERSION) || defined(LIBCXXRT))
+
std::bad_cast::bad_cast() _NOEXCEPT
{
}
@@ -48,3 +50,4 @@ std::bad_typeid::what() const _NOEXCEPT
void __cxxabiv1::__cxa_bad_cast() { throw std::bad_cast(); }
#endif
+#endif // _LIBCPPABI_VERSION