aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2012-10-22 18:04:00 +0000
committerDimitry Andric <dim@FreeBSD.org>2012-10-22 18:04:00 +0000
commitea907107107132d0201e0ba377408f4e117b581c (patch)
tree955d27b98fe24102c3e5101aa117112b0d21ae33 /include
parent43cd7615798ea22556f20bbd64cff1e0c691e1d0 (diff)
downloadsrc-ea907107107132d0201e0ba377408f4e117b581c.tar.gz
src-ea907107107132d0201e0ba377408f4e117b581c.zip
Vendor import of libc++ trunk r165949:vendor/libc++/r165949
Notes
Notes: svn path=/vendor/libc++/dist/; revision=241900 svn path=/vendor/libc++/r165949/; revision=241901; tag=vendor/libc++/r165949
Diffstat (limited to 'include')
-rw-r--r--include/__bit_reference100
-rw-r--r--include/__config40
-rw-r--r--include/__hash_table109
-rw-r--r--include/__locale19
-rw-r--r--include/__mutex_base91
-rw-r--r--include/__tree4
-rw-r--r--include/__tuple9
-rw-r--r--include/__undef_min_max4
-rw-r--r--include/algorithm113
-rw-r--r--include/array8
-rw-r--r--include/atomic2
-rw-r--r--include/bitset62
-rw-r--r--include/chrono131
-rw-r--r--include/cmath390
-rw-r--r--include/complex48
-rw-r--r--include/condition_variable16
-rw-r--r--include/cstddef22
-rw-r--r--include/cstdio12
-rw-r--r--include/cstdlib14
-rw-r--r--include/deque6
-rw-r--r--include/exception16
-rw-r--r--include/forward_list8
-rw-r--r--include/fstream69
-rw-r--r--include/functional11
-rw-r--r--include/future268
-rw-r--r--include/ios80
-rw-r--r--include/iosfwd2
-rw-r--r--include/istream5
-rw-r--r--include/iterator93
-rw-r--r--include/list4
-rw-r--r--include/locale52
-rw-r--r--include/map229
-rw-r--r--include/memory195
-rw-r--r--include/mutex52
-rw-r--r--include/new4
-rw-r--r--include/ostream2
-rw-r--r--include/queue4
-rw-r--r--include/random25
-rw-r--r--include/regex62
-rw-r--r--include/stack4
-rw-r--r--include/streambuf2
-rw-r--r--include/string87
-rw-r--r--include/support/win32/limits_win32.h79
-rw-r--r--include/support/win32/locale_win32.h116
-rw-r--r--include/support/win32/math_win32.h113
-rw-r--r--include/support/win32/support.h115
-rw-r--r--include/system_error8
-rw-r--r--include/thread98
-rw-r--r--include/tuple94
-rw-r--r--include/type_traits155
-rw-r--r--include/unordered_map269
-rw-r--r--include/utility14
-rw-r--r--include/valarray38
-rw-r--r--include/vector8
54 files changed, 1837 insertions, 1744 deletions
diff --git a/include/__bit_reference b/include/__bit_reference
index 906b9da462e6..8180295bde31 100644
--- a/include/__bit_reference
+++ b/include/__bit_reference
@@ -22,7 +22,7 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Cp, bool _IsConst> class __bit_iterator;
+template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
template <class _Cp> class __bit_const_reference;
template <class _Tp>
@@ -131,13 +131,14 @@ public:
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {}
- _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __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
+ _LIBCPP_CONSTEXPR
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {}
@@ -146,11 +147,11 @@ private:
// find
-template <class _Cp>
-__bit_iterator<_Cp, false>
-__find_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_Cp, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -180,11 +181,11 @@ __find_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _Cp>
-__bit_iterator<_Cp, false>
-__find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+template <class _Cp, bool _IsConst>
+__bit_iterator<_Cp, _IsConst>
+__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_Cp, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _It;
typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word
@@ -193,7 +194,7 @@ __find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __storage_type __b = ~(*__first.__seg_ & __m);
+ __storage_type __b = ~*__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
__n -= __dn;
@@ -210,17 +211,17 @@ __find_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __storage_type __b = ~(*__first.__seg_ & __m);
+ __storage_type __b = ~*__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
}
return _It(__first.__seg_, static_cast<unsigned>(__n));
}
-template <class _Cp, class _Tp>
+template <class _Cp, bool _IsConst, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-__bit_iterator<_Cp, false>
-find(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_)
+__bit_iterator<_Cp, _IsConst>
+find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
{
if (static_cast<bool>(__value_))
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
@@ -229,11 +230,11 @@ find(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, cons
// count
-template <class _Cp>
-typename __bit_iterator<_Cp, false>::difference_type
-__count_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_Cp, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _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;
@@ -260,11 +261,11 @@ __count_bool_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __
return __r;
}
-template <class _Cp>
-typename __bit_iterator<_Cp, false>::difference_type
-__count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
+template <class _Cp, bool _IsConst>
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n)
{
- typedef __bit_iterator<_Cp, false> _It;
+ typedef __bit_iterator<_Cp, _IsConst> _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;
@@ -275,7 +276,7 @@ __count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type _
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
- __r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
+ __r = _VSTD::__pop_count(~*__first.__seg_ & __m);
__n -= __dn;
++__first.__seg_;
}
@@ -286,15 +287,15 @@ __count_bool_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type _
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
- __r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
+ __r += _VSTD::__pop_count(~*__first.__seg_ & __m);
}
return __r;
}
-template <class _Cp, class _Tp>
+template <class _Cp, bool _IsConst, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-typename __bit_iterator<_Cp, false>::difference_type
-count(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, const _Tp& __value_)
+typename __bit_iterator<_Cp, _IsConst>::difference_type
+count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_)
{
if (static_cast<bool>(__value_))
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first));
@@ -926,12 +927,12 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
// equal
-template <class _Cp>
+template <class _Cp, bool _IC1, bool _IC2>
bool
-__equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1,
- __bit_iterator<_Cp, true> __first2)
+__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+ __bit_iterator<_Cp, _IC2> __first2)
{
- typedef __bit_iterator<_Cp, true> _It;
+ typedef __bit_iterator<_Cp, _IC1> _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;
@@ -950,11 +951,15 @@ __equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true>
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
if (__first2.__ctz_ > __first1.__ctz_)
+ {
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
return false;
+ }
else
+ {
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
return false;
+ }
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
__dn -= __ddn;
@@ -1004,12 +1009,12 @@ __equal_unaligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true>
return true;
}
-template <class _Cp>
+template <class _Cp, bool _IC1, bool _IC2>
bool
-__equal_aligned(__bit_iterator<_Cp, true> __first1, __bit_iterator<_Cp, true> __last1,
- __bit_iterator<_Cp, true> __first2)
+__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1,
+ __bit_iterator<_Cp, _IC2> __first2)
{
- typedef __bit_iterator<_Cp, true> _It;
+ typedef __bit_iterator<_Cp, _IC1> _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;
@@ -1057,7 +1062,8 @@ equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __b
return __equal_unaligned(__first1, __last1, __first2);
}
-template <class _Cp, bool _IsConst>
+template <class _Cp, bool _IsConst,
+ typename _Cp::__storage_type>
class __bit_iterator
{
public:
@@ -1228,19 +1234,23 @@ private:
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_aligned(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
+ template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC1>,
+ __bit_iterator<_Dp, _IC2>);
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>,
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>,
typename _Dp::size_type);
- template <class _Dp> friend __bit_iterator<_Dp, false> __find_bool_false(__bit_iterator<_Dp, false>,
+ template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>,
typename _Dp::size_type);
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+ __count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
+ template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
+ __count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
};
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/__config b/include/__config
index 7cd01dc1b55b..75b2206f2a6d 100644
--- a/include/__config
+++ b/include/__config
@@ -15,7 +15,11 @@
#pragma GCC system_header
#endif
-#define _LIBCPP_VERSION 1001
+#ifdef __GNUC__
+#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+#endif
+
+#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1
@@ -53,7 +57,8 @@
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
-# if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
+# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
+ || (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
@@ -145,8 +150,10 @@
#if defined(__clang__)
#if __has_feature(cxx_alignas)
+# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
+# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
@@ -180,9 +187,9 @@ typedef __char32_t char32_t;
#endif
#if __has_feature(cxx_attributes)
-# define _ATTRIBUTE(x) [[x]]
+# define _LIBCPP_NORETURN [[noreturn]]
#else
-# define _ATTRIBUTE(x) __attribute__ ((x))
+# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -245,8 +252,9 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
-#if __FreeBSD__
+#if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
#define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_C11_FEATURES
#endif
#if (__has_feature(cxx_noexcept))
@@ -274,8 +282,9 @@ namespace std {
#elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
+#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
-#define _ATTRIBUTE(x) __attribute__((x))
+#define _LIBCPP_NORETURN __attribute__((noreturn))
#if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS
@@ -305,15 +314,15 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
+#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
+#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
+#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -321,9 +330,9 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
+#endif // _GNUC_VER < 404
-#if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
+#if _GNUC_VER < 406
#define _LIBCPP_HAS_NO_NULLPTR
#endif
@@ -347,7 +356,7 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
-#define _ATTRIBUTE __declspec
+#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
@@ -389,6 +398,12 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_CONSTEXPR constexpr
#endif
+#ifdef __GNUC__
+#define _NOALIAS __attribute__((malloc))
+#else
+#define _NOALIAS
+#endif
+
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
@@ -404,6 +419,7 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
_ __v_; \
_LIBCPP_ALWAYS_INLINE x(_ __v) : __v_(__v) {} \
+ _LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<_>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
diff --git a/include/__hash_table b/include/__hash_table
index fad4e0e6ad4a..ba04b3e546a4 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -58,10 +58,31 @@ struct __hash_node
value_type __value_;
};
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+__is_power2(size_t __bc)
+{
+ return __bc > 2 && !(__bc & (__bc - 1));
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__constrain_hash(size_t __h, size_t __bc)
+{
+ return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+size_t
+__next_pow2(size_t __n)
+{
+ return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
+}
+
template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
-template <class _ConstNodePtr> class __hash_const_iterator;
-template <class _HashIterator> class __hash_map_iterator;
-template <class _HashIterator> class __hash_map_const_iterator;
+template <class _ConstNodePtr> class _LIBCPP_VISIBLE __hash_const_iterator;
+template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_iterator;
+template <class _HashIterator> class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
class _LIBCPP_VISIBLE unordered_map;
@@ -240,7 +261,7 @@ public:
__hash_local_iterator& operator++()
{
__node_ = __node_->__next_;
- if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
+ if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -330,7 +351,7 @@ public:
__hash_const_local_iterator& operator++()
{
__node_ = __node_->__next_;
- if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
+ if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_)
__node_ = nullptr;
return *this;
}
@@ -637,7 +658,7 @@ public:
template <class _Key>
_LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const
- {return hash_function()(__k) % bucket_count();}
+ {return __constrain_hash(hash_function()(__k), bucket_count());}
template <class _Key>
iterator find(const _Key& __x);
@@ -871,7 +892,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
{
if (size() > 0)
{
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
@@ -895,7 +916,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
{
__p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr;
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
size() = __u.size();
__u.size() = 0;
@@ -992,7 +1013,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__p1_.first().__next_ = __u.__p1_.first().__next_;
if (size() > 0)
{
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr;
__u.size() = 0;
@@ -1190,12 +1211,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
size_t __chash;
if (__bc != 0)
{
- __chash = __nd->__hash_ % __bc;
+ __chash = __constrain_hash(__nd->__hash_, __bc);
__ndptr = __bucket_list_[__chash];
if (__ndptr != nullptr)
{
for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
- __ndptr->__hash_ % __bc == __chash;
+ __constrain_hash(__ndptr->__hash_, __bc) == __chash;
__ndptr = __ndptr->__next_)
{
if (key_eq()(__ndptr->__value_, __nd->__value_))
@@ -1206,10 +1227,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
{
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_VSTD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
- __chash = __nd->__hash_ % __bc;
+ __chash = __constrain_hash(__nd->__hash_, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
@@ -1221,7 +1242,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__nd->__next_ != nullptr)
- __bucket_list_[__nd->__next_->__hash_ % __bc] = __nd;
+ __bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd;
}
else
{
@@ -1245,11 +1266,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_VSTD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __cp->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr)
{
@@ -1259,12 +1280,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__cp->__next_ != nullptr)
- __bucket_list_[__cp->__next_->__hash_ % __bc] = __cp;
+ __bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp;
}
else
{
for (bool __found = false; __pn->__next_ != nullptr &&
- __pn->__next_->__hash_ % __bc == __chash;
+ __constrain_hash(__pn->__next_->__hash_, __bc) == __chash;
__pn = __pn->__next_)
{
// __found key_eq() action
@@ -1285,7 +1306,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__pn->__next_ = __cp;
if (__cp->__next_ != nullptr)
{
- size_t __nhash = __cp->__next_->__hash_ % __bc;
+ size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __cp;
}
@@ -1306,11 +1327,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_VSTD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
}
- size_t __chash = __cp->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cp->__hash_, __bc);
__node_pointer __pp = __bucket_list_[__chash];
while (__pp->__next_ != __np)
__pp = __pp->__next_;
@@ -1333,12 +1354,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
size_t __chash;
if (__bc != 0)
{
- __chash = __hash % __bc;
+ __chash = __constrain_hash(__hash, __bc);
__nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __x))
@@ -1350,10 +1371,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_holder __h = __construct_node(__x, __hash);
if (size()+1 > __bc * max_load_factor() || __bc == 0)
{
- rehash(_VSTD::max<size_type>(2 * __bc + 1,
+ rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc),
size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count();
- __chash = __hash % __bc;
+ __chash = __constrain_hash(__hash, __bc);
}
// insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash];
@@ -1365,7 +1386,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
// fix up __bucket_list_
__bucket_list_[__chash] = __pn;
if (__h->__next_ != nullptr)
- __bucket_list_[__h->__next_->__hash_ % __bc] = __h.get();
+ __bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get();
}
else
{
@@ -1489,16 +1510,20 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
{
- __n = __next_prime(_VSTD::max<size_type>(__n, size() > 0));
+ if (__n == 1)
+ __n = 2;
+ else if (__n & (__n - 1))
+ __n = __next_prime(__n);
size_type __bc = bucket_count();
if (__n > __bc)
__rehash(__n);
- else
+ else if (__n < __bc)
{
__n = _VSTD::max<size_type>
(
__n,
- __next_prime(size_t(ceil(float(size()) / max_load_factor())))
+ __is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
+ __next_prime(size_t(ceil(float(size()) / max_load_factor())))
);
if (__n < __bc)
__rehash(__n);
@@ -1521,13 +1546,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
__node_pointer __cp = __pp->__next_;
if (__cp != nullptr)
{
- size_type __chash = __cp->__hash_ % __nbc;
+ size_type __chash = __constrain_hash(__cp->__hash_, __nbc);
__bucket_list_[__chash] = __pp;
size_type __phash = __chash;
for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
__cp = __pp->__next_)
{
- __chash = __cp->__hash_ % __nbc;
+ __chash = __constrain_hash(__cp->__hash_, __nbc);
if (__chash == __phash)
__pp = __cp;
else
@@ -1565,12 +1590,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __hash % __bc;
+ size_t __chash = __constrain_hash(__hash, __bc);
__node_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
@@ -1590,12 +1615,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
size_type __bc = bucket_count();
if (__bc != 0)
{
- size_t __chash = __hash % __bc;
+ size_t __chash = __constrain_hash(__hash, __bc);
__node_const_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr)
{
for (__nd = __nd->__next_; __nd != nullptr &&
- __nd->__hash_ % __bc == __chash;
+ __constrain_hash(__nd->__hash_, __bc) == __chash;
__nd = __nd->__next_)
{
if (key_eq()(__nd->__value_, __k))
@@ -1734,7 +1759,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// current node
__node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
size_type __bc = bucket_count();
- size_t __chash = __cn->__hash_ % __bc;
+ size_t __chash = __constrain_hash(__cn->__hash_, __bc);
// find previous node
__node_pointer __pn = __bucket_list_[__chash];
for (; __pn->__next_ != __cn; __pn = __pn->__next_)
@@ -1742,15 +1767,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// Fix up __bucket_list_
// if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
- if (__pn == _VSTD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
+ if (__pn == _VSTD::addressof(__p1_.first()) || __constrain_hash(__pn->__hash_, __bc) != __chash)
{
- if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
+ if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash)
__bucket_list_[__chash] = nullptr;
}
// if __cn->__next_ is not in same bucket (nullptr is in same bucket)
if (__cn->__next_ != nullptr)
{
- size_t __nhash = __cn->__next_->__hash_ % __bc;
+ size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc);
if (__nhash != __chash)
__bucket_list_[__nhash] = __pn;
}
@@ -1881,10 +1906,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p2_.swap(__u.__p2_);
__p3_.swap(__u.__p3_);
if (size() > 0)
- __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
+ __bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
if (__u.size() > 0)
- __u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
+ __u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] =
static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first()));
}
@@ -1898,7 +1923,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
if (__np != nullptr)
{
for (__np = __np->__next_; __np != nullptr &&
- __np->__hash_ % __bc == __n;
+ __constrain_hash(__np->__hash_, __bc) == __n;
__np = __np->__next_, ++__r)
;
}
diff --git a/include/__locale b/include/__locale
index b1e07113e7d4..e6c357f9e531 100644
--- a/include/__locale
+++ b/include/__locale
@@ -31,17 +31,24 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-class locale;
+class _LIBCPP_VISIBLE locale;
-template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
-template <class _Facet> const _Facet& use_facet(const locale&);
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+bool
+has_facet(const locale&) _NOEXCEPT;
+
+template <class _Facet>
+_LIBCPP_INLINE_VISIBILITY
+const _Facet&
+use_facet(const locale&);
class _LIBCPP_VISIBLE locale
{
public:
// types:
- class facet;
- class id;
+ class _LIBCPP_VISIBLE facet;
+ class _LIBCPP_VISIBLE id;
typedef int category;
static const category // values assigned here are for exposition only
@@ -119,7 +126,7 @@ class _LIBCPP_VISIBLE locale::id
static int32_t __next_id;
public:
- _LIBCPP_INLINE_VISIBILITY id() {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {}
private:
void __init();
void operator=(const id&); // = delete;
diff --git a/include/__mutex_base b/include/__mutex_base
index 5410272b4c99..538e89bedf89 100644
--- a/include/__mutex_base
+++ b/include/__mutex_base
@@ -38,7 +38,11 @@ class _LIBCPP_VISIBLE mutex
public:
_LIBCPP_INLINE_VISIBILITY
- mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
+#else
+ mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
+#endif
~mutex();
private:
@@ -47,8 +51,8 @@ private:
public:
void lock();
- bool try_lock();
- void unlock();
+ bool try_lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
@@ -58,17 +62,19 @@ struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {};
-//constexpr
-extern const
-defer_lock_t defer_lock;
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
+
+extern const defer_lock_t defer_lock;
+extern const try_to_lock_t try_to_lock;
+extern const adopt_lock_t adopt_lock;
-//constexpr
-extern const
-try_to_lock_t try_to_lock;
+#else
-//constexpr
-extern const
-adopt_lock_t adopt_lock;
+constexpr defer_lock_t defer_lock = defer_lock_t();
+constexpr try_to_lock_t try_to_lock = try_to_lock_t();
+constexpr adopt_lock_t adopt_lock = adopt_lock_t();
+
+#endif
template <class _Mutex>
class _LIBCPP_VISIBLE lock_guard
@@ -106,12 +112,12 @@ private:
public:
_LIBCPP_INLINE_VISIBILITY
- unique_lock() : __m_(nullptr), __owns_(false) {}
+ unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY
- unique_lock(mutex_type& __m, defer_lock_t)
+ unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT
: __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t)
@@ -141,11 +147,11 @@ private:
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- unique_lock(unique_lock&& __u)
+ unique_lock(unique_lock&& __u) _NOEXCEPT
: __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY
- unique_lock& operator=(unique_lock&& __u)
+ unique_lock& operator=(unique_lock&& __u) _NOEXCEPT
{
if (__owns_)
__m_->unlock();
@@ -190,13 +196,13 @@ public:
void unlock();
_LIBCPP_INLINE_VISIBILITY
- void swap(unique_lock& __u)
+ void swap(unique_lock& __u) _NOEXCEPT
{
_VSTD::swap(__m_, __u.__m_);
_VSTD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
- mutex_type* release()
+ mutex_type* release() _NOEXCEPT
{
mutex_type* __m = __m_;
__m_ = nullptr;
@@ -205,12 +211,12 @@ public:
}
_LIBCPP_INLINE_VISIBILITY
- bool owns_lock() const {return __owns_;}
+ bool owns_lock() const _NOEXCEPT {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT
- operator bool () const {return __owns_;}
+ operator bool () const _NOEXCEPT {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
- mutex_type* mutex() const {return __m_;}
+ mutex_type* mutex() const _NOEXCEPT {return __m_;}
};
template <class _Mutex>
@@ -276,7 +282,8 @@ unique_lock<_Mutex>::unlock()
template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
+swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT
+ {__x.swap(__y);}
struct _LIBCPP_VISIBLE cv_status
{
@@ -297,7 +304,11 @@ class _LIBCPP_VISIBLE condition_variable
pthread_cond_t __cv_;
public:
_LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
+#else
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
+#endif
~condition_variable();
private:
@@ -305,18 +316,13 @@ private:
condition_variable& operator=(const condition_variable&); // = delete;
public:
- void notify_one();
- void notify_all();
+ void notify_one() _NOEXCEPT;
+ void notify_all() _NOEXCEPT;
void wait(unique_lock<mutex>& __lk);
template <class _Predicate>
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
- template <class _Duration>
- cv_status
- wait_until(unique_lock<mutex>& __lk,
- const chrono::time_point<chrono::system_clock, _Duration>& __t);
-
template <class _Clock, class _Duration>
cv_status
wait_until(unique_lock<mutex>& __lk,
@@ -371,28 +377,13 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
wait(__lk);
}
-template <class _Duration>
-cv_status
-condition_variable::wait_until(unique_lock<mutex>& __lk,
- const chrono::time_point<chrono::system_clock, _Duration>& __t)
-{
- using namespace chrono;
- typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
- __do_timed_wait(__lk,
- __nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
- return system_clock::now() < __t ? cv_status::no_timeout :
- cv_status::timeout;
-}
-
template <class _Clock, class _Duration>
cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t)
{
using namespace chrono;
- system_clock::time_point __s_now = system_clock::now();
- typename _Clock::time_point __c_now = _Clock::now();
- __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
+ wait_for(__lk, __t - _Clock::now());
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
}
@@ -416,9 +407,17 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
+ if (__d <= __d.zero())
+ return cv_status::timeout;
+ typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
+ typedef time_point<system_clock, nanoseconds> __sys_tpi;
+ __sys_tpf _Max = __sys_tpi::max();
system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now();
- __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
+ if (_Max - __d > __s_now)
+ __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
+ else
+ __do_timed_wait(__lk, __sys_tpi::max());
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout;
}
diff --git a/include/__tree b/include/__tree
index f57c80c850e2..bd38b4f2b32a 100644
--- a/include/__tree
+++ b/include/__tree
@@ -614,8 +614,8 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
};
-template <class _TreeIterator> class __map_iterator;
-template <class _TreeIterator> class __map_const_iterator;
+template <class _TreeIterator> class _LIBCPP_VISIBLE __map_iterator;
+template <class _TreeIterator> class _LIBCPP_VISIBLE __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_iterator
diff --git a/include/__tuple b/include/__tuple
index 82168048e6ce..1fa90a0088a3 100644
--- a/include/__tuple
+++ b/include/__tuple
@@ -79,38 +79,47 @@ template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
+_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
_Tp&
get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
diff --git a/include/__undef_min_max b/include/__undef_min_max
index 88bc53feaaf8..b1e80d1b0499 100644
--- a/include/__undef_min_max
+++ b/include/__undef_min_max
@@ -9,11 +9,11 @@
//===----------------------------------------------------------------------===//
#ifdef min
-#warning: macro min is incompatible with C++. #undef'ing min
+#warning: macro min is incompatible with C++. #undefing min
#undef min
#endif
#ifdef max
-#warning: macro max is incompatible with C++. #undef'ing max
+#warning: macro max is incompatible with C++. #undefing max
#undef max
#endif
diff --git a/include/algorithm b/include/algorithm
index d924a7de3f2d..1ce14b46d425 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -593,7 +593,7 @@ template <class BidirectionalIterator, class Compare>
#include <utility>
#include <memory>
#include <iterator>
-#include <cstdlib>
+#include <cstddef>
#include <__undef_min_max>
@@ -2103,12 +2103,31 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out
template <class _ForwardIterator>
_ForwardIterator
-__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, false_type)
+__rotate_left(_ForwardIterator __first, _ForwardIterator __last)
+{
+ typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
+ value_type __tmp = _VSTD::move(*__first);
+ _ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
+ *__lm1 = _VSTD::move(__tmp);
+ return __lm1;
+}
+
+template <class _BidirectionalIterator>
+_BidirectionalIterator
+__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
+{
+ typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
+ _BidirectionalIterator __lm1 = _VSTD::prev(__last);
+ value_type __tmp = _VSTD::move(*__lm1);
+ _BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
+ *__first = _VSTD::move(__tmp);
+ return __fp1;
+}
+
+template <class _ForwardIterator>
+_ForwardIterator
+__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{
- if (__first == __middle)
- return __last;
- if (__middle == __last)
- return __first;
_ForwardIterator __i = __middle;
while (true)
{
@@ -2156,15 +2175,11 @@ __gcd(_Integral __x, _Integral __y)
template<typename _RandomAccessIterator>
_RandomAccessIterator
-__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, true_type)
+__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last)
{
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
- if (__first == __middle)
- return __last;
- if (__middle == __last)
- return __first;
const difference_type __m1 = __middle - __first;
const difference_type __m2 = __last - __middle;
if (__m1 == __m2)
@@ -2172,15 +2187,15 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
_VSTD::swap_ranges(__first, __middle, __middle);
return __middle;
}
- const difference_type __g = __gcd(__m1, __m2);
+ const difference_type __g = _VSTD::__gcd(__m1, __m2);
for (_RandomAccessIterator __p = __first + __g; __p != __first;)
{
- value_type __t(*--__p);
+ value_type __t(_VSTD::move(*--__p));
_RandomAccessIterator __p1 = __p;
_RandomAccessIterator __p2 = __p1 + __m1;
do
{
- *__p1 = *__p2;
+ *__p1 = _VSTD::move(*__p2);
__p1 = __p2;
const difference_type __d = __last - __p2;
if (__m1 < __d)
@@ -2188,7 +2203,7 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
else
__p2 = __first + (__m1 - __d);
} while (__p2 != __p);
- *__p1 = __t;
+ *__p1 = _VSTD::move(__t);
}
return __first + __m2;
}
@@ -2196,22 +2211,64 @@ __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomA
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
+__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
+ _VSTD::forward_iterator_tag)
+{
+ typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type;
+ if (_VSTD::is_trivially_move_assignable<value_type>::value)
+ {
+ if (_VSTD::next(__first) == __middle)
+ return _VSTD::__rotate_left(__first, __last);
+ }
+ return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _BidirectionalIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_BidirectionalIterator
+__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
+ _VSTD::bidirectional_iterator_tag)
+{
+ typedef typename _VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type;
+ if (_VSTD::is_trivially_move_assignable<value_type>::value)
+ {
+ if (_VSTD::next(__first) == __middle)
+ return _VSTD::__rotate_left(__first, __last);
+ if (_VSTD::next(__middle) == __last)
+ return _VSTD::__rotate_right(__first, __last);
+ }
+ return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _RandomAccessIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_RandomAccessIterator
+__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
+ _VSTD::random_access_iterator_tag)
+{
+ typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type;
+ if (_VSTD::is_trivially_move_assignable<value_type>::value)
+ {
+ if (_VSTD::next(__first) == __middle)
+ return _VSTD::__rotate_left(__first, __last);
+ if (_VSTD::next(__middle) == __last)
+ return _VSTD::__rotate_right(__first, __last);
+ return _VSTD::__rotate_gcd(__first, __middle, __last);
+ }
+ return _VSTD::__rotate_forward(__first, __middle, __last);
+}
+
+template <class _ForwardIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+_ForwardIterator
rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{
+ if (__first == __middle)
+ return __last;
+ if (__middle == __last)
+ return __first;
return _VSTD::__rotate(__first, __middle, __last,
- integral_constant
- <
- bool,
- is_convertible
- <
- typename iterator_traits<_ForwardIterator>::iterator_category,
- random_access_iterator_tag
- >::value &&
- is_trivially_copy_assignable
- <
- typename iterator_traits<_ForwardIterator>::value_type
- >::value
- >());
+ typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category());
}
// rotate_copy
diff --git a/include/array b/include/array
index c11f4bd74f5f..029bfd00a5c0 100644
--- a/include/array
+++ b/include/array
@@ -55,7 +55,7 @@ struct array
// capacity:
constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept;
- bool empty() const noexcept;
+ constexpr bool empty() const noexcept;
// element access:
reference operator[](size_type n);
@@ -173,11 +173,11 @@ struct _LIBCPP_VISIBLE array
// capacity:
_LIBCPP_INLINE_VISIBILITY
- /*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
- /*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
- bool empty() const _NOEXCEPT {return _Size == 0;}
+ _LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
diff --git a/include/atomic b/include/atomic
index 6a200eba599f..6dffdb21fde4 100644
--- a/include/atomic
+++ b/include/atomic
@@ -555,7 +555,7 @@ kill_dependency(_Tp __y) _NOEXCEPT
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
struct __atomic_base // false
{
- _Atomic(_Tp) __a_;
+ mutable _Atomic(_Tp) __a_;
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile _NOEXCEPT
diff --git a/include/bitset b/include/bitset
index 6e12e5ccc515..1167f50440f1 100644
--- a/include/bitset
+++ b/include/bitset
@@ -148,9 +148,9 @@ class __bitset
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
+ typedef size_type __storage_type;
protected:
typedef __bitset __self;
- typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -159,7 +159,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>;
__storage_type __first_[_N_words];
@@ -168,12 +168,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
- __bitset() _NOEXCEPT;
- explicit __bitset(unsigned long long __v) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
- _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -194,8 +194,10 @@ protected:
bool any() const _NOEXCEPT;
size_t __hash_code() const _NOEXCEPT;
private:
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT;
+#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
@@ -206,11 +208,19 @@ private:
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ : __first_{0}
+#endif
{
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
+#endif
}
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+
template <size_t _N_words, size_t _Size>
void
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
@@ -232,11 +242,19 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
}
+#endif // _LIBCPP_HAS_NO_CONSTEXPR
+
template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
+#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+ : __first_{__v}
+#endif
{
+#ifdef _LIBCPP_HAS_NO_CONSTEXPR
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
+#endif
}
template <size_t _N_words, size_t _Size>
@@ -406,9 +424,9 @@ class __bitset<1, _Size>
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
+ typedef size_type __storage_type;
protected:
typedef __bitset __self;
- typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -417,7 +435,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>;
__storage_type __first_;
@@ -426,12 +444,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
- __bitset() _NOEXCEPT;
- explicit __bitset(unsigned long long __v) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);}
- _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -455,6 +473,7 @@ protected:
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
{
@@ -462,6 +481,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
{
@@ -549,9 +569,9 @@ class __bitset<0, 0>
public:
typedef ptrdiff_t difference_type;
typedef size_t size_type;
+ typedef size_type __storage_type;
protected:
typedef __bitset __self;
- typedef size_type __storage_type;
typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -567,12 +587,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
- __bitset() _NOEXCEPT;
- explicit __bitset(unsigned long long) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);}
- _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
{return iterator(0, 0);}
@@ -595,16 +615,18 @@ protected:
};
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
}
-template <size_t _Size> class bitset;
+template <size_t _Size> class _LIBCPP_VISIBLE bitset;
template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size>
@@ -619,8 +641,9 @@ public:
typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors:
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+ bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT>
explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@@ -647,7 +670,8 @@ public:
bitset& flip(size_t __pos);
// element access:
- _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+ const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const;
unsigned long long to_ullong() const;
@@ -663,7 +687,7 @@ public:
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
size_t count() const _NOEXCEPT;
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
diff --git a/include/chrono b/include/chrono
index 0571f9dff7e4..508c1f377579 100644
--- a/include/chrono
+++ b/include/chrono
@@ -20,6 +20,7 @@ namespace chrono
{
template <class ToDuration, class Rep, class Period>
+constexpr
ToDuration
duration_cast(const duration<Rep, Period>& fd);
@@ -29,9 +30,9 @@ template <class Rep>
struct duration_values
{
public:
- static Rep zero();
- static Rep max();
- static Rep min();
+ static constexpr Rep zero();
+ static constexpr Rep max();
+ static constexpr Rep min();
};
// duration
@@ -46,9 +47,9 @@ public:
typedef Rep rep;
typedef Period period;
- duration() = default;
+ constexpr duration() = default;
template <class Rep2>
- explicit duration(const Rep2& r,
+ constexpr explicit duration(const Rep2& r,
typename enable_if
<
is_convertible<Rep2, rep>::value &&
@@ -58,7 +59,7 @@ public:
// conversions
template <class Rep2, class Period2>
- duration(const duration<Rep2, Period2>& d,
+ constexpr duration(const duration<Rep2, Period2>& d,
typename enable_if
<
treat_as_floating_point<rep>::value ||
@@ -67,12 +68,12 @@ public:
// observer
- rep count() const;
+ constexpr rep count() const;
// arithmetic
- duration operator+() const;
- duration operator-() const;
+ constexpr duration operator+() const;
+ constexpr duration operator-() const;
duration& operator++();
duration operator++(int);
duration& operator--();
@@ -86,9 +87,9 @@ public:
// special values
- static duration zero();
- static duration min();
- static duration max();
+ static constexpr duration zero();
+ static constexpr duration min();
+ static constexpr duration max();
};
typedef duration<long long, nano> nanoseconds;
@@ -145,36 +146,48 @@ namespace chrono {
// duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2>
+ constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2>
+ constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2>
+ constexpr
duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2>
+ constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast
@@ -306,7 +319,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
@@ -316,7 +329,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -328,7 +341,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -340,7 +353,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
_ToDuration operator()(const _FromDuration& __fd) const
{
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -352,6 +365,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename enable_if
<
__is_duration<_ToDuration>::value,
@@ -369,9 +383,9 @@ template <class _Rep>
struct _LIBCPP_VISIBLE duration_values
{
public:
- _LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
- _LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
- _LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
};
// duration
@@ -389,9 +403,9 @@ private:
rep __rep_;
public:
- _LIBCPP_INLINE_VISIBILITY duration() {} // = default;
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
template <class _Rep2>
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
explicit duration(const _Rep2& __r,
typename enable_if
<
@@ -403,7 +417,7 @@ public:
// conversions
template <class _Rep2, class _Period2>
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
duration(const duration<_Rep2, _Period2>& __d,
typename enable_if
<
@@ -415,12 +429,12 @@ public:
// observer
- _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;}
// arithmetic
- _LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
- _LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -436,9 +450,9 @@ public:
// special values
- _LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
- _LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
- _LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());}
};
typedef duration<long long, nano> nanoseconds;
@@ -453,7 +467,7 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration>
struct __duration_eq
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -464,13 +478,14 @@ struct __duration_eq
template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -481,6 +496,7 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -492,7 +508,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _LhsDuration, class _RhsDuration>
struct __duration_lt
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -503,13 +519,14 @@ struct __duration_lt
template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration>
{
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();}
};
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -520,6 +537,7 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -530,6 +548,7 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -540,6 +559,7 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -550,30 +570,31 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
- __r += __rhs;
- return __r;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count());
}
// Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
- __r -= __rhs;
- return __r;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count());
}
// Duration *
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -582,13 +603,13 @@ typename enable_if
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- duration<_Cr, _Period> __r = __d;
- __r *= static_cast<_Cr>(__s);
- return __r;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename enable_if
<
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -627,17 +648,18 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- duration<_Cr, _Period> __r = __d;
- __r /= static_cast<_Cr>(__s);
- return __r;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -649,23 +671,24 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{
typedef typename common_type<_Rep1, _Rep2>::type _Cr;
- duration<_Cr, _Period> __r = __d;
- __r %= static_cast<_Cr>(__s);
- return __r;
+ typedef duration<_Cr, _Period> _Cd;
+ return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s));
}
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
- typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
- __r %= __rhs;
- return __r;
+ typedef typename common_type<_Rep1, _Rep2>::type _Cr;
+ typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd;
+ return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count()));
}
//////////////////////////////////////////////////////////
@@ -705,13 +728,13 @@ public:
// arithmetic
- _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
- _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
+ _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
+ _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
// special values
- _LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
- _LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());}
+ _LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());}
};
} // chrono
diff --git a/include/cmath b/include/cmath
index 76d7a821acb1..a70bbf2d8902 100644
--- a/include/cmath
+++ b/include/cmath
@@ -316,7 +316,7 @@ long double truncl(long double x);
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_signbit(_A1 __x)
+__libcpp_signbit(_A1 __x) _NOEXCEPT
{
return signbit(__x);
}
@@ -326,7 +326,7 @@ __libcpp_signbit(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-signbit(_A1 __x)
+signbit(_A1 __x) _NOEXCEPT
{
return __libcpp_signbit(__x);
}
@@ -340,7 +340,7 @@ signbit(_A1 __x)
template <class _A1>
_LIBCPP_ALWAYS_INLINE
int
-__libcpp_fpclassify(_A1 __x)
+__libcpp_fpclassify(_A1 __x) _NOEXCEPT
{
return fpclassify(__x);
}
@@ -350,7 +350,7 @@ __libcpp_fpclassify(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
-fpclassify(_A1 __x)
+fpclassify(_A1 __x) _NOEXCEPT
{
return __libcpp_fpclassify(__x);
}
@@ -364,7 +364,7 @@ fpclassify(_A1 __x)
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isfinite(_A1 __x)
+__libcpp_isfinite(_A1 __x) _NOEXCEPT
{
return isfinite(__x);
}
@@ -374,7 +374,7 @@ __libcpp_isfinite(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-isfinite(_A1 __x)
+isfinite(_A1 __x) _NOEXCEPT
{
return __libcpp_isfinite(__x);
}
@@ -388,7 +388,7 @@ isfinite(_A1 __x)
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isinf(_A1 __x)
+__libcpp_isinf(_A1 __x) _NOEXCEPT
{
return isinf(__x);
}
@@ -398,7 +398,7 @@ __libcpp_isinf(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-isinf(_A1 __x)
+isinf(_A1 __x) _NOEXCEPT
{
return __libcpp_isinf(__x);
}
@@ -412,7 +412,7 @@ isinf(_A1 __x)
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isnan(_A1 __x)
+__libcpp_isnan(_A1 __x) _NOEXCEPT
{
return isnan(__x);
}
@@ -422,7 +422,7 @@ __libcpp_isnan(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-isnan(_A1 __x)
+isnan(_A1 __x) _NOEXCEPT
{
return __libcpp_isnan(__x);
}
@@ -436,7 +436,7 @@ isnan(_A1 __x)
template <class _A1>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isnormal(_A1 __x)
+__libcpp_isnormal(_A1 __x) _NOEXCEPT
{
return isnormal(__x);
}
@@ -446,7 +446,7 @@ __libcpp_isnormal(_A1 __x)
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-isnormal(_A1 __x)
+isnormal(_A1 __x) _NOEXCEPT
{
return __libcpp_isnormal(__x);
}
@@ -460,7 +460,7 @@ isnormal(_A1 __x)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isgreater(_A1 __x, _A2 __y)
+__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT
{
return isgreater(__x, __y);
}
@@ -475,7 +475,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-isgreater(_A1 __x, _A2 __y)
+isgreater(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_isgreater(__x, __y);
}
@@ -489,7 +489,7 @@ isgreater(_A1 __x, _A2 __y)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isgreaterequal(_A1 __x, _A2 __y)
+__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
{
return isgreaterequal(__x, __y);
}
@@ -504,7 +504,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-isgreaterequal(_A1 __x, _A2 __y)
+isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_isgreaterequal(__x, __y);
}
@@ -518,7 +518,7 @@ isgreaterequal(_A1 __x, _A2 __y)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isless(_A1 __x, _A2 __y)
+__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT
{
return isless(__x, __y);
}
@@ -533,7 +533,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-isless(_A1 __x, _A2 __y)
+isless(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_isless(__x, __y);
}
@@ -547,7 +547,7 @@ isless(_A1 __x, _A2 __y)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_islessequal(_A1 __x, _A2 __y)
+__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT
{
return islessequal(__x, __y);
}
@@ -562,7 +562,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-islessequal(_A1 __x, _A2 __y)
+islessequal(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_islessequal(__x, __y);
}
@@ -576,7 +576,7 @@ islessequal(_A1 __x, _A2 __y)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_islessgreater(_A1 __x, _A2 __y)
+__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
{
return islessgreater(__x, __y);
}
@@ -591,7 +591,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-islessgreater(_A1 __x, _A2 __y)
+islessgreater(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_islessgreater(__x, __y);
}
@@ -605,7 +605,7 @@ islessgreater(_A1 __x, _A2 __y)
template <class _A1, class _A2>
_LIBCPP_ALWAYS_INLINE
bool
-__libcpp_isunordered(_A1 __x, _A2 __y)
+__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT
{
return isunordered(__x, __y);
}
@@ -620,7 +620,7 @@ typename std::enable_if
std::is_floating_point<_A2>::value,
bool
>::type
-isunordered(_A1 __x, _A2 __y)
+isunordered(_A1 __x, _A2 __y) _NOEXCEPT
{
return __libcpp_isunordered(__x, __y);
}
@@ -650,15 +650,15 @@ using ::double_t;
inline _LIBCPP_INLINE_VISIBILITY
float
-abs(float __x) {return fabsf(__x);}
+abs(float __x) _NOEXCEPT {return fabsf(__x);}
inline _LIBCPP_INLINE_VISIBILITY
double
-abs(double __x) {return fabs(__x);}
+abs(double __x) _NOEXCEPT {return fabs(__x);}
inline _LIBCPP_INLINE_VISIBILITY
long double
-abs(long double __x) {return fabsl(__x);}
+abs(long double __x) _NOEXCEPT {return fabsl(__x);}
#ifndef __sun__
@@ -668,14 +668,14 @@ using ::acos;
using ::acosf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) {return acosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) {return acosl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-acos(_A1 __x) {return acos((double)__x);}
+acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
// asin
@@ -683,14 +683,14 @@ using ::asin;
using ::asinf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) {return asinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) {return asinl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-asin(_A1 __x) {return asin((double)__x);}
+asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
// atan
@@ -698,14 +698,14 @@ using ::atan;
using ::atanf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) {return atanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) {return atanl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-atan(_A1 __x) {return atan((double)__x);}
+atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
// atan2
@@ -713,8 +713,8 @@ using ::atan2;
using ::atan2f;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) {return atan2f(__y, __x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) {return atan2l(__y, __x);}
+inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
#endif
template <class _A1, class _A2>
@@ -725,7 +725,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-atan2(_A1 __y, _A2 __x)
+atan2(_A1 __y, _A2 __x) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -739,14 +739,14 @@ using ::ceil;
using ::ceilf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) {return ceilf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) {return ceill(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-ceil(_A1 __x) {return ceil((double)__x);}
+ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
// cos
@@ -754,14 +754,14 @@ using ::cos;
using ::cosf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) {return cosf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) {return cosl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
#endif
template <class _A1>
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-cos(_A1 __x) {return cos((double)__x);}
+cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
// cosh
@@ -769,14 +769,14 @@ using ::cosh;
using ::coshf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) {return coshf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) {return coshl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-cosh(_A1 __x) {return cosh((double)__x);}
+cosh(_A1 __x) _NOEXCEPT {return cosh((double)__x);}
#endif // __sun__
// exp
@@ -787,15 +787,15 @@ 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);}
+inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-exp(_A1 __x) {return exp((double)__x);}
+exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
// fabs
@@ -803,14 +803,14 @@ using ::fabs;
using ::fabsf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) {return fabsf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) {return fabsl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-fabs(_A1 __x) {return fabs((double)__x);}
+fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
// floor
@@ -818,14 +818,14 @@ using ::floor;
using ::floorf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) {return floorf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) {return floorl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-floor(_A1 __x) {return floor((double)__x);}
+floor(_A1 __x) _NOEXCEPT {return floor((double)__x);}
// fmod
@@ -835,8 +835,8 @@ using ::fmodf;
#ifndef __sun__
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) {return fmodf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) {return fmodl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
#endif
template <class _A1, class _A2>
@@ -847,7 +847,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-fmod(_A1 __x, _A2 __y)
+fmod(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -862,14 +862,14 @@ using ::frexp;
using ::frexpf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) {return frexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) {return frexpl(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-frexp(_A1 __x, int* __e) {return frexp((double)__x, __e);}
+frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
// ldexp
@@ -877,14 +877,14 @@ using ::ldexp;
using ::ldexpf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) {return ldexpf(__x, __e);}
-inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) {return ldexpl(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
+inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-ldexp(_A1 __x, int __e) {return ldexp((double)__x, __e);}
+ldexp(_A1 __x, int __e) _NOEXCEPT {return ldexp((double)__x, __e);}
// log
@@ -894,14 +894,14 @@ using ::logf;
#ifndef __sun__
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float log(float __x) {return logf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) {return logl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-log(_A1 __x) {return log((double)__x);}
+log(_A1 __x) _NOEXCEPT {return log((double)__x);}
// log10
@@ -910,14 +910,14 @@ using ::log10;
using ::log10f;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) {return log10f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) {return log10l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-log10(_A1 __x) {return log10((double)__x);}
+log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
// modf
@@ -925,8 +925,8 @@ using ::modf;
using ::modff;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) {return modff(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) {return modfl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
#endif
// pow
@@ -938,8 +938,8 @@ 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);}
+inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
#endif
template <class _A1, class _A2>
@@ -950,7 +950,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-pow(_A1 __x, _A2 __y)
+pow(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -965,14 +965,14 @@ using ::sin;
using ::sinf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) {return sinf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) {return sinl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-sin(_A1 __x) {return sin((double)__x);}
+sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
// sinh
@@ -980,14 +980,14 @@ using ::sinh;
using ::sinhf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) {return sinhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) {return sinhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-sinh(_A1 __x) {return sinh((double)__x);}
+sinh(_A1 __x) _NOEXCEPT {return sinh((double)__x);}
// sqrt
@@ -997,14 +997,14 @@ using ::sqrtf;
#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);}
+inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-sqrt(_A1 __x) {return sqrt((double)__x);}
+sqrt(_A1 __x) _NOEXCEPT {return sqrt((double)__x);}
// tan
@@ -1013,14 +1013,14 @@ using ::tanf;
#ifndef __sun__
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) {return tanf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) {return tanl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-tan(_A1 __x) {return tan((double)__x);}
+tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
// tanh
@@ -1028,14 +1028,14 @@ using ::tanh;
using ::tanhf;
#ifndef _MSC_VER
-inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) {return tanhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) {return tanhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-tanh(_A1 __x) {return tanh((double)__x);}
+tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
// acosh
@@ -1043,13 +1043,13 @@ tanh(_A1 __x) {return tanh((double)__x);}
using ::acosh;
using ::acoshf;
-inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) {return acoshf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) {return acoshl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float acosh(float __x) _NOEXCEPT {return acoshf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __x) _NOEXCEPT {return acoshl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-acosh(_A1 __x) {return acosh((double)__x);}
+acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
#endif
// asinh
@@ -1058,13 +1058,13 @@ acosh(_A1 __x) {return acosh((double)__x);}
using ::asinh;
using ::asinhf;
-inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) {return asinhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) {return asinhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float asinh(float __x) _NOEXCEPT {return asinhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __x) _NOEXCEPT {return asinhl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-asinh(_A1 __x) {return asinh((double)__x);}
+asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
#endif
// atanh
@@ -1073,13 +1073,13 @@ asinh(_A1 __x) {return asinh((double)__x);}
using ::atanh;
using ::atanhf;
-inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) {return atanhf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) {return atanhl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float atanh(float __x) _NOEXCEPT {return atanhf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __x) _NOEXCEPT {return atanhl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-atanh(_A1 __x) {return atanh((double)__x);}
+atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
#endif
// cbrt
@@ -1088,13 +1088,13 @@ atanh(_A1 __x) {return atanh((double)__x);}
using ::cbrt;
using ::cbrtf;
-inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) {return cbrtf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) {return cbrtl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __x) _NOEXCEPT {return cbrtf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __x) _NOEXCEPT {return cbrtl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-cbrt(_A1 __x) {return cbrt((double)__x);}
+cbrt(_A1 __x) _NOEXCEPT {return cbrt((double)__x);}
#endif
// copysign
@@ -1102,8 +1102,8 @@ cbrt(_A1 __x) {return cbrt((double)__x);}
using ::copysign;
using ::copysignf;
-inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) {return copysignf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) {return copysignl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float copysign(float __x, float __y) _NOEXCEPT {return copysignf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double copysign(long double __x, long double __y) _NOEXCEPT {return copysignl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1113,7 +1113,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-copysign(_A1 __x, _A2 __y)
+copysign(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1128,60 +1128,60 @@ copysign(_A1 __x, _A2 __y)
using ::erf;
using ::erff;
-inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) {return erff(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) {return erfl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float erf(float __x) _NOEXCEPT {return erff(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __x) _NOEXCEPT {return erfl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-erf(_A1 __x) {return erf((double)__x);}
+erf(_A1 __x) _NOEXCEPT {return erf((double)__x);}
// erfc
using ::erfc;
using ::erfcf;
-inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) {return erfcf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) {return erfcl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float erfc(float __x) _NOEXCEPT {return erfcf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __x) _NOEXCEPT {return erfcl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-erfc(_A1 __x) {return erfc((double)__x);}
+erfc(_A1 __x) _NOEXCEPT {return erfc((double)__x);}
// exp2
using ::exp2;
using ::exp2f;
-inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) {return exp2f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) {return exp2l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float exp2(float __x) _NOEXCEPT {return exp2f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __x) _NOEXCEPT {return exp2l(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-exp2(_A1 __x) {return exp2((double)__x);}
+exp2(_A1 __x) _NOEXCEPT {return exp2((double)__x);}
// expm1
using ::expm1;
using ::expm1f;
-inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) {return expm1f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) {return expm1l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float expm1(float __x) _NOEXCEPT {return expm1f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __x) _NOEXCEPT {return expm1l(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-expm1(_A1 __x) {return expm1((double)__x);}
+expm1(_A1 __x) _NOEXCEPT {return expm1((double)__x);}
// fdim
using ::fdim;
using ::fdimf;
-inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) {return fdimf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) {return fdiml(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float fdim(float __x, float __y) _NOEXCEPT {return fdimf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __x, long double __y) _NOEXCEPT {return fdiml(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1191,7 +1191,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-fdim(_A1 __x, _A2 __y)
+fdim(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1201,13 +1201,13 @@ fdim(_A1 __x, _A2 __y)
// fma
-inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) {return (float)((double)__x*__y + __z);}
+inline _LIBCPP_INLINE_VISIBILITY float fmaf(float __x, float __y, float __z) _NOEXCEPT {return (float)((double)__x*__y + __z);}
#define FP_FAST_FMAF
using ::fma;
-inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) {return fmaf(__x, __y, __z);}
-inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) {return fmal(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY float fma(float __x, float __y, float __z) _NOEXCEPT {return fmaf(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __x, long double __y, long double __z) _NOEXCEPT {return fmal(__x, __y, __z);}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1218,7 +1218,7 @@ typename enable_if
is_arithmetic<_A3>::value,
typename __promote<_A1, _A2, _A3>::type
>::type
-fma(_A1 __x, _A2 __y, _A3 __z)
+fma(_A1 __x, _A2 __y, _A3 __z) _NOEXCEPT
{
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1232,8 +1232,8 @@ fma(_A1 __x, _A2 __y, _A3 __z)
using ::fmax;
using ::fmaxf;
-inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) {return fmaxf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) {return fmaxl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float fmax(float __x, float __y) _NOEXCEPT {return fmaxf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __x, long double __y) _NOEXCEPT {return fmaxl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1243,7 +1243,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-fmax(_A1 __x, _A2 __y)
+fmax(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1256,8 +1256,8 @@ fmax(_A1 __x, _A2 __y)
using ::fmin;
using ::fminf;
-inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) {return fminf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) {return fminl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float fmin(float __x, float __y) _NOEXCEPT {return fminf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __x, long double __y) _NOEXCEPT {return fminl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1267,7 +1267,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-fmin(_A1 __x, _A2 __y)
+fmin(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1280,8 +1280,8 @@ fmin(_A1 __x, _A2 __y)
using ::hypot;
using ::hypotf;
-inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) {return hypotf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) {return hypotl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float hypot(float __x, float __y) _NOEXCEPT {return hypotf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __x, long double __y) _NOEXCEPT {return hypotl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1291,7 +1291,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-hypot(_A1 __x, _A2 __y)
+hypot(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1304,27 +1304,27 @@ hypot(_A1 __x, _A2 __y)
using ::ilogb;
using ::ilogbf;
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) {return ilogbf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) {return ilogbl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __x) _NOEXCEPT {return ilogbf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __x) _NOEXCEPT {return ilogbl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, int>::type
-ilogb(_A1 __x) {return ilogb((double)__x);}
+ilogb(_A1 __x) _NOEXCEPT {return ilogb((double)__x);}
// lgamma
using ::lgamma;
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);}
+inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __x) _NOEXCEPT {return lgammaf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __x) _NOEXCEPT {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);}
+lgamma(_A1 __x) _NOEXCEPT {return lgamma((double)__x);}
// llrint
@@ -1332,91 +1332,91 @@ lgamma(_A1 __x) {return lgamma((double)__x);}
using ::llrint;
using ::llrintf;
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) {return llrintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) {return llrintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __x) _NOEXCEPT {return llrintf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __x) _NOEXCEPT {return llrintl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long long>::type
-llrint(_A1 __x) {return llrint((double)__x);}
+llrint(_A1 __x) _NOEXCEPT {return llrint((double)__x);}
// llround
using ::llround;
using ::llroundf;
-inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) {return llroundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) {return llroundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(float __x) _NOEXCEPT {return llroundf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __x) _NOEXCEPT {return llroundl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long long>::type
-llround(_A1 __x) {return llround((double)__x);}
+llround(_A1 __x) _NOEXCEPT {return llround((double)__x);}
// log1p
using ::log1p;
using ::log1pf;
-inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) {return log1pf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) {return log1pl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float log1p(float __x) _NOEXCEPT {return log1pf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __x) _NOEXCEPT {return log1pl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-log1p(_A1 __x) {return log1p((double)__x);}
+log1p(_A1 __x) _NOEXCEPT {return log1p((double)__x);}
// log2
using ::log2;
using ::log2f;
-inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) {return log2f(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) {return log2l(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float log2(float __x) _NOEXCEPT {return log2f(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __x) _NOEXCEPT {return log2l(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-log2(_A1 __x) {return log2((double)__x);}
+log2(_A1 __x) _NOEXCEPT {return log2((double)__x);}
// logb
using ::logb;
using ::logbf;
-inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) {return logbf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) {return logbl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float logb(float __x) _NOEXCEPT {return logbf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __x) _NOEXCEPT {return logbl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-logb(_A1 __x) {return logb((double)__x);}
+logb(_A1 __x) _NOEXCEPT {return logb((double)__x);}
// lrint
using ::lrint;
using ::lrintf;
-inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) {return lrintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) {return lrintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(float __x) _NOEXCEPT {return lrintf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __x) _NOEXCEPT {return lrintl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
-lrint(_A1 __x) {return lrint((double)__x);}
+lrint(_A1 __x) _NOEXCEPT {return lrint((double)__x);}
// lround
using ::lround;
using ::lroundf;
-inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) {return lroundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) {return lroundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(float __x) _NOEXCEPT {return lroundf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(long double __x) _NOEXCEPT {return lroundl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
-lround(_A1 __x) {return lround((double)__x);}
+lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
// nan
#endif // _MSC_VER
@@ -1431,21 +1431,21 @@ using ::nanf;
using ::nearbyint;
using ::nearbyintf;
-inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) {return nearbyintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) {return nearbyintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __x) _NOEXCEPT {return nearbyintf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __x) _NOEXCEPT {return nearbyintl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-nearbyint(_A1 __x) {return nearbyint((double)__x);}
+nearbyint(_A1 __x) _NOEXCEPT {return nearbyint((double)__x);}
// nextafter
using ::nextafter;
using ::nextafterf;
-inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) {return nextafterf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) {return nextafterl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __x, float __y) _NOEXCEPT {return nextafterf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __x, long double __y) _NOEXCEPT {return nextafterl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1455,7 +1455,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-nextafter(_A1 __x, _A2 __y)
+nextafter(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1468,21 +1468,21 @@ nextafter(_A1 __x, _A2 __y)
using ::nexttoward;
using ::nexttowardf;
-inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) {return nexttowardf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) {return nexttowardl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __x, long double __y) _NOEXCEPT {return nexttowardf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __x, long double __y) _NOEXCEPT {return nexttowardl(__x, __y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-nexttoward(_A1 __x, long double __y) {return nexttoward((double)__x, __y);}
+nexttoward(_A1 __x, long double __y) _NOEXCEPT {return nexttoward((double)__x, __y);}
// remainder
using ::remainder;
using ::remainderf;
-inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) {return remainderf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) {return remainderl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float remainder(float __x, float __y) _NOEXCEPT {return remainderf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __x, long double __y) _NOEXCEPT {return remainderl(__x, __y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1492,7 +1492,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-remainder(_A1 __x, _A2 __y)
+remainder(_A1 __x, _A2 __y) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1505,8 +1505,8 @@ remainder(_A1 __x, _A2 __y)
using ::remquo;
using ::remquof;
-inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) {return remquof(__x, __y, __z);}
-inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) {return remquol(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY float remquo(float __x, float __y, int* __z) _NOEXCEPT {return remquof(__x, __y, __z);}
+inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __x, long double __y, int* __z) _NOEXCEPT {return remquol(__x, __y, __z);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1516,7 +1516,7 @@ typename enable_if
is_arithmetic<_A2>::value,
typename __promote<_A1, _A2>::type
>::type
-remquo(_A1 __x, _A2 __y, int* __z)
+remquo(_A1 __x, _A2 __y, int* __z) _NOEXCEPT
{
typedef typename __promote<_A1, _A2>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
@@ -1529,78 +1529,78 @@ remquo(_A1 __x, _A2 __y, int* __z)
using ::rint;
using ::rintf;
-inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) {return rintf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) {return rintl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float rint(float __x) _NOEXCEPT {return rintf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __x) _NOEXCEPT {return rintl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-rint(_A1 __x) {return rint((double)__x);}
+rint(_A1 __x) _NOEXCEPT {return rint((double)__x);}
// round
using ::round;
using ::roundf;
-inline _LIBCPP_INLINE_VISIBILITY float round(float __x) {return roundf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) {return roundl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float round(float __x) _NOEXCEPT {return roundf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double round(long double __x) _NOEXCEPT {return roundl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-round(_A1 __x) {return round((double)__x);}
+round(_A1 __x) _NOEXCEPT {return round((double)__x);}
// scalbln
using ::scalbln;
using ::scalblnf;
-inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) {return scalblnf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) {return scalblnl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __x, long __y) _NOEXCEPT {return scalblnf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __x, long __y) _NOEXCEPT {return scalblnl(__x, __y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-scalbln(_A1 __x, long __y) {return scalbln((double)__x, __y);}
+scalbln(_A1 __x, long __y) _NOEXCEPT {return scalbln((double)__x, __y);}
// scalbn
using ::scalbn;
using ::scalbnf;
-inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) {return scalbnf(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) {return scalbnl(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __x, int __y) _NOEXCEPT {return scalbnf(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __x, int __y) _NOEXCEPT {return scalbnl(__x, __y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-scalbn(_A1 __x, int __y) {return scalbn((double)__x, __y);}
+scalbn(_A1 __x, int __y) _NOEXCEPT {return scalbn((double)__x, __y);}
// tgamma
using ::tgamma;
using ::tgammaf;
-inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) {return tgammaf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) {return tgammal(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __x) _NOEXCEPT {return tgammaf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __x) _NOEXCEPT {return tgammal(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-tgamma(_A1 __x) {return tgamma((double)__x);}
+tgamma(_A1 __x) _NOEXCEPT {return tgamma((double)__x);}
// trunc
using ::trunc;
using ::truncf;
-inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) {return truncf(__x);}
-inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) {return truncl(__x);}
+inline _LIBCPP_INLINE_VISIBILITY float trunc(float __x) _NOEXCEPT {return truncf(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __x) _NOEXCEPT {return truncl(__x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
-trunc(_A1 __x) {return trunc((double)__x);}
+trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
#endif // !_MSC_VER
diff --git a/include/complex b/include/complex
index 3b660a35a9ab..6f8815298ca6 100644
--- a/include/complex
+++ b/include/complex
@@ -330,13 +330,13 @@ class _LIBCPP_VISIBLE complex<float>
public:
typedef float value_type;
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {}
- explicit /*constexpr*/ complex(const complex<double>& __c);
- explicit /*constexpr*/ complex(const complex<long double>& __c);
+ explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
+ explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
@@ -386,13 +386,13 @@ class _LIBCPP_VISIBLE complex<double>
public:
typedef double value_type;
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {}
- /*constexpr*/ complex(const complex<float>& __c);
- explicit /*constexpr*/ complex(const complex<long double>& __c);
+ _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c);
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
@@ -442,13 +442,13 @@ class _LIBCPP_VISIBLE complex<long double>
public:
typedef long double value_type;
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {}
- /*constexpr*/ complex(const complex<float>& __c);
- /*constexpr*/ complex(const complex<double>& __c);
+ _LIBCPP_CONSTEXPR complex(const complex<float>& __c);
+ _LIBCPP_CONSTEXPR complex(const complex<double>& __c);
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
- /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
@@ -490,33 +490,33 @@ public:
}
};
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
-//constexpr
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
@@ -1351,7 +1351,11 @@ tanh(const complex<_Tp>& __x)
_Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i));
- return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
+ _Tp __2rsh(sinh(__2r));
+ if (isinf(__2rsh) && isinf(__d))
+ return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
+ __2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
+ return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
}
// asin
diff --git a/include/condition_variable b/include/condition_variable
index b4da556f6356..7d0b069a793b 100644
--- a/include/condition_variable
+++ b/include/condition_variable
@@ -28,8 +28,8 @@ public:
condition_variable(const condition_variable&) = delete;
condition_variable& operator=(const condition_variable&) = delete;
- void notify_one();
- void notify_all();
+ void notify_one() noexcept;
+ void notify_all() noexcept;
void wait(unique_lock<mutex>& lock);
template <class Predicate>
@@ -72,8 +72,8 @@ public:
condition_variable_any(const condition_variable_any&) = delete;
condition_variable_any& operator=(const condition_variable_any&) = delete;
- void notify_one();
- void notify_all();
+ void notify_one() noexcept;
+ void notify_all() noexcept;
template <class Lock>
void wait(Lock& lock);
@@ -124,8 +124,8 @@ class _LIBCPP_VISIBLE condition_variable_any
public:
condition_variable_any();
- void notify_one();
- void notify_all();
+ void notify_one() _NOEXCEPT;
+ void notify_all() _NOEXCEPT;
template <class _Lock>
void wait(_Lock& __lock);
@@ -161,7 +161,7 @@ condition_variable_any::condition_variable_any()
inline _LIBCPP_INLINE_VISIBILITY
void
-condition_variable_any::notify_one()
+condition_variable_any::notify_one() _NOEXCEPT
{
{lock_guard<mutex> _(*__mut_);}
__cv_.notify_one();
@@ -169,7 +169,7 @@ condition_variable_any::notify_one()
inline _LIBCPP_INLINE_VISIBILITY
void
-condition_variable_any::notify_all()
+condition_variable_any::notify_all() _NOEXCEPT
{
{lock_guard<mutex> _(*__mut_);}
__cv_.notify_all();
diff --git a/include/cstddef b/include/cstddef
index 4a6b16e186b8..4b01be26afed 100644
--- a/include/cstddef
+++ b/include/cstddef
@@ -62,28 +62,28 @@ 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 _LIBCPP_CONSTEXPR nullptr_t() : _(0) {}
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : _(0) {}
- _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
template <class _Tp>
- _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
operator _Tp* () const {return 0;}
template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;}
- friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
- friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
- friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
};
-inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
+inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t()
diff --git a/include/cstdio b/include/cstdio
index 2a6ec762deae..718d2f715516 100644
--- a/include/cstdio
+++ b/include/cstdio
@@ -103,6 +103,18 @@ void perror(const char* s);
#pragma GCC system_header
#endif
+#ifdef getc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
+#undef getc
+inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
+#endif // getc
+
+#ifdef putc
+inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
+#undef putc
+inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
+#endif // putc
+
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;
diff --git a/include/cstdlib b/include/cstdlib
index a5c78e98274f..7f6c6c82f7de 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -74,6 +74,9 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
+int at_quick_exit(void (*func)(void)) // C++11
+void quick_exit(int status); // C++11
+void *aligned_alloc(size_t alignment, size_t size); // C11
} // std
@@ -135,14 +138,17 @@ using ::wcstombs;
using ::at_quick_exit;
using ::quick_exit;
#endif
+#ifdef _LIBCPP_HAS_C11_FEATURES
+using ::aligned_alloc;
+#endif
// 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);}
+inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
+inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
-inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
-inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
+inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _MSC_VER
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/deque b/include/deque
index e65acfc806d4..b86d77f9f20d 100644
--- a/include/deque
+++ b/include/deque
@@ -1966,6 +1966,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
}
else
{
+ value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
@@ -1973,7 +1974,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
++__base::size();
if (__pos > 1)
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
- *__b = value_type(_VSTD::forward<_Args>(__args)...);
+ *__b = _VSTD::move(__tmp);
}
}
else
@@ -1989,13 +1990,14 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
}
else
{
+ value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _VSTD::move_backward(__e - __de, __em1, __e);
- *--__e = value_type(_VSTD::forward<_Args>(__args)...);
+ *--__e = _VSTD::move(__tmp);
}
}
return __base::begin() + __pos;
diff --git a/include/exception b/include/exception
index f7c3b70b00ea..5b75fb04bbba 100644
--- a/include/exception
+++ b/include/exception
@@ -107,19 +107,19 @@ public:
typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
-_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
+_LIBCPP_NORETURN _LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
-_ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
+_LIBCPP_NORETURN _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
-class exception_ptr;
+class _LIBCPP_VISIBLE exception_ptr;
exception_ptr current_exception() _NOEXCEPT;
-_ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
+_LIBCPP_NORETURN void rethrow_exception(exception_ptr);
class _LIBCPP_VISIBLE exception_ptr
{
@@ -143,7 +143,7 @@ public:
{return !(__x == __y);}
friend exception_ptr current_exception() _NOEXCEPT;
- _ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
+ _LIBCPP_NORETURN friend void rethrow_exception(exception_ptr);
};
template<class _Ep>
@@ -174,7 +174,7 @@ public:
virtual ~nested_exception() _NOEXCEPT;
// access functions
- _ATTRIBUTE(noreturn) void rethrow_nested() const;
+ _LIBCPP_NORETURN void rethrow_nested() const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
};
@@ -187,7 +187,7 @@ struct __nested
};
template <class _Tp>
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
@@ -206,7 +206,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
}
template <class _Tp>
-_ATTRIBUTE(noreturn)
+_LIBCPP_NORETURN
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if<
diff --git a/include/forward_list b/include/forward_list
index 19f748478f5d..404c6eb1cb0f 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -212,8 +212,8 @@ struct __forward_list_node
value_type __value_;
};
-template<class _Tp, class _Alloc> class forward_list;
-template<class _NodeConstPtr> class __forward_list_const_iterator;
+template<class _Tp, class _Alloc> class _LIBCPP_VISIBLE forward_list;
+template<class _NodeConstPtr> class _LIBCPP_VISIBLE __forward_list_const_iterator;
template <class _NodePtr>
class _LIBCPP_VISIBLE __forward_list_iterator
@@ -225,8 +225,8 @@ class _LIBCPP_VISIBLE __forward_list_iterator
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
- template<class, class> friend class forward_list;
- template<class> friend class __forward_list_const_iterator;
+ template<class, class> friend class _LIBCPP_VISIBLE forward_list;
+ template<class> friend class _LIBCPP_VISIBLE __forward_list_const_iterator;
public:
typedef forward_iterator_tag iterator_category;
diff --git a/include/fstream b/include/fstream
index 8e1b1fb69e25..1b8e7a0a5d47 100644
--- a/include/fstream
+++ b/include/fstream
@@ -234,6 +234,7 @@ private:
FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_;
state_type __st_;
+ state_type __st_last_;
ios_base::openmode __om_;
ios_base::openmode __cm_;
bool __owns_eb_;
@@ -253,14 +254,20 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__intbuf_(0),
__ibs_(0),
__file_(0),
- __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
+ __cv_(nullptr),
__st_(),
+ __st_last_(),
__om_(0),
__cm_(0),
__owns_eb_(false),
__owns_ib_(false),
- __always_noconv_(__cv_->always_noconv())
+ __always_noconv_(false)
{
+ if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
+ {
+ __cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
+ __always_noconv_ = __cv_->always_noconv();
+ }
setbuf(0, 4096);
}
@@ -288,6 +295,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__file_ = __rhs.__file_;
__cv_ = __rhs.__cv_;
__st_ = __rhs.__st_;
+ __st_last_ = __rhs.__st_last_;
__om_ = __rhs.__om_;
__cm_ = __rhs.__cm_;
__owns_eb_ = __rhs.__owns_eb_;
@@ -320,6 +328,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__rhs.__ibs_ = 0;
__rhs.__file_ = 0;
__rhs.__st_ = state_type();
+ __rhs.__st_last_ = state_type();
__rhs.__om_ = 0;
__rhs.__cm_ = 0;
__rhs.__owns_eb_ = false;
@@ -335,6 +344,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
{
close();
swap(__rhs);
+ return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -397,6 +407,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
_VSTD::swap(__file_, __rhs.__file_);
_VSTD::swap(__cv_, __rhs.__cv_);
_VSTD::swap(__st_, __rhs.__st_);
+ _VSTD::swap(__st_last_, __rhs.__st_last_);
_VSTD::swap(__om_, __rhs.__om_);
_VSTD::swap(__cm_, __rhs.__cm_);
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
@@ -591,18 +602,22 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
- size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
+ size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
- state_type __svs = __st_;
+ __st_last_ = __st_;
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
if (__nr != 0)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!__cv_)
+ throw bad_cast();
+#endif
__extbufend_ = __extbufnext_ + __nr;
char_type* __inext;
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
this->eback() + __unget_sz,
- this->egptr(), __inext);
+ this->eback() + __ibs_, __inext);
if (__r == codecvt_base::noconv)
{
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
@@ -676,6 +691,10 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
codecvt_base::result __r;
do
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!__cv_)
+ throw bad_cast();
+#endif
const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -765,6 +784,10 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode)
{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!__cv_)
+ throw bad_cast();
+#endif
int __width = __cv_->encoding();
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
@@ -799,6 +822,7 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
return pos_type(off_type(-1));
if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
+ __st_ = __sp.state();
return __sp;
}
@@ -808,6 +832,10 @@ basic_filebuf<_CharT, _Traits>::sync()
{
if (__file_ == 0)
return 0;
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ if (!__cv_)
+ throw bad_cast();
+#endif
if (__cm_ & ios_base::out)
{
if (this->pptr() != this->pbase())
@@ -830,6 +858,8 @@ basic_filebuf<_CharT, _Traits>::sync()
else if (__cm_ & ios_base::in)
{
off_type __c;
+ state_type __state = __st_last_;
+ bool __update_st = false;
if (__always_noconv_)
__c = this->egptr() - this->gptr();
else
@@ -842,32 +872,19 @@ basic_filebuf<_CharT, _Traits>::sync()
{
if (this->gptr() != this->egptr())
{
- reverse(this->gptr(), this->egptr());
- codecvt_base::result __r;
- const char_type* __e = this->gptr();
- char* __extbe;
- do
- {
- __r = __cv_->out(__st_, __e, this->egptr(), __e,
- __extbuf_, __extbuf_ + __ebs_, __extbe);
- switch (__r)
- {
- case codecvt_base::noconv:
- __c += this->egptr() - this->gptr();
- break;
- case codecvt_base::ok:
- case codecvt_base::partial:
- __c += __extbe - __extbuf_;
- break;
- default:
- return -1;
- }
- } while (__r == codecvt_base::partial);
+ const int __off = __cv_->length(__state, __extbuf_,
+ __extbufnext_,
+ this->gptr() - this->eback());
+ __c += __extbufnext_ - __extbuf_ - __off;
+ __update_st = true;
}
}
}
if (fseeko(__file_, -__c, SEEK_CUR))
return -1;
+ if (__update_st)
+ __st_ = __state;
+ __extbufnext_ = __extbufend_ = __extbuf_;
this->setg(0, 0, 0);
__cm_ = 0;
}
diff --git a/include/functional b/include/functional
index 884a57773514..ec5c5e593334 100644
--- a/include/functional
+++ b/include/functional
@@ -1113,7 +1113,8 @@ class _LIBCPP_VISIBLE function<_Rp(_ArgTypes...)>
_LIBCPP_INLINE_VISIBILITY
static bool __not_null(const function<_Rp(_Ap...)>& __p) {return __p;}
- template <class _Fp, bool = __invokable<_Fp&, _ArgTypes...>::value>
+ template <class _Fp, bool = !is_same<_Fp, function>::value &&
+ __invokable<_Fp&, _ArgTypes...>::value>
struct __callable;
template <class _Fp>
struct __callable<_Fp, true>
@@ -1350,6 +1351,7 @@ function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
__f_ = __f.__f_;
__f.__f_ = 0;
}
+ return *this;
}
template<class _Rp, class ..._ArgTypes>
@@ -1361,6 +1363,7 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
else if (__f_)
__f_->destroy_deallocate();
__f_ = 0;
+ return *this;
}
template<class _Rp, class ..._ArgTypes>
@@ -1707,7 +1710,11 @@ public:
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
- template <class _Gp, class ..._BA>
+ template <class _Gp, class ..._BA,
+ class = typename enable_if
+ <
+ is_constructible<_Fd, _Gp>::value
+ >::type>
_LIBCPP_INLINE_VISIBILITY
explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
: __f_(_VSTD::forward<_Gp>(__f)),
diff --git a/include/future b/include/future
index aae707e1e4e8..39475bd955c8 100644
--- a/include/future
+++ b/include/future
@@ -40,10 +40,10 @@ enum class future_status
};
template <> struct is_error_code_enum<future_errc> : public true_type { };
-error_code make_error_code(future_errc e);
-error_condition make_error_condition(future_errc e);
+error_code make_error_code(future_errc e) noexcept;
+error_condition make_error_condition(future_errc e) noexcept;
-const error_category& future_category();
+const error_category& future_category() noexcept;
class future_error
: public logic_error
@@ -51,8 +51,8 @@ class future_error
public:
future_error(error_code ec); // exposition only
- const error_code& code() const throw();
- const char* what() const throw();
+ const error_code& code() const noexcept;
+ const char* what() const noexcept;
};
template <class R>
@@ -62,14 +62,14 @@ public:
promise();
template <class Allocator>
promise(allocator_arg_t, const Allocator& a);
- promise(promise&& rhs);
+ promise(promise&& rhs) noexcept;
promise(const promise& rhs) = delete;
~promise();
// assignment
- promise& operator=(promise&& rhs);
+ promise& operator=(promise&& rhs) noexcept;
promise& operator=(const promise& rhs) = delete;
- void swap(promise& other);
+ void swap(promise& other) noexcept;
// retrieving the result
future<R> get_future();
@@ -92,14 +92,14 @@ public:
promise();
template <class Allocator>
promise(allocator_arg_t, const Allocator& a);
- promise(promise&& rhs);
+ promise(promise&& rhs) noexcept;
promise(const promise& rhs) = delete;
~promise();
// assignment
- promise& operator=(promise&& rhs);
+ promise& operator=(promise&& rhs) noexcept;
promise& operator=(const promise& rhs) = delete;
- void swap(promise& other);
+ void swap(promise& other) noexcept;
// retrieving the result
future<R&> get_future();
@@ -120,14 +120,14 @@ public:
promise();
template <class Allocator>
promise(allocator_arg_t, const Allocator& a);
- promise(promise&& rhs);
+ promise(promise&& rhs) noexcept;
promise(const promise& rhs) = delete;
~promise();
// assignment
- promise& operator=(promise&& rhs);
+ promise& operator=(promise&& rhs) noexcept;
promise& operator=(const promise& rhs) = delete;
- void swap(promise& other);
+ void swap(promise& other) noexcept;
// retrieving the result
future<void> get_future();
@@ -141,7 +141,7 @@ public:
void set_exception_at_thread_exit(exception_ptr p);
};
-template <class R> void swap(promise<R>& x, promise<R>& y);
+template <class R> void swap(promise<R>& x, promise<R>& y) noexcept;
template <class R, class Alloc>
struct uses_allocator<promise<R>, Alloc> : public true_type {};
@@ -150,19 +150,19 @@ template <class R>
class future
{
public:
- future();
- future(future&&);
+ future() noexcept;
+ future(future&&) noexcept;
future(const future& rhs) = delete;
~future();
future& operator=(const future& rhs) = delete;
- future& operator=(future&&);
- shared_future<R> share() &&;
+ future& operator=(future&&) noexcept;
+ shared_future<R> share();
// retrieving the value
R get();
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -177,19 +177,19 @@ template <class R>
class future<R&>
{
public:
- future();
- future(future&&);
+ future() noexcept;
+ future(future&&) noexcept;
future(const future& rhs) = delete;
~future();
future& operator=(const future& rhs) = delete;
- future& operator=(future&&);
- shared_future<R&> share() &&;
+ future& operator=(future&&) noexcept;
+ shared_future<R&> share();
// retrieving the value
R& get();
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -204,19 +204,19 @@ template <>
class future<void>
{
public:
- future();
- future(future&&);
+ future() noexcept;
+ future(future&&) noexcept;
future(const future& rhs) = delete;
~future();
future& operator=(const future& rhs) = delete;
- future& operator=(future&&);
- shared_future<void> share() &&;
+ future& operator=(future&&) noexcept;
+ shared_future<void> share();
// retrieving the value
void get();
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -231,19 +231,19 @@ template <class R>
class shared_future
{
public:
- shared_future();
+ shared_future() noexcept;
shared_future(const shared_future& rhs);
- shared_future(future<R>&&);
- shared_future(shared_future&& rhs);
+ shared_future(future<R>&&) noexcept;
+ shared_future(shared_future&& rhs) noexcept;
~shared_future();
shared_future& operator=(const shared_future& rhs);
- shared_future& operator=(shared_future&& rhs);
+ shared_future& operator=(shared_future&& rhs) noexcept;
// retrieving the value
const R& get() const;
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -258,19 +258,19 @@ template <class R>
class shared_future<R&>
{
public:
- shared_future();
+ shared_future() noexcept;
shared_future(const shared_future& rhs);
- shared_future(future<R&>&&);
- shared_future(shared_future&& rhs);
+ shared_future(future<R&>&&) noexcept;
+ shared_future(shared_future&& rhs) noexcept;
~shared_future();
shared_future& operator=(const shared_future& rhs);
- shared_future& operator=(shared_future&& rhs);
+ shared_future& operator=(shared_future&& rhs) noexcept;
// retrieving the value
R& get() const;
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -285,19 +285,19 @@ template <>
class shared_future<void>
{
public:
- shared_future();
+ shared_future() noexcept;
shared_future(const shared_future& rhs);
- shared_future(future<void>&&);
- shared_future(shared_future&& rhs);
+ shared_future(future<void>&&) noexcept;
+ shared_future(shared_future&& rhs) noexcept;
~shared_future();
shared_future& operator=(const shared_future& rhs);
- shared_future& operator=(shared_future&& rhs);
+ shared_future& operator=(shared_future&& rhs) noexcept;
// retrieving the value
void get() const;
// functions to check state
- bool valid() const;
+ bool valid() const noexcept;
void wait() const;
template <class Rep, class Period>
@@ -325,7 +325,7 @@ public:
typedef R result_type;
// construction and destruction
- packaged_task();
+ packaged_task() noexcept;
template <class F>
explicit packaged_task(F&& f);
template <class F, class Allocator>
@@ -333,15 +333,15 @@ public:
~packaged_task();
// no copy
- packaged_task(packaged_task&) = delete;
- packaged_task& operator=(packaged_task&) = delete;
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
// move support
- packaged_task(packaged_task&& other);
- packaged_task& operator=(packaged_task&& other);
- void swap(packaged_task& other);
+ packaged_task(packaged_task&& other) noexcept;
+ packaged_task& operator=(packaged_task&& other) noexcept;
+ void swap(packaged_task& other) noexcept;
- bool valid() const;
+ bool valid() const noexcept;
// result retrieval
future<R> get_future();
@@ -354,7 +354,7 @@ public:
};
template <class R>
- void swap(packaged_task<R(ArgTypes...)&, packaged_task<R(ArgTypes...)>&);
+ void swap(packaged_task<R(ArgTypes...)&, packaged_task<R(ArgTypes...)>&) noexcept;
template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
@@ -413,18 +413,18 @@ _LIBCPP_DECLARE_STRONG_ENUM(future_status)
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_status)
_LIBCPP_VISIBLE
-const error_category& future_category();
+const error_category& future_category() _NOEXCEPT;
inline _LIBCPP_INLINE_VISIBILITY
error_code
-make_error_code(future_errc __e)
+make_error_code(future_errc __e) _NOEXCEPT
{
return error_code(static_cast<int>(__e), future_category());
}
inline _LIBCPP_INLINE_VISIBILITY
error_condition
-make_error_condition(future_errc __e)
+make_error_condition(future_errc __e) _NOEXCEPT
{
return error_condition(static_cast<int>(__e), future_category());
}
@@ -437,7 +437,7 @@ public:
future_error(error_code __ec);
_LIBCPP_INLINE_VISIBILITY
- const error_code& code() const throw() {return __ec_;}
+ const error_code& code() const _NOEXCEPT {return __ec_;}
virtual ~future_error() _NOEXCEPT;
};
@@ -755,7 +755,6 @@ template <class _Alloc>
void
__assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
{
- this->~base();
typename _Alloc::template rebind<__assoc_sub_state_alloc>::other __a(__alloc_);
this->~__assoc_sub_state_alloc();
__a.deallocate(this, 1);
@@ -963,12 +962,12 @@ __async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
base::__on_zero_shared();
}
-template <class _Rp> class promise;
-template <class _Rp> class shared_future;
+template <class _Rp> class _LIBCPP_VISIBLE promise;
+template <class _Rp> class _LIBCPP_VISIBLE shared_future;
// future
-template <class _Rp> class future;
+template <class _Rp> class _LIBCPP_VISIBLE future;
template <class _Rp, class _Fp>
future<_Rp>
@@ -1010,15 +1009,15 @@ class _LIBCPP_VISIBLE future
public:
_LIBCPP_INLINE_VISIBILITY
- future() : __state_(nullptr) {}
+ future() _NOEXCEPT : __state_(nullptr) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- future(future&& __rhs)
+ future(future&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
future(const future&) = delete;
future& operator=(const future&) = delete;
_LIBCPP_INLINE_VISIBILITY
- future& operator=(future&& __rhs)
+ future& operator=(future&& __rhs) _NOEXCEPT
{
future(std::move(__rhs)).swap(*this);
return *this;
@@ -1036,11 +1035,11 @@ public:
_Rp get();
_LIBCPP_INLINE_VISIBILITY
- void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -1114,15 +1113,15 @@ class _LIBCPP_VISIBLE future<_Rp&>
public:
_LIBCPP_INLINE_VISIBILITY
- future() : __state_(nullptr) {}
+ future() _NOEXCEPT : __state_(nullptr) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- future(future&& __rhs)
+ future(future&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
future(const future&) = delete;
future& operator=(const future&) = delete;
_LIBCPP_INLINE_VISIBILITY
- future& operator=(future&& __rhs)
+ future& operator=(future&& __rhs) _NOEXCEPT
{
future(std::move(__rhs)).swap(*this);
return *this;
@@ -1140,11 +1139,11 @@ public:
_Rp& get();
_LIBCPP_INLINE_VISIBILITY
- void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -1213,15 +1212,15 @@ class _LIBCPP_VISIBLE future<void>
public:
_LIBCPP_INLINE_VISIBILITY
- future() : __state_(nullptr) {}
+ future() _NOEXCEPT : __state_(nullptr) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- future(future&& __rhs)
+ future(future&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
future(const future&) = delete;
future& operator=(const future&) = delete;
_LIBCPP_INLINE_VISIBILITY
- future& operator=(future&& __rhs)
+ future& operator=(future&& __rhs) _NOEXCEPT
{
future(std::move(__rhs)).swap(*this);
return *this;
@@ -1239,11 +1238,11 @@ public:
void get();
_LIBCPP_INLINE_VISIBILITY
- void swap(future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -1262,7 +1261,7 @@ public:
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(future<_Rp>& __x, future<_Rp>& __y)
+swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
{
__x.swap(__y);
}
@@ -1277,7 +1276,7 @@ class _LIBCPP_VISIBLE promise
__assoc_state<_Rp>* __state_;
_LIBCPP_INLINE_VISIBILITY
- explicit promise(nullptr_t) : __state_(nullptr) {}
+ explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
template <class> friend class packaged_task;
public:
@@ -1286,7 +1285,7 @@ public:
promise(allocator_arg_t, const _Alloc& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise(promise&& __rhs)
+ promise(promise&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
promise(const promise& __rhs) = delete;
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1299,7 +1298,7 @@ public:
// assignment
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise& operator=(promise&& __rhs)
+ promise& operator=(promise&& __rhs) _NOEXCEPT
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -1311,7 +1310,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// retrieving the result
future<_Rp> get_future();
@@ -1455,7 +1454,7 @@ class _LIBCPP_VISIBLE promise<_Rp&>
__assoc_state<_Rp&>* __state_;
_LIBCPP_INLINE_VISIBILITY
- explicit promise(nullptr_t) : __state_(nullptr) {}
+ explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
template <class> friend class packaged_task;
@@ -1465,7 +1464,7 @@ public:
promise(allocator_arg_t, const _Allocator& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise(promise&& __rhs)
+ promise(promise&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
promise(const promise& __rhs) = delete;
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1478,7 +1477,7 @@ public:
// assignment
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise& operator=(promise&& __rhs)
+ promise& operator=(promise&& __rhs) _NOEXCEPT
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -1490,7 +1489,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// retrieving the result
future<_Rp&> get_future();
@@ -1598,7 +1597,7 @@ class _LIBCPP_VISIBLE promise<void>
__assoc_sub_state* __state_;
_LIBCPP_INLINE_VISIBILITY
- explicit promise(nullptr_t) : __state_(nullptr) {}
+ explicit promise(nullptr_t) _NOEXCEPT : __state_(nullptr) {}
template <class> friend class packaged_task;
@@ -1608,7 +1607,7 @@ public:
promise(allocator_arg_t, const _Allocator& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise(promise&& __rhs)
+ promise(promise&& __rhs) _NOEXCEPT
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
promise(const promise& __rhs) = delete;
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1621,7 +1620,7 @@ public:
// assignment
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- promise& operator=(promise&& __rhs)
+ promise& operator=(promise&& __rhs) _NOEXCEPT
{
promise(std::move(__rhs)).swap(*this);
return *this;
@@ -1633,7 +1632,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- void swap(promise& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// retrieving the result
future<void> get_future();
@@ -1661,7 +1660,7 @@ promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(promise<_Rp>& __x, promise<_Rp>& __y)
+swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
{
__x.swap(__y);
}
@@ -1686,7 +1685,7 @@ public:
__packaged_task_base() {}
_LIBCPP_INLINE_VISIBILITY
virtual ~__packaged_task_base() {}
- virtual void __move_to(__packaged_task_base*) = 0;
+ virtual void __move_to(__packaged_task_base*) _NOEXCEPT = 0;
virtual void destroy() = 0;
virtual void destroy_deallocate() = 0;
virtual _Rp operator()(_ArgTypes&& ...) = 0;
@@ -1710,7 +1709,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__packaged_task_func(_Fp&& __f, const _Alloc& __a)
: __f_(_VSTD::move(__f), __a) {}
- virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*);
+ virtual void __move_to(__packaged_task_base<_Rp(_ArgTypes...)>*) _NOEXCEPT;
virtual void destroy();
virtual void destroy_deallocate();
virtual _Rp operator()(_ArgTypes&& ... __args);
@@ -1719,7 +1718,7 @@ public:
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
void
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
- __packaged_task_base<_Rp(_ArgTypes...)>* __p)
+ __packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
{
::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
}
@@ -1762,27 +1761,27 @@ public:
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
- __packaged_task_function() : __f_(nullptr) {}
+ __packaged_task_function() _NOEXCEPT : __f_(nullptr) {}
template<class _Fp>
__packaged_task_function(_Fp&& __f);
template<class _Fp, class _Alloc>
__packaged_task_function(allocator_arg_t, const _Alloc& __a, _Fp&& __f);
- __packaged_task_function(__packaged_task_function&&);
- __packaged_task_function& operator=(__packaged_task_function&&);
+ __packaged_task_function(__packaged_task_function&&) _NOEXCEPT;
+ __packaged_task_function& operator=(__packaged_task_function&&) _NOEXCEPT;
__packaged_task_function(const __packaged_task_function&) = delete;
__packaged_task_function& operator=(const __packaged_task_function&) = delete;
~__packaged_task_function();
- void swap(__packaged_task_function&);
+ void swap(__packaged_task_function&) _NOEXCEPT;
_Rp operator()(_ArgTypes...) const;
};
template<class _Rp, class ..._ArgTypes>
-__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f)
+__packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged_task_function&& __f) _NOEXCEPT
{
if (__f.__f_ == nullptr)
__f_ = nullptr;
@@ -1854,7 +1853,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
template<class _Rp, class ..._ArgTypes>
__packaged_task_function<_Rp(_ArgTypes...)>&
-__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f)
+__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
{
if (__f_ == (__base*)&__buf_)
__f_->destroy();
@@ -1873,6 +1872,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&
__f_ = __f.__f_;
__f.__f_ = nullptr;
}
+ return *this;
}
template<class _Rp, class ..._ArgTypes>
@@ -1886,7 +1886,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
template<class _Rp, class ..._ArgTypes>
void
-__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f)
+__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
{
if (__f_ == (__base*)&__buf_ && __f.__f_ == (__base*)&__f.__buf_)
{
@@ -1942,7 +1942,7 @@ private:
public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
- packaged_task() : __p_(nullptr) {}
+ packaged_task() _NOEXCEPT : __p_(nullptr) {}
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
@@ -1954,29 +1954,29 @@ public:
// ~packaged_task() = default;
// no copy
- packaged_task(packaged_task&) = delete;
- packaged_task& operator=(packaged_task&) = delete;
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
// move support
_LIBCPP_INLINE_VISIBILITY
- packaged_task(packaged_task&& __other)
+ packaged_task(packaged_task&& __other) _NOEXCEPT
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
_LIBCPP_INLINE_VISIBILITY
- packaged_task& operator=(packaged_task&& __other)
+ packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
{
__f_ = _VSTD::move(__other.__f_);
__p_ = _VSTD::move(__other.__p_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
- void swap(packaged_task& __other)
+ void swap(packaged_task& __other) _NOEXCEPT
{
__f_.swap(__other.__f_);
__p_.swap(__other.__p_);
}
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __p_.__state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
// result retrieval
_LIBCPP_INLINE_VISIBILITY
@@ -2057,7 +2057,7 @@ private:
public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
- packaged_task() : __p_(nullptr) {}
+ packaged_task() _NOEXCEPT : __p_(nullptr) {}
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
@@ -2069,29 +2069,29 @@ public:
// ~packaged_task() = default;
// no copy
- packaged_task(packaged_task&) = delete;
- packaged_task& operator=(packaged_task&) = delete;
+ packaged_task(const packaged_task&) = delete;
+ packaged_task& operator=(const packaged_task&) = delete;
// move support
_LIBCPP_INLINE_VISIBILITY
- packaged_task(packaged_task&& __other)
+ packaged_task(packaged_task&& __other) _NOEXCEPT
: __f_(_VSTD::move(__other.__f_)), __p_(_VSTD::move(__other.__p_)) {}
_LIBCPP_INLINE_VISIBILITY
- packaged_task& operator=(packaged_task&& __other)
+ packaged_task& operator=(packaged_task&& __other) _NOEXCEPT
{
__f_ = _VSTD::move(__other.__f_);
__p_ = _VSTD::move(__other.__p_);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
- void swap(packaged_task& __other)
+ void swap(packaged_task& __other) _NOEXCEPT
{
__f_.swap(__other.__f_);
__p_.swap(__other.__p_);
}
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __p_.__state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __p_.__state_ != nullptr;}
// result retrieval
_LIBCPP_INLINE_VISIBILITY
@@ -2164,7 +2164,7 @@ packaged_task<void(_ArgTypes...)>::reset()
template <class _Callable>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y)
+swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) _NOEXCEPT
{
__x.swap(__y);
}
@@ -2265,23 +2265,23 @@ class _LIBCPP_VISIBLE shared_future
public:
_LIBCPP_INLINE_VISIBILITY
- shared_future() : __state_(nullptr) {}
+ shared_future() _NOEXCEPT : __state_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
{if (__state_) __state_->__add_shared();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future(future<_Rp>&& __f) : __state_(__f.__state_)
+ shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
{__f.__state_ = nullptr;}
_LIBCPP_INLINE_VISIBILITY
- shared_future(shared_future&& __rhs) : __state_(__rhs.__state_)
+ shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
{__rhs.__state_ = nullptr;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~shared_future();
shared_future& operator=(const shared_future& __rhs);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future& operator=(shared_future&& __rhs)
+ shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
{
shared_future(std::move(__rhs)).swap(*this);
return *this;
@@ -2293,11 +2293,11 @@ public:
const _Rp& get() const {return __state_->copy();}
_LIBCPP_INLINE_VISIBILITY
- void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -2339,23 +2339,23 @@ class _LIBCPP_VISIBLE shared_future<_Rp&>
public:
_LIBCPP_INLINE_VISIBILITY
- shared_future() : __state_(nullptr) {}
+ shared_future() _NOEXCEPT : __state_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
{if (__state_) __state_->__add_shared();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future(future<_Rp&>&& __f) : __state_(__f.__state_)
+ shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
{__f.__state_ = nullptr;}
_LIBCPP_INLINE_VISIBILITY
- shared_future(shared_future&& __rhs) : __state_(__rhs.__state_)
+ shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
{__rhs.__state_ = nullptr;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~shared_future();
shared_future& operator=(const shared_future& __rhs);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future& operator=(shared_future&& __rhs)
+ shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
{
shared_future(std::move(__rhs)).swap(*this);
return *this;
@@ -2367,11 +2367,11 @@ public:
_Rp& get() const {return __state_->copy();}
_LIBCPP_INLINE_VISIBILITY
- void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -2413,23 +2413,23 @@ class _LIBCPP_VISIBLE shared_future<void>
public:
_LIBCPP_INLINE_VISIBILITY
- shared_future() : __state_(nullptr) {}
+ shared_future() _NOEXCEPT : __state_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
{if (__state_) __state_->__add_shared();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future(future<void>&& __f) : __state_(__f.__state_)
+ shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
{__f.__state_ = nullptr;}
_LIBCPP_INLINE_VISIBILITY
- shared_future(shared_future&& __rhs) : __state_(__rhs.__state_)
+ shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
{__rhs.__state_ = nullptr;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~shared_future();
shared_future& operator=(const shared_future& __rhs);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- shared_future& operator=(shared_future&& __rhs)
+ shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
{
shared_future(std::move(__rhs)).swap(*this);
return *this;
@@ -2441,11 +2441,11 @@ public:
void get() const {__state_->copy();}
_LIBCPP_INLINE_VISIBILITY
- void swap(shared_future& __rhs) {_VSTD::swap(__state_, __rhs.__state_);}
+ void swap(shared_future& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
// functions to check state
_LIBCPP_INLINE_VISIBILITY
- bool valid() const {return __state_ != nullptr;}
+ bool valid() const _NOEXCEPT {return __state_ != nullptr;}
_LIBCPP_INLINE_VISIBILITY
void wait() const {__state_->wait();}
@@ -2464,7 +2464,7 @@ public:
template <class _Rp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y)
+swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
{
__x.swap(__y);
}
diff --git a/include/ios b/include/ios
index 51d50870b607..7e489e390aaa 100644
--- a/include/ios
+++ b/include/ios
@@ -29,43 +29,43 @@ public:
class failure;
typedef T1 fmtflags;
- static const fmtflags boolalpha;
- static const fmtflags dec;
- static const fmtflags fixed;
- static const fmtflags hex;
- static const fmtflags internal;
- static const fmtflags left;
- static const fmtflags oct;
- static const fmtflags right;
- static const fmtflags scientific;
- static const fmtflags showbase;
- static const fmtflags showpoint;
- static const fmtflags showpos;
- static const fmtflags skipws;
- static const fmtflags unitbuf;
- static const fmtflags uppercase;
- static const fmtflags adjustfield;
- static const fmtflags basefield;
- static const fmtflags floatfield;
+ static constexpr fmtflags boolalpha;
+ static constexpr fmtflags dec;
+ static constexpr fmtflags fixed;
+ static constexpr fmtflags hex;
+ static constexpr fmtflags internal;
+ static constexpr fmtflags left;
+ static constexpr fmtflags oct;
+ static constexpr fmtflags right;
+ static constexpr fmtflags scientific;
+ static constexpr fmtflags showbase;
+ static constexpr fmtflags showpoint;
+ static constexpr fmtflags showpos;
+ static constexpr fmtflags skipws;
+ static constexpr fmtflags unitbuf;
+ static constexpr fmtflags uppercase;
+ static constexpr fmtflags adjustfield;
+ static constexpr fmtflags basefield;
+ static constexpr fmtflags floatfield;
typedef T2 iostate;
- static const iostate badbit;
- static const iostate eofbit;
- static const iostate failbit;
- static const iostate goodbit;
+ static constexpr iostate badbit;
+ static constexpr iostate eofbit;
+ static constexpr iostate failbit;
+ static constexpr iostate goodbit;
typedef T3 openmode;
- static const openmode app;
- static const openmode ate;
- static const openmode binary;
- static const openmode in;
- static const openmode out;
- static const openmode trunc;
+ static constexpr openmode app;
+ static constexpr openmode ate;
+ static constexpr openmode binary;
+ static constexpr openmode in;
+ static constexpr openmode out;
+ static constexpr openmode trunc;
typedef T4 seekdir;
- static const seekdir beg;
- static const seekdir cur;
- static const seekdir end;
+ static constexpr seekdir beg;
+ static constexpr seekdir cur;
+ static constexpr seekdir end;
class Init;
@@ -160,7 +160,7 @@ protected:
basic_ios();
void init(basic_streambuf<charT,traits>* sb);
void move(basic_ios& rhs);
- void swap(basic_ios& rhs);
+ void swap(basic_ios& rhs) noexcept;
void set_rdbuf(basic_streambuf<charT, traits>* sb);
};
@@ -227,7 +227,7 @@ typedef ptrdiff_t streamsize;
class _LIBCPP_VISIBLE ios_base
{
public:
- class failure;
+ class _LIBCPP_VISIBLE failure;
typedef unsigned int fmtflags;
static const fmtflags boolalpha = 0x0001;
@@ -271,7 +271,7 @@ public:
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
- class Init;
+ class _LIBCPP_VISIBLE Init;
// 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
@@ -342,7 +342,7 @@ protected:
void __call_callbacks(event);
void copyfmt(const ios_base&);
void move(ios_base&);
- void swap(ios_base&);
+ void swap(ios_base&) _NOEXCEPT;
_LIBCPP_ALWAYS_INLINE
void set_rdbuf(void* __sb)
@@ -632,12 +632,12 @@ protected:
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
_LIBCPP_INLINE_VISIBILITY
- void swap(basic_ios& __rhs);
+ void swap(basic_ios& __rhs) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private:
basic_ostream<char_type, traits_type>* __tie_;
- char_type __fill_;
+ mutable int_type __fill_;
};
template <class _CharT, class _Traits>
@@ -659,7 +659,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
{
ios_base::init(__sb);
__tie_ = 0;
- __fill_ = widen(' ');
+ __fill_ = traits_type::eof();
}
template <class _CharT, class _Traits>
@@ -731,6 +731,8 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT
basic_ios<_CharT, _Traits>::fill() const
{
+ if (traits_type::eq_int_type(traits_type::eof(), __fill_))
+ __fill_ = widen(' ');
return __fill_;
}
@@ -774,7 +776,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
void
-basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
+basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
{
ios_base::swap(__rhs);
_VSTD::swap(__tie_, __rhs.__tie_);
diff --git a/include/iosfwd b/include/iosfwd
index 7e5ac7321f54..efdff5f35659 100644
--- a/include/iosfwd
+++ b/include/iosfwd
@@ -95,7 +95,7 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
_LIBCPP_BEGIN_NAMESPACE_STD
-class ios_base;
+class _LIBCPP_VISIBLE ios_base;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator;
diff --git a/include/istream b/include/istream
index 7312425eb070..72b2004dd53c 100644
--- a/include/istream
+++ b/include/istream
@@ -194,7 +194,7 @@ protected:
public:
// 27.7.1.1.3 Prefix/suffix:
- class sentry;
+ class _LIBCPP_VISIBLE sentry;
// 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -1263,6 +1263,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
+ this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@@ -1290,6 +1291,7 @@ basic_istream<_CharT, _Traits>::unget()
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
+ this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@@ -1368,6 +1370,7 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
+ this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
diff --git a/include/iterator b/include/iterator
index 75fee4b9db55..5747504a35b0 100644
--- a/include/iterator
+++ b/include/iterator
@@ -263,10 +263,10 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_istream<charT,traits> istream_type;
- istreambuf_iterator() throw();
- istreambuf_iterator(istream_type& s) throw();
- istreambuf_iterator(streambuf_type* s) throw();
- istreambuf_iterator(a-private-type) throw();
+ istreambuf_iterator() noexcept;
+ istreambuf_iterator(istream_type& s) noexcept;
+ istreambuf_iterator(streambuf_type* s) noexcept;
+ istreambuf_iterator(a-private-type) noexcept;
charT operator*() const;
pointer operator->() const;
@@ -293,13 +293,13 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_ostream<charT,traits> ostream_type;
- ostreambuf_iterator(ostream_type& s) throw();
- ostreambuf_iterator(streambuf_type* s) throw();
+ ostreambuf_iterator(ostream_type& s) noexcept;
+ ostreambuf_iterator(streambuf_type* s) noexcept;
ostreambuf_iterator& operator=(charT c);
ostreambuf_iterator& operator*();
ostreambuf_iterator& operator++();
ostreambuf_iterator& operator++(int);
- bool failed() const throw();
+ bool failed() const noexcept;
};
template <class C> auto begin(C& c) -> decltype(c.begin());
@@ -815,12 +815,12 @@ private:
__sbuf_ = 0;
}
public:
- _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {}
- _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw()
+ _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
+ _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {__test_for_eof();}
- _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw()
+ _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
: __sbuf_(__s) {__test_for_eof();}
- _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
+ _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT
: __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY char_type operator*() const
@@ -867,9 +867,9 @@ public:
private:
streambuf_type* __sbuf_;
public:
- _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw()
+ _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT
: __sbuf_(__s.rdbuf()) {}
- _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw()
+ _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT
: __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
{
@@ -880,7 +880,15 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
- _LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;}
+ _LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
+
+ template <class _Ch, class _Tr>
+ friend
+ _LIBCPP_HIDDEN
+ ostreambuf_iterator<_Ch, _Tr>
+ __pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
+ const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
+ ios_base& __iob, _Ch __fl);
};
template <class _Iter>
@@ -1009,43 +1017,52 @@ make_move_iterator(const _Iter& __i)
template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter>
+_LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
-template <class _Ip, class _Op> _Op copy(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
-template <class _Ip, class _Op> _Op move(_Ip, _Ip, _Op);
-template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2);
+template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
+template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_trivially_copy_assignable<_Tp>::value,
@@ -1284,6 +1301,38 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
return !(__y < __x);
}
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+ return !(__x == __y);
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+ return __y < __x;
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+ return !(__x < __y);
+}
+
+template <class _Iter1>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
+{
+ return !(__y < __x);
+}
+
template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type
@@ -1313,34 +1362,42 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
+_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter>
+_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
diff --git a/include/list b/include/list
index b486e8313411..812588690014 100644
--- a/include/list
+++ b/include/list
@@ -213,9 +213,9 @@ struct __list_node
_Tp __value_;
};
-template <class _Tp, class _Alloc> class list;
+template <class _Tp, class _Alloc> class _LIBCPP_VISIBLE list;
template <class _Tp, class _Alloc> class __list_imp;
-template <class _Tp, class _VoidPtr> class __list_const_iterator;
+template <class _Tp, class _VoidPtr> class _LIBCPP_VISIBLE __list_const_iterator;
template <class _Tp, class _VoidPtr>
class _LIBCPP_VISIBLE __list_iterator
diff --git a/include/locale b/include/locale
index bec27f6d9eb2..0d77a4a13e79 100644
--- a/include/locale
+++ b/include/locale
@@ -1587,6 +1587,52 @@ __pad_and_output(_OutputIterator __s,
return __s;
}
+template <class _CharT, class _Traits>
+_LIBCPP_HIDDEN
+ostreambuf_iterator<_CharT, _Traits>
+__pad_and_output(ostreambuf_iterator<_CharT, _Traits> __s,
+ const _CharT* __ob, const _CharT* __op, const _CharT* __oe,
+ ios_base& __iob, _CharT __fl)
+{
+ if (__s.__sbuf_ == nullptr)
+ return __s;
+ streamsize __sz = __oe - __ob;
+ streamsize __ns = __iob.width();
+ if (__ns > __sz)
+ __ns -= __sz;
+ else
+ __ns = 0;
+ streamsize __np = __op - __ob;
+ if (__np > 0)
+ {
+ if (__s.__sbuf_->sputn(__ob, __np) != __np)
+ {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ if (__ns > 0)
+ {
+ basic_string<_CharT, _Traits> __sp(__ns, __fl);
+ if (__s.__sbuf_->sputn(__sp.data(), __ns) != __ns)
+ {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __np = __oe - __op;
+ if (__np > 0)
+ {
+ if (__s.__sbuf_->sputn(__op, __np) != __np)
+ {
+ __s.__sbuf_ = nullptr;
+ return __s;
+ }
+ }
+ __iob.width(0);
+ return __s;
+}
+
template <class _CharT, class _OutputIterator>
_OutputIterator
num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
@@ -3920,7 +3966,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
if (__cvtptr_ != nullptr)
{
wide_string __ws(2*(__frm_end - __frm), _Elem());
- __ws.resize(__ws.capacity());
+ if (__frm != __frm_end)
+ __ws.resize(__ws.capacity());
codecvt_base::result __r = codecvt_base::ok;
state_type __st = __cvtstate_;
if (__frm != __frm_end)
@@ -3980,7 +4027,8 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
if (__cvtptr_ != nullptr)
{
byte_string __bs(2*(__frm_end - __frm), char());
- __bs.resize(__bs.capacity());
+ if (__frm != __frm_end)
+ __bs.resize(__bs.capacity());
codecvt_base::result __r = codecvt_base::ok;
state_type __st = __cvtstate_;
if (__frm != __frm_end)
diff --git a/include/map b/include/map
index 633579b7ee06..dd98da5e7ae8 100644
--- a/include/map
+++ b/include/map
@@ -880,45 +880,15 @@ public:
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool>
- emplace() {return __tree_.__emplace_unique();}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool>
- emplace(_A0&& __a0)
- {return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
-
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
+ template <class ..._Args>
pair<iterator, bool>
- emplace(_A0&& __a0, _Args&& ...__args);
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
- _LIBCPP_INLINE_VISIBILITY
- iterator
- emplace_hint(const_iterator __p)
- {return __tree_.__emplace_hint_unique(__p.__i_);}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator
- emplace_hint(const_iterator __p, _A0&& __a0)
- {return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ emplace(_Args&& ...__args);
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
+ template <class ..._Args>
iterator
- emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
+ emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -1015,13 +985,23 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<value_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<key_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
+ template <class _A0, class _A1, class ..._Args>
+ __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(const key_type& __k);
@@ -1215,9 +1195,12 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0,
- class>
-typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+template <class _A0>
+typename enable_if
+<
+ is_constructible<pair<const _Key, _Tp>, _A0>::value,
+ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+>::type
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
@@ -1228,19 +1211,37 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
return __h;
}
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0>
+typename enable_if
+<
+ is_constructible<_Key, _A0>::value,
+ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
+>::type
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
+{
+ __node_allocator& __na = __tree_.__node_alloc();
+ __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));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class>
+template <class _A0, class _A1, class ..._Args>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
-map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
+map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+ _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+ _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1329,14 +1330,11 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
- >
+template <class ..._Args>
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
-map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
+map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1344,15 +1342,12 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
- >
+template <class ..._Args>
typename map<_Key, _Tp, _Compare, _Allocator>::iterator
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
- _A0&& __a0, _Args&& ...__args)
+ _Args&& ...__args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
if (__r.__i_.__ptr_ == __h.get())
__h.release();
@@ -1629,43 +1624,15 @@ public:
{return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace() {return __tree_.__emplace_multi();}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator
- emplace(_A0&& __a0)
- {return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
-
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
+ template <class ..._Args>
iterator
- emplace(_A0&& __a0, _Args&& ...__args);
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
+ emplace(_Args&& ...__args);
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p)
- {return __tree_.__emplace_hint_multi(__p.__i_);}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator
- emplace_hint(const_iterator __p, _A0&& __a0)
- {return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
+ template <class ..._Args>
iterator
- emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
+ emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
@@ -1757,13 +1724,23 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node();
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<value_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<key_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class ..._Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
+ template <class _A0, class _A1, class ..._Args>
+ __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
@@ -1797,10 +1774,12 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0,
- class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
- >
-typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+template <class _A0>
+typename enable_if
+<
+ is_constructible<pair<const _Key, _Tp>, _A0>::value,
+ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+>::type
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
@@ -1811,20 +1790,37 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
return __h;
}
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+template <class _A0>
+typename enable_if
+<
+ is_constructible<_Key, _A0>::value,
+ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
+>::type
+multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
+{
+ __node_allocator& __na = __tree_.__node_alloc();
+ __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));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
+template <class _A0, class _A1, class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
-multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
+multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+ _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+ _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
@@ -1835,30 +1831,23 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&&
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
- >
+template <class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
-multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
+multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
-template <class _A0, class ..._Args,
- class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
- >
+template <class ..._Args>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
- _A0&& __a0,
_Args&& ...__args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
__h.release();
return __r;
diff --git a/include/memory b/include/memory
index e30a6fd7c5b4..fe5dd0c79030 100644
--- a/include/memory
+++ b/include/memory
@@ -602,6 +602,10 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <cassert>
#endif
+#if __has_feature(cxx_atomic)
+# include <atomic>
+#endif
+
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -2467,7 +2471,11 @@ struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
template <class _Tp>
struct _LIBCPP_VISIBLE default_delete
{
- _LIBCPP_INLINE_VISIBILITY default_delete() _NOEXCEPT {}
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
+#else
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+#endif
template <class _Up>
_LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&,
typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
@@ -2482,7 +2490,11 @@ template <class _Tp>
struct _LIBCPP_VISIBLE default_delete<_Tp[]>
{
public:
- _LIBCPP_INLINE_VISIBILITY default_delete() _NOEXCEPT {}
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
+#else
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+#endif
template <class _Up>
_LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&,
typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
@@ -2520,13 +2532,13 @@ private:
typedef typename remove_reference<deleter_type>::type& _Dp_reference;
typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
public:
- _LIBCPP_INLINE_VISIBILITY unique_ptr() _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
: __ptr_(pointer())
{
static_assert(!is_pointer<deleter_type>::value,
"unique_ptr constructed with null function pointer deleter");
}
- _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
: __ptr_(pointer())
{
static_assert(!is_pointer<deleter_type>::value,
@@ -2699,13 +2711,13 @@ private:
typedef typename remove_reference<deleter_type>::type& _Dp_reference;
typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
public:
- _LIBCPP_INLINE_VISIBILITY unique_ptr() _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
: __ptr_(pointer())
{
static_assert(!is_pointer<deleter_type>::value,
"unique_ptr constructed with null function pointer deleter");
}
- _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
: __ptr_(pointer())
{
static_assert(!is_pointer<deleter_type>::value,
@@ -2955,7 +2967,7 @@ operator>=(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {re
template <class _T1, class _D1>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
{
return !__x;
}
@@ -2963,7 +2975,7 @@ operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t)
template <class _T1, class _D1>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
{
return !__x;
}
@@ -2971,7 +2983,7 @@ operator==(nullptr_t, const unique_ptr<_T1, _D1>& __x)
template <class _T1, class _D1>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
+operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT
{
return static_cast<bool>(__x);
}
@@ -2979,7 +2991,7 @@ operator!=(const unique_ptr<_T1, _D1>& __x, nullptr_t)
template <class _T1, class _D1>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x)
+operator!=(nullptr_t, const unique_ptr<_T1, _D1>& __x) _NOEXCEPT
{
return static_cast<bool>(__x);
}
@@ -3379,8 +3391,19 @@ struct __scalar_hash<_Tp, 4>
template<class _Tp>
struct _LIBCPP_VISIBLE hash<_Tp*>
- : public __scalar_hash<_Tp*>
+ : public unary_function<_Tp*, size_t>
{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp* __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp* __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
};
template <class _Tp, class _Dp>
@@ -3557,7 +3580,7 @@ public:
virtual const char* what() const _NOEXCEPT;
};
-template<class _Tp> class weak_ptr;
+template<class _Tp> class _LIBCPP_VISIBLE weak_ptr;
class __shared_count
{
@@ -3603,6 +3626,9 @@ public:
long use_count() const _NOEXCEPT {return __shared_count::use_count();}
__shared_weak_count* lock() _NOEXCEPT;
+ // purposefully not protected with #ifndef _LIBCPP_NO_RTTI because doing so
+ // breaks ABI for those clients who need to compile their projects with
+ // -fno-rtti and yet link against a libc++.dylib compiled without -fno-rtti.
virtual const void* __get_deleter(const type_info&) const _NOEXCEPT;
private:
virtual void __on_zero_shared_weak() _NOEXCEPT = 0;
@@ -3720,7 +3746,7 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
__a.deallocate(this, 1);
}
-template<class _Tp> class enable_shared_from_this;
+template<class _Tp> class _LIBCPP_VISIBLE enable_shared_from_this;
template<class _Tp>
class _LIBCPP_VISIBLE shared_ptr
@@ -3733,8 +3759,8 @@ private:
struct __nat {int __for_bool_;};
public:
- shared_ptr() _NOEXCEPT;
- shared_ptr(nullptr_t) _NOEXCEPT;
+ _LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp,
class = typename enable_if
<
@@ -3923,6 +3949,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool owner_before(weak_ptr<_Up> const& __p) const
{return __cntrl_ < __p.__cntrl_;}
+ _LIBCPP_INLINE_VISIBILITY
+ bool
+ __owner_equivalent(const shared_ptr& __p) const
+ {return __cntrl_ == __p.__cntrl_;}
#ifndef _LIBCPP_NO_RTTI
template <class _Dp>
@@ -3994,6 +4024,7 @@ private:
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
: __ptr_(0),
__cntrl_(0)
@@ -4002,6 +4033,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
: __ptr_(0),
__cntrl_(0)
@@ -4892,7 +4924,7 @@ private:
__shared_weak_count* __cntrl_;
public:
- weak_ptr() _NOEXCEPT;
+ _LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
@@ -4964,6 +4996,7 @@ public:
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
: __ptr_(0),
__cntrl_(0)
@@ -5194,7 +5227,7 @@ class _LIBCPP_VISIBLE enable_shared_from_this
{
mutable weak_ptr<_Tp> __weak_this_;
protected:
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
enable_shared_from_this() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
enable_shared_from_this(enable_shared_from_this const&) _NOEXCEPT {}
@@ -5231,6 +5264,134 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
+#if __has_feature(cxx_atomic)
+
+class __sp_mut
+{
+ void* _;
+public:
+ void lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
+
+private:
+ _LIBCPP_CONSTEXPR __sp_mut(void*) _NOEXCEPT;
+ __sp_mut(const __sp_mut&);
+ __sp_mut& operator=(const __sp_mut&);
+
+ friend _LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*);
+};
+
+_LIBCPP_VISIBLE __sp_mut& __get_sp_mut(const void*);
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_is_lock_free(const shared_ptr<_Tp>*)
+{
+ return false;
+}
+
+template <class _Tp>
+shared_ptr<_Tp>
+atomic_load(const shared_ptr<_Tp>* __p)
+{
+ __sp_mut& __m = __get_sp_mut(__p);
+ __m.lock();
+ shared_ptr<_Tp> __q = *__p;
+ __m.unlock();
+ return __q;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
+{
+ return atomic_load(__p);
+}
+
+template <class _Tp>
+void
+atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+{
+ __sp_mut& __m = __get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+void
+atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
+{
+ atomic_store(__p, __r);
+}
+
+template <class _Tp>
+shared_ptr<_Tp>
+atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
+{
+ __sp_mut& __m = __get_sp_mut(__p);
+ __m.lock();
+ __p->swap(__r);
+ __m.unlock();
+ return __r;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+shared_ptr<_Tp>
+atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
+{
+ return atomic_exchange(__p, __r);
+}
+
+template <class _Tp>
+bool
+atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
+{
+ __sp_mut& __m = __get_sp_mut(__p);
+ __m.lock();
+ if (__p->__owner_equivalent(*__v))
+ {
+ *__p = __w;
+ __m.unlock();
+ return true;
+ }
+ *__v = *__p;
+ __m.unlock();
+ return false;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
+{
+ return atomic_compare_exchange_strong(__p, __v, __w);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w, memory_order, memory_order)
+{
+ return atomic_compare_exchange_strong(__p, __v, __w);
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+bool
+atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
+ shared_ptr<_Tp> __w, memory_order, memory_order)
+{
+ return atomic_compare_exchange_weak(__p, __v, __w);
+}
+
+#endif // __has_feature(cxx_atomic)
+
//enum class
struct _LIBCPP_VISIBLE pointer_safety
{
diff --git a/include/mutex b/include/mutex
index 62b733f4122e..ee20f021ea9b 100644
--- a/include/mutex
+++ b/include/mutex
@@ -20,7 +20,7 @@ namespace std
class mutex
{
public:
- mutex();
+ constexpr mutex() noexcept;
~mutex();
mutex(const mutex&) = delete;
@@ -44,7 +44,7 @@ public:
recursive_mutex& operator=(const recursive_mutex&) = delete;
void lock();
- bool try_lock();
+ bool try_lock() noexcept;
void unlock();
typedef pthread_mutex_t* native_handle_type;
@@ -79,7 +79,7 @@ public:
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void lock();
- bool try_lock();
+ bool try_lock() noexcept;
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
@@ -114,9 +114,9 @@ class unique_lock
{
public:
typedef Mutex mutex_type;
- unique_lock();
+ unique_lock() noexcept;
explicit unique_lock(mutex_type& m);
- unique_lock(mutex_type& m, defer_lock_t);
+ unique_lock(mutex_type& m, defer_lock_t) noexcept;
unique_lock(mutex_type& m, try_to_lock_t);
unique_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration>
@@ -128,8 +128,8 @@ public:
unique_lock(unique_lock const&) = delete;
unique_lock& operator=(unique_lock const&) = delete;
- unique_lock(unique_lock&& u);
- unique_lock& operator=(unique_lock&& u);
+ unique_lock(unique_lock&& u) noexcept;
+ unique_lock& operator=(unique_lock&& u) noexcept;
void lock();
bool try_lock();
@@ -141,16 +141,16 @@ public:
void unlock();
- void swap(unique_lock& u);
- mutex_type* release();
+ void swap(unique_lock& u) noexcept;
+ mutex_type* release() noexcept;
- bool owns_lock() const;
- explicit operator bool () const;
- mutex_type* mutex() const;
+ bool owns_lock() const noexcept;
+ explicit operator bool () const noexcept;
+ mutex_type* mutex() const noexcept;
};
template <class Mutex>
- void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
+ void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept;
template <class L1, class L2, class... L3>
int try_lock(L1&, L2&, L3&...);
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
struct once_flag
{
- constexpr once_flag();
+ constexpr once_flag() noexcept;
once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete;
@@ -201,8 +201,8 @@ private:
public:
void lock();
- bool try_lock();
- void unlock();
+ bool try_lock() _NOEXCEPT;
+ void unlock() _NOEXCEPT;
typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY
@@ -224,14 +224,14 @@ private:
public:
void lock();
- bool try_lock();
+ bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock();
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
@@ -267,14 +267,14 @@ private:
public:
void lock();
- bool try_lock();
+ bool try_lock() _NOEXCEPT;
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
- void unlock();
+ void unlock() _NOEXCEPT;
};
template <class _Clock, class _Duration>
@@ -425,25 +425,27 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
#endif // _LIBCPP_HAS_NO_VARIADICS
-struct once_flag;
+struct _LIBCPP_VISIBLE once_flag;
#ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Callable, class... _Args>
- void call_once(once_flag&, _Callable&&, _Args&&...);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable>
- void call_once(once_flag&, _Callable);
+_LIBCPP_INLINE_VISIBILITY
+void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_VISIBLE once_flag
{
_LIBCPP_INLINE_VISIBILITY
- // constexpr
- once_flag() {}
+ _LIBCPP_CONSTEXPR
+ once_flag() _NOEXCEPT : __state_(0) {}
private:
once_flag(const once_flag&); // = delete;
diff --git a/include/new b/include/new
index 5bcbad0cd046..ae0951a7485a 100644
--- a/include/new
+++ b/include/new
@@ -96,7 +96,7 @@ _LIBCPP_VISIBLE void* operator new(std::size_t __sz)
throw(std::bad_alloc)
#endif
;
-_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
@@ -105,7 +105,7 @@ _LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
throw(std::bad_alloc)
#endif
;
-_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
+_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
diff --git a/include/ostream b/include/ostream
index e6dd4b578bea..b135ddb7713a 100644
--- a/include/ostream
+++ b/include/ostream
@@ -169,7 +169,7 @@ protected:
public:
// 27.7.2.4 Prefix/suffix:
- class sentry;
+ class _LIBCPP_VISIBLE sentry;
// 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
diff --git a/include/queue b/include/queue
index e05ab8f8b0ff..4741f0035cac 100644
--- a/include/queue
+++ b/include/queue
@@ -177,13 +177,15 @@ template <class T, class Container, class Compare>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container> class queue;
+template <class _Tp, class _Container> class _LIBCPP_VISIBLE queue;
template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
diff --git a/include/random b/include/random
index 098332725c87..a1553f13f8b5 100644
--- a/include/random
+++ b/include/random
@@ -217,7 +217,7 @@ public:
void discard(unsigned long long z);
// property functions
- const Engine& base() const;
+ const Engine& base() const noexcept;
};
template<class Engine, size_t p, size_t r>
@@ -269,7 +269,7 @@ public:
result_type operator()(); void discard(unsigned long long z);
// property functions
- const Engine& base() const;
+ const Engine& base() const noexcept;
};
template<class Engine, size_t w, class UIntType>
@@ -323,7 +323,7 @@ public:
void discard(unsigned long long z);
// property functions
- const Engine& base() const;
+ const Engine& base() const noexcept;
};
template<class Engine, size_t k>
@@ -392,7 +392,7 @@ public:
result_type operator()();
// property functions
- double entropy() const;
+ double entropy() const noexcept;
// no copy functions
random_device(const random_device& ) = delete;
@@ -1813,10 +1813,11 @@ struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b>
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
-class linear_congruential_engine;
+class _LIBCPP_VISIBLE linear_congruential_engine;
template <class _CharT, class _Traits,
class _Up, _Up _Ap, _Up _Cp, _Up _Np>
+_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
const linear_congruential_engine<_Up, _Ap, _Cp, _Np>&);
@@ -2021,7 +2022,7 @@ typedef minstd_rand default_random_engine;
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
-class mersenne_twister_engine;
+class _LIBCPP_VISIBLE mersenne_twister_engine;
template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
_UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
@@ -2035,6 +2036,7 @@ operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp,
template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
_UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
_UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
@@ -2424,7 +2426,7 @@ typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
// subtract_with_carry_engine
template<class _UIntType, size_t __w, size_t __s, size_t __r>
-class subtract_with_carry_engine;
+class _LIBCPP_VISIBLE subtract_with_carry_engine;
template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
bool
@@ -2433,6 +2435,7 @@ operator==(
const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+_LIBCPP_INLINE_VISIBILITY
bool
operator!=(
const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
@@ -2788,7 +2791,7 @@ public:
// property functions
_LIBCPP_INLINE_VISIBILITY
- const _Engine& base() const {return __e_;}
+ const _Engine& base() const _NOEXCEPT {return __e_;}
template<class _Eng, size_t _Pp, size_t _Rp>
friend
@@ -2993,7 +2996,7 @@ public:
// property functions
_LIBCPP_INLINE_VISIBILITY
- const _Engine& base() const {return __e_;}
+ const _Engine& base() const _NOEXCEPT {return __e_;}
template<class _Eng, size_t _Wp, class _UI>
friend
@@ -3222,7 +3225,7 @@ public:
// property functions
_LIBCPP_INLINE_VISIBILITY
- const _Engine& base() const {return __e_;}
+ const _Engine& base() const _NOEXCEPT {return __e_;}
private:
template<class _Eng, size_t _Kp>
@@ -3399,7 +3402,7 @@ public:
result_type operator()();
// property functions
- double entropy() const;
+ double entropy() const _NOEXCEPT;
private:
// no copy functions
diff --git a/include/regex b/include/regex
index 2ebb0f1d5bca..7505f2ea3295 100644
--- a/include/regex
+++ b/include/regex
@@ -147,7 +147,7 @@ public:
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
basic_regex(const charT* p, size_t len, flag_type f);
basic_regex(const basic_regex&);
- basic_regex(basic_regex&&);
+ basic_regex(basic_regex&&) noexcept;
template <class ST, class SA>
explicit basic_regex(const basic_string<charT, ST, SA>& p,
flag_type f = regex_constants::ECMAScript);
@@ -159,7 +159,7 @@ public:
~basic_regex();
basic_regex& operator=(const basic_regex&);
- basic_regex& operator=(basic_regex&&);
+ basic_regex& operator=(basic_regex&&) noexcept;
basic_regex& operator=(const charT* ptr);
basic_regex& operator=(initializer_list<charT> il);
template <class ST, class SA>
@@ -167,7 +167,7 @@ public:
// assign:
basic_regex& assign(const basic_regex& that);
- basic_regex& assign(basic_regex&& that);
+ basic_regex& assign(basic_regex&& that) noexcept;
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
basic_regex& assign(const charT* p, size_t len, flag_type f);
template <class string_traits, class A>
@@ -449,7 +449,7 @@ public:
// construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator());
match_results(const match_results& m);
- match_results(match_results&& m);
+ match_results(match_results&& m) noexcept;
match_results& operator=(const match_results& m);
match_results& operator=(match_results&& m);
~match_results();
@@ -760,7 +760,7 @@ enum syntax_option_type
};
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
syntax_option_type
operator~(syntax_option_type __x)
{
@@ -768,7 +768,7 @@ operator~(syntax_option_type __x)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
syntax_option_type
operator&(syntax_option_type __x, syntax_option_type __y)
{
@@ -776,7 +776,7 @@ operator&(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
syntax_option_type
operator|(syntax_option_type __x, syntax_option_type __y)
{
@@ -784,7 +784,7 @@ operator|(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
syntax_option_type
operator^(syntax_option_type __x, syntax_option_type __y)
{
@@ -792,7 +792,6 @@ operator^(syntax_option_type __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
syntax_option_type&
operator&=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -801,7 +800,6 @@ operator&=(syntax_option_type& __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
syntax_option_type&
operator|=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -810,7 +808,6 @@ operator|=(syntax_option_type& __x, syntax_option_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
syntax_option_type&
operator^=(syntax_option_type& __x, syntax_option_type __y)
{
@@ -839,7 +836,7 @@ enum match_flag_type
};
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
match_flag_type
operator~(match_flag_type __x)
{
@@ -847,7 +844,7 @@ operator~(match_flag_type __x)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
match_flag_type
operator&(match_flag_type __x, match_flag_type __y)
{
@@ -855,7 +852,7 @@ operator&(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
match_flag_type
operator|(match_flag_type __x, match_flag_type __y)
{
@@ -863,7 +860,7 @@ operator|(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
+_LIBCPP_CONSTEXPR
match_flag_type
operator^(match_flag_type __x, match_flag_type __y)
{
@@ -871,7 +868,6 @@ operator^(match_flag_type __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
match_flag_type&
operator&=(match_flag_type& __x, match_flag_type __y)
{
@@ -880,7 +876,6 @@ operator&=(match_flag_type& __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
match_flag_type&
operator|=(match_flag_type& __x, match_flag_type __y)
{
@@ -889,7 +884,6 @@ operator|=(match_flag_type& __x, match_flag_type __y)
}
inline _LIBCPP_INLINE_VISIBILITY
-/*constexpr*/
match_flag_type&
operator^=(match_flag_type& __x, match_flag_type __y)
{
@@ -1237,11 +1231,11 @@ regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
template <class _CharT> class __node;
-template <class _BidirectionalIterator> class sub_match;
+template <class _BidirectionalIterator> class _LIBCPP_VISIBLE sub_match;
template <class _BidirectionalIterator,
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
-class match_results;
+class _LIBCPP_VISIBLE match_results;
template <class _CharT>
struct __state
@@ -2439,16 +2433,16 @@ private:
public:
// constants:
- static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase;
- static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
- static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize;
- static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate;
- static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
- static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic;
- static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended;
- static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk;
- static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep;
- static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep;
+ static const regex_constants::syntax_option_type icase = regex_constants::icase;
+ static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
+ static const regex_constants::syntax_option_type optimize = regex_constants::optimize;
+ static const regex_constants::syntax_option_type collate = regex_constants::collate;
+ static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
+ static const regex_constants::syntax_option_type basic = regex_constants::basic;
+ static const regex_constants::syntax_option_type extended = regex_constants::extended;
+ static const regex_constants::syntax_option_type awk = regex_constants::awk;
+ static const regex_constants::syntax_option_type grep = regex_constants::grep;
+ static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
// construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY
@@ -2512,6 +2506,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const basic_regex& __that)
{return *this = __that;}
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ basic_regex& assign(basic_regex&& __that) _NOEXCEPT
+ {return *this = _VSTD::move(__that);}
+#endif
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
{return assign(__p, __p + __traits_.length(__p), __f);}
@@ -2563,6 +2562,7 @@ public:
{
__member_init(__f);
__parse(__first, __last);
+ return *this;
}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -4740,7 +4740,7 @@ public:
bool matched;
_LIBCPP_INLINE_VISIBILITY
- /*constexpr*/ sub_match() : matched() {}
+ _LIBCPP_CONSTEXPR sub_match() : matched() {}
_LIBCPP_INLINE_VISIBILITY
difference_type length() const
diff --git a/include/stack b/include/stack
index 59906bd89edb..12fb35b703e3 100644
--- a/include/stack
+++ b/include/stack
@@ -91,13 +91,15 @@ template <class T, class Container>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Tp, class _Container> class stack;
+template <class _Tp, class _Container> class _LIBCPP_VISIBLE stack;
template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container>
+_LIBCPP_INLINE_VISIBILITY
bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
diff --git a/include/streambuf b/include/streambuf
index e128be5d59c3..e34ad23eb723 100644
--- a/include/streambuf
+++ b/include/streambuf
@@ -540,7 +540,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
{
if (__nout_ < __eout_)
*__nout_++ = *__s;
- else if (overflow(*__s) == __eof)
+ else if (overflow(traits_type::to_int_type(*__s)) == __eof)
break;
}
return __i;
diff --git a/include/string b/include/string
index 620e6f828eae..89a00e55b4bb 100644
--- a/include/string
+++ b/include/string
@@ -51,8 +51,8 @@ struct char_traits
typedef mbstate_t state_type;
static void assign(char_type& c1, const char_type& c2) noexcept;
- static bool eq(char_type c1, char_type c2) noexcept;
- static bool lt(char_type c1, char_type c2) noexcept;
+ static constexpr bool eq(char_type c1, char_type c2) noexcept;
+ static constexpr bool lt(char_type c1, char_type c2) noexcept;
static int compare(const char_type* s1, const char_type* s2, size_t n);
static size_t length(const char_type* s);
@@ -61,11 +61,11 @@ struct char_traits
static char_type* copy(char_type* s1, const char_type* s2, size_t n);
static char_type* assign(char_type* s, size_t n, char_type a);
- static int_type not_eof(int_type c) noexcept;
- static char_type to_char_type(int_type c) noexcept;
- static int_type to_int_type(char_type c) noexcept;
- static bool eq_int_type(int_type c1, int_type c2) noexcept;
- static int_type eof() noexcept;
+ static constexpr int_type not_eof(int_type c) noexcept;
+ static constexpr char_type to_char_type(int_type c) noexcept;
+ static constexpr int_type to_int_type(char_type c) noexcept;
+ static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept;
+ static constexpr int_type eof() noexcept;
};
template <> struct char_traits<char>;
@@ -506,10 +506,10 @@ struct _LIBCPP_VISIBLE char_traits
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -519,19 +519,20 @@ struct _LIBCPP_VISIBLE char_traits
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
static char_type* assign(char_type* __s, size_t __n, char_type __a);
- _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
- static char_type to_char_type(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static int_type to_int_type(char_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static int_type eof() _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(EOF);}
};
@@ -631,10 +632,10 @@ struct _LIBCPP_VISIBLE char_traits<char>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return (unsigned char)__c1 < (unsigned char)__c2;}
_LIBCPP_INLINE_VISIBILITY
@@ -655,19 +656,20 @@ struct _LIBCPP_VISIBLE char_traits<char>
static char_type* assign(char_type* __s, size_t __n, char_type __a)
{return (char_type*)memset(__s, to_int_type(__a), __n);}
- _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
+ _LIBCPP_INLINE_VISIBILITY
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
- static char_type to_char_type(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static int_type to_int_type(char_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type((unsigned char)__c);}
_LIBCPP_INLINE_VISIBILITY
- static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static int_type eof() _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(EOF);}
};
@@ -686,10 +688,10 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY
@@ -712,19 +714,19 @@ struct _LIBCPP_VISIBLE char_traits<wchar_t>
{return (char_type*)wmemset(__s, __a, __n);}
_LIBCPP_INLINE_VISIBILITY
- static int_type not_eof(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
- static char_type to_char_type(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static int_type to_int_type(char_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static int_type eof() _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(WEOF);}
};
@@ -743,10 +745,10 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -757,19 +759,19 @@ struct _LIBCPP_VISIBLE char_traits<char16_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY
- static int_type not_eof(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
- static char_type to_char_type(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static int_type to_int_type(char_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static int_type eof() _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xDFFF);}
};
@@ -863,10 +865,10 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -877,19 +879,19 @@ struct _LIBCPP_VISIBLE char_traits<char32_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY
- static int_type not_eof(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY
- static char_type to_char_type(int_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static int_type to_int_type(char_type __c) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY
- static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
+ static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY
- static int_type eof() _NOEXCEPT
+ static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
{return int_type(0xFFFFFFFF);}
};
@@ -2206,6 +2208,7 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input
clear();
for (; __first != __last; ++__first)
push_back(*__first);
+ return *this;
}
template <class _CharT, class _Traits, class _Allocator>
diff --git a/include/support/win32/limits_win32.h b/include/support/win32/limits_win32.h
deleted file mode 100644
index 671631df2f9c..000000000000
--- a/include/support/win32/limits_win32.h
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*-
-//===--------------------- support/win32/limits_win32.h -------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
-
-#if !defined(_MSC_VER)
-#error "This header is MSVC specific, Clang and GCC should not include it"
-#else
-
-#ifndef NOMINMAX
-#define NOMINMAX
-#endif
-#include <windows.h> // ymath.h works correctly
-
-#include <float.h> // limit constants
-
-#define __FLT_MANT_DIG__ FLT_MANT_DIG
-#define __FLT_DIG__ FLT_DIG
-#define __FLT_RADIX__ FLT_RADIX
-#define __FLT_MIN_EXP__ FLT_MIN_EXP
-#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
-#define __FLT_MAX_EXP__ FLT_MAX_EXP
-#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
-#define __FLT_MIN__ FLT_MIN
-#define __FLT_MAX__ FLT_MAX
-#define __FLT_EPSILON__ FLT_EPSILON
-// predefined by MinGW GCC
-#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
-
-#define __DBL_MANT_DIG__ DBL_MANT_DIG
-#define __DBL_DIG__ DBL_DIG
-#define __DBL_RADIX__ DBL_RADIX
-#define __DBL_MIN_EXP__ DBL_MIN_EXP
-#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
-#define __DBL_MAX_EXP__ DBL_MAX_EXP
-#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
-#define __DBL_MIN__ DBL_MIN
-#define __DBL_MAX__ DBL_MAX
-#define __DBL_EPSILON__ DBL_EPSILON
-// predefined by MinGW GCC
-#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
-
-#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
-#define __LDBL_DIG__ LDBL_DIG
-#define __LDBL_RADIX__ LDBL_RADIX
-#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
-#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
-#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
-#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
-#define __LDBL_MIN__ LDBL_MIN
-#define __LDBL_MAX__ LDBL_MAX
-#define __LDBL_EPSILON__ LDBL_EPSILON
-// predefined by MinGW GCC
-#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
-
-// __builtin replacements/workarounds
-#include <math.h> // HUGE_VAL
-#include <ymath.h> // internal MSVC header providing the needed functionality
-#define __builtin_huge_val() HUGE_VAL
-#define __builtin_huge_valf() _FInf._Float
-#define __builtin_huge_vall() _LInf._Long_double
-#define __builtin_nan(__dummy) _Nan._Double
-#define __builtin_nanf(__dummy) _FNan._Float
-#define __builtin_nanl(__dummmy) _LNan._Long_double
-#define __builtin_nans(__dummy) _Snan._Double
-#define __builtin_nansf(__dummy) _FSnan._Float
-#define __builtin_nansl(__dummy) _LSnan._Long_double
-
-#endif // _MSC_VER
-
-#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
diff --git a/include/support/win32/locale_win32.h b/include/support/win32/locale_win32.h
deleted file mode 100644
index e035420fb582..000000000000
--- a/include/support/win32/locale_win32.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// -*- C++ -*-
-//===--------------------- support/win32/locale_win32.h -------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
-
-// ctype mask table defined in msvcrt.dll
-extern "C" unsigned short __declspec(dllimport) _ctype[];
-
-#include "support/win32/support.h"
-#include <memory>
-#include <xlocinfo.h> // _locale_t
-#define locale_t _locale_t
-#define LC_COLLATE_MASK _M_COLLATE
-#define LC_CTYPE_MASK _M_CTYPE
-#define LC_MONETARY_MASK _M_MONETARY
-#define LC_NUMERIC_MASK _M_NUMERIC
-#define LC_TIME_MASK _M_TIME
-#define LC_MESSAGES_MASK _M_MESSAGES
-#define LC_ALL_MASK ( LC_COLLATE_MASK \
- | LC_CTYPE_MASK \
- | LC_MESSAGES_MASK \
- | LC_MONETARY_MASK \
- | LC_NUMERIC_MASK \
- | LC_TIME_MASK )
-#define freelocale _free_locale
-// FIXME: base currently unused. Needs manual work to construct the new locale
-locale_t newlocale( int mask, const char * locale, locale_t base );
-locale_t uselocale( locale_t newloc );
-lconv *localeconv_l( locale_t loc );
-size_t mbrlen_l( const char *__restrict__ s, size_t n,
- mbstate_t *__restrict__ ps, locale_t loc);
-size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
- size_t len, mbstate_t *__restrict__ ps, locale_t loc );
-size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
- locale_t loc);
-size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
- size_t n, mbstate_t *__restrict__ ps, locale_t loc);
-size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
- size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
-size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
- size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
-wint_t btowc_l( int c, locale_t loc );
-int wctob_l( wint_t c, locale_t loc );
-typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
-typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
-_LIBCPP_ALWAYS_INLINE inline
-decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
-{
- __locale_raii __current( uselocale(__l), uselocale );
- return MB_CUR_MAX;
-}
-
-// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
-#include <stdio.h>
-#define mbtowc_l _mbtowc_l
-#define strtoll_l _strtoi64_l
-#define strtoull_l _strtoui64_l
-// FIXME: current msvcrt does not know about long double
-#define strtold_l _strtod_l
-#define islower_l _islower_l
-#define isupper_l _isupper_l
-#define isdigit_l _isdigit_l
-#define isxdigit_l _isxdigit_l
-#define strcoll_l _strcoll_l
-#define strxfrm_l _strxfrm_l
-#define wcscoll_l _wcscoll_l
-#define wcsxfrm_l _wcsxfrm_l
-#define toupper_l _toupper_l
-#define tolower_l _tolower_l
-#define iswspace_l _iswspace_l
-#define iswprint_l _iswprint_l
-#define iswcntrl_l _iswcntrl_l
-#define iswupper_l _iswupper_l
-#define iswlower_l _iswlower_l
-#define iswalpha_l _iswalpha_l
-#define iswdigit_l _iswdigit_l
-#define iswpunct_l _iswpunct_l
-#define iswxdigit_l _iswxdigit_l
-#define towupper_l _towupper_l
-#define towlower_l _towlower_l
-#define strftime_l _strftime_l
-#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
-#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
-int asprintf_l( char **ret, locale_t loc, const char *format, ... );
-int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
-
-
-// not-so-pressing FIXME: use locale to determine blank characters
-inline int isblank_l( int c, locale_t /*loc*/ )
-{
- return ( c == ' ' || c == '\t' );
-}
-inline int iswblank_l( wint_t c, locale_t /*loc*/ )
-{
- return ( c == L' ' || c == L'\t' );
-}
-
-#ifdef _MSC_VER
-inline int isblank( int c, locale_t /*loc*/ )
-{ return ( c == ' ' || c == '\t' ); }
-inline int iswblank( wint_t c, locale_t /*loc*/ )
-{ return ( c == L' ' || c == L'\t' ); }
-#endif // _MSC_VER
-#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
diff --git a/include/support/win32/math_win32.h b/include/support/win32/math_win32.h
deleted file mode 100644
index 41c50d624744..000000000000
--- a/include/support/win32/math_win32.h
+++ /dev/null
@@ -1,113 +0,0 @@
-// -*- C++ -*-
-//===---------------------- support/win32/math_win32.h --------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
-#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
-
-#if !defined(_MSC_VER)
-#error "This header is MSVC specific, Clang and GCC should not include it"
-#else
-
-#include <math.h>
-
-typedef float float_t;
-typedef double double_t;
-
-_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
-{
- return _finite(num) != 0;
-}
-_LIBCPP_ALWAYS_INLINE bool isinf( double num )
-{
- return !isfinite(num) && !_isnan(num);
-}
-_LIBCPP_ALWAYS_INLINE bool isnan( double num )
-{
- return _isnan(num) != 0;
-}
-_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
-{
- int class_ = _fpclass(num);
- return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x > y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x >= y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
-{
- if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
- else return x < y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
-{
- if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
- else return x <= y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
-{
- if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
- else return x < y || x > y;
-}
-
-_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
-{
- return isnan(x) || isnan(y);
-}
-_LIBCPP_ALWAYS_INLINE bool signbit( double num )
-{
- switch(_fpclass(num))
- {
- case _FPCLASS_SNAN:
- case _FPCLASS_QNAN:
- case _FPCLASS_NINF:
- case _FPCLASS_NN:
- case _FPCLASS_ND:
- case _FPCLASS_NZ:
- return true;
- case _FPCLASS_PZ:
- case _FPCLASS_PD:
- case _FPCLASS_PN:
- case _FPCLASS_PINF:
- return false;
- }
- return false;
-}
-_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
-{
- return (signbit (x) != signbit (y) ? - x : x);
-}
-_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
-{
- return ::_copysign(x,y);
-}
-_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
-{
- return ::_copysignl(x,y);
-}
-_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
-{
- return _fpclass(num);
-}
-
-#endif // _MSC_VER
-
-#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
diff --git a/include/support/win32/support.h b/include/support/win32/support.h
deleted file mode 100644
index 0b8a912ac176..000000000000
--- a/include/support/win32/support.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// -*- C++ -*-
-//===----------------------- support/win32/support.h ----------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
-#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
-
-/*
- Functions and constants used in libc++ that are missing from the Windows C library.
- */
-
-#include <__config>
-#include <wchar.h> // mbstate_t
-#include <stdio.h> // _snwprintf
-#define swprintf _snwprintf
-#define vswprintf _vsnwprintf
-#define vfscnaf fscanf
-
-int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
-int asprintf( char **sptr, const char *__restrict fmt, ...);
-//int vfscanf( FILE *__restrict stream, const char *__restrict format,
-// va_list arg);
-
-size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
- size_t nmc, size_t len, mbstate_t *__restrict ps );
-size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
- size_t nwc, size_t len, mbstate_t *__restrict ps );
-
-#if defined(_MSC_VER)
-#define snprintf _snprintf
-
-#include <xlocinfo.h>
-#define atoll _atoi64
-#define strtoll _strtoi64
-#define strtoull _strtoui64
-#define wcstoll _wcstoi64
-#define wcstoull _wcstoui64
-_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
-{ return _Stof(nptr, endptr, 0); }
-_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
-{ return _Stod(nptr, endptr, 0); }
-_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
-{ return _Stold(nptr, endptr, 0); }
-
-#define _Exit _exit
-
-#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
-#include <intrin.h>
-
-_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
- static const unsigned int m1 = 0x55555555; //binary: 0101...
- static const unsigned int m2 = 0x33333333; //binary: 00110011..
- static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
- static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
- x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
- x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
- x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
- return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
-}
-
-_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
- return __builtin_popcount(static_cast<int>(x));
-}
-
-_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
- static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
- static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
- static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
- static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
- x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
- x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
- x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
- return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
-}
-
-_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
-{
- DWORD r = 0;
- _BitScanReverse(&r, x);
- return static_cast<int>(r);
-}
-// sizeof(long) == sizeof(int) on Windows
-_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
-{ return __builtin_ctz( static_cast<int>(x) ); }
-_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
-{
- DWORD r = 0;
- _BitScanReverse64(&r, x);
- return static_cast<int>(r);
-}
-_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
-{
- DWORD r = 0;
- _BitScanForward(&r, x);
- return static_cast<int>(r);
-}
-// sizeof(long) == sizeof(int) on Windows
-_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
-{ return __builtin_clz( static_cast<int>(x) ); }
-_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
-{
- DWORD r = 0;
- _BitScanForward64(&r, x);
- return static_cast<int>(r);
-}
-#endif // !__clang__
-#endif // _MSC_VER
-
-#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H
diff --git a/include/system_error b/include/system_error
index e9f2b55eac13..9f7e4e9e34a7 100644
--- a/include/system_error
+++ b/include/system_error
@@ -354,12 +354,12 @@ struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { };
#endif
-class error_condition;
-class error_code;
+class _LIBCPP_VISIBLE error_condition;
+class _LIBCPP_VISIBLE error_code;
// class error_category
-class __do_message;
+class _LIBCPP_HIDDEN __do_message;
class _LIBCPP_VISIBLE error_category
{
@@ -387,7 +387,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
- friend class __do_message;
+ friend class _LIBCPP_HIDDEN __do_message;
};
class _LIBCPP_HIDDEN __do_message
diff --git a/include/thread b/include/thread
index 23b191589998..60d8885951d3 100644
--- a/include/thread
+++ b/include/thread
@@ -26,41 +26,41 @@ public:
class id;
typedef pthread_t native_handle_type;
- thread();
+ thread() noexcept;
template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
~thread();
thread(const thread&) = delete;
- thread(thread&& t);
+ thread(thread&& t) noexcept;
thread& operator=(const thread&) = delete;
- thread& operator=(thread&& t);
+ thread& operator=(thread&& t) noexcept;
- void swap(thread& t);
+ void swap(thread& t) noexcept;
- bool joinable() const;
+ bool joinable() const noexcept;
void join();
void detach();
- id get_id() const;
+ id get_id() const noexcept;
native_handle_type native_handle();
- static unsigned hardware_concurrency();
+ static unsigned hardware_concurrency() noexcept;
};
-void swap(thread& x, thread& y);
+void swap(thread& x, thread& y) noexcept;
class thread::id
{
public:
- id();
+ id() noexcept;
};
-bool operator==(thread::id x, thread::id y);
-bool operator!=(thread::id x, thread::id y);
-bool operator< (thread::id x, thread::id y);
-bool operator<=(thread::id x, thread::id y);
-bool operator> (thread::id x, thread::id y);
-bool operator>=(thread::id x, thread::id y);
+bool operator==(thread::id x, thread::id y) noexcept;
+bool operator!=(thread::id x, thread::id y) noexcept;
+bool operator< (thread::id x, thread::id y) noexcept;
+bool operator<=(thread::id x, thread::id y) noexcept;
+bool operator> (thread::id x, thread::id y) noexcept;
+bool operator>=(thread::id x, thread::id y) noexcept;
template<class charT, class traits>
basic_ostream<charT, traits>&
@@ -69,9 +69,9 @@ operator<<(basic_ostream<charT, traits>& out, thread::id id);
namespace this_thread
{
-thread::id get_id();
+thread::id get_id() noexcept;
-void yield();
+void yield() noexcept;
template <class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
@@ -173,13 +173,13 @@ __thread_specific_ptr<_Tp>::reset(pointer __p)
delete __p_old;
}
-class thread;
-class __thread_id;
+class _LIBCPP_VISIBLE thread;
+class _LIBCPP_VISIBLE __thread_id;
namespace this_thread
{
-__thread_id get_id();
+_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
} // this_thread
@@ -195,25 +195,25 @@ class _LIBCPP_VISIBLE __thread_id
public:
_LIBCPP_INLINE_VISIBILITY
- __thread_id() : __id_(0) {}
+ __thread_id() _NOEXCEPT : __id_(0) {}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator==(__thread_id __x, __thread_id __y)
+ bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
{return __x.__id_ == __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator!=(__thread_id __x, __thread_id __y)
+ bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
{return !(__x == __y);}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator< (__thread_id __x, __thread_id __y)
+ bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
{return __x.__id_ < __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator<=(__thread_id __x, __thread_id __y)
+ bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
{return !(__y < __x);}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator> (__thread_id __x, __thread_id __y)
+ bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
{return __y < __x ;}
friend _LIBCPP_INLINE_VISIBILITY
- bool operator>=(__thread_id __x, __thread_id __y)
+ bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
{return !(__x < __y);}
template<class _CharT, class _Traits>
@@ -227,7 +227,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
__thread_id(pthread_t __id) : __id_(__id) {}
- friend __thread_id this_thread::get_id();
+ friend __thread_id this_thread::get_id() _NOEXCEPT;
friend class _LIBCPP_VISIBLE thread;
friend struct _LIBCPP_VISIBLE hash<__thread_id>;
};
@@ -248,7 +248,7 @@ namespace this_thread
inline _LIBCPP_INLINE_VISIBILITY
__thread_id
-get_id()
+get_id() _NOEXCEPT
{
return pthread_self();
}
@@ -266,7 +266,7 @@ public:
typedef pthread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
- thread() : __t_(0) {}
+ thread() _NOEXCEPT : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args,
class = typename enable_if
@@ -282,23 +282,23 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
- thread& operator=(thread&& __t);
+ thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+ thread& operator=(thread&& __t) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- void swap(thread& __t) {_VSTD::swap(__t_, __t.__t_);}
+ void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
- bool joinable() const {return __t_ != 0;}
+ bool joinable() const _NOEXCEPT {return __t_ != 0;}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
- id get_id() const {return __t_;}
+ id get_id() const _NOEXCEPT {return __t_;}
_LIBCPP_INLINE_VISIBILITY
- native_handle_type native_handle() {return __t_;}
+ native_handle_type native_handle() _NOEXCEPT {return __t_;}
- static unsigned hardware_concurrency();
+ static unsigned hardware_concurrency() _NOEXCEPT;
};
class __assoc_sub_state;
@@ -386,7 +386,7 @@ thread::thread(_Fp __f)
inline _LIBCPP_INLINE_VISIBILITY
thread&
-thread::operator=(thread&& __t)
+thread::operator=(thread&& __t) _NOEXCEPT
{
if (__t_ != 0)
terminate();
@@ -398,7 +398,7 @@ thread::operator=(thread&& __t)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
-void swap(thread& __x, thread& __y) {__x.swap(__y);}
+void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
namespace this_thread
{
@@ -410,10 +410,20 @@ void
sleep_for(const chrono::duration<_Rep, _Period>& __d)
{
using namespace chrono;
- nanoseconds __ns = duration_cast<nanoseconds>(__d);
- if (__ns < __d)
- ++__ns;
- sleep_for(__ns);
+ if (__d > duration<_Rep, _Period>::zero())
+ {
+ _LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+ nanoseconds __ns;
+ if (__d < _Max)
+ {
+ __ns = duration_cast<nanoseconds>(__d);
+ if (__ns < __d)
+ ++__ns;
+ }
+ else
+ __ns = nanoseconds::max();
+ sleep_for(__ns);
+ }
}
template <class _Clock, class _Duration>
@@ -438,7 +448,7 @@ sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
}
inline _LIBCPP_INLINE_VISIBILITY
-void yield() {sched_yield();}
+void yield() _NOEXCEPT {sched_yield();}
} // this_thread
diff --git a/include/tuple b/include/tuple
index 683c9dd5294c..65af3eb6405e 100644
--- a/include/tuple
+++ b/include/tuple
@@ -130,7 +130,11 @@ _LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE allocator_arg_t { };
+#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
+#else
+constexpr allocator_arg_t allocator_arg = allocator_arg_t();
+#endif
// uses_allocator
@@ -227,7 +231,8 @@ class __tuple_leaf
__tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_INLINE_VISIBILITY __tuple_leaf() : value()
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+ _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
@@ -255,7 +260,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- explicit __tuple_leaf(_Tp&& __t)
+ explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
(is_lvalue_reference<_Hp>::value &&
@@ -311,19 +316,20 @@ public:
>::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
- __tuple_leaf(const __tuple_leaf& __t)
+ __tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: value(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&
- operator=(_Tp&& __t)
+ operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
{
value = _VSTD::forward<_Tp>(__t);
return *this;
@@ -336,8 +342,8 @@ public:
return 0;
}
- _LIBCPP_INLINE_VISIBILITY _Hp& get() {return value;}
- _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return value;}
+ _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return value;}
+ _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return value;}
};
template <size_t _Ip, class _Hp>
@@ -347,7 +353,8 @@ class __tuple_leaf<_Ip, _Hp, true>
__tuple_leaf& operator=(const __tuple_leaf&);
public:
- _LIBCPP_INLINE_VISIBILITY __tuple_leaf() {}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
+ _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
@@ -366,7 +373,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY
- explicit __tuple_leaf(_Tp&& __t)
+ explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: _Hp(_VSTD::forward<_Tp>(__t)) {}
template <class _Tp, class _Alloc>
@@ -387,12 +394,13 @@ public:
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
+ _NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: _Hp(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&
- operator=(_Tp&& __t)
+ operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
{
_Hp::operator=(_VSTD::forward<_Tp>(__t));
return *this;
@@ -406,13 +414,13 @@ public:
return 0;
}
- _LIBCPP_INLINE_VISIBILITY _Hp& get() {return static_cast<_Hp&>(*this);}
- _LIBCPP_INLINE_VISIBILITY const _Hp& get() const {return static_cast<const _Hp&>(*this);}
+ _LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
+ _LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
-void __swallow(_Tp&&...) {}
+void __swallow(_Tp&&...) _NOEXCEPT {}
template <bool ...> struct __all;
@@ -436,13 +444,19 @@ template<size_t ..._Indx, class ..._Tp>
struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
: public __tuple_leaf<_Indx, _Tp>...
{
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR __tuple_impl()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
- _Up&&... __u) :
+ _Up&&... __u)
+ _NOEXCEPT_((__all<is_nothrow_constructible<_Tf, _Up>::value...>::value &&
+ __all<is_nothrow_default_constructible<_Tl>::value...>::value)) :
__tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))...,
__tuple_leaf<_Ul, _Tl>()...
{}
@@ -467,7 +481,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
>::type
>
_LIBCPP_INLINE_VISIBILITY
- __tuple_impl(_Tuple&& __t)
+ __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
+ typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...
{}
@@ -493,7 +508,8 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
__tuple_assignable<_Tuple, tuple<_Tp...> >::value,
__tuple_impl&
>::type
- operator=(_Tuple&& __t)
+ operator=(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_assignable<_Tp&, typename tuple_element<_Indx,
+ typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>(_VSTD::get<_Indx>(__t)))...);
@@ -502,7 +518,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
_LIBCPP_INLINE_VISIBILITY
__tuple_impl&
- operator=(const __tuple_impl& __t)
+ operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
return *this;
@@ -532,7 +548,11 @@ class _LIBCPP_VISIBLE tuple
public:
_LIBCPP_INLINE_VISIBILITY
- explicit tuple(const _Tp& ... __t)
+ _LIBCPP_CONSTEXPR tuple()
+ _NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -568,6 +588,15 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple(_Up&&... __u)
+ _NOEXCEPT_((
+ is_nothrow_constructible<
+ typename __make_tuple_indices<sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+ _Up...
+ >::value
+ ))
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -600,6 +629,15 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
+ _NOEXCEPT_((
+ is_nothrow_constructible<
+ typename __make_tuple_indices<sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
+ typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
+ typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type,
+ _Up...
+ >::value
+ ))
: base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -637,7 +675,7 @@ public:
>::type = false
>
_LIBCPP_INLINE_VISIBILITY
- tuple(_Tuple&& __t)
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Tuple,
@@ -650,7 +688,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
explicit
- tuple(_Tuple&& __t)
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
@@ -671,7 +709,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple&
- operator=(_Tuple&& __t)
+ operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
{
base_.operator=(_VSTD::forward<_Tuple>(__t));
return *this;
@@ -687,19 +725,19 @@ class _LIBCPP_VISIBLE tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
- tuple() {}
+ _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&) {}
+ tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&, const tuple&) {}
+ tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(array<_Up, 0>) {}
+ tuple(array<_Up, 0>) _NOEXCEPT {}
template <class _Alloc, class _Up>
_LIBCPP_INLINE_VISIBILITY
- tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) {}
+ tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
void swap(tuple&) _NOEXCEPT {}
};
@@ -750,7 +788,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&...>
-tie(_Tp&... __t)
+tie(_Tp&... __t) _NOEXCEPT
{
return tuple<_Tp&...>(__t...);
}
@@ -765,7 +803,7 @@ struct __ignore_t
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
-template <class _Tp> class reference_wrapper;
+template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
template <class _Tp>
struct ___make_tuple_return
@@ -796,7 +834,7 @@ make_tuple(_Tp&&... __t)
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
-forward_as_tuple(_Tp&&... __t)
+forward_as_tuple(_Tp&&... __t) _NOEXCEPT
{
return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...);
}
diff --git a/include/type_traits b/include/type_traits
index a54e25204eeb..f74b77846d33 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -607,22 +607,33 @@ template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}
template <class _Tp> struct _LIBCPP_VISIBLE is_abstract : public __libcpp_abstract<_Tp> {};
+// is_base_of
+
+#ifdef _LIBCP_HAS_IS_BASE_OF
+
+template <class _Bp, class _Dp>
+struct _LIBCPP_VISIBLE is_base_of
+ : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
+
+#else // __has_feature(is_base_of)
+
+#error is_base_of not implemented.
+
+#endif // __has_feature(is_base_of)
+
// is_convertible
#if __has_feature(is_convertible_to)
template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
- : public integral_constant<bool, __is_convertible_to(_T1, _T2)> {};
+ : public integral_constant<bool, __is_convertible_to(_T1, _T2) &&
+ !is_abstract<_T2>::value> {};
#else // __has_feature(is_convertible_to)
namespace __is_convertible_imp
{
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _Tp> char __test(const volatile typename remove_reference<_Tp>::type&&);
-#else
template <class _Tp> char __test(_Tp);
-#endif
template <class _Tp> __two __test(...);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> _Tp&& __source();
@@ -657,7 +668,17 @@ template <class _T1, class _T2,
unsigned _T2_is_array_function_or_void = __is_convertible_imp::__is_array_function_or_void<_T2>::value>
struct __is_convertible
: public integral_constant<bool,
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
+#else
+ sizeof(__is_convertible_imp::__test<_T2>(__is_convertible_imp::__source<_T1>())) == 1
+ && !(!is_function<_T1>::value && !is_reference<_T1>::value && is_reference<_T2>::value
+ && (!is_const<typename remove_reference<_T2>::type>::value
+ || is_volatile<typename remove_reference<_T2>::type>::value)
+ && (is_same<typename remove_cv<_T1>::type,
+ typename remove_cv<typename remove_reference<_T2>::type>::type>::value
+ || is_base_of<typename remove_reference<_T2>::type, _T1>::value))
+#endif
>
{};
@@ -687,6 +708,7 @@ template <class _T1, class _T2> struct __is_convertible<_T1, _T2, 2, 0>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1> struct __is_convertible<_T1, _T1&&, 2, 0> : public true_type {};
#endif
+template <class _T1> struct __is_convertible<_T1, _T1&, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*const, 2, 0> : public true_type {};
template <class _T1> struct __is_convertible<_T1, _T1*volatile, 2, 0> : public true_type {};
@@ -718,20 +740,6 @@ template <class _T1, class _T2> struct _LIBCPP_VISIBLE is_convertible
#endif // __has_feature(is_convertible_to)
-// is_base_of
-
-#ifdef _LIBCP_HAS_IS_BASE_OF
-
-template <class _Bp, class _Dp>
-struct _LIBCPP_VISIBLE is_base_of
- : public integral_constant<bool, __is_base_of(_Bp, _Dp)> {};
-
-#else // __has_feature(is_base_of)
-
-#error is_base_of not implemented.
-
-#endif // __has_feature(is_base_of)
-
// is_empty
#if __has_feature(is_empty)
@@ -1609,77 +1617,13 @@ struct __member_pointer_traits
template <class _Callable> class result_of;
+#ifdef _LIBCPP_HAS_NO_VARIADICS
+
template <class _Fn, bool, bool>
class __result_of
{
};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
-template <class _Fn, class ..._ArgTypes>
-class __result_of<_Fn(_ArgTypes...), true, false>
-{
-public:
- typedef decltype(declval<_Fn>()(declval<_ArgTypes>()...)) type;
-};
-
-template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
-struct __result_of_mp;
-
-// member function pointer
-
-template <class _MP, class _Tp>
-struct __result_of_mp<_MP, _Tp, true>
- : public common_type<typename __member_pointer_traits<_MP>::_ReturnType>
-{
-};
-
-// member data pointer
-
-template <class _MP, class _Tp, bool>
-struct __result_of_mdp;
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mdp<_Rp _Class::*, _Tp, false>
-{
- typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type&& type;
-};
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mdp<_Rp _Class::*, _Tp, true>
-{
- typedef typename __apply_cv<_Tp, _Rp>::type&& type;
-};
-
-template <class _Rp, class _Class, class _Tp>
-struct __result_of_mp<_Rp _Class::*, _Tp, false>
- : public __result_of_mdp<_Rp _Class::*, _Tp,
- is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
-{
-};
-
-template <class _Fn, class _Tp, class ..._ArgTypes>
-class __result_of<_Fn(_Tp, _ArgTypes...), false, true> // _Fn must be member pointer
- : public __result_of_mp<typename remove_reference<_Fn>::type,
- _Tp,
- is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
-{
-};
-
-// result_of
-
-template <class _Fn, class ..._ArgTypes>
-class _LIBCPP_VISIBLE result_of<_Fn(_ArgTypes...)>
- : public __result_of<_Fn(_ArgTypes...),
- is_class<typename remove_reference<_Fn>::type>::value ||
- is_function<typename remove_reference<_Fn>::type>::value,
- is_member_pointer<typename remove_reference<_Fn>::type>::value
- >
-{
-};
-
-#else // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Fn>
class __result_of<_Fn(), true, false>
{
@@ -2781,37 +2725,37 @@ struct __check_complete<_Tp&&>
template <class _Rp, class ..._Param>
struct __check_complete<_Rp (*)(_Param...)>
- : private __check_complete<_Param...>
+ : private __check_complete<_Rp>
{
};
template <class _Rp, class ..._Param>
struct __check_complete<_Rp (_Param...)>
- : private __check_complete<_Param...>
+ : private __check_complete<_Rp>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...)>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
@@ -2819,49 +2763,49 @@ struct __check_complete<_Rp (_Class::*)(_Param...) const volatile>
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) &&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const&&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) volatile&&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
template <class _Rp, class _Class, class ..._Param>
struct __check_complete<_Rp (_Class::*)(_Param...) const volatile&&>
- : private __check_complete<_Class, _Param...>
+ : private __check_complete<_Class>
{
};
@@ -2885,11 +2829,13 @@ __invoke(__any, _Args&& ...__args)
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...));
template <class _Fp, class _A0, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...));
@@ -2897,11 +2843,13 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
// bullets 3 and 4
template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f);
template <class _Fp, class _A0>
+_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f);
@@ -2909,6 +2857,7 @@ __invoke(_Fp&& __f, _A0&& __a0)
// bullet 5
template <class _Fp, class ..._Args>
+_LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...));
@@ -2917,7 +2866,7 @@ __invoke(_Fp&& __f, _Args&& ...__args)
template <class _Fp, class ..._Args>
struct __invokable_imp
- : private __check_complete<_Fp, _Args...>
+ : private __check_complete<_Fp>
{
typedef decltype(
__invoke(_VSTD::declval<_Fp>(), _VSTD::declval<_Args>()...)
@@ -2951,6 +2900,12 @@ struct __invoke_of
{
};
+template <class _Fp, class ..._Args>
+class _LIBCPP_VISIBLE result_of<_Fp(_Args...)>
+ : public __invoke_of<_Fp, _Args...>
+{
+};
+
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
diff --git a/include/unordered_map b/include/unordered_map
index 15243f6fe082..cb2ab42abef2 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -786,42 +786,15 @@ public:
const_iterator cend() const _NOEXCEPT {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> emplace()
- {return __table_.__emplace_unique();}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> emplace(_A0&& __a0)
- {return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
-
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- pair<iterator, bool> emplace(_A0&& __a0, _Args&&... __args);
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator)
- {return __table_.__emplace_unique().first;}
+ template <class... _Args>
+ pair<iterator, bool> emplace(_Args&&... __args);
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
+ template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator, _A0&& __a0)
- {return __table_.__emplace_unique(_VSTD::forward<_A0>(__a0)).first;}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator, _A0&& __a0, _Args&&... __args)
- {return emplace(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...).first;}
+ iterator emplace_hint(const_iterator, _Args&&... __args)
+ {return emplace(_VSTD::forward<_Args>(__args)...).first;}
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -932,14 +905,25 @@ public:
private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ __node_holder __construct_node();
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<value_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<key_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0, _Args&&... __args);
+ template <class _A0, class _A1, class ..._Args>
+ __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(const key_type& __k);
#endif
@@ -1106,34 +1090,26 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0, class... _Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
- _Args&&... __args)
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node()
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first),
- _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second),
- _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0,
- class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
- >
-typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+template <class _A0>
+typename enable_if
+<
+ is_constructible<pair<const _Key, _Tp>, _A0>::value,
+ typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+>::type
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
@@ -1145,17 +1121,50 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
return __h;
}
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0>
+typename enable_if
+<
+ is_constructible<_Key, _A0>::value,
+ typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+>::type
+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), _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));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0, class... _Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
+template <class _A0, class _A1, class ..._Args>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0,
+ _A1&& __a1,
+ _Args&&... __args)
+{
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+ _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+ _VSTD::forward<_Args>(__args)...);
+ __h.get_deleter().__first_constructed = true;
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class... _Args>
pair<typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator, bool>
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
if (__r.second)
__h.release();
@@ -1409,39 +1418,13 @@ public:
const_iterator cend() const _NOEXCEPT {return __table_.end();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace()
- {return __table_.__emplace_multi();}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace(_A0&& __a0)
- {return __table_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
-
#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- iterator emplace(_A0&& __a0, _Args&&... __args);
+ template <class... _Args>
+ iterator emplace(_Args&&... __args);
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p)
- {return __table_.__emplace_hint_multi(__p.__i_);}
-
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- _LIBCPP_INLINE_VISIBILITY
- iterator emplace_hint(const_iterator __p, _A0&& __a0)
- {return __table_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- iterator emplace_hint(const_iterator __p, _A0&& __a0, _Args&&... __args);
+ template <class... _Args>
+ iterator emplace_hint(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -1543,14 +1526,27 @@ public:
void reserve(size_type __n) {__table_.reserve(__n);}
private:
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
- template <class _A0, class... _Args,
- class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0, _Args&&... __args);
- template <class _A0,
- class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
- __node_holder __construct_node(_A0&& __a0);
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ __node_holder __construct_node();
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<value_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
+ template <class _A0>
+ typename enable_if
+ <
+ is_constructible<key_type, _A0>::value,
+ __node_holder
+ >::type
+ __construct_node(_A0&& __a0);
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+ template <class _A0, class _A1, class ..._Args>
+ __node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args);
+#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -1716,34 +1712,26 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0, class... _Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
- _A0&& __a0, _Args&&... __args)
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node()
{
__node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first),
- _VSTD::forward<_A0>(__a0));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_));
__h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second),
- _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true;
return __h;
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0,
- class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
- >
-typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+template <class _A0>
+typename enable_if
+<
+ is_constructible<pair<const _Key, _Tp>, _A0>::value,
+ typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+>::type
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __table_.__node_alloc();
@@ -1755,32 +1743,61 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(_A0&& __a0
return __h;
}
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class _A0>
+typename enable_if
+<
+ is_constructible<_Key, _A0>::value,
+ typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+>::type
+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), _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));
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0, class... _Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
+template <class _A0, class _A1, class ..._Args>
+typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(
+ _A0&& __a0, _A1&& __a1, _Args&&... __args)
+{
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_),
+ _VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
+ _VSTD::forward<_Args>(__args)...);
+ __h.get_deleter().__first_constructed = true;
+ __h.get_deleter().__second_constructed = true;
+ return __h;
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+template <class... _Args>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
-unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_A0&& __a0, _Args&&... __args)
+unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace(_Args&&... __args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __table_.__node_insert_multi(__h.get());
__h.release();
return __r;
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-template <class _A0, class... _Args,
- class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
- >
+template <class... _Args>
typename unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::iterator
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::emplace_hint(
- const_iterator __p, _A0&& __a0, _Args&&... __args)
+ const_iterator __p, _Args&&... __args)
{
- __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
- _VSTD::forward<_Args>(__args)...);
+ __node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
iterator __r = __table_.__node_insert_multi(__p.__i_, __h.get());
__h.release();
return __r;
diff --git a/include/utility b/include/utility
index 279d42188821..df693ec1e86b 100644
--- a/include/utility
+++ b/include/utility
@@ -233,8 +233,8 @@ struct _LIBCPP_VISIBLE pair
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
- ,typename enable_if<is_constructible<_T1, _U1>::value &&
- is_constructible<_T2, _U2>::value>::type* = 0
+ ,typename enable_if<is_convertible<const _U1&, _T1>::value &&
+ is_convertible<const _U2&, _T2>::value>::type* = 0
#endif
)
: first(__p.first), second(__p.second) {}
@@ -261,8 +261,8 @@ struct _LIBCPP_VISIBLE pair
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _U1, class _U2,
- class = typename enable_if<is_constructible<first_type, _U1 >::value &&
- is_constructible<second_type, _U2>::value>::type>
+ class = typename enable_if<is_convertible<_U1, first_type>::value &&
+ is_convertible<_U2, second_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair(_U1&& __u1, _U2&& __u2)
: first(_VSTD::forward<_U1>(__u1)),
@@ -272,8 +272,8 @@ struct _LIBCPP_VISIBLE pair
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
- typename enable_if<is_constructible<_T1, _U1>::value &&
- is_constructible<_T2, _U2>::value>::type* = 0)
+ typename enable_if<is_convertible<_U1, _T1>::value &&
+ is_convertible<_U2, _T2>::value>::type* = 0)
: first(_VSTD::forward<_U1>(__p.first)),
second(_VSTD::forward<_U2>(__p.second)) {}
@@ -419,7 +419,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-template <class _Tp> class reference_wrapper;
+template <class _Tp> class _LIBCPP_VISIBLE reference_wrapper;
template <class _Tp>
struct ___make_pair_return
diff --git a/include/valarray b/include/valarray
index 3c0422a1b5b6..4091d0f71b3e 100644
--- a/include/valarray
+++ b/include/valarray
@@ -29,7 +29,7 @@ public:
valarray(const value_type& x, size_t n);
valarray(const value_type* px, size_t n);
valarray(const valarray& v);
- valarray(valarray&& v);
+ valarray(valarray&& v) noexcept;
valarray(const slice_array<value_type>& sa);
valarray(const gslice_array<value_type>& ga);
valarray(const mask_array<value_type>& ma);
@@ -39,7 +39,7 @@ public:
// assignment:
valarray& operator=(const valarray& v);
- valarray& operator=(valarray&& v);
+ valarray& operator=(valarray&& v) noexcept;
valarray& operator=(initializer_list<value_type> il);
valarray& operator=(const value_type& x);
valarray& operator=(const slice_array<value_type>& sa);
@@ -91,7 +91,7 @@ public:
valarray& operator>>=(const valarray& v);
// member functions:
- void swap(valarray& v);
+ void swap(valarray& v) noexcept;
size_t size() const;
@@ -231,7 +231,7 @@ public:
indirect_array() = delete;
};
-template<class T> void swap(valarray<T>& x, valarray<T>& y);
+template<class T> void swap(valarray<T>& x, valarray<T>& y) noexcept;
template<class T> valarray<T> operator* (const valarray<T>& x, const valarray<T>& y);
template<class T> valarray<T> operator* (const valarray<T>& x, const T& y);
@@ -354,7 +354,7 @@ template <class T> unspecified2 end(const valarray<T>& v);
_LIBCPP_BEGIN_NAMESPACE_STD
-template<class _Tp> class valarray;
+template<class _Tp> class _LIBCPP_VISIBLE valarray;
class _LIBCPP_VISIBLE slice
{
@@ -381,25 +381,29 @@ public:
_LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
};
-template <class _Tp> class slice_array;
-class gslice;
-template <class _Tp> class gslice_array;
-template <class _Tp> class mask_array;
-template <class _Tp> class indirect_array;
+template <class _Tp> class _LIBCPP_VISIBLE slice_array;
+class _LIBCPP_VISIBLE gslice;
+template <class _Tp> class _LIBCPP_VISIBLE gslice_array;
+template <class _Tp> class _LIBCPP_VISIBLE mask_array;
+template <class _Tp> class _LIBCPP_VISIBLE indirect_array;
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
_Tp*
begin(valarray<_Tp>& __v);
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
const _Tp*
begin(const valarray<_Tp>& __v);
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
_Tp*
end(valarray<_Tp>& __v);
template <class _Tp>
+_LIBCPP_INLINE_VISIBILITY
const _Tp*
end(const valarray<_Tp>& __v);
@@ -801,7 +805,7 @@ public:
valarray(const value_type* __p, size_t __n);
valarray(const valarray& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray(valarray&& __v);
+ valarray(valarray&& __v) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
valarray(initializer_list<value_type> __il);
@@ -815,7 +819,7 @@ public:
// assignment:
valarray& operator=(const valarray& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- valarray& operator=(valarray&& __v);
+ valarray& operator=(valarray&& __v) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
valarray& operator=(initializer_list<value_type>);
@@ -956,7 +960,7 @@ public:
operator>>= (const _Expr& __v);
// member functions:
- void swap(valarray& __v);
+ void swap(valarray& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
@@ -2709,7 +2713,7 @@ valarray<_Tp>::valarray(const valarray& __v)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
-valarray<_Tp>::valarray(valarray&& __v)
+valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
: __begin_(__v.__begin_),
__end_(__v.__end_)
{
@@ -2886,7 +2890,7 @@ valarray<_Tp>::operator=(const valarray& __v)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
valarray<_Tp>&
-valarray<_Tp>::operator=(valarray&& __v)
+valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
{
resize(0);
__begin_ = __v.__begin_;
@@ -3446,7 +3450,7 @@ valarray<_Tp>::operator>>=(const _Expr& __v)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
-valarray<_Tp>::swap(valarray& __v)
+valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
{
_VSTD::swap(__begin_, __v.__begin_);
_VSTD::swap(__end_, __v.__end_);
@@ -3613,7 +3617,7 @@ valarray<_Tp>::resize(size_t __n, value_type __x)
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
-swap(valarray<_Tp>& __x, valarray<_Tp>& __y)
+swap(valarray<_Tp>& __x, valarray<_Tp>& __y) _NOEXCEPT
{
__x.swap(__y);
}
diff --git a/include/vector b/include/vector
index 61f0aef748f9..ee7143555caa 100644
--- a/include/vector
+++ b/include/vector
@@ -1681,8 +1681,9 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
}
else
{
+ value_type __tmp(_VSTD::forward<_Args>(__args)...);
__move_range(__p, this->__end_, __p + 1);
- *__p = value_type(_VSTD::forward<_Args>(__args)...);
+ *__p = _VSTD::move(__tmp);
}
}
else
@@ -1970,6 +1971,7 @@ public:
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
+ typedef size_type __storage_type;
typedef __bit_iterator<vector, false> pointer;
typedef __bit_iterator<vector, true> const_pointer;
#ifdef _LIBCPP_DEBUG
@@ -1991,7 +1993,6 @@ public:
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
private:
- typedef size_type __storage_type;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__storage_type>
@@ -2317,7 +2318,7 @@ private:
friend class __bit_const_reference<vector>;
friend class __bit_iterator<vector, false>;
friend class __bit_iterator<vector, true>;
- friend class __bit_array<vector>;
+ friend struct __bit_array<vector>;
friend struct _LIBCPP_VISIBLE hash<vector>;
};
@@ -2699,6 +2700,7 @@ vector<bool, _Allocator>::operator=(vector&& __v)
{
__move_assign(__v, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());
+ return *this;
}
template <class _Allocator>