1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-05 09:14:03 +00:00

Import new versions of libcxxrt and libc++.

Please tests any C++ code you care about with -stdlib=libc++!

Approved by:	dim (mentor)
This commit is contained in:
David Chisnall 2012-03-14 00:09:36 +00:00
commit 94e3ee44c3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=232950
89 changed files with 5833 additions and 3735 deletions

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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>

View File

@ -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>

View File

@ -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_;}

View File

@ -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_));

View File

@ -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_;

View File

@ -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

View File

@ -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>

View File

@ -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 {};

View File

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

View File

@ -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)
{

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;}

View File

@ -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;}

View File

@ -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);}

View File

@ -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);}

View File

@ -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());

View File

@ -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)
{
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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();}

View File

@ -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();

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -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)...);

File diff suppressed because it is too large Load Diff

View File

@ -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>);
}
}

View File

@ -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();
}

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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);
}

View File

@ -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

View File

@ -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();
}

View File

@ -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>

View File

@ -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

View File

@ -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

View File

@ -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>

File diff suppressed because it is too large Load Diff

View File

@ -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 _Tp& __x, const typename _Tp::first_type& __y) const
bool operator()(const _Pp& __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 _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 _Cp& __x, const _Key& __y) const
{return static_cast<const _Pred&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY
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;

View File

@ -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)

View File

@ -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)

View File

@ -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
{}

View File

@ -61,7 +61,7 @@ static
steady_clock::rep
steady_simplified()
{
return mach_absolute_time();
return static_cast<steady_clock::rep>(mach_absolute_time());
}
static

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();
}

View File

@ -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)
{

File diff suppressed because it is too large Load Diff

View File

@ -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;

View File

@ -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

View File

@ -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()
{

View File

@ -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>

View File

@ -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},

View File

@ -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

View File

@ -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());

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* aux.cc - Compiler helper functions.
*

View File

@ -1,3 +1,25 @@
/*
* Copyright 2012 David Chisnall. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __CXXABI_H_
#define __CXXABI_H_
#include <stdint.h>

View File

@ -1,3 +1,28 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* dwarf_eh.h - Defines some helper functions for parsing DWARF exception
* handling tables.

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "typeinfo.h"
#include <stdio.h>

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
#include <dlfcn.h>
#include <stdio.h>
@ -12,12 +38,6 @@
#pragma weak pthread_setspecific
#pragma weak pthread_getspecific
#pragma weak pthread_once
#pragma weak pthread_once
#pragma weak pthread_cond_signal
#pragma weak pthread_cond_wait
#pragma weak pthread_mutex_lock
#pragma weak pthread_mutex_unlock
using namespace ABI_NAMESPACE;
@ -403,10 +423,7 @@ static char *emergency_malloc(size_t size)
// Only 4 emergency buffers allowed per thread!
if (info->emergencyBuffersHeld > 3) { return 0; }
if (pthread_mutex_lock)
{
pthread_mutex_lock(&emergency_malloc_lock);
}
pthread_mutex_lock(&emergency_malloc_lock);
int buffer = -1;
while (buffer < 0)
{
@ -417,10 +434,7 @@ static char *emergency_malloc(size_t size)
void *m = calloc(1, size);
if (0 != m)
{
if (pthread_mutex_unlock)
{
pthread_mutex_unlock(&emergency_malloc_lock);
}
pthread_mutex_unlock(&emergency_malloc_lock);
return (char*)m;
}
for (int i=0 ; i<16 ; i++)
@ -437,24 +451,10 @@ static char *emergency_malloc(size_t size)
// of the emergency buffers.
if (buffer < 0)
{
// If we don't have pthread_cond_wait, then there is only one
// thread and it's already used all of the emergency buffers, so we
// have no alternative but to die. Calling abort() instead of
// terminate, because terminate can throw exceptions, which can
// bring us back here and infinite loop.
if (!pthread_cond_wait)
{
fputs("Terminating while out of memory trying to throw an exception",
stderr);
abort();
}
pthread_cond_wait(&emergency_malloc_wait, &emergency_malloc_lock);
}
}
if (pthread_mutex_unlock)
{
pthread_mutex_unlock(&emergency_malloc_lock);
}
pthread_mutex_unlock(&emergency_malloc_lock);
info->emergencyBuffersHeld++;
return emergency_buffer + (1024 * buffer);
}
@ -487,19 +487,13 @@ static void emergency_malloc_free(char *ptr)
memset((void*)ptr, 0, 1024);
// Signal the condition variable to wake up any threads that are blocking
// waiting for some space in the emergency buffer
if (pthread_mutex_lock)
{
pthread_mutex_lock(&emergency_malloc_lock);
}
pthread_mutex_lock(&emergency_malloc_lock);
// In theory, we don't need to do this with the lock held. In practice,
// our array of bools will probably be updated using 32-bit or 64-bit
// memory operations, so this update may clobber adjacent values.
buffer_allocated[buffer] = false;
if (pthread_cond_signal && pthread_mutex_unlock)
{
pthread_cond_signal(&emergency_malloc_wait);
pthread_mutex_unlock(&emergency_malloc_lock);
}
pthread_cond_signal(&emergency_malloc_wait);
pthread_mutex_unlock(&emergency_malloc_lock);
}
static char *alloc_or_die(size_t size)

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2012 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* guard.cc: Functions for thread-safe static initialisation.
*
@ -103,6 +129,10 @@ extern "C" int __cxa_guard_acquire(volatile int64_t *guard_object)
// the lock at the same time.
while (!__sync_bool_compare_and_swap_4(lock, 0, 1))
{
if (1 == ((*guard_object) >> 56))
{
break;
}
sched_yield();
}
// We have to test the guard again, in case another thread has performed

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* memory.cc - Contains stub definition of C++ new/delete operators.
*
@ -11,6 +37,10 @@
#include <stdlib.h>
#include "stdexcept.h"
#ifndef __has_builtin
#define __has_builtin(x) 0
#endif
#if !__has_builtin(__sync_swap)
#define __sync_swap __sync_lock_test_and_set
#endif

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* stdexcept.cc - provides stub implementations of the exceptions required by the runtime.
*/

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* stdexcept.h - provides a stub version of <stdexcept>, which defines enough
* of the exceptions for the runtime to use.

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stdlib.h>
namespace std

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2012 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "typeinfo.h"
#include <string.h>
#include <stdlib.h>
@ -65,18 +91,30 @@ extern "C" char* __cxa_demangle(const char* mangled_name,
{
memcpy(buf, demangled, len);
buf[len] = 0;
*n = len;
*status = 0;
if (n)
{
*n = len;
}
if (status)
{
*status = 0;
}
}
else
{
*status = -1;
if (status)
{
*status = -1;
}
}
free(demangled);
}
else
{
*status = -2;
if (status)
{
*status = -2;
}
return NULL;
}
return buf;

View File

@ -1,3 +1,29 @@
/*
* Copyright 2010-2011 PathScale, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
* IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <stddef.h>
#include "abi_namespace.h"
#include "typeinfo"

View File

@ -1,3 +1,25 @@
/*
* Copyright 2012 David Chisnall. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/**
* ARM-specific unwind definitions. These are taken from the ARM EHABI
* specification.

View File

@ -1,3 +1,25 @@
/*
* Copyright 2012 David Chisnall. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef UNWIND_H_INCLUDED
#define UNWIND_H_INCLUDED

View File

@ -58,6 +58,7 @@ STD_HEADERS= __bit_reference\
__tree\
__tuple\
__tuple_03\
__undef_min_max\
algorithm\
array\
atomic\