Index: vendor/libc++/dist/include/__mutex_base =================================================================== --- vendor/libc++/dist/include/__mutex_base (revision 319785) +++ vendor/libc++/dist/include/__mutex_base (revision 319786) @@ -1,437 +1,440 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP___MUTEX_BASE #define _LIBCPP___MUTEX_BASE #include <__config> #include #include #include <__threading_support> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS #ifndef _LIBCPP_THREAD_SAFETY_ANNOTATION # ifdef _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) __attribute__((x)) # else # define _LIBCPP_THREAD_SAFETY_ANNOTATION(x) # endif #endif // _LIBCPP_THREAD_SAFETY_ANNOTATION class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex { #ifndef _LIBCPP_CXX03_LANG __libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER; #else __libcpp_mutex_t __m_; #endif public: _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_CXX03_LANG - constexpr mutex() _NOEXCEPT = default; + constexpr mutex() = default; #else mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;} #endif ~mutex(); private: mutex(const mutex&);// = delete; mutex& operator=(const mutex&);// = delete; public: void lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability()); bool try_lock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(try_acquire_capability(true)); void unlock() _NOEXCEPT _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()); typedef __libcpp_mutex_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; + +static_assert(is_nothrow_default_constructible::value, + "the default constructor for std::mutex must be nothrow"); struct _LIBCPP_TYPE_VIS defer_lock_t {}; struct _LIBCPP_TYPE_VIS try_to_lock_t {}; struct _LIBCPP_TYPE_VIS adopt_lock_t {}; #if defined(_LIBCPP_CXX03_LANG) || 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; #else 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 _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable) lock_guard { public: typedef _Mutex mutex_type; private: mutex_type& __m_; public: _LIBCPP_INLINE_VISIBILITY explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {__m_.lock();} _LIBCPP_INLINE_VISIBILITY lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} _LIBCPP_INLINE_VISIBILITY ~lock_guard() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} private: lock_guard(lock_guard const&) _LIBCPP_EQUAL_DELETE; lock_guard& operator=(lock_guard const&) _LIBCPP_EQUAL_DELETE; }; template class _LIBCPP_TEMPLATE_VIS unique_lock { public: typedef _Mutex mutex_type; private: mutex_type* __m_; bool __owns_; public: _LIBCPP_INLINE_VISIBILITY unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} _LIBCPP_INLINE_VISIBILITY explicit unique_lock(mutex_type& __m) : __m_(_VSTD::addressof(__m)), __owns_(true) {__m_->lock();} _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT : __m_(_VSTD::addressof(__m)), __owns_(false) {} _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, try_to_lock_t) : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock()) {} _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, adopt_lock_t) : __m_(_VSTD::addressof(__m)), __owns_(true) {} template _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, const chrono::time_point<_Clock, _Duration>& __t) : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock_until(__t)) {} template _LIBCPP_INLINE_VISIBILITY unique_lock(mutex_type& __m, const chrono::duration<_Rep, _Period>& __d) : __m_(_VSTD::addressof(__m)), __owns_(__m.try_lock_for(__d)) {} _LIBCPP_INLINE_VISIBILITY ~unique_lock() { if (__owns_) __m_->unlock(); } private: unique_lock(unique_lock const&); // = delete; unique_lock& operator=(unique_lock const&); // = delete; public: #ifndef _LIBCPP_CXX03_LANG _LIBCPP_INLINE_VISIBILITY 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) _NOEXCEPT { if (__owns_) __m_->unlock(); __m_ = __u.__m_; __owns_ = __u.__owns_; __u.__m_ = nullptr; __u.__owns_ = false; return *this; } #endif // _LIBCPP_CXX03_LANG void lock(); bool try_lock(); template bool try_lock_for(const chrono::duration<_Rep, _Period>& __d); template bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock(); _LIBCPP_INLINE_VISIBILITY void swap(unique_lock& __u) _NOEXCEPT { _VSTD::swap(__m_, __u.__m_); _VSTD::swap(__owns_, __u.__owns_); } _LIBCPP_INLINE_VISIBILITY mutex_type* release() _NOEXCEPT { mutex_type* __m = __m_; __m_ = nullptr; __owns_ = false; return __m; } _LIBCPP_INLINE_VISIBILITY bool owns_lock() const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool () const _NOEXCEPT {return __owns_;} _LIBCPP_INLINE_VISIBILITY mutex_type* mutex() const _NOEXCEPT {return __m_;} }; template void unique_lock<_Mutex>::lock() { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::lock: references null mutex"); if (__owns_) __throw_system_error(EDEADLK, "unique_lock::lock: already locked"); __m_->lock(); __owns_ = true; } template bool unique_lock<_Mutex>::try_lock() { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock: references null mutex"); if (__owns_) __throw_system_error(EDEADLK, "unique_lock::try_lock: already locked"); __owns_ = __m_->try_lock(); return __owns_; } template template bool unique_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d) { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock_for: references null mutex"); if (__owns_) __throw_system_error(EDEADLK, "unique_lock::try_lock_for: already locked"); __owns_ = __m_->try_lock_for(__d); return __owns_; } template template bool unique_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { if (__m_ == nullptr) __throw_system_error(EPERM, "unique_lock::try_lock_until: references null mutex"); if (__owns_) __throw_system_error(EDEADLK, "unique_lock::try_lock_until: already locked"); __owns_ = __m_->try_lock_until(__t); return __owns_; } template void unique_lock<_Mutex>::unlock() { if (!__owns_) __throw_system_error(EPERM, "unique_lock::unlock: not locked"); __m_->unlock(); __owns_ = false; } template inline _LIBCPP_INLINE_VISIBILITY void swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT {__x.swap(__y);} //enum class cv_status _LIBCPP_DECLARE_STRONG_ENUM(cv_status) { no_timeout, timeout }; _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status) class _LIBCPP_TYPE_VIS condition_variable { #ifndef _LIBCPP_CXX03_LANG __libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER; #else __libcpp_condvar_t __cv_; #endif public: _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_CXX03_LANG constexpr condition_variable() _NOEXCEPT = default; #else condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;} #endif ~condition_variable(); private: condition_variable(const condition_variable&); // = delete; condition_variable& operator=(const condition_variable&); // = delete; public: void notify_one() _NOEXCEPT; void notify_all() _NOEXCEPT; void wait(unique_lock& __lk) _NOEXCEPT; template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS void wait(unique_lock& __lk, _Predicate __pred); template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t); template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred); template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS cv_status wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d); template bool _LIBCPP_INLINE_VISIBILITY wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred); typedef __libcpp_condvar_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__cv_;} private: void __do_timed_wait(unique_lock& __lk, chrono::time_point) _NOEXCEPT; }; #endif // !_LIBCPP_HAS_NO_THREADS template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < chrono::__is_duration<_To>::value, _To >::type __ceil(chrono::duration<_Rep, _Period> __d) { using namespace chrono; _To __r = duration_cast<_To>(__d); if (__r < __d) ++__r; return __r; } #ifndef _LIBCPP_HAS_NO_THREADS template void condition_variable::wait(unique_lock& __lk, _Predicate __pred) { while (!__pred()) wait(__lk); } template cv_status condition_variable::wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; wait_for(__lk, __t - _Clock::now()); return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; } template bool condition_variable::wait_until(unique_lock& __lk, const chrono::time_point<_Clock, _Duration>& __t, _Predicate __pred) { while (!__pred()) { if (wait_until(__lk, __t) == cv_status::timeout) return __pred(); } return true; } template cv_status condition_variable::wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d) { using namespace chrono; if (__d <= __d.zero()) return cv_status::timeout; typedef time_point > __sys_tpf; typedef time_point __sys_tpi; __sys_tpf _Max = __sys_tpi::max(); steady_clock::time_point __c_now = steady_clock::now(); system_clock::time_point __s_now = system_clock::now(); if (_Max - __d > __s_now) __do_timed_wait(__lk, __s_now + __ceil(__d)); else __do_timed_wait(__lk, __sys_tpi::max()); return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : cv_status::timeout; } template inline bool condition_variable::wait_for(unique_lock& __lk, const chrono::duration<_Rep, _Period>& __d, _Predicate __pred) { return wait_until(__lk, chrono::steady_clock::now() + __d, _VSTD::move(__pred)); } #endif // !_LIBCPP_HAS_NO_THREADS _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #endif // _LIBCPP___MUTEX_BASE Index: vendor/libc++/dist/include/mutex =================================================================== --- vendor/libc++/dist/include/mutex (revision 319785) +++ vendor/libc++/dist/include/mutex (revision 319786) @@ -1,703 +1,702 @@ // -*- C++ -*- //===--------------------------- mutex ------------------------------------===// // // 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_MUTEX #define _LIBCPP_MUTEX /* mutex synopsis namespace std { class mutex { public: constexpr mutex() noexcept; ~mutex(); mutex(const mutex&) = delete; mutex& operator=(const mutex&) = delete; void lock(); bool try_lock(); void unlock(); typedef pthread_mutex_t* native_handle_type; native_handle_type native_handle(); }; class recursive_mutex { public: recursive_mutex(); ~recursive_mutex(); recursive_mutex(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete; void lock(); bool try_lock() noexcept; void unlock(); typedef pthread_mutex_t* native_handle_type; native_handle_type native_handle(); }; class timed_mutex { public: timed_mutex(); ~timed_mutex(); timed_mutex(const timed_mutex&) = delete; timed_mutex& operator=(const timed_mutex&) = delete; void lock(); bool try_lock(); template bool try_lock_for(const chrono::duration& rel_time); template bool try_lock_until(const chrono::time_point& abs_time); void unlock(); }; class recursive_timed_mutex { public: recursive_timed_mutex(); ~recursive_timed_mutex(); recursive_timed_mutex(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; void lock(); bool try_lock() noexcept; template bool try_lock_for(const chrono::duration& rel_time); template bool try_lock_until(const chrono::time_point& abs_time); void unlock(); }; struct defer_lock_t {}; struct try_to_lock_t {}; struct adopt_lock_t {}; constexpr defer_lock_t defer_lock{}; constexpr try_to_lock_t try_to_lock{}; constexpr adopt_lock_t adopt_lock{}; template class lock_guard { public: typedef Mutex mutex_type; explicit lock_guard(mutex_type& m); lock_guard(mutex_type& m, adopt_lock_t); ~lock_guard(); lock_guard(lock_guard const&) = delete; lock_guard& operator=(lock_guard const&) = delete; }; template class scoped_lock // C++17 { public: using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex explicit scoped_lock(MutexTypes&... m); scoped_lock(MutexTypes&... m, adopt_lock_t); ~scoped_lock(); scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; private: tuple pm; // exposition only }; template class unique_lock { public: typedef Mutex mutex_type; unique_lock() noexcept; explicit unique_lock(mutex_type& m); 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 unique_lock(mutex_type& m, const chrono::time_point& abs_time); template unique_lock(mutex_type& m, const chrono::duration& rel_time); ~unique_lock(); unique_lock(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete; unique_lock(unique_lock&& u) noexcept; unique_lock& operator=(unique_lock&& u) noexcept; void lock(); bool try_lock(); template bool try_lock_for(const chrono::duration& rel_time); template bool try_lock_until(const chrono::time_point& abs_time); void unlock(); void swap(unique_lock& u) noexcept; mutex_type* release() noexcept; bool owns_lock() const noexcept; explicit operator bool () const noexcept; mutex_type* mutex() const noexcept; }; template void swap(unique_lock& x, unique_lock& y) noexcept; template int try_lock(L1&, L2&, L3&...); template void lock(L1&, L2&, L3&...); struct once_flag { constexpr once_flag() noexcept; once_flag(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete; }; template void call_once(once_flag& flag, Callable&& func, Args&&... args); } // std */ #include <__config> #include <__mutex_base> #include #include #ifndef _LIBCPP_CXX03_LANG #include #endif #include <__threading_support> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_THREADS class _LIBCPP_TYPE_VIS recursive_mutex { __libcpp_recursive_mutex_t __m_; public: recursive_mutex(); ~recursive_mutex(); private: recursive_mutex(const recursive_mutex&); // = delete; recursive_mutex& operator=(const recursive_mutex&); // = delete; public: void lock(); bool try_lock() _NOEXCEPT; void unlock() _NOEXCEPT; typedef __libcpp_recursive_mutex_t* native_handle_type; _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} }; class _LIBCPP_TYPE_VIS timed_mutex { mutex __m_; condition_variable __cv_; bool __locked_; public: timed_mutex(); ~timed_mutex(); private: timed_mutex(const timed_mutex&); // = delete; timed_mutex& operator=(const timed_mutex&); // = delete; public: void lock(); bool try_lock() _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() _NOEXCEPT; }; template bool timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; unique_lock __lk(__m_); bool no_timeout = _Clock::now() < __t; while (no_timeout && __locked_) no_timeout = __cv_.wait_until(__lk, __t) == cv_status::no_timeout; if (!__locked_) { __locked_ = true; return true; } return false; } class _LIBCPP_TYPE_VIS recursive_timed_mutex { mutex __m_; condition_variable __cv_; size_t __count_; __libcpp_thread_id __id_; public: recursive_timed_mutex(); ~recursive_timed_mutex(); private: recursive_timed_mutex(const recursive_timed_mutex&); // = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&); // = delete; public: void lock(); bool try_lock() _NOEXCEPT; template _LIBCPP_INLINE_VISIBILITY bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) {return try_lock_until(chrono::steady_clock::now() + __d);} template _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); void unlock() _NOEXCEPT; }; template bool recursive_timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; __libcpp_thread_id __id = __libcpp_thread_get_current_id(); unique_lock lk(__m_); if (__libcpp_thread_id_equal(__id, __id_)) { if (__count_ == numeric_limits::max()) return false; ++__count_; return true; } bool no_timeout = _Clock::now() < __t; while (no_timeout && __count_ != 0) no_timeout = __cv_.wait_until(lk, __t) == cv_status::no_timeout; if (__count_ == 0) { __count_ = 1; __id_ = __id; return true; } return false; } template int try_lock(_L0& __l0, _L1& __l1) { unique_lock<_L0> __u0(__l0, try_to_lock); if (__u0.owns_lock()) { if (__l1.try_lock()) { __u0.release(); return -1; } else return 1; } return 0; } #ifndef _LIBCPP_CXX03_LANG template int try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { int __r = 0; unique_lock<_L0> __u0(__l0, try_to_lock); if (__u0.owns_lock()) { __r = try_lock(__l1, __l2, __l3...); if (__r == -1) __u0.release(); else ++__r; } return __r; } #endif // _LIBCPP_CXX03_LANG template void lock(_L0& __l0, _L1& __l1) { while (true) { { unique_lock<_L0> __u0(__l0); if (__l1.try_lock()) { __u0.release(); break; } } __libcpp_thread_yield(); { unique_lock<_L1> __u1(__l1); if (__l0.try_lock()) { __u1.release(); break; } } __libcpp_thread_yield(); } } #ifndef _LIBCPP_CXX03_LANG template void __lock_first(int __i, _L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) { while (true) { switch (__i) { case 0: { unique_lock<_L0> __u0(__l0); __i = try_lock(__l1, __l2, __l3...); if (__i == -1) { __u0.release(); return; } } ++__i; __libcpp_thread_yield(); break; case 1: { unique_lock<_L1> __u1(__l1); __i = try_lock(__l2, __l3..., __l0); if (__i == -1) { __u1.release(); return; } } if (__i == sizeof...(_L3) + 1) __i = 0; else __i += 2; __libcpp_thread_yield(); break; default: __lock_first(__i - 2, __l2, __l3..., __l0, __l1); return; } } } template inline _LIBCPP_INLINE_VISIBILITY void lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3) { __lock_first(0, __l0, __l1, __l2, __l3...); } template inline _LIBCPP_INLINE_VISIBILITY void __unlock(_L0& __l0) { __l0.unlock(); } template inline _LIBCPP_INLINE_VISIBILITY void __unlock(_L0& __l0, _L1& __l1) { __l0.unlock(); __l1.unlock(); } template inline _LIBCPP_INLINE_VISIBILITY void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) { __l0.unlock(); __l1.unlock(); _VSTD::__unlock(__l2, __l3...); } #endif // _LIBCPP_CXX03_LANG #if _LIBCPP_STD_VER > 14 template class _LIBCPP_TEMPLATE_VIS scoped_lock; template <> class _LIBCPP_TEMPLATE_VIS scoped_lock<> { public: explicit scoped_lock() {} ~scoped_lock() = default; _LIBCPP_INLINE_VISIBILITY explicit scoped_lock(adopt_lock_t) {} scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; }; template class _LIBCPP_TEMPLATE_VIS scoped_lock<_Mutex> { public: typedef _Mutex mutex_type; private: mutex_type& __m_; public: explicit scoped_lock(mutex_type & __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {__m_.lock();} ~scoped_lock() _LIBCPP_THREAD_SAFETY_ANNOTATION(release_capability()) {__m_.unlock();} _LIBCPP_INLINE_VISIBILITY explicit scoped_lock(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} - scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; }; template class _LIBCPP_TEMPLATE_VIS scoped_lock { static_assert(sizeof...(_MArgs) > 1, "At least 2 lock types required"); typedef tuple<_MArgs&...> _MutexTuple; public: _LIBCPP_INLINE_VISIBILITY explicit scoped_lock(_MArgs&... __margs) : __t_(__margs...) { _VSTD::lock(__margs...); } _LIBCPP_INLINE_VISIBILITY scoped_lock(_MArgs&... __margs, adopt_lock_t) : __t_(__margs...) { } _LIBCPP_INLINE_VISIBILITY ~scoped_lock() { typedef typename __make_tuple_indices::type _Indices; __unlock_unpack(_Indices{}, __t_); } scoped_lock(scoped_lock const&) = delete; scoped_lock& operator=(scoped_lock const&) = delete; private: template _LIBCPP_INLINE_VISIBILITY static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) { _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...); } _MutexTuple __t_; }; #endif // _LIBCPP_STD_VER > 14 #endif // !_LIBCPP_HAS_NO_THREADS struct _LIBCPP_TEMPLATE_VIS once_flag; #ifndef _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...); #else // _LIBCPP_CXX03_LANG template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&); template _LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, const _Callable&); #endif // _LIBCPP_CXX03_LANG struct _LIBCPP_TEMPLATE_VIS once_flag { _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR once_flag() _NOEXCEPT : __state_(0) {} private: once_flag(const once_flag&); // = delete; once_flag& operator=(const once_flag&); // = delete; unsigned long __state_; #ifndef _LIBCPP_CXX03_LANG template friend void call_once(once_flag&, _Callable&&, _Args&&...); #else // _LIBCPP_CXX03_LANG template friend void call_once(once_flag&, _Callable&); template friend void call_once(once_flag&, const _Callable&); #endif // _LIBCPP_CXX03_LANG }; #ifndef _LIBCPP_CXX03_LANG template class __call_once_param { _Fp& __f_; public: _LIBCPP_INLINE_VISIBILITY explicit __call_once_param(_Fp& __f) : __f_(__f) {} _LIBCPP_INLINE_VISIBILITY void operator()() { typedef typename __make_tuple_indices::value, 1>::type _Index; __execute(_Index()); } private: template _LIBCPP_INLINE_VISIBILITY void __execute(__tuple_indices<_Indices...>) { __invoke(_VSTD::get<0>(_VSTD::move(__f_)), _VSTD::get<_Indices>(_VSTD::move(__f_))...); } }; #else template class __call_once_param { _Fp& __f_; public: _LIBCPP_INLINE_VISIBILITY explicit __call_once_param(_Fp& __f) : __f_(__f) {} _LIBCPP_INLINE_VISIBILITY void operator()() { __f_(); } }; #endif template void __call_once_proxy(void* __vp) { __call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); (*__p)(); } _LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*)); #ifndef _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) { if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { typedef tuple<_Callable&&, _Args&&...> _Gp; _Gp __f(_VSTD::forward<_Callable>(__func), _VSTD::forward<_Args>(__args)...); __call_once_param<_Gp> __p(__f); __call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); } } #else // _LIBCPP_CXX03_LANG template inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, _Callable& __func) { if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param<_Callable> __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy<_Callable>); } } template inline _LIBCPP_INLINE_VISIBILITY void call_once(once_flag& __flag, const _Callable& __func) { if (__libcpp_acquire_load(&__flag.__state_) != ~0ul) { __call_once_param __p(__func); __call_once(__flag.__state_, &__p, &__call_once_proxy); } } #endif // _LIBCPP_CXX03_LANG _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #endif // _LIBCPP_MUTEX Index: vendor/libc++/dist/include/numeric =================================================================== --- vendor/libc++/dist/include/numeric (revision 319785) +++ vendor/libc++/dist/include/numeric (revision 319786) @@ -1,275 +1,346 @@ // -*- C++ -*- //===---------------------------- numeric ---------------------------------===// // // 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_NUMERIC #define _LIBCPP_NUMERIC /* numeric synopsis namespace std { template T accumulate(InputIterator first, InputIterator last, T init); template T accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); template T inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init); template T inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); template OutputIterator partial_sum(InputIterator first, InputIterator last, OutputIterator result); template OutputIterator partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op); +template + OutputIterator + exclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, T init); // C++17 + +template + OutputIterator + exclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, T init, BinaryOperation binary_op); // C++17 + +template + OutputIterator + transform_exclusive_scan(InputIterator first, InputIterator last, + OutputIterator result, T init, + BinaryOperation binary_op, UnaryOperation unary_op); // C++17 + template OutputIterator adjacent_difference(InputIterator first, InputIterator last, OutputIterator result); template OutputIterator adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op); template void iota(ForwardIterator first, ForwardIterator last, T value); template constexpr common_type_t gcd(M m, N n); // C++17 template constexpr common_type_t lcm(M m, N n); // C++17 } // std */ #include <__config> #include #include // for numeric_limits +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> _LIBCPP_BEGIN_NAMESPACE_STD template inline _LIBCPP_INLINE_VISIBILITY _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init) { for (; __first != __last; ++__first) __init = __init + *__first; return __init; } template inline _LIBCPP_INLINE_VISIBILITY _Tp accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op) { for (; __first != __last; ++__first) __init = __binary_op(__init, *__first); return __init; } template inline _LIBCPP_INLINE_VISIBILITY _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init) { for (; __first1 != __last1; ++__first1, (void) ++__first2) __init = __init + *__first1 * *__first2; return __init; } template inline _LIBCPP_INLINE_VISIBILITY _Tp inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2) { for (; __first1 != __last1; ++__first1, (void) ++__first2) __init = __binary_op1(__init, __binary_op2(*__first1, *__first2)); return __init; } template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t(*__first); *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { __t = __t + *__first; *__result = __t; } } return __result; } template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t(*__first); *__result = __t; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { __t = __binary_op(__t, *__first); *__result = __t; } } return __result; } + +#if _LIBCPP_STD_VER > 14 +template +inline _LIBCPP_INLINE_VISIBILITY +_OutputIterator +exclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp __init, _BinaryOp __b) +{ + if (__first != __last) + { + _Tp __saved = __init; + do + { + __init = __b(__init, *__first); + *__result = __saved; + __saved = __init; + ++__result; + } while (++__first != __last); + } + return __result; +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_OutputIterator +exclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp __init) +{ + return _VSTD::exclusive_scan(__first, __last, __result, __init, _VSTD::plus<>()); +} + +template +inline _LIBCPP_INLINE_VISIBILITY +_OutputIterator +transform_exclusive_scan(_InputIterator __first, _InputIterator __last, + _OutputIterator __result, _Tp __init, + _BinaryOp __b, _UnaryOp __u) +{ + if (__first != __last) + { + _Tp __saved = __init; + do + { + __init = __b(__init, __u(*__first)); + *__result = __saved; + __saved = __init; + ++__result; + } while (++__first != __last); + } + return __result; +} +#endif template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t1(*__first); *__result = __t1; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); *__result = __t2 - __t1; __t1 = _VSTD::move(__t2); } } return __result; } template inline _LIBCPP_INLINE_VISIBILITY _OutputIterator adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result, _BinaryOperation __binary_op) { if (__first != __last) { typename iterator_traits<_InputIterator>::value_type __t1(*__first); *__result = __t1; for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result) { typename iterator_traits<_InputIterator>::value_type __t2(*__first); *__result = __binary_op(__t2, __t1); __t1 = _VSTD::move(__t2); } } return __result; } template inline _LIBCPP_INLINE_VISIBILITY void iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) { for (; __first != __last; ++__first, (void) ++__value_) *__first = __value_; } #if _LIBCPP_STD_VER > 14 template ::value> struct __abs; template struct __abs<_Result, _Source, true> { _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _Result operator()(_Source __t) const noexcept { if (__t >= 0) return __t; if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t); return -__t; } }; template struct __abs<_Result, _Source, false> { _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY _Result operator()(_Source __t) const noexcept { return __t; } }; template _LIBCPP_CONSTEXPR _LIBCPP_HIDDEN _Tp __gcd(_Tp __m, _Tp __n) { static_assert((!is_signed<_Tp>::value), ""); return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n); } template _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY common_type_t<_Tp,_Up> gcd(_Tp __m, _Up __n) { static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types"); static_assert((!is_same::type, bool>::value), "First argument to gcd cannot be bool" ); static_assert((!is_same::type, bool>::value), "Second argument to gcd cannot be bool" ); using _Rp = common_type_t<_Tp,_Up>; using _Wp = make_unsigned_t<_Rp>; return static_cast<_Rp>(_VSTD::__gcd( static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)), static_cast<_Wp>(__abs<_Rp, _Up>()(__n)))); } template _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY common_type_t<_Tp,_Up> lcm(_Tp __m, _Up __n) { static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types"); static_assert((!is_same::type, bool>::value), "First argument to lcm cannot be bool" ); static_assert((!is_same::type, bool>::value), "Second argument to lcm cannot be bool" ); if (__m == 0 || __n == 0) return 0; using _Rp = common_type_t<_Tp,_Up>; _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD::gcd(__m, __n); _Rp __val2 = __abs<_Rp, _Up>()(__n); _LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm"); return __val1 * __val2; } #endif /* _LIBCPP_STD_VER > 14 */ _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS #endif // _LIBCPP_NUMERIC Index: vendor/libc++/dist/include/optional =================================================================== --- vendor/libc++/dist/include/optional (revision 319785) +++ vendor/libc++/dist/include/optional (revision 319786) @@ -1,1323 +1,1323 @@ // -*- C++ -*- //===-------------------------- optional ----------------------------------===// // // 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_OPTIONAL #define _LIBCPP_OPTIONAL /* optional synopsis // C++1z namespace std { // 23.6.3, optional for object types template class optional; // 23.6.4, no-value state indicator struct nullopt_t{see below }; constexpr nullopt_t nullopt(unspecified ); // 23.6.5, class bad_optional_access class bad_optional_access; // 23.6.6, relational operators template constexpr bool operator==(const optional&, const optional&); template constexpr bool operator!=(const optional&, const optional&); template constexpr bool operator<(const optional&, const optional&); template constexpr bool operator>(const optional&, const optional&); template constexpr bool operator<=(const optional&, const optional&); template constexpr bool operator>=(const optional&, const optional&); // 23.6.7 comparison with nullopt template constexpr bool operator==(const optional&, nullopt_t) noexcept; template constexpr bool operator==(nullopt_t, const optional&) noexcept; template constexpr bool operator!=(const optional&, nullopt_t) noexcept; template constexpr bool operator!=(nullopt_t, const optional&) noexcept; template constexpr bool operator<(const optional&, nullopt_t) noexcept; template constexpr bool operator<(nullopt_t, const optional&) noexcept; template constexpr bool operator<=(const optional&, nullopt_t) noexcept; template constexpr bool operator<=(nullopt_t, const optional&) noexcept; template constexpr bool operator>(const optional&, nullopt_t) noexcept; template constexpr bool operator>(nullopt_t, const optional&) noexcept; template constexpr bool operator>=(const optional&, nullopt_t) noexcept; template constexpr bool operator>=(nullopt_t, const optional&) noexcept; // 23.6.8, comparison with T template constexpr bool operator==(const optional&, const U&); template constexpr bool operator==(const U&, const optional&); template constexpr bool operator!=(const optional&, const U&); template constexpr bool operator!=(const U&, const optional&); template constexpr bool operator<(const optional&, const U&); template constexpr bool operator<(const U&, const optional&); template constexpr bool operator<=(const optional&, const U&); template constexpr bool operator<=(const U&, const optional&); template constexpr bool operator>(const optional&, const U&); template constexpr bool operator>(const U&, const optional&); template constexpr bool operator>=(const optional&, const U&); template constexpr bool operator>=(const U&, const optional&); // 23.6.9, specialized algorithms template void swap(optional&, optional&) noexcept(see below ); template constexpr optional make_optional(T&&); template constexpr optional make_optional(Args&&... args); template constexpr optional make_optional(initializer_list il, Args&&... args); // 23.6.10, hash support template struct hash; template struct hash>; template class optional { public: using value_type = T; // 23.6.3.1, constructors constexpr optional() noexcept; constexpr optional(nullopt_t) noexcept; optional(const optional &); optional(optional &&) noexcept(see below); template constexpr explicit optional(in_place_t, Args &&...); template constexpr explicit optional(in_place_t, initializer_list, Args &&...); template constexpr EXPLICIT optional(U &&); template constexpr EXPLICIT optional(const optional &); template constexpr EXPLICIT optional(optional &&); // 23.6.3.2, destructor ~optional(); // 23.6.3.3, assignment optional &operator=(nullopt_t) noexcept; optional &operator=(const optional &); optional &operator=(optional &&) noexcept(see below ); template optional &operator=(U &&); template optional &operator=(const optional &); template optional &operator=(optional &&); template T& emplace(Args &&...); template T& emplace(initializer_list, Args &&...); // 23.6.3.4, swap void swap(optional &) noexcept(see below ); // 23.6.3.5, observers constexpr T const *operator->() const; constexpr T *operator->(); constexpr T const &operator*() const &; constexpr T &operator*() &; constexpr T &&operator*() &&; constexpr const T &&operator*() const &&; constexpr explicit operator bool() const noexcept; constexpr bool has_value() const noexcept; constexpr T const &value() const &; constexpr T &value() &; constexpr T &&value() &&; constexpr const T &&value() const &&; template constexpr T value_or(U &&) const &; template constexpr T value_or(U &&) &&; // 23.6.3.6, modifiers void reset() noexcept; private: T *val; // exposition only }; } // namespace std */ #include <__config> #include <__debug> #include <__functional_base> #include #include #include #include #include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_PUSH_MACROS #include <__undef_macros> namespace std // purposefully not using versioning namespace { class _LIBCPP_EXCEPTION_ABI bad_optional_access : public exception { public: // Get the key function ~bad_optional_access() into the dylib virtual ~bad_optional_access() _NOEXCEPT; virtual const char* what() const _NOEXCEPT; }; } // std #if _LIBCPP_STD_VER > 14 _LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_optional_access() { #ifndef _LIBCPP_NO_EXCEPTIONS throw bad_optional_access(); #else _VSTD::abort(); #endif } struct nullopt_t { struct __secret_tag { _LIBCPP_INLINE_VISIBILITY explicit __secret_tag() = default; }; _LIBCPP_INLINE_VISIBILITY constexpr explicit nullopt_t(__secret_tag, __secret_tag) noexcept {} }; /* inline */ constexpr nullopt_t nullopt{nullopt_t::__secret_tag{}, nullopt_t::__secret_tag{}}; template ::value> struct __optional_destruct_base; template struct __optional_destruct_base<_Tp, false> { typedef _Tp value_type; static_assert(is_object_v, "instantiation of optional with a non-object type is undefined behavior"); union { char __null_state_; value_type __val_; }; bool __engaged_; _LIBCPP_INLINE_VISIBILITY ~__optional_destruct_base() { if (__engaged_) __val_.~value_type(); } _LIBCPP_INLINE_VISIBILITY constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {} template _LIBCPP_INLINE_VISIBILITY constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args) : __val_(_VSTD::forward<_Args>(__args)...), __engaged_(true) {} _LIBCPP_INLINE_VISIBILITY void reset() noexcept { if (__engaged_) { __val_.~value_type(); __engaged_ = false; } } }; template struct __optional_destruct_base<_Tp, true> { typedef _Tp value_type; static_assert(is_object_v, "instantiation of optional with a non-object type is undefined behavior"); union { char __null_state_; value_type __val_; }; bool __engaged_; _LIBCPP_INLINE_VISIBILITY constexpr __optional_destruct_base() noexcept : __null_state_(), __engaged_(false) {} template _LIBCPP_INLINE_VISIBILITY constexpr explicit __optional_destruct_base(in_place_t, _Args&&... __args) : __val_(_VSTD::forward<_Args>(__args)...), __engaged_(true) {} _LIBCPP_INLINE_VISIBILITY void reset() noexcept { if (__engaged_) { __engaged_ = false; } } }; template ::value> struct __optional_storage_base : __optional_destruct_base<_Tp> { using __base = __optional_destruct_base<_Tp>; using value_type = _Tp; using __base::__base; _LIBCPP_INLINE_VISIBILITY constexpr bool has_value() const noexcept { return this->__engaged_; } _LIBCPP_INLINE_VISIBILITY constexpr value_type& __get() & noexcept { return this->__val_; } _LIBCPP_INLINE_VISIBILITY constexpr const value_type& __get() const& noexcept { return this->__val_; } _LIBCPP_INLINE_VISIBILITY constexpr value_type&& __get() && noexcept { return _VSTD::move(this->__val_); } _LIBCPP_INLINE_VISIBILITY constexpr const value_type&& __get() const&& noexcept { return _VSTD::move(this->__val_); } template _LIBCPP_INLINE_VISIBILITY void __construct(_Args&&... __args) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); ::new((void*)_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...); this->__engaged_ = true; } template _LIBCPP_INLINE_VISIBILITY void __construct_from(_That&& __opt) { if (__opt.has_value()) __construct(_VSTD::forward<_That>(__opt).__get()); } template _LIBCPP_INLINE_VISIBILITY void __assign_from(_That&& __opt) { if (this->__engaged_ == __opt.has_value()) { if (this->__engaged_) this->__val_ = _VSTD::forward<_That>(__opt).__get(); } else { if (this->__engaged_) this->reset(); else __construct(_VSTD::forward<_That>(__opt).__get()); } } }; // optional is currently required ill-formed, however it may to be in the // future. For this reason it has already been implemented to ensure we can // make the change in an ABI compatible manner. template struct __optional_storage_base<_Tp, true> { using value_type = _Tp; using __raw_type = remove_reference_t<_Tp>; __raw_type* __value_; template static constexpr bool __can_bind_reference() { using _RawUp = typename remove_reference<_Up>::type; using _UpPtr = _RawUp*; using _RawTp = typename remove_reference<_Tp>::type; using _TpPtr = _RawTp*; using _CheckLValueArg = integral_constant::value && is_convertible<_UpPtr, _TpPtr>::value) || is_same<_RawUp, reference_wrapper<_RawTp>>::value || is_same<_RawUp, reference_wrapper::type>>::value >; return (is_lvalue_reference<_Tp>::value && _CheckLValueArg::value) || (is_rvalue_reference<_Tp>::value && !is_lvalue_reference<_Up>::value && is_convertible<_UpPtr, _TpPtr>::value); } _LIBCPP_INLINE_VISIBILITY constexpr __optional_storage_base() noexcept : __value_(nullptr) {} template _LIBCPP_INLINE_VISIBILITY constexpr explicit __optional_storage_base(in_place_t, _UArg&& __uarg) : __value_(_VSTD::addressof(__uarg)) { static_assert(__can_bind_reference<_UArg>(), "Attempted to construct a reference element in tuple from a " "possible temporary"); } _LIBCPP_INLINE_VISIBILITY void reset() noexcept { __value_ = nullptr; } _LIBCPP_INLINE_VISIBILITY constexpr bool has_value() const noexcept { return __value_ != nullptr; } _LIBCPP_INLINE_VISIBILITY constexpr value_type& __get() const& noexcept { return *__value_; } _LIBCPP_INLINE_VISIBILITY constexpr value_type&& __get() const&& noexcept { return _VSTD::forward(*__value_); } template _LIBCPP_INLINE_VISIBILITY void __construct(_UArg&& __val) { _LIBCPP_ASSERT(!has_value(), "__construct called for engaged __optional_storage"); static_assert(__can_bind_reference<_UArg>(), "Attempted to construct a reference element in tuple from a " "possible temporary"); __value_ = _VSTD::addressof(__val); } template _LIBCPP_INLINE_VISIBILITY void __construct_from(_That&& __opt) { if (__opt.has_value()) __construct(_VSTD::forward<_That>(__opt).__get()); } template _LIBCPP_INLINE_VISIBILITY void __assign_from(_That&& __opt) { if (has_value() == __opt.has_value()) { if (has_value()) *__value_ = _VSTD::forward<_That>(__opt).__get(); } else { if (has_value()) reset(); else __construct(_VSTD::forward<_That>(__opt).__get()); } } }; template ::value> struct __optional_storage; template struct __optional_storage<_Tp, true> : __optional_storage_base<_Tp> { using __optional_storage_base<_Tp>::__optional_storage_base; }; template struct __optional_storage<_Tp, false> : __optional_storage_base<_Tp> { using value_type = _Tp; using __optional_storage_base<_Tp>::__optional_storage_base; _LIBCPP_INLINE_VISIBILITY __optional_storage() = default; _LIBCPP_INLINE_VISIBILITY __optional_storage(const __optional_storage& __opt) { this->__construct_from(__opt); } _LIBCPP_INLINE_VISIBILITY __optional_storage(__optional_storage&& __opt) noexcept(is_nothrow_move_constructible_v) { this->__construct_from(_VSTD::move(__opt)); } _LIBCPP_INLINE_VISIBILITY __optional_storage& operator=(const __optional_storage& __opt) { this->__assign_from(__opt); return *this; } _LIBCPP_INLINE_VISIBILITY __optional_storage& operator=(__optional_storage&& __opt) noexcept(is_nothrow_move_assignable_v && is_nothrow_move_constructible_v) { this->__assign_from(_VSTD::move(__opt)); return *this; } }; template using __optional_sfinae_ctor_base_t = __sfinae_ctor_base< is_copy_constructible<_Tp>::value, is_move_constructible<_Tp>::value >; template using __optional_sfinae_assign_base_t = __sfinae_assign_base< (is_copy_constructible<_Tp>::value && is_copy_assignable<_Tp>::value), (is_move_constructible<_Tp>::value && is_move_assignable<_Tp>::value) >; template class optional : private __optional_storage<_Tp> , private __optional_sfinae_ctor_base_t<_Tp> , private __optional_sfinae_assign_base_t<_Tp> { using __base = __optional_storage<_Tp>; public: using value_type = _Tp; private: // Disable the reference extension using this static assert. static_assert(!is_same_v, "instantiation of optional with in_place_t is ill-formed"); static_assert(!is_same_v<__uncvref_t, nullopt_t>, "instantiation of optional with nullopt_t is ill-formed"); static_assert(!is_reference_v, "instantiation of optional with a reference type is ill-formed"); static_assert(is_destructible_v, "instantiation of optional with a non-destructible type is ill-formed"); // LWG2756: conditionally explicit conversion from _Up struct _CheckOptionalArgsConstructor { template static constexpr bool __enable_implicit() { return is_constructible_v<_Tp, _Up&&> && is_convertible_v<_Up&&, _Tp>; } template static constexpr bool __enable_explicit() { return is_constructible_v<_Tp, _Up&&> && !is_convertible_v<_Up&&, _Tp>; } }; template using _CheckOptionalArgsCtor = conditional_t< !is_same_v, in_place_t> && !is_same_v, optional>, _CheckOptionalArgsConstructor, __check_tuple_constructor_fail >; template struct _CheckOptionalLikeConstructor { template > using __check_constructible_from_opt = __lazy_or< is_constructible<_Tp, _Opt&>, is_constructible<_Tp, _Opt const&>, is_constructible<_Tp, _Opt&&>, is_constructible<_Tp, _Opt const&&>, is_convertible<_Opt&, _Tp>, is_convertible<_Opt const&, _Tp>, is_convertible<_Opt&&, _Tp>, is_convertible<_Opt const&&, _Tp> >; template > using __check_assignable_from_opt = __lazy_or< is_assignable<_Tp&, _Opt&>, is_assignable<_Tp&, _Opt const&>, is_assignable<_Tp&, _Opt&&>, is_assignable<_Tp&, _Opt const&&> >; template static constexpr bool __enable_implicit() { return is_convertible<_QUp, _Tp>::value && !__check_constructible_from_opt<_Up>::value; } template static constexpr bool __enable_explicit() { return !is_convertible<_QUp, _Tp>::value && !__check_constructible_from_opt<_Up>::value; } template static constexpr bool __enable_assign() { // Construction and assignability of _Qup to _Tp has already been // checked. return !__check_constructible_from_opt<_Up>::value && !__check_assignable_from_opt<_Up>::value; } }; template using _CheckOptionalLikeCtor = conditional_t< __lazy_and< __lazy_not>, is_constructible<_Tp, _QualUp> >::value, _CheckOptionalLikeConstructor<_QualUp>, __check_tuple_constructor_fail >; template using _CheckOptionalLikeAssign = conditional_t< __lazy_and< __lazy_not>, is_constructible<_Tp, _QualUp>, is_assignable<_Tp&, _QualUp> >::value, _CheckOptionalLikeConstructor<_QualUp>, __check_tuple_constructor_fail >; public: _LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {} _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default; _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default; _LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {} template > > _LIBCPP_INLINE_VISIBILITY constexpr explicit optional(in_place_t, _Args&&... __args) : __base(in_place, _VSTD::forward<_Args>(__args)...) {} template &, _Args...>> > _LIBCPP_INLINE_VISIBILITY constexpr explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args) : __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {} template ::template __enable_implicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY constexpr optional(_Up&& __v) : __base(in_place, _VSTD::forward<_Up>(__v)) {} template ::template __enable_explicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY constexpr explicit optional(_Up&& __v) : __base(in_place, _VSTD::forward<_Up>(__v)) {} // LWG2756: conditionally explicit conversion from const optional<_Up>& template ::template __enable_implicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY optional(const optional<_Up>& __v) { this->__construct_from(__v); } template ::template __enable_explicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY explicit optional(const optional<_Up>& __v) { this->__construct_from(__v); } // LWG2756: conditionally explicit conversion from optional<_Up>&& template ::template __enable_implicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY optional(optional<_Up>&& __v) { this->__construct_from(_VSTD::move(__v)); } template ::template __enable_explicit<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY explicit optional(optional<_Up>&& __v) { this->__construct_from(_VSTD::move(__v)); } _LIBCPP_INLINE_VISIBILITY optional& operator=(nullopt_t) noexcept { reset(); return *this; } _LIBCPP_INLINE_VISIBILITY optional& operator=(const optional&) = default; _LIBCPP_INLINE_VISIBILITY optional& operator=(optional&&) = default; // LWG2756 template , optional> && !(is_same_v<_Up, value_type> && is_scalar_v) >, is_constructible, is_assignable >::value> > _LIBCPP_INLINE_VISIBILITY optional& operator=(_Up&& __v) { if (this->has_value()) this->__get() = _VSTD::forward<_Up>(__v); else this->__construct(_VSTD::forward<_Up>(__v)); return *this; } // LWG2756 template ::template __enable_assign<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY optional& operator=(const optional<_Up>& __v) { this->__assign_from(__v); return *this; } // LWG2756 template ::template __enable_assign<_Up>() , int> = 0> _LIBCPP_INLINE_VISIBILITY optional& operator=(optional<_Up>&& __v) { this->__assign_from(_VSTD::move(__v)); return *this; } template > > _LIBCPP_INLINE_VISIBILITY _Tp & emplace(_Args&&... __args) { reset(); this->__construct(_VSTD::forward<_Args>(__args)...); return this->__get(); } template &, _Args...> > > _LIBCPP_INLINE_VISIBILITY _Tp & emplace(initializer_list<_Up> __il, _Args&&... __args) { reset(); this->__construct(__il, _VSTD::forward<_Args>(__args)...); return this->__get(); } _LIBCPP_INLINE_VISIBILITY void swap(optional& __opt) noexcept(is_nothrow_move_constructible_v && is_nothrow_swappable_v) { if (this->has_value() == __opt.has_value()) { using _VSTD::swap; if (this->has_value()) swap(this->__get(), __opt.__get()); } else { if (this->has_value()) { __opt.__construct(_VSTD::move(this->__get())); reset(); } else { this->__construct(_VSTD::move(__opt.__get())); __opt.reset(); } } } _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t operator->() const { _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value"); #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF return _VSTD::addressof(this->__get()); #else return __operator_arrow(__has_operator_addressof{}, this->__get()); #endif } _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t operator->() { _LIBCPP_ASSERT(this->has_value(), "optional operator-> called for disengaged value"); #ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF return _VSTD::addressof(this->__get()); #else return __operator_arrow(__has_operator_addressof{}, this->__get()); #endif } _LIBCPP_INLINE_VISIBILITY constexpr const value_type& operator*() const& { _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value"); return this->__get(); } _LIBCPP_INLINE_VISIBILITY constexpr value_type& operator*() & { _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value"); return this->__get(); } _LIBCPP_INLINE_VISIBILITY constexpr value_type&& operator*() && { _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value"); return _VSTD::move(this->__get()); } _LIBCPP_INLINE_VISIBILITY constexpr const value_type&& operator*() const&& { _LIBCPP_ASSERT(this->has_value(), "optional operator* called for disengaged value"); return _VSTD::move(this->__get()); } _LIBCPP_INLINE_VISIBILITY constexpr explicit operator bool() const noexcept { return has_value(); } using __base::has_value; using __base::__get; _LIBCPP_INLINE_VISIBILITY constexpr value_type const& value() const& { if (!this->has_value()) __throw_bad_optional_access(); return this->__get(); } _LIBCPP_INLINE_VISIBILITY constexpr value_type& value() & { if (!this->has_value()) __throw_bad_optional_access(); return this->__get(); } _LIBCPP_INLINE_VISIBILITY constexpr value_type&& value() && { if (!this->has_value()) __throw_bad_optional_access(); return _VSTD::move(this->__get()); } _LIBCPP_INLINE_VISIBILITY constexpr value_type const&& value() const&& { if (!this->has_value()) __throw_bad_optional_access(); return _VSTD::move(this->__get()); } template _LIBCPP_INLINE_VISIBILITY constexpr value_type value_or(_Up&& __v) const& { static_assert(is_copy_constructible_v, "optional::value_or: T must be copy constructible"); static_assert(is_convertible_v<_Up, value_type>, "optional::value_or: U must be convertible to T"); return this->has_value() ? this->__get() : static_cast(_VSTD::forward<_Up>(__v)); } template _LIBCPP_INLINE_VISIBILITY - value_type value_or(_Up&& __v) && + constexpr value_type value_or(_Up&& __v) && { static_assert(is_move_constructible_v, "optional::value_or: T must be move constructible"); static_assert(is_convertible_v<_Up, value_type>, "optional::value_or: U must be convertible to T"); return this->has_value() ? _VSTD::move(this->__get()) : static_cast(_VSTD::forward<_Up>(__v)); } using __base::reset; private: template _LIBCPP_INLINE_VISIBILITY static _Up* __operator_arrow(true_type, _Up& __x) { return _VSTD::addressof(__x); } template _LIBCPP_INLINE_VISIBILITY static constexpr _Up* __operator_arrow(false_type, _Up& __x) { return &__x; } }; // Comparisons between optionals template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == _VSTD::declval()), bool>, bool > operator==(const optional<_Tp>& __x, const optional<_Up>& __y) { if (static_cast(__x) != static_cast(__y)) return false; if (!static_cast(__x)) return true; return *__x == *__y; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != _VSTD::declval()), bool>, bool > operator!=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (static_cast(__x) != static_cast(__y)) return true; if (!static_cast(__x)) return false; return *__x != *__y; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < _VSTD::declval()), bool>, bool > operator<(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__y)) return false; if (!static_cast(__x)) return true; return *__x < *__y; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > _VSTD::declval()), bool>, bool > operator>(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__x)) return false; if (!static_cast(__y)) return true; return *__x > *__y; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= _VSTD::declval()), bool>, bool > operator<=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__x)) return true; if (!static_cast(__y)) return false; return *__x <= *__y; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= _VSTD::declval()), bool>, bool > operator>=(const optional<_Tp>& __x, const optional<_Up>& __y) { if (!static_cast(__y)) return true; if (!static_cast(__x)) return false; return *__x >= *__y; } // Comparisons with nullopt template _LIBCPP_INLINE_VISIBILITY constexpr bool operator==(const optional<_Tp>& __x, nullopt_t) noexcept { return !static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator==(nullopt_t, const optional<_Tp>& __x) noexcept { return !static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator!=(const optional<_Tp>& __x, nullopt_t) noexcept { return static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator!=(nullopt_t, const optional<_Tp>& __x) noexcept { return static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator<(const optional<_Tp>&, nullopt_t) noexcept { return false; } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator<(nullopt_t, const optional<_Tp>& __x) noexcept { return static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator<=(const optional<_Tp>& __x, nullopt_t) noexcept { return !static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator<=(nullopt_t, const optional<_Tp>&) noexcept { return true; } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator>(const optional<_Tp>& __x, nullopt_t) noexcept { return static_cast(__x); } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator>(nullopt_t, const optional<_Tp>&) noexcept { return false; } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator>=(const optional<_Tp>&, nullopt_t) noexcept { return true; } template _LIBCPP_INLINE_VISIBILITY constexpr bool operator>=(nullopt_t, const optional<_Tp>& __x) noexcept { return !static_cast(__x); } // Comparisons with T template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == _VSTD::declval()), bool>, bool > operator==(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x == __v : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() == _VSTD::declval()), bool>, bool > operator==(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v == *__x : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != _VSTD::declval()), bool>, bool > operator!=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x != __v : true; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() != _VSTD::declval()), bool>, bool > operator!=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v != *__x : true; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < _VSTD::declval()), bool>, bool > operator<(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x < __v : true; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() < _VSTD::declval()), bool>, bool > operator<(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v < *__x : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= _VSTD::declval()), bool>, bool > operator<=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x <= __v : true; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() <= _VSTD::declval()), bool>, bool > operator<=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v <= *__x : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > _VSTD::declval()), bool>, bool > operator>(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x > __v : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() > _VSTD::declval()), bool>, bool > operator>(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v > *__x : true; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= _VSTD::declval()), bool>, bool > operator>=(const optional<_Tp>& __x, const _Up& __v) { return static_cast(__x) ? *__x >= __v : false; } template _LIBCPP_INLINE_VISIBILITY constexpr enable_if_t< is_convertible_v() >= _VSTD::declval()), bool>, bool > operator>=(const _Tp& __v, const optional<_Up>& __x) { return static_cast(__x) ? __v >= *__x : true; } template inline _LIBCPP_INLINE_VISIBILITY enable_if_t< is_move_constructible_v<_Tp> && is_swappable_v<_Tp>, void > swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y))) { __x.swap(__y); } template _LIBCPP_INLINE_VISIBILITY constexpr optional> make_optional(_Tp&& __v) { return optional>(_VSTD::forward<_Tp>(__v)); } template _LIBCPP_INLINE_VISIBILITY constexpr optional<_Tp> make_optional(_Args&&... __args) { return optional<_Tp>(in_place, _VSTD::forward<_Args>(__args)...); } template _LIBCPP_INLINE_VISIBILITY constexpr optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args) { return optional<_Tp>(in_place, __il, _VSTD::forward<_Args>(__args)...); } template struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper, remove_const_t<_Tp>> > { typedef optional<_Tp> argument_type; typedef size_t result_type; _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type& __opt) const { return static_cast(__opt) ? hash>()(*__opt) : 0; } }; _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 14 _LIBCPP_POP_MACROS #endif // _LIBCPP_OPTIONAL Index: vendor/libc++/dist/include/tuple =================================================================== --- vendor/libc++/dist/include/tuple (revision 319785) +++ vendor/libc++/dist/include/tuple (revision 319786) @@ -1,1407 +1,1417 @@ // -*- C++ -*- //===--------------------------- tuple ------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef _LIBCPP_TUPLE #define _LIBCPP_TUPLE /* tuple synopsis namespace std { template class tuple { public: constexpr tuple(); explicit tuple(const T&...); // constexpr in C++14 template explicit tuple(U&&...); // constexpr in C++14 tuple(const tuple&) = default; tuple(tuple&&) = default; template tuple(const tuple&); // constexpr in C++14 template tuple(tuple&&); // constexpr in C++14 template tuple(const pair&); // iff sizeof...(T) == 2 // constexpr in C++14 template tuple(pair&&); // iff sizeof...(T) == 2 // constexpr in C++14 // allocator-extended constructors template tuple(allocator_arg_t, const Alloc& a); template tuple(allocator_arg_t, const Alloc& a, const T&...); template tuple(allocator_arg_t, const Alloc& a, U&&...); template tuple(allocator_arg_t, const Alloc& a, const tuple&); template tuple(allocator_arg_t, const Alloc& a, tuple&&); template tuple(allocator_arg_t, const Alloc& a, const tuple&); template tuple(allocator_arg_t, const Alloc& a, tuple&&); template tuple(allocator_arg_t, const Alloc& a, const pair&); template tuple(allocator_arg_t, const Alloc& a, pair&&); tuple& operator=(const tuple&); tuple& operator=(tuple&&) noexcept(AND(is_nothrow_move_assignable::value ...)); template tuple& operator=(const tuple&); template tuple& operator=(tuple&&); template tuple& operator=(const pair&); // iff sizeof...(T) == 2 template tuple& operator=(pair&&); //iffsizeof...(T) == 2 void swap(tuple&) noexcept(AND(swap(declval(), declval())...)); }; const unspecified ignore; template tuple make_tuple(T&&...); // constexpr in C++14 template tuple forward_as_tuple(T&&...) noexcept; // constexpr in C++14 template tuple tie(T&...) noexcept; // constexpr in C++14 template tuple tuple_cat(Tuples&&... tpls); // constexpr in C++14 // [tuple.apply], calling a function with a tuple of arguments: template constexpr decltype(auto) apply(F&& f, Tuple&& t); // C++17 template constexpr T make_from_tuple(Tuple&& t); // C++17 // 20.4.1.4, tuple helper classes: template class tuple_size; // undefined template class tuple_size>; template constexpr size_t tuple_size_v = tuple_size::value; // C++17 template class tuple_element; // undefined template class tuple_element>; template using tuple_element_t = typename tuple_element ::type; // C++14 // 20.4.1.5, element access: template typename tuple_element>::type& get(tuple&) noexcept; // constexpr in C++14 template const typename tuple_element>::type& get(const tuple&) noexcept; // constexpr in C++14 template typename tuple_element>::type&& get(tuple&&) noexcept; // constexpr in C++14 template const typename tuple_element>::type&& get(const tuple&&) noexcept; // constexpr in C++14 template constexpr T1& get(tuple&) noexcept; // C++14 template constexpr const T1& get(const tuple&) noexcept; // C++14 template constexpr T1&& get(tuple&&) noexcept; // C++14 template constexpr const T1&& get(const tuple&&) noexcept; // C++14 // 20.4.1.6, relational operators: template bool operator==(const tuple&, const tuple&); // constexpr in C++14 template bool operator<(const tuple&, const tuple&); // constexpr in C++14 template bool operator!=(const tuple&, const tuple&); // constexpr in C++14 template bool operator>(const tuple&, const tuple&); // constexpr in C++14 template bool operator<=(const tuple&, const tuple&); // constexpr in C++14 template bool operator>=(const tuple&, const tuple&); // constexpr in C++14 template struct uses_allocator, Alloc>; template void swap(tuple& x, tuple& y) noexcept(noexcept(x.swap(y))); } // std */ #include <__config> #include <__tuple> #include #include #include <__functional_base> #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_CXX03_LANG // __tuple_leaf template ::value && !__libcpp_is_final<_Hp>::value > class __tuple_leaf; template inline _LIBCPP_INLINE_VISIBILITY void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y) _NOEXCEPT_(__is_nothrow_swappable<_Hp>::value) { swap(__x.get(), __y.get()); } template class __tuple_leaf { _Hp __value_; template static constexpr bool __can_bind_reference() { using _RawTp = typename remove_reference<_Tp>::type; using _RawHp = typename remove_reference<_Hp>::type; using _CheckLValueArg = integral_constant::value || is_same<_RawTp, reference_wrapper<_RawHp>>::value || is_same<_RawTp, reference_wrapper::type>>::value >; return !is_reference<_Hp>::value || (is_lvalue_reference<_Hp>::value && _CheckLValueArg::value) || (is_rvalue_reference<_Hp>::value && !is_lvalue_reference<_Tp>::value); } __tuple_leaf& operator=(const __tuple_leaf&); public: _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");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) : __value_() {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(allocator_arg_t(), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : __value_(__a) {static_assert(!is_reference<_Hp>::value, "Attempted to default construct a reference element in a tuple");} template ::type, __tuple_leaf>> , is_constructible<_Hp, _Tp> >::value >::type > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t)) {static_assert(__can_bind_reference<_Tp>(), "Attempted to construct a reference element in a tuple with an rvalue");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : __value_(_VSTD::forward<_Tp>(__t), __a) {static_assert(!is_reference<_Hp>::value, "Attempted to uses-allocator construct a reference element in a tuple");} __tuple_leaf(const __tuple_leaf& __t) = default; __tuple_leaf(__tuple_leaf&& __t) = default; template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { __value_ = _VSTD::forward<_Tp>(__t); return *this; } _LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { _VSTD::swap(*this, __t); return 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return __value_;} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return __value_;} }; template class __tuple_leaf<_Ip, _Hp, true> : private _Hp { __tuple_leaf& operator=(const __tuple_leaf&); public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf() _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc&) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(allocator_arg_t(), __a) {} template _LIBCPP_INLINE_VISIBILITY __tuple_leaf(integral_constant, const _Alloc& __a) : _Hp(__a) {} template ::type, __tuple_leaf>> , is_constructible<_Hp, _Tp> >::value >::type > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value)) : _Hp(_VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc&, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(allocator_arg_t(), __a, _VSTD::forward<_Tp>(__t)) {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_leaf(integral_constant, const _Alloc& __a, _Tp&& __t) : _Hp(_VSTD::forward<_Tp>(__t), __a) {} __tuple_leaf(__tuple_leaf const &) = default; __tuple_leaf(__tuple_leaf &&) = default; template _LIBCPP_INLINE_VISIBILITY __tuple_leaf& operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value)) { _Hp::operator=(_VSTD::forward<_Tp>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY int swap(__tuple_leaf& __t) _NOEXCEPT_(__is_nothrow_swappable<__tuple_leaf>::value) { _VSTD::swap(*this, __t); return 0; } _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);} _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast(*this);} }; template _LIBCPP_INLINE_VISIBILITY void __swallow(_Tp&&...) _NOEXCEPT {} template struct __lazy_all : __all<_Tp::value...> {}; template struct __all_default_constructible; template struct __all_default_constructible<__tuple_types<_Tp...>> : __all::value...> { }; // __tuple_impl template struct __tuple_impl; template struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...> : public __tuple_leaf<_Indx, _Tp>... { _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_impl() _NOEXCEPT_(__all::value...>::value) {} template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit __tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) _NOEXCEPT_((__all::value...>::value && __all::value...>::value)) : __tuple_leaf<_Uf, _Tf>(_VSTD::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>()... {} template _LIBCPP_INLINE_VISIBILITY explicit __tuple_impl(allocator_arg_t, const _Alloc& __a, __tuple_indices<_Uf...>, __tuple_types<_Tf...>, __tuple_indices<_Ul...>, __tuple_types<_Tl...>, _Up&&... __u) : __tuple_leaf<_Uf, _Tf>(__uses_alloc_ctor<_Tf, _Alloc, _Up>(), __a, _VSTD::forward<_Up>(__u))..., __tuple_leaf<_Ul, _Tl>(__uses_alloc_ctor<_Tl, _Alloc>(), __a)... {} template >::value >::type > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 __tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) : __tuple_leaf<_Indx, _Tp>(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))... {} template >::value >::type > _LIBCPP_INLINE_VISIBILITY __tuple_impl(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __tuple_leaf<_Indx, _Tp>(__uses_alloc_ctor<_Tp, _Alloc, typename tuple_element<_Indx, typename __make_tuple_types<_Tuple>::type>::type>(), __a, _VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))... {} template _LIBCPP_INLINE_VISIBILITY typename enable_if < __tuple_assignable<_Tuple, tuple<_Tp...> >::value, __tuple_impl& >::type operator=(_Tuple&& __t) _NOEXCEPT_((__all::type>::type>::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward::type>::type>(_VSTD::get<_Indx>(__t)))...); return *this; } __tuple_impl(const __tuple_impl&) = default; __tuple_impl(__tuple_impl&&) = default; _LIBCPP_INLINE_VISIBILITY __tuple_impl& operator=(const __tuple_impl& __t) _NOEXCEPT_((__all::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast&>(__t).get())...); return *this; } _LIBCPP_INLINE_VISIBILITY __tuple_impl& operator=(__tuple_impl&& __t) _NOEXCEPT_((__all::value...>::value)) { __swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(__tuple_impl& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) { __swallow(__tuple_leaf<_Indx, _Tp>::swap(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t))...); } }; template class _LIBCPP_TEMPLATE_VIS tuple { typedef __tuple_impl::type, _Tp...> _BaseT; _BaseT __base_; #if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION) static constexpr bool _EnableImplicitReducedArityExtension = true; #else static constexpr bool _EnableImplicitReducedArityExtension = false; #endif template struct _PackExpandsToThisTuple : false_type {}; template struct _PackExpandsToThisTuple<_Arg> : is_same::type, tuple> {}; template struct _CheckArgsConstructor : __check_tuple_constructor_fail {}; template struct _CheckArgsConstructor { template static constexpr bool __enable_default() { return __all::value...>::value; } template static constexpr bool __enable_explicit() { return __tuple_constructible< tuple<_Args...>, typename __make_tuple_types::type >::value && !__tuple_convertible< tuple<_Args...>, typename __make_tuple_types::type >::value && __all_default_constructible< typename __make_tuple_types::type >::value; } template static constexpr bool __enable_implicit() { return __tuple_convertible< tuple<_Args...>, typename __make_tuple_types::type >::value && __all_default_constructible< typename __make_tuple_types::type >::value; } }; template struct _CheckTupleLikeConstructor : __check_tuple_constructor_fail {}; template struct _CheckTupleLikeConstructor { template static constexpr bool __enable_implicit() { return __tuple_convertible<_Tuple, tuple>::value; } template static constexpr bool __enable_explicit() { return __tuple_constructible<_Tuple, tuple>::value && !__tuple_convertible<_Tuple, tuple>::value; } }; template struct _CheckTupleLikeConstructor { // This trait is used to disable the tuple-like constructor when // the UTypes... constructor should be selected instead. // See LWG issue #2549. template using _PreferTupleLikeConstructor = __lazy_or< // Don't attempt the two checks below if the tuple we are given // has the same type as this tuple. is_same::type, tuple>, __lazy_and< __lazy_not>, __lazy_not> > >; template static constexpr bool __enable_implicit() { return __lazy_and< __tuple_convertible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple> >::value; } template static constexpr bool __enable_explicit() { return __lazy_and< __tuple_constructible<_Tuple, tuple>, _PreferTupleLikeConstructor<_Tuple>, __lazy_not<__tuple_convertible<_Tuple, tuple>> >::value; } }; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT; template friend _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT; public: template ::template __enable_default<_Tp...>() >::type> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR tuple() _NOEXCEPT_(__all::value...>::value) {} tuple(tuple const&) = default; tuple(tuple&&) = default; template , __lazy_all<__dependent_type, _Dummy>...> >::value >::type> _LIBCPP_INLINE_VISIBILITY tuple(_AllocArgT, _Alloc const& __a) : __base_(allocator_arg_t(), __a, __tuple_indices<>(), __tuple_types<>(), typename __make_tuple_indices::type(), __tuple_types<_Tp...>()) {} template ::template __enable_implicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_explicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all::value...>::value)) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_implicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::template __enable_explicit<_Tp const&...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices<0>::type(), typename __make_tuple_types::type(), __t... ) {} template ::value, typename enable_if < _CheckArgsConstructor< sizeof...(_Up) == sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>() || _CheckArgsConstructor< _EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackIsTuple >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Up&&... __u) _NOEXCEPT_(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, typename __make_tuple_types::type, _Up... >::value )) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_explicit<_Up...>() || _CheckArgsConstructor< !_EnableImplicitReducedArityExtension && sizeof...(_Up) < sizeof...(_Tp) && !_PackExpandsToThisTuple<_Up...>::value >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(_Up&&... __u) _NOEXCEPT_(( is_nothrow_constructible<_BaseT, typename __make_tuple_indices::type, typename __make_tuple_types::type, typename __make_tuple_indices::type, typename __make_tuple_types::type, _Up... >::value )) : __base_(typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_implicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value >::template __enable_explicit<_Up...>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u) : __base_(allocator_arg_t(), __a, typename __make_tuple_indices::type(), typename __make_tuple_types::type(), typename __make_tuple_indices::type(), typename __make_tuple_types::type(), _VSTD::forward<_Up>(__u)...) {} template ::value && !_PackExpandsToThisTuple<_Tuple>::value >::template __enable_implicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(_VSTD::forward<_Tuple>(__t)) {} template ::value && !_PackExpandsToThisTuple<_Tuple>::value >::template __enable_explicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value)) : __base_(_VSTD::forward<_Tuple>(__t)) {} template ::value >::template __enable_implicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} template ::value >::template __enable_explicit<_Tuple>(), bool >::type = false > _LIBCPP_INLINE_VISIBILITY explicit tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t) : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {} using _CanCopyAssign = __all::value...>; using _CanMoveAssign = __all::value...>; _LIBCPP_INLINE_VISIBILITY tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t) _NOEXCEPT_((__all::value...>::value)) { __base_.operator=(__t.__base_); return *this; } _LIBCPP_INLINE_VISIBILITY tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t) _NOEXCEPT_((__all::value...>::value)) { __base_.operator=(static_cast<_BaseT&&>(__t.__base_)); return *this; } template ::value >::type > _LIBCPP_INLINE_VISIBILITY tuple& operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value)) { __base_.operator=(_VSTD::forward<_Tuple>(__t)); return *this; } _LIBCPP_INLINE_VISIBILITY void swap(tuple& __t) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__base_.swap(__t.__base_);} }; template <> class _LIBCPP_TEMPLATE_VIS tuple<> { public: _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR tuple() _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&, const tuple&) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(array<_Up, 0>) _NOEXCEPT {} template _LIBCPP_INLINE_VISIBILITY tuple(allocator_arg_t, const _Alloc&, array<_Up, 0>) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void swap(tuple&) _NOEXCEPT {} }; +#ifdef __cpp_deduction_guides +// NOTE: These are not yet standardized, but are required to simulate the +// implicit deduction guide that should be generated had libc++ declared the +// tuple-like constructors "correctly" +template +tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>; +template +tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>; +#endif + template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < __all<__is_swappable<_Tp>::value...>::value, void >::type swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u) _NOEXCEPT_(__all<__is_nothrow_swappable<_Tp>::value...>::value) {__t.swap(__u);} // get template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, tuple<_Tp...> >::type& get(tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get(); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type& get(const tuple<_Tp...>& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast&>(__t.__base_).get(); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get()); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const typename tuple_element<_Ip, tuple<_Tp...> >::type&& get(const tuple<_Tp...>&& __t) _NOEXCEPT { typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type; return static_cast( static_cast&&>(__t.__base_).get()); } #if _LIBCPP_STD_VER > 11 namespace __find_detail { static constexpr size_t __not_found = -1; static constexpr size_t __ambiguous = __not_found - 1; inline _LIBCPP_INLINE_VISIBILITY constexpr size_t __find_idx_return(size_t __curr_i, size_t __res, bool __matches) { return !__matches ? __res : (__res == __not_found ? __curr_i : __ambiguous); } template inline _LIBCPP_INLINE_VISIBILITY constexpr size_t __find_idx(size_t __i, const bool (&__matches)[_Nx]) { return __i == _Nx ? __not_found : __find_idx_return(__i, __find_idx(__i + 1, __matches), __matches[__i]); } template struct __find_exactly_one_checked { static constexpr bool __matches[] = {is_same<_T1, _Args>::value...}; static constexpr size_t value = __find_detail::__find_idx(0, __matches); static_assert (value != __not_found, "type not found in type list" ); static_assert(value != __ambiguous,"type occurs more than once in type list"); }; template struct __find_exactly_one_checked<_T1> { static_assert(!is_same<_T1, _T1>::value, "type not in empty type list"); }; } // namespace __find_detail; template struct __find_exactly_one_t : public __find_detail::__find_exactly_one_checked<_T1, _Args...> { }; template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1& get(tuple<_Args...>& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept { return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup)); } #endif // tie template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<_Tp&...> tie(_Tp&... __t) _NOEXCEPT { return tuple<_Tp&...>(__t...); } template struct __ignore_t { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const __ignore_t& operator=(_Tp&&) const {return *this;} }; namespace { constexpr __ignore_t ignore = __ignore_t(); } template struct __make_tuple_return_impl { typedef _Tp type; }; template struct __make_tuple_return_impl > { typedef _Tp& type; }; template struct __make_tuple_return { typedef typename __make_tuple_return_impl::type>::type type; }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple::type...> make_tuple(_Tp&&... __t) { return tuple::type...>(_VSTD::forward<_Tp>(__t)...); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<_Tp&&...> forward_as_tuple(_Tp&&... __t) _NOEXCEPT { return tuple<_Tp&&...>(_VSTD::forward<_Tp>(__t)...); } template struct __tuple_equal { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp& __x, const _Up& __y) { return __tuple_equal<_Ip - 1>()(__x, __y) && _VSTD::get<_Ip-1>(__x) == _VSTD::get<_Ip-1>(__y); } }; template <> struct __tuple_equal<0> { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp&, const _Up&) { return true; } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return __tuple_equal()(__x, __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x == __y); } template struct __tuple_less { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp& __x, const _Up& __y) { const size_t __idx = tuple_size<_Tp>::value - _Ip; if (_VSTD::get<__idx>(__x) < _VSTD::get<__idx>(__y)) return true; if (_VSTD::get<__idx>(__y) < _VSTD::get<__idx>(__x)) return false; return __tuple_less<_Ip-1>()(__x, __y); } }; template <> struct __tuple_less<0> { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator()(const _Tp&, const _Up&) { return false; } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return __tuple_less()(__x, __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return __y < __x; } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__x < __y); } template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 bool operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y) { return !(__y < __x); } // tuple_cat template struct __tuple_cat_type; template struct __tuple_cat_type, __tuple_types<_Utypes...> > { typedef tuple<_Ttypes..., _Utypes...> type; }; template struct __tuple_cat_return_1 { }; template struct __tuple_cat_return_1, true, _Tuple0> { typedef typename __tuple_cat_type, typename __make_tuple_types::type>::type>::type type; }; template struct __tuple_cat_return_1, true, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_1< typename __tuple_cat_type< tuple<_Types...>, typename __make_tuple_types::type>::type >::type, __tuple_like::type>::value, _Tuple1, _Tuples...> { }; template struct __tuple_cat_return; template struct __tuple_cat_return<_Tuple0, _Tuples...> : public __tuple_cat_return_1, __tuple_like::type>::value, _Tuple0, _Tuples...> { }; template <> struct __tuple_cat_return<> { typedef tuple<> type; }; inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 tuple<> tuple_cat() { return tuple<>(); } template struct __tuple_cat_return_ref_imp; template struct __tuple_cat_return_ref_imp, __tuple_indices<_I0...>, _Tuple0> { typedef typename remove_reference<_Tuple0>::type _T0; typedef tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, _T0>::type>::type&&...> type; }; template struct __tuple_cat_return_ref_imp, __tuple_indices<_I0...>, _Tuple0, _Tuple1, _Tuples...> : public __tuple_cat_return_ref_imp< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_I0, typename remove_reference<_Tuple0>::type>::type>::type&&...>, typename __make_tuple_indices::type>::value>::type, _Tuple1, _Tuples...> { }; template struct __tuple_cat_return_ref : public __tuple_cat_return_ref_imp, typename __make_tuple_indices< tuple_size::type>::value >::type, _Tuple0, _Tuples...> { }; template struct __tuple_cat; template struct __tuple_cat, __tuple_indices<_I0...>, __tuple_indices<_J0...> > { template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return_ref&&, _Tuple0&&>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0) { return forward_as_tuple(_VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))...); } template _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return_ref&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls) { typedef typename remove_reference<_Tuple0>::type _T0; typedef typename remove_reference<_Tuple1>::type _T1; return __tuple_cat< tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>, typename __make_tuple_indices::value>::type, typename __make_tuple_indices::value>::type>() (forward_as_tuple( _VSTD::forward<_Types>(_VSTD::get<_I0>(__t))..., _VSTD::get<_J0>(_VSTD::forward<_Tuple0>(__t0))... ), _VSTD::forward<_Tuple1>(__t1), _VSTD::forward<_Tuples>(__tpls)...); } }; template inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 typename __tuple_cat_return<_Tuple0, _Tuples...>::type tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls) { typedef typename remove_reference<_Tuple0>::type _T0; return __tuple_cat, __tuple_indices<>, typename __make_tuple_indices::value>::type>() (tuple<>(), _VSTD::forward<_Tuple0>(__t0), _VSTD::forward<_Tuples>(__tpls)...); } template struct _LIBCPP_TEMPLATE_VIS uses_allocator, _Alloc> : true_type {}; template template inline _LIBCPP_INLINE_VISIBILITY pair<_T1, _T2>::pair(piecewise_construct_t, tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args, __tuple_indices<_I1...>, __tuple_indices<_I2...>) : first(_VSTD::forward<_Args1>(_VSTD::get<_I1>( __first_args))...), second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...) { } #if _LIBCPP_STD_VER > 14 template constexpr size_t tuple_size_v = tuple_size<_Tp>::value; #define _LIBCPP_NOEXCEPT_RETURN(...) noexcept(noexcept(__VA_ARGS__)) { return __VA_ARGS__; } template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) __apply_tuple_impl(_Fn && __f, _Tuple && __t, __tuple_indices<_Id...>) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__invoke_constexpr( _VSTD::forward<_Fn>(__f), _VSTD::get<_Id>(_VSTD::forward<_Tuple>(__t))...) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) apply(_Fn && __f, _Tuple && __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__apply_tuple_impl( _VSTD::forward<_Fn>(__f), _VSTD::forward<_Tuple>(__t), typename __make_tuple_indices>>::type{}) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp __make_from_tuple_impl(_Tuple&& __t, __tuple_indices<_Idx...>) _LIBCPP_NOEXCEPT_RETURN( _Tp(_VSTD::get<_Idx>(_VSTD::forward<_Tuple>(__t))...) ) template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp make_from_tuple(_Tuple&& __t) _LIBCPP_NOEXCEPT_RETURN( _VSTD::__make_from_tuple_impl<_Tp>(_VSTD::forward<_Tuple>(__t), typename __make_tuple_indices>>::type{}) ) #undef _LIBCPP_NOEXCEPT_RETURN #endif // _LIBCPP_STD_VER > 14 #endif // !defined(_LIBCPP_CXX03_LANG) _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_TUPLE Index: vendor/libc++/dist/include/variant =================================================================== --- vendor/libc++/dist/include/variant (revision 319785) +++ vendor/libc++/dist/include/variant (revision 319786) @@ -1,1567 +1,1562 @@ // -*- C++ -*- //===------------------------------ variant -------------------------------===// // // 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_VARIANT #define _LIBCPP_VARIANT /* variant synopsis namespace std { // 20.7.2, class template variant template class variant { public: // 20.7.2.1, constructors constexpr variant() noexcept(see below); variant(const variant&); variant(variant&&) noexcept(see below); template constexpr variant(T&&) noexcept(see below); template constexpr explicit variant(in_place_type_t, Args&&...); template constexpr explicit variant( in_place_type_t, initializer_list, Args&&...); template constexpr explicit variant(in_place_index_t, Args&&...); template constexpr explicit variant( in_place_index_t, initializer_list, Args&&...); // 20.7.2.2, destructor ~variant(); // 20.7.2.3, assignment variant& operator=(const variant&); variant& operator=(variant&&) noexcept(see below); template variant& operator=(T&&) noexcept(see below); // 20.7.2.4, modifiers template T& emplace(Args&&...); template T& emplace(initializer_list, Args&&...); template variant_alternative_t& emplace(Args&&...); template variant_alternative_t& emplace(initializer_list, Args&&...); // 20.7.2.5, value status constexpr bool valueless_by_exception() const noexcept; constexpr size_t index() const noexcept; // 20.7.2.6, swap void swap(variant&) noexcept(see below); }; // 20.7.3, variant helper classes template struct variant_size; // undefined template constexpr size_t variant_size_v = variant_size::value; template struct variant_size; template struct variant_size; template struct variant_size; template struct variant_size>; template struct variant_alternative; // undefined template using variant_alternative_t = typename variant_alternative::type; template struct variant_alternative; template struct variant_alternative; template struct variant_alternative; template struct variant_alternative>; constexpr size_t variant_npos = -1; // 20.7.4, value access template constexpr bool holds_alternative(const variant&) noexcept; template constexpr variant_alternative_t>& get(variant&); template constexpr variant_alternative_t>&& get(variant&&); template constexpr variant_alternative_t> const& get(const variant&); template constexpr variant_alternative_t> const&& get(const variant&&); template constexpr T& get(variant&); template constexpr T&& get(variant&&); template constexpr const T& get(const variant&); template constexpr const T&& get(const variant&&); template constexpr add_pointer_t>> get_if(variant*) noexcept; template constexpr add_pointer_t>> get_if(const variant*) noexcept; template constexpr add_pointer_t get_if(variant*) noexcept; template constexpr add_pointer_t get_if(const variant*) noexcept; // 20.7.5, relational operators template constexpr bool operator==(const variant&, const variant&); template constexpr bool operator!=(const variant&, const variant&); template constexpr bool operator<(const variant&, const variant&); template constexpr bool operator>(const variant&, const variant&); template constexpr bool operator<=(const variant&, const variant&); template constexpr bool operator>=(const variant&, const variant&); // 20.7.6, visitation template constexpr see below visit(Visitor&&, Variants&&...); // 20.7.7, class monostate struct monostate; // 20.7.8, monostate relational operators constexpr bool operator<(monostate, monostate) noexcept; constexpr bool operator>(monostate, monostate) noexcept; constexpr bool operator<=(monostate, monostate) noexcept; constexpr bool operator>=(monostate, monostate) noexcept; constexpr bool operator==(monostate, monostate) noexcept; constexpr bool operator!=(monostate, monostate) noexcept; // 20.7.9, specialized algorithms template void swap(variant&, variant&) noexcept(see below); // 20.7.10, class bad_variant_access class bad_variant_access; // 20.7.11, hash support template struct hash; template struct hash>; template <> struct hash; } // namespace std */ #include <__config> #include <__tuple> #include #include #include #include #include #include #include #include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif namespace std { // explicitly not using versioning namespace class _LIBCPP_EXCEPTION_ABI bad_variant_access : public exception { public: virtual const char* what() const _NOEXCEPT; }; } // namespace std _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER > 14 _LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY void __throw_bad_variant_access() { #ifndef _LIBCPP_NO_EXCEPTIONS throw bad_variant_access(); #else _VSTD::abort(); #endif } template class _LIBCPP_TEMPLATE_VIS variant; template struct _LIBCPP_TEMPLATE_VIS variant_size; template constexpr size_t variant_size_v = variant_size<_Tp>::value; template struct _LIBCPP_TEMPLATE_VIS variant_size : variant_size<_Tp> {}; template struct _LIBCPP_TEMPLATE_VIS variant_size : variant_size<_Tp> {}; template struct _LIBCPP_TEMPLATE_VIS variant_size : variant_size<_Tp> {}; template struct _LIBCPP_TEMPLATE_VIS variant_size> : integral_constant {}; template struct _LIBCPP_TEMPLATE_VIS variant_alternative; template using variant_alternative_t = typename variant_alternative<_Ip, _Tp>::type; template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const _Tp> : add_const> {}; template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, volatile _Tp> : add_volatile> {}; template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp> : add_cv> {}; template struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> { static_assert(_Ip < sizeof...(_Types)); using type = __type_pack_element<_Ip, _Types...>; }; constexpr size_t variant_npos = static_cast(-1); constexpr unsigned int __variant_npos = static_cast(-1); namespace __find_detail { template inline _LIBCPP_INLINE_VISIBILITY constexpr size_t __find_index() { constexpr bool __matches[] = {is_same_v<_Tp, _Types>...}; size_t __result = __not_found; for (size_t __i = 0; __i < sizeof...(_Types); ++__i) { if (__matches[__i]) { if (__result != __not_found) { return __ambiguous; } __result = __i; } } return __result; } template struct __find_unambiguous_index_sfinae_impl : integral_constant {}; template <> struct __find_unambiguous_index_sfinae_impl<__not_found> {}; template <> struct __find_unambiguous_index_sfinae_impl<__ambiguous> {}; template struct __find_unambiguous_index_sfinae : __find_unambiguous_index_sfinae_impl<__find_index<_Tp, _Types...>()> {}; } // namespace __find_detail namespace __variant_detail { struct __valueless_t {}; enum class _Trait { _TriviallyAvailable, _Available, _Unavailable }; template class _IsTriviallyAvailable, template class _IsAvailable> constexpr _Trait __trait = _IsTriviallyAvailable<_Tp>::value ? _Trait::_TriviallyAvailable : _IsAvailable<_Tp>::value ? _Trait::_Available : _Trait::_Unavailable; inline _LIBCPP_INLINE_VISIBILITY constexpr _Trait __common_trait(initializer_list<_Trait> __traits) { _Trait __result = _Trait::_TriviallyAvailable; for (_Trait __t : __traits) { if (static_cast(__t) > static_cast(__result)) { __result = __t; } } return __result; } template struct __traits { static constexpr _Trait __copy_constructible_trait = __common_trait({__trait<_Types, is_trivially_copy_constructible, is_copy_constructible>...}); static constexpr _Trait __move_constructible_trait = __common_trait({__trait<_Types, is_trivially_move_constructible, is_move_constructible>...}); static constexpr _Trait __copy_assignable_trait = __common_trait( {__copy_constructible_trait, - __move_constructible_trait, __trait<_Types, is_trivially_copy_assignable, is_copy_assignable>...}); static constexpr _Trait __move_assignable_trait = __common_trait( {__move_constructible_trait, __trait<_Types, is_trivially_move_assignable, is_move_assignable>...}); static constexpr _Trait __destructible_trait = __common_trait( {__trait<_Types, is_trivially_destructible, is_destructible>...}); }; namespace __access { struct __union { template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<0>) { return _VSTD::forward<_Vp>(__v).__head; } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __get_alt(_Vp&& __v, in_place_index_t<_Ip>) { return __get_alt(_VSTD::forward<_Vp>(__v).__tail, in_place_index<_Ip - 1>); } }; struct __base { template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __get_alt(_Vp&& __v) { return __union::__get_alt(_VSTD::forward<_Vp>(__v).__data, in_place_index<_Ip>); } }; struct __variant { template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __get_alt(_Vp&& __v) { return __base::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v).__impl); } }; } // namespace __access namespace __visitation { struct __base { template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { constexpr auto __fdiagonal = __make_fdiagonal<_Visitor&&, decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); return __fdiagonal[__index](_VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Vs>(__vs).__as_base()...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) { constexpr auto __fmatrix = __make_fmatrix<_Visitor&&, decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>(); return __at(__fmatrix, __vs.index()...)( _VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Vs>(__vs).__as_base()...); } private: template inline _LIBCPP_INLINE_VISIBILITY static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __at(const array<_Tp, _Np>& __elems, size_t __index, _Indices... __indices) { return __at(__elems[__index], __indices...); } template static constexpr void __std_visit_visitor_return_type_check() { static_assert( __all...>::value, "`std::visit` requires the visitor to have a single return type."); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_farray(_Fs&&... __fs) { __std_visit_visitor_return_type_check...>(); using __result = array...>, sizeof...(_Fs)>; return __result{{_VSTD::forward<_Fs>(__fs)...}}; } template struct __dispatcher { template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) { return __invoke_constexpr( static_cast<_Fp>(__f), __access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...); } }; template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_dispatch(index_sequence<_Is...>) { return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>; } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal_impl() { return __make_dispatch<_Fp, _Vs...>( index_sequence<(__identity<_Vs>{}, _Ip)...>{}); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal_impl(index_sequence<_Is...>) { return __base::__make_farray(__make_fdiagonal_impl<_Is, _Fp, _Vs...>()...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fdiagonal() { constexpr size_t _Np = decay_t<_Vp>::__size(); static_assert(__all<(_Np == decay_t<_Vs>::__size())...>::value); return __make_fdiagonal_impl<_Fp, _Vp, _Vs...>(make_index_sequence<_Np>{}); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fmatrix_impl(index_sequence<_Is...> __is) { return __make_dispatch<_Fp, _Vs...>(__is); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fmatrix_impl(index_sequence<_Is...>, index_sequence<_Js...>, _Ls... __ls) { return __base::__make_farray(__make_fmatrix_impl<_Fp, _Vs...>( index_sequence<_Is..., _Js>{}, __ls...)...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_fmatrix() { return __make_fmatrix_impl<_Fp, _Vs...>( index_sequence<>{}, make_index_sequence::__size()>{}...); } }; struct __variant { template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_alt_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { return __base::__visit_alt_at(__index, _VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Vs>(__vs).__impl...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_alt(_Visitor&& __visitor, _Vs&&... __vs) { return __base::__visit_alt(_VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Vs>(__vs).__impl...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_value_at(size_t __index, _Visitor&& __visitor, _Vs&&... __vs) { return __visit_alt_at( __index, __make_value_visitor(_VSTD::forward<_Visitor>(__visitor)), _VSTD::forward<_Vs>(__vs)...); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr decltype(auto) __visit_value(_Visitor&& __visitor, _Vs&&... __vs) { return __visit_alt( __make_value_visitor(_VSTD::forward<_Visitor>(__visitor)), _VSTD::forward<_Vs>(__vs)...); } private: template static constexpr void __std_visit_exhaustive_visitor_check() { static_assert(is_callable_v<_Visitor(_Values...)>, "`std::visit` requires the visitor to be exhaustive."); } template struct __value_visitor { template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) operator()(_Alts&&... __alts) const { __std_visit_exhaustive_visitor_check< _Visitor, decltype((_VSTD::forward<_Alts>(__alts).__value))...>(); return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Alts>(__alts).__value...); } _Visitor&& __visitor; }; template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto __make_value_visitor(_Visitor&& __visitor) { return __value_visitor<_Visitor>{_VSTD::forward<_Visitor>(__visitor)}; } }; } // namespace __visitation template struct _LIBCPP_TEMPLATE_VIS __alt { using __value_type = _Tp; template inline _LIBCPP_INLINE_VISIBILITY explicit constexpr __alt(in_place_t, _Args&&... __args) : __value(_VSTD::forward<_Args>(__args)...) {} __value_type __value; }; template <_Trait _DestructibleTrait, size_t _Index, class... _Types> union _LIBCPP_TEMPLATE_VIS __union; template <_Trait _DestructibleTrait, size_t _Index> union _LIBCPP_TEMPLATE_VIS __union<_DestructibleTrait, _Index> {}; #define _LIBCPP_VARIANT_UNION(destructible_trait, destructor) \ template \ union _LIBCPP_TEMPLATE_VIS __union { \ public: \ inline _LIBCPP_INLINE_VISIBILITY \ explicit constexpr __union(__valueless_t) noexcept : __dummy{} {} \ \ template \ inline _LIBCPP_INLINE_VISIBILITY \ explicit constexpr __union(in_place_index_t<0>, _Args&&... __args) \ : __head(in_place, _VSTD::forward<_Args>(__args)...) {} \ \ template \ inline _LIBCPP_INLINE_VISIBILITY \ explicit constexpr __union(in_place_index_t<_Ip>, _Args&&... __args) \ : __tail(in_place_index<_Ip - 1>, _VSTD::forward<_Args>(__args)...) {} \ \ __union(const __union&) = default; \ __union(__union&&) = default; \ \ destructor \ \ __union& operator=(const __union&) = default; \ __union& operator=(__union&&) = default; \ \ private: \ char __dummy; \ __alt<_Index, _Tp> __head; \ __union __tail; \ \ friend struct __access::__union; \ } _LIBCPP_VARIANT_UNION(_Trait::_TriviallyAvailable, ~__union() = default;); _LIBCPP_VARIANT_UNION(_Trait::_Available, ~__union() {}); _LIBCPP_VARIANT_UNION(_Trait::_Unavailable, ~__union() = delete;); #undef _LIBCPP_VARIANT_UNION template <_Trait _DestructibleTrait, class... _Types> class _LIBCPP_TEMPLATE_VIS __base { public: inline _LIBCPP_INLINE_VISIBILITY explicit constexpr __base(__valueless_t tag) noexcept : __data(tag), __index(__variant_npos) {} template inline _LIBCPP_INLINE_VISIBILITY explicit constexpr __base(in_place_index_t<_Ip>, _Args&&... __args) : __data(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...), __index(_Ip) {} inline _LIBCPP_INLINE_VISIBILITY constexpr bool valueless_by_exception() const noexcept { return index() == variant_npos; } inline _LIBCPP_INLINE_VISIBILITY constexpr size_t index() const noexcept { return __index == __variant_npos ? variant_npos : __index; } protected: inline _LIBCPP_INLINE_VISIBILITY constexpr auto&& __as_base() & { return *this; } inline _LIBCPP_INLINE_VISIBILITY constexpr auto&& __as_base() && { return _VSTD::move(*this); } inline _LIBCPP_INLINE_VISIBILITY constexpr auto&& __as_base() const & { return *this; } inline _LIBCPP_INLINE_VISIBILITY constexpr auto&& __as_base() const && { return _VSTD::move(*this); } inline _LIBCPP_INLINE_VISIBILITY static constexpr size_t __size() { return sizeof...(_Types); } __union<_DestructibleTrait, 0, _Types...> __data; unsigned int __index; friend struct __access::__base; friend struct __visitation::__base; }; template class _LIBCPP_TEMPLATE_VIS __destructor; #define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \ template \ class _LIBCPP_TEMPLATE_VIS __destructor<__traits<_Types...>, \ destructible_trait> \ : public __base { \ using __base_type = __base; \ \ public: \ using __base_type::__base_type; \ using __base_type::operator=; \ \ __destructor(const __destructor&) = default; \ __destructor(__destructor&&) = default; \ destructor \ __destructor& operator=(const __destructor&) = default; \ __destructor& operator=(__destructor&&) = default; \ \ protected: \ inline _LIBCPP_INLINE_VISIBILITY \ destroy \ } _LIBCPP_VARIANT_DESTRUCTOR( _Trait::_TriviallyAvailable, ~__destructor() = default;, void __destroy() noexcept { this->__index = __variant_npos; }); _LIBCPP_VARIANT_DESTRUCTOR( _Trait::_Available, ~__destructor() { __destroy(); }, void __destroy() noexcept { if (!this->valueless_by_exception()) { __visitation::__base::__visit_alt( [](auto& __alt) noexcept { using __alt_type = decay_t; __alt.~__alt_type(); }, *this); } this->__index = __variant_npos; }); _LIBCPP_VARIANT_DESTRUCTOR( _Trait::_Unavailable, ~__destructor() = delete;, void __destroy() noexcept = delete;); #undef _LIBCPP_VARIANT_DESTRUCTOR template class _LIBCPP_TEMPLATE_VIS __constructor : public __destructor<_Traits> { using __base_type = __destructor<_Traits>; public: using __base_type::__base_type; using __base_type::operator=; protected: template inline _LIBCPP_INLINE_VISIBILITY static _Tp& __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) { ::new ((void*)_VSTD::addressof(__a)) __alt<_Ip, _Tp>(in_place, _VSTD::forward<_Args>(__args)...); return __a.__value; } template inline _LIBCPP_INLINE_VISIBILITY static void __generic_construct(__constructor& __lhs, _Rhs&& __rhs) { __lhs.__destroy(); if (!__rhs.valueless_by_exception()) { __visitation::__base::__visit_alt_at( __rhs.index(), [](auto& __lhs_alt, auto&& __rhs_alt) { __construct_alt( __lhs_alt, _VSTD::forward(__rhs_alt).__value); }, __lhs, _VSTD::forward<_Rhs>(__rhs)); __lhs.__index = __rhs.index(); } } }; template class _LIBCPP_TEMPLATE_VIS __move_constructor; #define _LIBCPP_VARIANT_MOVE_CONSTRUCTOR(move_constructible_trait, \ move_constructor) \ template \ class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \ move_constructible_trait> \ : public __constructor<__traits<_Types...>> { \ using __base_type = __constructor<__traits<_Types...>>; \ \ public: \ using __base_type::__base_type; \ using __base_type::operator=; \ \ __move_constructor(const __move_constructor&) = default; \ move_constructor \ ~__move_constructor() = default; \ __move_constructor& operator=(const __move_constructor&) = default; \ __move_constructor& operator=(__move_constructor&&) = default; \ } _LIBCPP_VARIANT_MOVE_CONSTRUCTOR( _Trait::_TriviallyAvailable, __move_constructor(__move_constructor&& __that) = default;); _LIBCPP_VARIANT_MOVE_CONSTRUCTOR( _Trait::_Available, __move_constructor(__move_constructor&& __that) noexcept( __all...>::value) : __move_constructor(__valueless_t{}) { this->__generic_construct(*this, _VSTD::move(__that)); }); _LIBCPP_VARIANT_MOVE_CONSTRUCTOR( _Trait::_Unavailable, __move_constructor(__move_constructor&&) = delete;); #undef _LIBCPP_VARIANT_MOVE_CONSTRUCTOR template class _LIBCPP_TEMPLATE_VIS __copy_constructor; #define _LIBCPP_VARIANT_COPY_CONSTRUCTOR(copy_constructible_trait, \ copy_constructor) \ template \ class _LIBCPP_TEMPLATE_VIS __copy_constructor<__traits<_Types...>, \ copy_constructible_trait> \ : public __move_constructor<__traits<_Types...>> { \ using __base_type = __move_constructor<__traits<_Types...>>; \ \ public: \ using __base_type::__base_type; \ using __base_type::operator=; \ \ copy_constructor \ __copy_constructor(__copy_constructor&&) = default; \ ~__copy_constructor() = default; \ __copy_constructor& operator=(const __copy_constructor&) = default; \ __copy_constructor& operator=(__copy_constructor&&) = default; \ } _LIBCPP_VARIANT_COPY_CONSTRUCTOR( _Trait::_TriviallyAvailable, __copy_constructor(const __copy_constructor& __that) = default;); _LIBCPP_VARIANT_COPY_CONSTRUCTOR( _Trait::_Available, __copy_constructor(const __copy_constructor& __that) : __copy_constructor(__valueless_t{}) { this->__generic_construct(*this, __that); }); _LIBCPP_VARIANT_COPY_CONSTRUCTOR( _Trait::_Unavailable, __copy_constructor(const __copy_constructor&) = delete;); #undef _LIBCPP_VARIANT_COPY_CONSTRUCTOR template class _LIBCPP_TEMPLATE_VIS __assignment : public __copy_constructor<_Traits> { using __base_type = __copy_constructor<_Traits>; public: using __base_type::__base_type; using __base_type::operator=; template inline _LIBCPP_INLINE_VISIBILITY auto& __emplace(_Args&&... __args) { this->__destroy(); auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this), _VSTD::forward<_Args>(__args)...); this->__index = _Ip; return __res; } protected: - template + template inline _LIBCPP_INLINE_VISIBILITY - void __assign_alt(__alt<_Ip, _Tp>& __a, - _Arg&& __arg, - bool_constant<_CopyAssign> __tag) { + void __assign_alt(__alt<_Ip, _Tp>& __a, _Arg&& __arg) { if (this->index() == _Ip) { __a.__value = _VSTD::forward<_Arg>(__arg); } else { struct { void operator()(true_type) const { - __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); + __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); } void operator()(false_type) const { - __this->__emplace<_Ip>(_VSTD::forward<_Arg>(__arg)); + __this->__emplace<_Ip>(_Tp(_VSTD::forward<_Arg>(__arg))); } __assignment* __this; _Arg&& __arg; } __impl{this, _VSTD::forward<_Arg>(__arg)}; - __impl(__tag); + __impl(bool_constant || + !is_nothrow_move_constructible_v<_Tp>>{}); } } template inline _LIBCPP_INLINE_VISIBILITY void __generic_assign(_That&& __that) { if (this->valueless_by_exception() && __that.valueless_by_exception()) { // do nothing. } else if (__that.valueless_by_exception()) { this->__destroy(); } else { __visitation::__base::__visit_alt_at( __that.index(), [this](auto& __this_alt, auto&& __that_alt) { this->__assign_alt( __this_alt, - _VSTD::forward(__that_alt).__value, - is_lvalue_reference<_That>{}); + _VSTD::forward(__that_alt).__value); }, *this, _VSTD::forward<_That>(__that)); } } }; template class _LIBCPP_TEMPLATE_VIS __move_assignment; #define _LIBCPP_VARIANT_MOVE_ASSIGNMENT(move_assignable_trait, \ move_assignment) \ template \ class _LIBCPP_TEMPLATE_VIS __move_assignment<__traits<_Types...>, \ move_assignable_trait> \ : public __assignment<__traits<_Types...>> { \ using __base_type = __assignment<__traits<_Types...>>; \ \ public: \ using __base_type::__base_type; \ using __base_type::operator=; \ \ __move_assignment(const __move_assignment&) = default; \ __move_assignment(__move_assignment&&) = default; \ ~__move_assignment() = default; \ __move_assignment& operator=(const __move_assignment&) = default; \ move_assignment \ } _LIBCPP_VARIANT_MOVE_ASSIGNMENT( _Trait::_TriviallyAvailable, __move_assignment& operator=(__move_assignment&& __that) = default;); _LIBCPP_VARIANT_MOVE_ASSIGNMENT( _Trait::_Available, __move_assignment& operator=(__move_assignment&& __that) noexcept( __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_move_assignable_v<_Types>)...>::value) { this->__generic_assign(_VSTD::move(__that)); return *this; }); _LIBCPP_VARIANT_MOVE_ASSIGNMENT( _Trait::_Unavailable, __move_assignment& operator=(__move_assignment&&) = delete;); #undef _LIBCPP_VARIANT_MOVE_ASSIGNMENT template class _LIBCPP_TEMPLATE_VIS __copy_assignment; #define _LIBCPP_VARIANT_COPY_ASSIGNMENT(copy_assignable_trait, \ copy_assignment) \ template \ class _LIBCPP_TEMPLATE_VIS __copy_assignment<__traits<_Types...>, \ copy_assignable_trait> \ : public __move_assignment<__traits<_Types...>> { \ using __base_type = __move_assignment<__traits<_Types...>>; \ \ public: \ using __base_type::__base_type; \ using __base_type::operator=; \ \ __copy_assignment(const __copy_assignment&) = default; \ __copy_assignment(__copy_assignment&&) = default; \ ~__copy_assignment() = default; \ copy_assignment \ __copy_assignment& operator=(__copy_assignment&&) = default; \ } _LIBCPP_VARIANT_COPY_ASSIGNMENT( _Trait::_TriviallyAvailable, __copy_assignment& operator=(const __copy_assignment& __that) = default;); _LIBCPP_VARIANT_COPY_ASSIGNMENT( _Trait::_Available, __copy_assignment& operator=(const __copy_assignment& __that) { this->__generic_assign(__that); return *this; }); _LIBCPP_VARIANT_COPY_ASSIGNMENT( _Trait::_Unavailable, __copy_assignment& operator=(const __copy_assignment&) = delete;); #undef _LIBCPP_VARIANT_COPY_ASSIGNMENT template class _LIBCPP_TEMPLATE_VIS __impl : public __copy_assignment<__traits<_Types...>> { using __base_type = __copy_assignment<__traits<_Types...>>; public: using __base_type::__base_type; using __base_type::operator=; template inline _LIBCPP_INLINE_VISIBILITY void __assign(_Arg&& __arg) { this->__assign_alt(__access::__base::__get_alt<_Ip>(*this), - _VSTD::forward<_Arg>(__arg), - false_type{}); + _VSTD::forward<_Arg>(__arg)); } inline _LIBCPP_INLINE_VISIBILITY void __swap(__impl& __that) { if (this->valueless_by_exception() && __that.valueless_by_exception()) { // do nothing. } else if (this->index() == __that.index()) { __visitation::__base::__visit_alt_at( this->index(), [](auto& __this_alt, auto& __that_alt) { using _VSTD::swap; swap(__this_alt.__value, __that_alt.__value); }, *this, __that); } else { __impl* __lhs = this; __impl* __rhs = _VSTD::addressof(__that); if (__lhs->__move_nothrow() && !__rhs->__move_nothrow()) { _VSTD::swap(__lhs, __rhs); } __impl __tmp(_VSTD::move(*__rhs)); #ifndef _LIBCPP_NO_EXCEPTIONS // EXTENSION: When the move construction of `__lhs` into `__rhs` throws // and `__tmp` is nothrow move constructible then we move `__tmp` back // into `__rhs` and provide the strong exception safety guarentee. try { this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); } catch (...) { if (__tmp.__move_nothrow()) { this->__generic_construct(*__rhs, _VSTD::move(__tmp)); } throw; } #else this->__generic_construct(*__rhs, _VSTD::move(*__lhs)); #endif this->__generic_construct(*__lhs, _VSTD::move(__tmp)); } } private: inline _LIBCPP_INLINE_VISIBILITY bool __move_nothrow() const { constexpr bool __results[] = {is_nothrow_move_constructible_v<_Types>...}; return this->valueless_by_exception() || __results[this->index()]; } }; template struct __overload; template <> struct __overload<> { void operator()() const; }; template struct __overload<_Tp, _Types...> : __overload<_Types...> { using __overload<_Types...>::operator(); __identity<_Tp> operator()(_Tp) const; }; template using __best_match_t = typename result_of_t<__overload<_Types...>(_Tp&&)>::type; } // __variant_detail template class _LIBCPP_TEMPLATE_VIS variant : private __sfinae_ctor_base< __all...>::value, __all...>::value>, private __sfinae_assign_base< __all<(is_copy_constructible_v<_Types> && - is_move_constructible_v<_Types> && is_copy_assignable_v<_Types>)...>::value, __all<(is_move_constructible_v<_Types> && is_move_assignable_v<_Types>)...>::value> { static_assert(0 < sizeof...(_Types), "variant must consist of at least one alternative."); static_assert(__all...>::value, "variant can not have an array type as an alternative."); static_assert(__all...>::value, "variant can not have a reference type as an alternative."); static_assert(__all...>::value, "variant can not have a void type as an alternative."); using __first_type = variant_alternative_t<0, variant>; public: template , _Dummy>::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY constexpr variant() noexcept(is_nothrow_default_constructible_v<__first_type>) : __impl(in_place_index<0>) {} variant(const variant&) = default; variant(variant&&) = default; template < class _Arg, enable_if_t, variant>, int> = 0, class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY constexpr variant(_Arg&& __arg) noexcept( is_nothrow_constructible_v<_Tp, _Arg>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {} template , class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY explicit constexpr variant( in_place_index_t<_Ip>, _Args&&... __args) noexcept(is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} template < size_t _Ip, class _Up, class... _Args, enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY explicit constexpr variant( in_place_index_t<_Ip>, initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, initializer_list<_Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} template < class _Tp, class... _Args, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY explicit constexpr variant(in_place_type_t<_Tp>, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, _Args...>) : __impl(in_place_index<_Ip>, _VSTD::forward<_Args>(__args)...) {} template < class _Tp, class _Up, class... _Args, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY explicit constexpr variant( in_place_type_t<_Tp>, initializer_list<_Up> __il, _Args&&... __args) noexcept( is_nothrow_constructible_v<_Tp, initializer_list< _Up>&, _Args...>) : __impl(in_place_index<_Ip>, __il, _VSTD::forward<_Args>(__args)...) {} ~variant() = default; variant& operator=(const variant&) = default; variant& operator=(variant&&) = default; template < class _Arg, enable_if_t, variant>, int> = 0, class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t && is_constructible_v<_Tp, _Arg>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY variant& operator=(_Arg&& __arg) noexcept( is_nothrow_assignable_v<_Tp&, _Arg> && is_nothrow_constructible_v<_Tp, _Arg>) { __impl.template __assign<_Ip>(_VSTD::forward<_Arg>(__arg)); return *this; } template < size_t _Ip, class... _Args, enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _Tp& emplace(_Args&&... __args) { return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < size_t _Ip, class _Up, class... _Args, enable_if_t<(_Ip < sizeof...(_Types)), int> = 0, class _Tp = variant_alternative_t<_Ip, variant<_Types...>>, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } template < class _Tp, class... _Args, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _Tp& emplace(_Args&&... __args) { return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...); } template < class _Tp, class _Up, class... _Args, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, enable_if_t&, _Args...>, int> = 0> inline _LIBCPP_INLINE_VISIBILITY _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) { return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...); } inline _LIBCPP_INLINE_VISIBILITY constexpr bool valueless_by_exception() const noexcept { return __impl.valueless_by_exception(); } inline _LIBCPP_INLINE_VISIBILITY constexpr size_t index() const noexcept { return __impl.index(); } template < bool _Dummy = true, enable_if_t< __all<( __dependent_type, _Dummy>::value && __dependent_type, _Dummy>::value)...>::value, int> = 0> inline _LIBCPP_INLINE_VISIBILITY void swap(variant& __that) noexcept( __all<(is_nothrow_move_constructible_v<_Types> && is_nothrow_swappable_v<_Types>)...>::value) { __impl.__swap(__that.__impl); } private: __variant_detail::__impl<_Types...> __impl; friend struct __variant_detail::__access::__variant; friend struct __variant_detail::__visitation::__variant; }; template inline _LIBCPP_INLINE_VISIBILITY constexpr bool __holds_alternative(const variant<_Types...>& __v) noexcept { return __v.index() == _Ip; } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool holds_alternative(const variant<_Types...>& __v) noexcept { return __holds_alternative<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template inline _LIBCPP_INLINE_VISIBILITY static constexpr auto&& __generic_get(_Vp&& __v) { using __variant_detail::__access::__variant; if (!__holds_alternative<_Ip>(__v)) { __throw_bad_variant_access(); } return __variant::__get_alt<_Ip>(_VSTD::forward<_Vp>(__v)).__value; } template inline _LIBCPP_INLINE_VISIBILITY constexpr variant_alternative_t<_Ip, variant<_Types...>>& get( variant<_Types...>& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get<_Ip>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr variant_alternative_t<_Ip, variant<_Types...>>&& get( variant<_Types...>&& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get<_Ip>(_VSTD::move(__v)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr const variant_alternative_t<_Ip, variant<_Types...>>& get( const variant<_Types...>& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get<_Ip>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr const variant_alternative_t<_Ip, variant<_Types...>>&& get( const variant<_Types...>&& __v) { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get<_Ip>(_VSTD::move(__v)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp& get(variant<_Types...>& __v) { static_assert(!is_void_v<_Tp>); return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr _Tp&& get(variant<_Types...>&& __v) { static_assert(!is_void_v<_Tp>); return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>( _VSTD::move(__v)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr const _Tp& get(const variant<_Types...>& __v) { static_assert(!is_void_v<_Tp>); return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr const _Tp&& get(const variant<_Types...>&& __v) { static_assert(!is_void_v<_Tp>); return _VSTD::get<__find_exactly_one_t<_Tp, _Types...>::value>( _VSTD::move(__v)); } template inline _LIBCPP_INLINE_VISIBILITY constexpr auto* __generic_get_if(_Vp* __v) noexcept { using __variant_detail::__access::__variant; return __v && __holds_alternative<_Ip>(*__v) ? _VSTD::addressof(__variant::__get_alt<_Ip>(*__v).__value) : nullptr; } template inline _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t>> get_if(variant<_Types...>* __v) noexcept { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get_if<_Ip>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t>> get_if(const variant<_Types...>* __v) noexcept { static_assert(_Ip < sizeof...(_Types)); static_assert(!is_void_v>>); return __generic_get_if<_Ip>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t<_Tp> get_if(variant<_Types...>* __v) noexcept { static_assert(!is_void_v<_Tp>); return _VSTD::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr add_pointer_t get_if(const variant<_Types...>* __v) noexcept { static_assert(!is_void_v<_Tp>); return _VSTD::get_if<__find_exactly_one_t<_Tp, _Types...>::value>(__v); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator==(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__lhs.index() != __rhs.index()) return false; if (__lhs.valueless_by_exception()) return true; return __variant::__visit_value_at(__lhs.index(), equal_to<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator!=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__lhs.index() != __rhs.index()) return true; if (__lhs.valueless_by_exception()) return false; return __variant::__visit_value_at( __lhs.index(), not_equal_to<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator<(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__rhs.valueless_by_exception()) return false; if (__lhs.valueless_by_exception()) return true; if (__lhs.index() < __rhs.index()) return true; if (__lhs.index() > __rhs.index()) return false; return __variant::__visit_value_at(__lhs.index(), less<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator>(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__lhs.valueless_by_exception()) return false; if (__rhs.valueless_by_exception()) return true; if (__lhs.index() > __rhs.index()) return true; if (__lhs.index() < __rhs.index()) return false; return __variant::__visit_value_at(__lhs.index(), greater<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator<=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__lhs.valueless_by_exception()) return true; if (__rhs.valueless_by_exception()) return false; if (__lhs.index() < __rhs.index()) return true; if (__lhs.index() > __rhs.index()) return false; return __variant::__visit_value_at( __lhs.index(), less_equal<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator>=(const variant<_Types...>& __lhs, const variant<_Types...>& __rhs) { using __variant_detail::__visitation::__variant; if (__rhs.valueless_by_exception()) return true; if (__lhs.valueless_by_exception()) return false; if (__lhs.index() > __rhs.index()) return true; if (__lhs.index() < __rhs.index()) return false; return __variant::__visit_value_at( __lhs.index(), greater_equal<>{}, __lhs, __rhs); } template inline _LIBCPP_INLINE_VISIBILITY constexpr decltype(auto) visit(_Visitor&& __visitor, _Vs&&... __vs) { using __variant_detail::__visitation::__variant; bool __results[] = {__vs.valueless_by_exception()...}; for (bool __result : __results) { if (__result) { __throw_bad_variant_access(); } } return __variant::__visit_value(_VSTD::forward<_Visitor>(__visitor), _VSTD::forward<_Vs>(__vs)...); } struct _LIBCPP_TEMPLATE_VIS monostate {}; inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator<(monostate, monostate) noexcept { return false; } inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator>(monostate, monostate) noexcept { return false; } inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator<=(monostate, monostate) noexcept { return true; } inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator>=(monostate, monostate) noexcept { return true; } inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator==(monostate, monostate) noexcept { return true; } inline _LIBCPP_INLINE_VISIBILITY constexpr bool operator!=(monostate, monostate) noexcept { return false; } template inline _LIBCPP_INLINE_VISIBILITY auto swap(variant<_Types...>& __lhs, variant<_Types...>& __rhs) noexcept(noexcept(__lhs.swap(__rhs))) -> decltype(__lhs.swap(__rhs)) { __lhs.swap(__rhs); } template struct _LIBCPP_TEMPLATE_VIS hash< __enable_hash_helper, remove_const_t<_Types>...>> { using argument_type = variant<_Types...>; using result_type = size_t; inline _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type& __v) const { using __variant_detail::__visitation::__variant; size_t __res = __v.valueless_by_exception() ? 299792458 // Random value chosen by the universe upon creation : __variant::__visit_alt( [](const auto& __alt) { using __alt_type = decay_t; using __value_type = remove_const_t< typename __alt_type::__value_type>; return hash<__value_type>{}(__alt.__value); }, __v); return __hash_combine(__res, hash{}(__v.index())); } }; template <> struct _LIBCPP_TEMPLATE_VIS hash { using argument_type = monostate; using result_type = size_t; inline _LIBCPP_INLINE_VISIBILITY result_type operator()(const argument_type&) const _NOEXCEPT { return 66740831; // return a fundamentally attractive random value. } }; #endif // _LIBCPP_STD_VER > 14 _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_VARIANT Index: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp =================================================================== --- vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp (nonexistent) @@ -1,197 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// The following compilers don't generate constexpr special members correctly. -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// - -// template class variant; - -// variant& operator=(variant&&) noexcept(see below); - -#include -#include - -#include "test_macros.h" - -struct NTMoveAssign { - constexpr NTMoveAssign(int v) : value(v) {} - NTMoveAssign(const NTMoveAssign &) = default; - NTMoveAssign(NTMoveAssign &&) = default; - NTMoveAssign &operator=(const NTMoveAssign &that) = default; - NTMoveAssign &operator=(NTMoveAssign &&that) { - value = that.value; - that.value = -1; - return *this; - }; - int value; -}; - -static_assert(!std::is_trivially_move_assignable::value, ""); -static_assert(std::is_move_assignable::value, ""); - -struct TMoveAssign { - constexpr TMoveAssign(int v) : value(v) {} - TMoveAssign(const TMoveAssign &) = delete; - TMoveAssign(TMoveAssign &&) = default; - TMoveAssign &operator=(const TMoveAssign &) = delete; - TMoveAssign &operator=(TMoveAssign &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_assignable::value, ""); - -struct TMoveAssignNTCopyAssign { - constexpr TMoveAssignNTCopyAssign(int v) : value(v) {} - TMoveAssignNTCopyAssign(const TMoveAssignNTCopyAssign &) = default; - TMoveAssignNTCopyAssign(TMoveAssignNTCopyAssign &&) = default; - TMoveAssignNTCopyAssign &operator=(const TMoveAssignNTCopyAssign &that) { - value = that.value; - return *this; - } - TMoveAssignNTCopyAssign &operator=(TMoveAssignNTCopyAssign &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_assignable_v, ""); - -void test_move_assignment_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_move_assignable::value, ""); - static_assert(std::is_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_assignable::value, ""); - } -} - -template struct Result { size_t index; T value; }; - -void test_move_assignment_same_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42); - v = std::move(v2); - return {v.index(), std::get<0>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43l); - V v2(42l); - v = std::move(v2); - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = std::move(v2); - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -void test_move_assignment_different_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42l); - v = std::move(v2); - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = std::move(v2); - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - - -template -constexpr bool test_constexpr_assign_extension_imp( - std::variant&& v, ValueType&& new_value) -{ - std::variant v2( - std::forward(new_value)); - const auto cp = v2; - v = std::move(v2); - return v.index() == NewIdx && - std::get(v) == std::get(cp); -} - -void test_constexpr_move_assignment_extension() { -#ifdef _LIBCPP_VERSION - using V = std::variant; - static_assert(std::is_trivially_copyable::value, ""); - static_assert(std::is_trivially_move_assignable::value, ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); - static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); -#endif -} - -int main() { - test_move_assignment_same_index(); - test_move_assignment_different_index(); - test_move_assignment_sfinae(); - test_constexpr_move_assignment_extension(); -} Property changes on: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/move.pass.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp =================================================================== --- vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (nonexistent) @@ -1,209 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// The following compilers don't generate constexpr special members correctly. -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - -// - -// template class variant; - -// variant& operator=(variant const&); - -#include -#include - -#include "test_macros.h" - -struct NTCopyAssign { - constexpr NTCopyAssign(int v) : value(v) {} - NTCopyAssign(const NTCopyAssign &) = default; - NTCopyAssign(NTCopyAssign &&) = default; - NTCopyAssign &operator=(const NTCopyAssign &that) { - value = that.value; - return *this; - }; - NTCopyAssign &operator=(NTCopyAssign &&) = delete; - int value; -}; - -static_assert(!std::is_trivially_copy_assignable::value, ""); -static_assert(std::is_copy_assignable::value, ""); - -struct TCopyAssign { - constexpr TCopyAssign(int v) : value(v) {} - TCopyAssign(const TCopyAssign &) = default; - TCopyAssign(TCopyAssign &&) = default; - TCopyAssign &operator=(const TCopyAssign &) = default; - TCopyAssign &operator=(TCopyAssign &&) = delete; - int value; -}; - -static_assert(std::is_trivially_copy_assignable::value, ""); - -struct TCopyAssignNTMoveAssign { - constexpr TCopyAssignNTMoveAssign(int v) : value(v) {} - TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default; - TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default; - TCopyAssignNTMoveAssign &operator=(const TCopyAssignNTMoveAssign &) = default; - TCopyAssignNTMoveAssign &operator=(TCopyAssignNTMoveAssign &&that) { - value = that.value; - that.value = -1; - return *this; - } - int value; -}; - -static_assert(std::is_trivially_copy_assignable_v, ""); - -void test_copy_assignment_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_copy_assignable::value, ""); - static_assert(std::is_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_assignable::value, ""); - } -} - -template struct Result { size_t index; T value; }; - -void test_copy_assignment_same_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42); - v = v2; - return {v.index(), std::get<0>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43l); - V v2(42l); - v = v2; - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -void test_copy_assignment_different_index() { - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(43); - V v2(42l); - v = v2; - return {v.index(), std::get<1>(v)}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42l, ""); - } - { - struct { - constexpr Result operator()() const { - using V = std::variant; - V v(std::in_place_type, 43); - V v2(std::in_place_type, 42); - v = v2; - return {v.index(), std::get<1>(v).value}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } -} - -template -constexpr bool test_constexpr_assign_extension_imp( - std::variant&& v, ValueType&& new_value) -{ - const std::variant cp( - std::forward(new_value)); - v = cp; - return v.index() == NewIdx && - std::get(v) == std::get(cp); -} - -void test_constexpr_copy_assignment_extension() { -#ifdef _LIBCPP_VERSION - using V = std::variant; - static_assert(std::is_trivially_copyable::value, ""); - static_assert(std::is_trivially_copy_assignable::value, ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); - static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); - static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); -#endif -} - -int main() { - test_copy_assignment_same_index(); - test_copy_assignment_different_index(); - test_copy_assignment_sfinae(); - test_constexpr_copy_assignment_extension(); -} Property changes on: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.assign/copy.pass.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp =================================================================== --- vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp (nonexistent) @@ -1,153 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template class variant; - -// variant(variant&&) noexcept(see below); - -#include -#include - -#include "test_macros.h" - -struct NTMove { - constexpr NTMove(int v) : value(v) {} - NTMove(const NTMove &) = delete; - NTMove(NTMove &&that) : value(that.value) { that.value = -1; } - int value; -}; - -static_assert(!std::is_trivially_move_constructible::value, ""); -static_assert(std::is_move_constructible::value, ""); - -struct TMove { - constexpr TMove(int v) : value(v) {} - TMove(const TMove &) = delete; - TMove(TMove &&) = default; - int value; -}; - -static_assert(std::is_trivially_move_constructible::value, ""); - -struct TMoveNTCopy { - constexpr TMoveNTCopy(int v) : value(v) {} - TMoveNTCopy(const TMoveNTCopy& that) : value(that.value) {} - TMoveNTCopy(TMoveNTCopy&&) = default; - int value; -}; - -static_assert(std::is_trivially_move_constructible::value, ""); - -void test_move_ctor_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_move_constructible::value, ""); - static_assert(std::is_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_move_constructible::value, ""); - } -} - -template -struct Result { size_t index; T value; }; - -void test_move_ctor_basic() { - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2 = std::move(v); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2 = std::move(v); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<0>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<0>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 0, ""); - static_assert(result.value.value == 42, ""); - } - { - struct { - constexpr Result operator()() const { - std::variant v(std::in_place_index<1>, 42); - std::variant v2(std::move(v)); - return {v2.index(), std::get<1>(std::move(v2))}; - } - } test; - constexpr auto result = test(); - static_assert(result.index == 1, ""); - static_assert(result.value.value == 42, ""); - } -} - -int main() { - test_move_ctor_basic(); - test_move_ctor_sfinae(); -} Property changes on: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/move.pass.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp =================================================================== --- vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp (nonexistent) @@ -1,120 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// The LLVM Compiler Infrastructure -// -// This file is dual licensed under the MIT and the University of Illinois Open -// Source Licenses. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03, c++11, c++14 - -// - -// template class variant; - -// variant(variant const&); - -#include -#include - -#include "test_macros.h" - -struct NTCopy { - constexpr NTCopy(int v) : value(v) {} - NTCopy(const NTCopy &that) : value(that.value) {} - NTCopy(NTCopy &&) = delete; - int value; -}; - -static_assert(!std::is_trivially_copy_constructible::value, ""); -static_assert(std::is_copy_constructible::value, ""); - -struct TCopy { - constexpr TCopy(int v) : value(v) {} - TCopy(TCopy const &) = default; - TCopy(TCopy &&) = delete; - int value; -}; - -static_assert(std::is_trivially_copy_constructible::value, ""); - -struct TCopyNTMove { - constexpr TCopyNTMove(int v) : value(v) {} - TCopyNTMove(const TCopyNTMove&) = default; - TCopyNTMove(TCopyNTMove&& that) : value(that.value) { that.value = -1; } - int value; -}; - -static_assert(std::is_trivially_copy_constructible::value, ""); - -void test_copy_ctor_sfinae() { - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(!std::is_trivially_copy_constructible::value, ""); - static_assert(std::is_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } - { - using V = std::variant; - static_assert(std::is_trivially_copy_constructible::value, ""); - } -} - -void test_copy_ctor_basic() { - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2 = v; - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2) == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2 = v; - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2) == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<0>, 42); - static_assert(v.index() == 0, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 0, ""); - static_assert(std::get<0>(v2).value == 42, ""); - } - { - constexpr std::variant v(std::in_place_index<1>, 42); - static_assert(v.index() == 1, ""); - constexpr std::variant v2(v); - static_assert(v2.index() == 1, ""); - static_assert(std::get<1>(v2).value == 42, ""); - } -} - -int main() { - test_copy_ctor_basic(); - test_copy_ctor_sfinae(); -} Property changes on: vendor/libc++/dist/test/libcxx/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/localization/locale.categories/category.ctype/locale.codecvt.byname/ctor_char.pass.cpp (revision 319786) @@ -1,70 +1,72 @@ //===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // template <> class codecvt_byname // explicit codecvt_byname(const char* nm, size_t refs = 0); // explicit codecvt_byname(const string& nm, size_t refs = 0); #include #include +#include "platform_support.h" + typedef std::codecvt_byname F; class my_facet : public F { public: static int count; explicit my_facet(const char* nm, std::size_t refs = 0) : F(nm, refs) {++count;} explicit my_facet(const std::string& nm, std::size_t refs = 0) : F(nm, refs) {++count;} ~my_facet() {--count;} }; int my_facet::count = 0; int main() { { - std::locale l(std::locale::classic(), new my_facet("en_US")); + std::locale l(std::locale::classic(), new my_facet(LOCALE_en_US)); assert(my_facet::count == 1); } assert(my_facet::count == 0); { - my_facet f("en_US", 1); + my_facet f(LOCALE_en_US, 1); assert(my_facet::count == 1); { std::locale l(std::locale::classic(), &f); assert(my_facet::count == 1); } assert(my_facet::count == 1); } assert(my_facet::count == 0); { - std::locale l(std::locale::classic(), new my_facet(std::string("en_US"))); + std::locale l(std::locale::classic(), new my_facet(std::string(LOCALE_en_US))); assert(my_facet::count == 1); } assert(my_facet::count == 0); { - my_facet f(std::string("en_US"), 1); + my_facet f(std::string(LOCALE_en_US), 1); assert(my_facet::count == 1); { std::locale l(std::locale::classic(), &f); assert(my_facet::count == 1); } assert(my_facet::count == 1); } assert(my_facet::count == 0); } Index: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp (nonexistent) +++ vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp (revision 319786) @@ -0,0 +1,97 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// OutputIterator exclusive_scan(InputIterator first, InputIterator last, +// OutputIterator result, T init); +// + +#include +#include +#include + +#include "test_iterators.h" + +template +void +test(Iter1 first, Iter1 last, T init, Iter2 rFirst, Iter2 rLast) +{ + std::vector::value_type> v; + +// Not in place + std::exclusive_scan(first, last, std::back_inserter(v), init); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); + +// In place + v.clear(); + v.assign(first, last); + std::exclusive_scan(v.begin(), v.end(), v.begin(), init); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); +} + + +template +void +test() +{ + int ia[] = {1, 3, 5, 7, 9}; + const int pRes[] = {0, 1, 4, 9, 16}; + const unsigned sa = sizeof(ia) / sizeof(ia[0]); + static_assert(sa == sizeof(pRes) / sizeof(pRes[0])); // just to be sure + + for (unsigned int i = 0; i < sa; ++i ) + test(Iter(ia), Iter(ia + i), 0, pRes, pRes + i); +} + +int triangle(int n) { return n*(n+1)/2; } + +// Basic sanity +void basic_tests() +{ + { + std::vector v(10); + std::fill(v.begin(), v.end(), 3); + std::exclusive_scan(v.begin(), v.end(), v.begin(), 50); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 50 + (int) i * 3); + } + + { + std::vector v(10); + std::iota(v.begin(), v.end(), 0); + std::exclusive_scan(v.begin(), v.end(), v.begin(), 30); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 30 + triangle(i-1)); + } + + { + std::vector v(10); + std::iota(v.begin(), v.end(), 1); + std::exclusive_scan(v.begin(), v.end(), v.begin(), 40); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 40 + triangle(i)); + } + +} + +int main() +{ + basic_tests(); + +// All the iterator categories + test >(); + test >(); + test >(); + test >(); + test(); + test< int*>(); +} Property changes on: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter.pass.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp (nonexistent) +++ vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp (revision 319786) @@ -0,0 +1,87 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// OutputIterator +// exclusive_scan(InputIterator first, InputIterator last, +// OutputIterator result, +// T init, BinaryOperation binary_op); // C++17 + +#include +#include +#include + +#include "test_iterators.h" + +template +void +test(Iter1 first, Iter1 last, T init, Op op, Iter2 rFirst, Iter2 rLast) +{ + std::vector::value_type> v; + +// Not in place + std::exclusive_scan(first, last, std::back_inserter(v), init, op); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); + +// In place + v.clear(); + v.assign(first, last); + std::exclusive_scan(v.begin(), v.end(), v.begin(), init, op); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); +} + + +template +void +test() +{ + int ia[] = {1, 3, 5, 7, 9}; + const int pRes[] = {0, 1, 4, 9, 16}; + const int mRes[] = {1, 1, 3, 15, 105}; + const unsigned sa = sizeof(ia) / sizeof(ia[0]); + static_assert(sa == sizeof(pRes) / sizeof(pRes[0])); // just to be sure + static_assert(sa == sizeof(mRes) / sizeof(mRes[0])); // just to be sure + + for (unsigned int i = 0; i < sa; ++i ) { + test(Iter(ia), Iter(ia + i), 0, std::plus<>(), pRes, pRes + i); + test(Iter(ia), Iter(ia + i), 1, std::multiplies<>(), mRes, mRes + i); + } +} + +int main() +{ +// All the iterator categories + test >(); + test >(); + test >(); + test >(); + test(); + test< int*>(); + +// Make sure that the calculations are done using the init typedef + { + std::vector v(10); + std::iota(v.begin(), v.end(), 1); + std::vector res; + std::exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>()); + + assert(res.size() == 10); + int j = 1; + assert(res[0] == 1); + for (size_t i = 1; i < v.size(); ++i) + { + j *= i; + assert(res[i] == j); + } + } +} + \ No newline at end of file Property changes on: vendor/libc++/dist/test/std/numerics/numeric.ops/exclusive.scan/exclusive_scan_iter_iter_iter_init_op.pass.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp (nonexistent) +++ vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp (revision 319786) @@ -0,0 +1,154 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// +// UNSUPPORTED: c++98, c++03, c++11, c++14 + +// template +// OutputIterator transform_exclusive_scan(InputIterator first, InputIterator last, +// OutputIterator result, T init, +// BinaryOperation binary_op, +// UnaryOperation unary_op); + + +#include +#include +#include +#include + +#include "test_iterators.h" + +template +struct identity : std::unary_function<_Tp, _Tp> +{ + constexpr const _Tp& operator()(const _Tp& __x) const { return __x;} +}; + +template <> +struct identity +{ + template + constexpr auto operator()(_Tp&& __x) const + _NOEXCEPT_(noexcept(_VSTD::forward<_Tp>(__x))) + -> decltype (_VSTD::forward<_Tp>(__x)) + { return _VSTD::forward<_Tp>(__x); } +}; + +template +void +test(Iter1 first, Iter1 last, BOp bop, UOp uop, T init, Iter2 rFirst, Iter2 rLast) +{ + std::vector::value_type> v; +// Test not in-place + std::transform_exclusive_scan(first, last, std::back_inserter(v), init, bop, uop); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); + +// Test in-place + v.clear(); + v.assign(first, last); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), init, bop, uop); + assert(std::equal(v.begin(), v.end(), rFirst, rLast)); +} + + +template +void +test() +{ + int ia[] = { 1, 3, 5, 7, 9}; + const int pResI0[] = { 0, 1, 4, 9, 16}; // with identity + const int mResI0[] = { 0, 0, 0, 0, 0}; + const int pResN0[] = { 0, -1, -4, -9, -16}; // with negate + const int mResN0[] = { 0, 0, 0, 0, 0}; + const int pResI2[] = { 2, 3, 6, 11, 18}; // with identity + const int mResI2[] = { 2, 2, 6, 30, 210}; + const int pResN2[] = { 2, 1, -2, -7, -14}; // with negate + const int mResN2[] = { 2, -2, 6, -30, 210}; + const unsigned sa = sizeof(ia) / sizeof(ia[0]); + static_assert(sa == sizeof(pResI0) / sizeof(pResI0[0])); // just to be sure + static_assert(sa == sizeof(mResI0) / sizeof(mResI0[0])); // just to be sure + static_assert(sa == sizeof(pResN0) / sizeof(pResN0[0])); // just to be sure + static_assert(sa == sizeof(mResN0) / sizeof(mResN0[0])); // just to be sure + static_assert(sa == sizeof(pResI2) / sizeof(pResI2[0])); // just to be sure + static_assert(sa == sizeof(mResI2) / sizeof(mResI2[0])); // just to be sure + static_assert(sa == sizeof(pResN2) / sizeof(pResN2[0])); // just to be sure + static_assert(sa == sizeof(mResN2) / sizeof(mResN2[0])); // just to be sure + + for (unsigned int i = 0; i < sa; ++i ) { + test(Iter(ia), Iter(ia + i), std::plus<>(), identity<>(), 0, pResI0, pResI0 + i); + test(Iter(ia), Iter(ia + i), std::multiplies<>(), identity<>(), 0, mResI0, mResI0 + i); + test(Iter(ia), Iter(ia + i), std::plus<>(), std::negate<>(), 0, pResN0, pResN0 + i); + test(Iter(ia), Iter(ia + i), std::multiplies<>(), std::negate<>(), 0, mResN0, mResN0 + i); + test(Iter(ia), Iter(ia + i), std::plus<>(), identity<>(), 2, pResI2, pResI2 + i); + test(Iter(ia), Iter(ia + i), std::multiplies<>(), identity<>(), 2, mResI2, mResI2 + i); + test(Iter(ia), Iter(ia + i), std::plus<>(), std::negate<>(), 2, pResN2, pResN2 + i); + test(Iter(ia), Iter(ia + i), std::multiplies<>(), std::negate<>(), 2, mResN2, mResN2 + i); + } +} + +int triangle(int n) { return n*(n+1)/2; } + +// Basic sanity +void basic_tests() +{ + { + std::vector v(10); + std::fill(v.begin(), v.end(), 3); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 50, std::plus<>(), identity<>()); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 50 + (int) i * 3); + } + + { + std::vector v(10); + std::iota(v.begin(), v.end(), 0); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 30, std::plus<>(), identity<>()); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 30 + triangle(i-1)); + } + + { + std::vector v(10); + std::iota(v.begin(), v.end(), 1); + std::transform_exclusive_scan(v.begin(), v.end(), v.begin(), 40, std::plus<>(), identity<>()); + for (size_t i = 0; i < v.size(); ++i) + assert(v[i] == 40 + triangle(i)); + } + +// Make sure that the calculations are done using the init typedef + { + std::vector v(10); + std::iota(v.begin(), v.end(), 1); + std::vector res; + std::transform_exclusive_scan(v.begin(), v.end(), std::back_inserter(res), 1, std::multiplies<>(), identity<>()); + + assert(res.size() == 10); + int j = 1; + assert(res[0] == 1); + for (size_t i = 1; i < res.size(); ++i) + { + j *= i; + assert(res[i] == j); + } + } +} + +int main() +{ + basic_tests(); + +// All the iterator categories + test >(); + test >(); + test >(); + test >(); + test(); + test< int*>(); +} Property changes on: vendor/libc++/dist/test/std/numerics/numeric.ops/transform.exclusive.scan/transform_exclusive_scan_iter_iter_iter_init_bop_uop.pass.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/thread/thread.mutex/thread.mutex.requirements/thread.mutex.requirements.mutex/thread.mutex.class/default.pass.cpp (revision 319786) @@ -1,23 +1,25 @@ //===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // // UNSUPPORTED: libcpp-has-no-threads // // class mutex; // mutex(); #include +#include int main() { + static_assert(std::is_nothrow_default_constructible::value, ""); std::mutex m; } Index: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.mod/reset.pass.cpp (revision 319786) @@ -1,61 +1,59 @@ //===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // // void reset() noexcept; #include #include #include using std::optional; struct X { static bool dtor_called; ~X() {dtor_called = true;} }; bool X::dtor_called = false; int main() { { optional opt; static_assert(noexcept(opt.reset()) == true, ""); opt.reset(); assert(static_cast(opt) == false); } { optional opt(3); opt.reset(); assert(static_cast(opt) == false); } { optional opt; static_assert(noexcept(opt.reset()) == true, ""); assert(X::dtor_called == false); opt.reset(); assert(X::dtor_called == false); assert(static_cast(opt) == false); } - assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997 { optional opt(X{}); X::dtor_called = false; opt.reset(); assert(X::dtor_called == true); assert(static_cast(opt) == false); X::dtor_called = false; } - assert(X::dtor_called == false); // TRANSITION, Clang/C2 VSO#239997 } Index: vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/optional/optional.object/optional.object.observe/value_or.pass.cpp (revision 319786) @@ -1,68 +1,74 @@ //===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // -// template T optional::value_or(U&& v) &&; +// template constexpr T optional::value_or(U&& v) &&; #include #include #include #include "test_macros.h" using std::optional; using std::in_place_t; using std::in_place; struct Y { int i_; - Y(int i) : i_(i) {} + constexpr Y(int i) : i_(i) {} }; struct X { int i_; - X(int i) : i_(i) {} - X(X&& x) : i_(x.i_) {x.i_ = 0;} - X(const Y& y) : i_(y.i_) {} - X(Y&& y) : i_(y.i_+1) {} + constexpr X(int i) : i_(i) {} + constexpr X(X&& x) : i_(x.i_) {x.i_ = 0;} + constexpr X(const Y& y) : i_(y.i_) {} + constexpr X(Y&& y) : i_(y.i_+1) {} friend constexpr bool operator==(const X& x, const X& y) {return x.i_ == y.i_;} }; -int main() +constexpr int test() { { optional opt(in_place, 2); Y y(3); assert(std::move(opt).value_or(y) == 2); assert(*opt == 0); } { optional opt(in_place, 2); assert(std::move(opt).value_or(Y(3)) == 2); assert(*opt == 0); } { optional opt; Y y(3); assert(std::move(opt).value_or(y) == 3); assert(!opt); } { optional opt; assert(std::move(opt).value_or(Y(3)) == 4); assert(!opt); } + return 0; +} + +int main() +{ + static_assert(test() == 0); } Index: vendor/libc++/dist/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp (nonexistent) +++ vendor/libc++/dist/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp (revision 319786) @@ -0,0 +1,155 @@ +//===----------------------------------------------------------------------===// +// +// 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. +// +//===----------------------------------------------------------------------===// + +// UNSUPPORTED: c++98, c++03, c++11, c++14 +// UNSUPPORTED: libcpp-no-deduction-guides + +// GCC's implementation of class template deduction is still immature and runs +// into issues with libc++. However GCC accepts this code when compiling +// against libstdc++. +// XFAIL: gcc + +// + +// Test that the constructors offered by std::basic_string are formulated +// so they're compatible with implicit deduction guides. + +#include +#include +#include + +#include "test_macros.h" +#include "archetypes.hpp" + + +// Overloads +// using A = Allocator +// using AT = std::allocator_arg_t +// --------------- +// (1) tuple(const Types&...) -> tuple +// (2) explicit tuple(const Types&...) -> tuple +// (3) tuple(AT, A const&, Types const&...) -> tuple +// (4) explicit tuple(AT, A const&, Types const&...) -> tuple +// (5) tuple(tuple const& t) -> decltype(t) +// (6) tuple(tuple&& t) -> decltype(t) +// (7) tuple(AT, A const&, tuple const& t) -> decltype(t) +// (8) tuple(AT, A const&, tuple&& t) -> decltype(t) +void test_primary_template() +{ + const std::allocator A; + const auto AT = std::allocator_arg; + { // Testing (1) + int x = 101; + std::tuple t1(42); + ASSERT_SAME_TYPE(decltype(t1), std::tuple); + std::tuple t2(x, 0.0, nullptr); + ASSERT_SAME_TYPE(decltype(t2), std::tuple); + } + { // Testing (2) + using T = ExplicitTestTypes::TestType; + static_assert(!std::is_convertible::value, ""); + + std::tuple t1(T{}); + ASSERT_SAME_TYPE(decltype(t1), std::tuple); + + const T v{}; + std::tuple t2(T{}, 101l, v); + ASSERT_SAME_TYPE(decltype(t2), std::tuple); + } + { // Testing (3) + int x = 101; + std::tuple t1(AT, A, 42); + ASSERT_SAME_TYPE(decltype(t1), std::tuple); + + std::tuple t2(AT, A, 42, 0.0, x); + ASSERT_SAME_TYPE(decltype(t2), std::tuple); + } + { // Testing (4) + using T = ExplicitTestTypes::TestType; + static_assert(!std::is_convertible::value, ""); + + std::tuple t1(AT, A, T{}); + ASSERT_SAME_TYPE(decltype(t1), std::tuple); + + const T v{}; + std::tuple t2(AT, A, T{}, 101l, v); + ASSERT_SAME_TYPE(decltype(t2), std::tuple); + } + { // Testing (5) + using Tup = std::tuple; + const Tup t(42, nullptr); + + std::tuple t1(t); + ASSERT_SAME_TYPE(decltype(t1), Tup); + } + { // Testing (6) + using Tup = std::tuple; + std::tuple t1(Tup(nullptr, 42, 'a')); + ASSERT_SAME_TYPE(decltype(t1), Tup); + } + { // Testing (7) + using Tup = std::tuple; + const Tup t(42, nullptr); + + std::tuple t1(AT, A, t); + ASSERT_SAME_TYPE(decltype(t1), Tup); + } + { // Testing (8) + using Tup = std::tuple; + std::tuple t1(AT, A, Tup(nullptr, 42, 'a')); + ASSERT_SAME_TYPE(decltype(t1), Tup); + } +} + +// Overloads +// using A = Allocator +// using AT = std::allocator_arg_t +// --------------- +// (1) tuple() -> tuple<> +// (2) tuple(AT, A const&) -> tuple<> +// (3) tuple(tuple const&) -> tuple<> +// (4) tuple(tuple&&) -> tuple<> +// (5) tuple(AT, A const&, tuple const&) -> tuple<> +// (6) tuple(AT, A const&, tuple&&) -> tuple<> +void test_empty_specialization() +{ + std::allocator A; + const auto AT = std::allocator_arg; + { // Testing (1) + std::tuple t1{}; + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } + { // Testing (2) + std::tuple t1{AT, A}; + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } + { // Testing (3) + const std::tuple<> t{}; + std::tuple t1(t); + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } + { // Testing (4) + std::tuple t1(std::tuple<>{}); + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } + { // Testing (5) + const std::tuple<> t{}; + std::tuple t1(AT, A, t); + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } + { // Testing (6) + std::tuple t1(AT, A, std::tuple<>{}); + ASSERT_SAME_TYPE(decltype(t1), std::tuple<>); + } +} + +int main() { + test_primary_template(); + test_empty_specialization(); +} Property changes on: vendor/libc++/dist/test/std/utilities/tuple/tuple.tuple/tuple.cnstr/implicit_deduction_guides.pass.cpp ___________________________________________________________________ Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:keywords ## -0,0 +1 ## +FreeBSD=%H \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/T.pass.cpp (revision 319786) @@ -1,239 +1,263 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 // XFAIL: with_system_cxx_lib=macosx10.9 // XFAIL: with_system_cxx_lib=macosx10.7 // XFAIL: with_system_cxx_lib=macosx10.8 // // template class variant; // template // variant& operator=(T&&) noexcept(see below); #include #include #include #include #include "test_macros.h" #include "variant_test_helpers.hpp" namespace MetaHelpers { struct Dummy { Dummy() = default; }; struct ThrowsCtorT { ThrowsCtorT(int) noexcept(false) {} ThrowsCtorT &operator=(int) noexcept { return *this; } }; struct ThrowsAssignT { ThrowsAssignT(int) noexcept {} ThrowsAssignT &operator=(int) noexcept(false) { return *this; } }; struct NoThrowT { NoThrowT(int) noexcept {} NoThrowT &operator=(int) noexcept { return *this; } }; } // namespace MetaHelpers namespace RuntimeHelpers { #ifndef TEST_HAS_NO_EXCEPTIONS struct ThrowsCtorT { int value; ThrowsCtorT() : value(0) {} ThrowsCtorT(int) noexcept(false) { throw 42; } ThrowsCtorT &operator=(int v) noexcept { value = v; return *this; } }; +struct MoveCrashes { + int value; + MoveCrashes(int v = 0) noexcept : value{v} {} + MoveCrashes(MoveCrashes &&) noexcept { assert(false); } + MoveCrashes &operator=(MoveCrashes &&) noexcept { assert(false); return *this; } + MoveCrashes &operator=(int v) noexcept { + value = v; + return *this; + } +}; + +struct ThrowsCtorTandMove { + int value; + ThrowsCtorTandMove() : value(0) {} + ThrowsCtorTandMove(int) noexcept(false) { throw 42; } + ThrowsCtorTandMove(ThrowsCtorTandMove &&) noexcept(false) { assert(false); } + ThrowsCtorTandMove &operator=(int v) noexcept { + value = v; + return *this; + } +}; + struct ThrowsAssignT { int value; ThrowsAssignT() : value(0) {} ThrowsAssignT(int v) noexcept : value(v) {} ThrowsAssignT &operator=(int) noexcept(false) { throw 42; } }; struct NoThrowT { int value; NoThrowT() : value(0) {} NoThrowT(int v) noexcept : value(v) {} NoThrowT &operator=(int v) noexcept { value = v; return *this; } }; #endif // !defined(TEST_HAS_NO_EXCEPTIONS) } // namespace RuntimeHelpers void test_T_assignment_noexcept() { using namespace MetaHelpers; { using V = std::variant; static_assert(std::is_nothrow_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_assignable::value, ""); } } void test_T_assignment_sfinae() { { using V = std::variant; static_assert(!std::is_assignable::value, "ambiguous"); } { using V = std::variant; static_assert(!std::is_assignable::value, "ambiguous"); } { using V = std::variant; static_assert(!std::is_assignable::value, "no matching operator="); } #if !defined(TEST_VARIANT_HAS_NO_REFERENCES) { using V = std::variant; static_assert(!std::is_assignable::value, "ambiguous"); } { using V = std::variant; static_assert(!std::is_assignable::value, "ambiguous"); } -#endif +#endif // TEST_VARIANT_HAS_NO_REFERENCES } void test_T_assignment_basic() { { std::variant v(43); v = 42; assert(v.index() == 0); assert(std::get<0>(v) == 42); } { std::variant v(43l); v = 42; assert(v.index() == 0); assert(std::get<0>(v) == 42); v = 43l; assert(v.index() == 1); assert(std::get<1>(v) == 43); } #if !defined(TEST_VARIANT_HAS_NO_REFERENCES) { using V = std::variant; int x = 42; V v(43l); v = x; assert(v.index() == 0); assert(&std::get<0>(v) == &x); v = std::move(x); assert(v.index() == 1); assert(&std::get<1>(v) == &x); // 'long' is selected by FUN(const int &) since 'const int &' cannot bind // to 'int&'. const int &cx = x; v = cx; assert(v.index() == 2); assert(std::get<2>(v) == 42); } -#endif +#endif // TEST_VARIANT_HAS_NO_REFERENCES } void test_T_assignment_performs_construction() { using namespace RuntimeHelpers; #ifndef TEST_HAS_NO_EXCEPTIONS { using V = std::variant; V v(std::in_place_type, "hello"); try { v = 42; + assert(false); } catch (...) { /* ... */ } - assert(v.valueless_by_exception()); + assert(v.index() == 0); + assert(std::get<0>(v) == "hello"); } { using V = std::variant; V v(std::in_place_type, "hello"); v = 42; assert(v.index() == 0); assert(std::get<0>(v).value == 42); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } void test_T_assignment_performs_assignment() { using namespace RuntimeHelpers; #ifndef TEST_HAS_NO_EXCEPTIONS { using V = std::variant; V v; v = 42; assert(v.index() == 0); assert(std::get<0>(v).value == 42); } { using V = std::variant; V v; v = 42; assert(v.index() == 0); assert(std::get<0>(v).value == 42); } { using V = std::variant; V v(100); try { v = 42; assert(false); } catch (...) { /* ... */ } assert(v.index() == 0); assert(std::get<0>(v).value == 100); } { using V = std::variant; V v(100); try { v = 42; assert(false); } catch (...) { /* ... */ } assert(v.index() == 1); assert(std::get<1>(v).value == 100); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } int main() { test_T_assignment_basic(); test_T_assignment_performs_construction(); test_T_assignment_performs_assignment(); test_T_assignment_noexcept(); test_T_assignment_sfinae(); } Index: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/copy.pass.cpp (revision 319786) @@ -1,404 +1,594 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't generate constexpr special members correctly. +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 + // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 // XFAIL: with_system_cxx_lib=macosx10.9 // XFAIL: with_system_cxx_lib=macosx10.7 // XFAIL: with_system_cxx_lib=macosx10.8 // // template class variant; // variant& operator=(variant const&); #include #include #include #include #include "test_macros.h" struct NoCopy { NoCopy(const NoCopy &) = delete; NoCopy &operator=(const NoCopy &) = default; }; -struct NothrowCopy { - NothrowCopy(const NothrowCopy &) noexcept = default; - NothrowCopy &operator=(const NothrowCopy &) noexcept = default; -}; - struct CopyOnly { CopyOnly(const CopyOnly &) = default; CopyOnly(CopyOnly &&) = delete; CopyOnly &operator=(const CopyOnly &) = default; CopyOnly &operator=(CopyOnly &&) = delete; }; struct MoveOnly { MoveOnly(const MoveOnly &) = delete; MoveOnly(MoveOnly &&) = default; MoveOnly &operator=(const MoveOnly &) = default; }; struct MoveOnlyNT { MoveOnlyNT(const MoveOnlyNT &) = delete; MoveOnlyNT(MoveOnlyNT &&) {} MoveOnlyNT &operator=(const MoveOnlyNT &) = default; }; struct CopyAssign { static int alive; static int copy_construct; static int copy_assign; static int move_construct; static int move_assign; static void reset() { copy_construct = copy_assign = move_construct = move_assign = alive = 0; } CopyAssign(int v) : value(v) { ++alive; } CopyAssign(const CopyAssign &o) : value(o.value) { ++alive; ++copy_construct; } - CopyAssign(CopyAssign &&o) : value(o.value) { + CopyAssign(CopyAssign &&o) noexcept : value(o.value) { o.value = -1; ++alive; ++move_construct; } CopyAssign &operator=(const CopyAssign &o) { value = o.value; ++copy_assign; return *this; } - CopyAssign &operator=(CopyAssign &&o) { + CopyAssign &operator=(CopyAssign &&o) noexcept { value = o.value; o.value = -1; ++move_assign; return *this; } ~CopyAssign() { --alive; } int value; }; int CopyAssign::alive = 0; int CopyAssign::copy_construct = 0; int CopyAssign::copy_assign = 0; int CopyAssign::move_construct = 0; int CopyAssign::move_assign = 0; struct CopyMaybeThrows { CopyMaybeThrows(const CopyMaybeThrows &); CopyMaybeThrows &operator=(const CopyMaybeThrows &); }; struct CopyDoesThrow { CopyDoesThrow(const CopyDoesThrow &) noexcept(false); CopyDoesThrow &operator=(const CopyDoesThrow &) noexcept(false); }; + +struct NTCopyAssign { + constexpr NTCopyAssign(int v) : value(v) {} + NTCopyAssign(const NTCopyAssign &) = default; + NTCopyAssign(NTCopyAssign &&) = default; + NTCopyAssign &operator=(const NTCopyAssign &that) { + value = that.value; + return *this; + }; + NTCopyAssign &operator=(NTCopyAssign &&) = delete; + int value; +}; + +static_assert(!std::is_trivially_copy_assignable::value, ""); +static_assert(std::is_copy_assignable::value, ""); + +struct TCopyAssign { + constexpr TCopyAssign(int v) : value(v) {} + TCopyAssign(const TCopyAssign &) = default; + TCopyAssign(TCopyAssign &&) = default; + TCopyAssign &operator=(const TCopyAssign &) = default; + TCopyAssign &operator=(TCopyAssign &&) = delete; + int value; +}; + +static_assert(std::is_trivially_copy_assignable::value, ""); + +struct TCopyAssignNTMoveAssign { + constexpr TCopyAssignNTMoveAssign(int v) : value(v) {} + TCopyAssignNTMoveAssign(const TCopyAssignNTMoveAssign &) = default; + TCopyAssignNTMoveAssign(TCopyAssignNTMoveAssign &&) = default; + TCopyAssignNTMoveAssign &operator=(const TCopyAssignNTMoveAssign &) = default; + TCopyAssignNTMoveAssign &operator=(TCopyAssignNTMoveAssign &&that) { + value = that.value; + that.value = -1; + return *this; + } + int value; +}; + +static_assert(std::is_trivially_copy_assignable_v, ""); + #ifndef TEST_HAS_NO_EXCEPTIONS struct CopyThrows { CopyThrows() = default; CopyThrows(const CopyThrows &) { throw 42; } CopyThrows &operator=(const CopyThrows &) { throw 42; } }; +struct CopyCannotThrow { + static int alive; + CopyCannotThrow() { ++alive; } + CopyCannotThrow(const CopyCannotThrow &) noexcept { ++alive; } + CopyCannotThrow(CopyCannotThrow &&) noexcept { assert(false); } + CopyCannotThrow &operator=(const CopyCannotThrow &) noexcept = default; + CopyCannotThrow &operator=(CopyCannotThrow &&) noexcept { assert(false); return *this; } +}; + +int CopyCannotThrow::alive = 0; + struct MoveThrows { static int alive; MoveThrows() { ++alive; } MoveThrows(const MoveThrows &) { ++alive; } MoveThrows(MoveThrows &&) { throw 42; } MoveThrows &operator=(const MoveThrows &) { return *this; } MoveThrows &operator=(MoveThrows &&) { throw 42; } ~MoveThrows() { --alive; } }; int MoveThrows::alive = 0; struct MakeEmptyT { static int alive; MakeEmptyT() { ++alive; } MakeEmptyT(const MakeEmptyT &) { ++alive; // Don't throw from the copy constructor since variant's assignment // operator performs a copy before committing to the assignment. } MakeEmptyT(MakeEmptyT &&) { throw 42; } MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; } MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; } ~MakeEmptyT() { --alive; } }; int MakeEmptyT::alive = 0; template void makeEmpty(Variant &v) { Variant v2(std::in_place_type); try { - v = v2; + v = std::move(v2); assert(false); } catch (...) { assert(v.valueless_by_exception()); } } #endif // TEST_HAS_NO_EXCEPTIONS void test_copy_assignment_not_noexcept() { { using V = std::variant; static_assert(!std::is_nothrow_copy_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_copy_assignable::value, ""); } } void test_copy_assignment_sfinae() { { using V = std::variant; static_assert(std::is_copy_assignable::value, ""); } { - // variant only provides copy assignment when both the copy and move - // constructors are well formed using V = std::variant; - static_assert(!std::is_copy_assignable::value, ""); + static_assert(std::is_copy_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_copy_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_copy_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_copy_assignable::value, ""); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_copy_assignable::value, ""); + static_assert(std::is_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_assignable::value, ""); + } } void test_copy_assignment_empty_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } void test_copy_assignment_non_empty_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>, 42); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } { using V = std::variant; V v1(std::in_place_index<2>, "hello"); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } void test_copy_assignment_empty_non_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_index<0>, 42); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 0); assert(std::get<0>(v1) == 42); } { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_type, "hello"); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 2); assert(std::get<2>(v1) == "hello"); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } +template struct Result { size_t index; T value; }; + void test_copy_assignment_same_index() { { using V = std::variant; V v1(43); V v2(42); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 0); assert(std::get<0>(v1) == 42); } { using V = std::variant; V v1(43l); V v2(42l); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1) == 42); } { using V = std::variant; V v1(std::in_place_type, 43); V v2(std::in_place_type, 42); CopyAssign::reset(); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1).value == 42); assert(CopyAssign::copy_construct == 0); assert(CopyAssign::move_construct == 0); assert(CopyAssign::copy_assign == 1); } #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_type); MET &mref = std::get<1>(v1); V v2(std::in_place_type); try { v1 = v2; assert(false); } catch (...) { } assert(v1.index() == 1); assert(&std::get<1>(v1) == &mref); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS + + // The following tests are for not-yet-standardized behavior (P0602): + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42); + v = v2; + return {v.index(), std::get<0>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43l); + V v2(42l); + v = v2; + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } } void test_copy_assignment_different_index() { { using V = std::variant; V v1(43); V v2(42l); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1) == 42); } { using V = std::variant; CopyAssign::reset(); V v1(std::in_place_type, 43); V v2(std::in_place_type, 42); assert(CopyAssign::copy_construct == 0); assert(CopyAssign::move_construct == 0); assert(CopyAssign::alive == 1); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1).value == 42); assert(CopyAssign::alive == 2); assert(CopyAssign::copy_construct == 1); assert(CopyAssign::move_construct == 1); assert(CopyAssign::copy_assign == 0); } #ifndef TEST_HAS_NO_EXCEPTIONS { - // Test that if copy construction throws then original value is - // unchanged. using V = std::variant; V v1(std::in_place_type, "hello"); V v2(std::in_place_type); try { v1 = v2; assert(false); } catch (...) { /* ... */ } - assert(v1.index() == 2); - assert(std::get<2>(v1) == "hello"); + // Test that copy construction is used directly if move construction may throw, + // resulting in a valueless variant if copy throws. + assert(v1.valueless_by_exception()); } { - // Test that if move construction throws then the variant is left - // valueless by exception. using V = std::variant; V v1(std::in_place_type, "hello"); V v2(std::in_place_type); assert(MoveThrows::alive == 1); - try { - v1 = v2; - assert(false); - } catch (...) { /* ... */ - } - assert(v1.valueless_by_exception()); + // Test that copy construction is used directly if move construction may throw. + v1 = v2; + assert(v1.index() == 1); assert(v2.index() == 1); - assert(MoveThrows::alive == 1); + assert(MoveThrows::alive == 2); } { + // Test that direct copy construction is preferred when it cannot throw. + using V = std::variant; + V v1(std::in_place_type, "hello"); + V v2(std::in_place_type); + assert(CopyCannotThrow::alive == 1); + v1 = v2; + assert(v1.index() == 1); + assert(v2.index() == 1); + assert(CopyCannotThrow::alive == 2); + } + { using V = std::variant; V v1(std::in_place_type); V v2(std::in_place_type, "hello"); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 2); assert(std::get<2>(v1) == "hello"); assert(v2.index() == 2); assert(std::get<2>(v2) == "hello"); } { using V = std::variant; V v1(std::in_place_type); V v2(std::in_place_type, "hello"); V &vref = (v1 = v2); assert(&vref == &v1); assert(v1.index() == 2); assert(std::get<2>(v1) == "hello"); assert(v2.index() == 2); assert(std::get<2>(v2) == "hello"); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS + + // The following tests are for not-yet-standardized behavior (P0602): + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42l); + v = v2; + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = v2; + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } } +template +constexpr bool test_constexpr_assign_extension_imp( + std::variant&& v, ValueType&& new_value) +{ + const std::variant cp( + std::forward(new_value)); + v = cp; + return v.index() == NewIdx && + std::get(v) == std::get(cp); +} +void test_constexpr_copy_assignment_extension() { + // The following tests are for not-yet-standardized behavior (P0602): + using V = std::variant; + static_assert(std::is_trivially_copyable::value, ""); + static_assert(std::is_trivially_copy_assignable::value, ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); + static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); +} + int main() { test_copy_assignment_empty_empty(); test_copy_assignment_non_empty_empty(); test_copy_assignment_empty_non_empty(); test_copy_assignment_same_index(); test_copy_assignment_different_index(); test_copy_assignment_sfinae(); test_copy_assignment_not_noexcept(); + test_constexpr_copy_assignment_extension(); } Index: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.assign/move.pass.cpp (revision 319786) @@ -1,326 +1,509 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 +// The following compilers don't generate constexpr special members correctly. +// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 +// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 + // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 // XFAIL: with_system_cxx_lib=macosx10.9 // XFAIL: with_system_cxx_lib=macosx10.7 // XFAIL: with_system_cxx_lib=macosx10.8 // // template class variant; // variant& operator=(variant&&) noexcept(see below); #include #include #include #include #include #include "test_macros.h" #include "variant_test_helpers.hpp" struct NoCopy { NoCopy(const NoCopy &) = delete; NoCopy &operator=(const NoCopy &) = default; }; struct CopyOnly { CopyOnly(const CopyOnly &) = default; CopyOnly(CopyOnly &&) = delete; CopyOnly &operator=(const CopyOnly &) = default; CopyOnly &operator=(CopyOnly &&) = delete; }; struct MoveOnly { MoveOnly(const MoveOnly &) = delete; MoveOnly(MoveOnly &&) = default; MoveOnly &operator=(const MoveOnly &) = delete; MoveOnly &operator=(MoveOnly &&) = default; }; struct MoveOnlyNT { MoveOnlyNT(const MoveOnlyNT &) = delete; MoveOnlyNT(MoveOnlyNT &&) {} MoveOnlyNT &operator=(const MoveOnlyNT &) = delete; MoveOnlyNT &operator=(MoveOnlyNT &&) = default; }; struct MoveOnlyOddNothrow { MoveOnlyOddNothrow(MoveOnlyOddNothrow &&) noexcept(false) {} MoveOnlyOddNothrow(const MoveOnlyOddNothrow &) = delete; MoveOnlyOddNothrow &operator=(MoveOnlyOddNothrow &&) noexcept = default; MoveOnlyOddNothrow &operator=(const MoveOnlyOddNothrow &) = delete; }; struct MoveAssignOnly { MoveAssignOnly(MoveAssignOnly &&) = delete; MoveAssignOnly &operator=(MoveAssignOnly &&) = default; }; struct MoveAssign { static int move_construct; static int move_assign; static void reset() { move_construct = move_assign = 0; } MoveAssign(int v) : value(v) {} MoveAssign(MoveAssign &&o) : value(o.value) { ++move_construct; o.value = -1; } MoveAssign &operator=(MoveAssign &&o) { value = o.value; ++move_assign; o.value = -1; return *this; } int value; }; int MoveAssign::move_construct = 0; int MoveAssign::move_assign = 0; +struct NTMoveAssign { + constexpr NTMoveAssign(int v) : value(v) {} + NTMoveAssign(const NTMoveAssign &) = default; + NTMoveAssign(NTMoveAssign &&) = default; + NTMoveAssign &operator=(const NTMoveAssign &that) = default; + NTMoveAssign &operator=(NTMoveAssign &&that) { + value = that.value; + that.value = -1; + return *this; + }; + int value; +}; + +static_assert(!std::is_trivially_move_assignable::value, ""); +static_assert(std::is_move_assignable::value, ""); + +struct TMoveAssign { + constexpr TMoveAssign(int v) : value(v) {} + TMoveAssign(const TMoveAssign &) = delete; + TMoveAssign(TMoveAssign &&) = default; + TMoveAssign &operator=(const TMoveAssign &) = delete; + TMoveAssign &operator=(TMoveAssign &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_assignable::value, ""); + +struct TMoveAssignNTCopyAssign { + constexpr TMoveAssignNTCopyAssign(int v) : value(v) {} + TMoveAssignNTCopyAssign(const TMoveAssignNTCopyAssign &) = default; + TMoveAssignNTCopyAssign(TMoveAssignNTCopyAssign &&) = default; + TMoveAssignNTCopyAssign &operator=(const TMoveAssignNTCopyAssign &that) { + value = that.value; + return *this; + } + TMoveAssignNTCopyAssign &operator=(TMoveAssignNTCopyAssign &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_assignable_v, ""); + +struct TrivialCopyNontrivialMove { + TrivialCopyNontrivialMove(TrivialCopyNontrivialMove const&) = default; + TrivialCopyNontrivialMove(TrivialCopyNontrivialMove&&) noexcept {} + TrivialCopyNontrivialMove& operator=(TrivialCopyNontrivialMove const&) = default; + TrivialCopyNontrivialMove& operator=(TrivialCopyNontrivialMove&&) noexcept { + return *this; + } +}; + +static_assert(std::is_trivially_copy_assignable_v, ""); +static_assert(!std::is_trivially_move_assignable_v, ""); + + void test_move_assignment_noexcept() { { using V = std::variant; static_assert(std::is_nothrow_move_assignable::value, ""); } { using V = std::variant; static_assert(std::is_nothrow_move_assignable::value, ""); } { using V = std::variant; static_assert(std::is_nothrow_move_assignable::value, ""); } { using V = std::variant; static_assert(std::is_nothrow_move_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_move_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_move_assignable::value, ""); } } void test_move_assignment_sfinae() { { using V = std::variant; static_assert(std::is_move_assignable::value, ""); } { - // variant only provides move assignment when both the move constructor - // and move assignment operator are well formed. using V = std::variant; - static_assert(!std::is_move_assignable::value, ""); + static_assert(std::is_move_assignable::value, ""); } { using V = std::variant; static_assert(!std::is_move_assignable::value, ""); } { using V = std::variant; static_assert(std::is_move_assignable::value, ""); } { using V = std::variant; static_assert(std::is_move_assignable::value, ""); } { // variant only provides move assignment when the types also provide // a move constructor. using V = std::variant; static_assert(!std::is_move_assignable::value, ""); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_move_assignable::value, ""); + static_assert(std::is_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_move_assignable::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_assignable::value, ""); + } } void test_move_assignment_empty_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } void test_move_assignment_non_empty_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>, 42); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } { using V = std::variant; V v1(std::in_place_index<2>, "hello"); V v2(std::in_place_index<0>); makeEmpty(v2); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } void test_move_assignment_empty_non_empty() { #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_index<0>, 42); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 0); assert(std::get<0>(v1) == 42); } { using V = std::variant; V v1(std::in_place_index<0>); makeEmpty(v1); V v2(std::in_place_type, "hello"); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 2); assert(std::get<2>(v1) == "hello"); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } +template struct Result { size_t index; T value; }; + void test_move_assignment_same_index() { { using V = std::variant; V v1(43); V v2(42); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 0); assert(std::get<0>(v1) == 42); } { using V = std::variant; V v1(43l); V v2(42l); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1) == 42); } { using V = std::variant; V v1(std::in_place_type, 43); V v2(std::in_place_type, 42); MoveAssign::reset(); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1).value == 42); assert(MoveAssign::move_construct == 0); assert(MoveAssign::move_assign == 1); } #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_type); MET &mref = std::get<1>(v1); V v2(std::in_place_type); try { v1 = std::move(v2); assert(false); } catch (...) { } assert(v1.index() == 1); assert(&std::get<1>(v1) == &mref); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS + + // The following tests are for not-yet-standardized behavior (P0602): + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42); + v = std::move(v2); + return {v.index(), std::get<0>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43l); + V v2(42l); + v = std::move(v2); + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = std::move(v2); + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } } void test_move_assignment_different_index() { { using V = std::variant; V v1(43); V v2(42l); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1) == 42); } { using V = std::variant; V v1(std::in_place_type, 43); V v2(std::in_place_type, 42); MoveAssign::reset(); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 1); assert(std::get<1>(v1).value == 42); assert(MoveAssign::move_construct == 1); assert(MoveAssign::move_assign == 0); } #ifndef TEST_HAS_NO_EXCEPTIONS using MET = MakeEmptyT; { using V = std::variant; V v1(std::in_place_type); V v2(std::in_place_type); try { v1 = std::move(v2); assert(false); } catch (...) { } assert(v1.valueless_by_exception()); assert(v1.index() == std::variant_npos); } { using V = std::variant; V v1(std::in_place_type); V v2(std::in_place_type, "hello"); V &vref = (v1 = std::move(v2)); assert(&vref == &v1); assert(v1.index() == 2); assert(std::get<2>(v1) == "hello"); } -#endif +#endif // TEST_HAS_NO_EXCEPTIONS + + // The following tests are for not-yet-standardized behavior (P0602): + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(43); + V v2(42l); + v = std::move(v2); + return {v.index(), std::get<1>(v)}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42l, ""); + } + { + struct { + constexpr Result operator()() const { + using V = std::variant; + V v(std::in_place_type, 43); + V v2(std::in_place_type, 42); + v = std::move(v2); + return {v.index(), std::get<1>(v).value}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } } +template +constexpr bool test_constexpr_assign_extension_imp( + std::variant&& v, ValueType&& new_value) +{ + std::variant v2( + std::forward(new_value)); + const auto cp = v2; + v = std::move(v2); + return v.index() == NewIdx && + std::get(v) == std::get(cp); +} + +void test_constexpr_move_assignment_extension() { + // The following tests are for not-yet-standardized behavior (P0602): + using V = std::variant; + static_assert(std::is_trivially_copyable::value, ""); + static_assert(std::is_trivially_move_assignable::value, ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(42l), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<0>(V(nullptr), 101l), ""); + static_assert(test_constexpr_assign_extension_imp<1>(V(42l), nullptr), ""); + static_assert(test_constexpr_assign_extension_imp<2>(V(42l), 101), ""); +} + int main() { test_move_assignment_empty_empty(); test_move_assignment_non_empty_empty(); test_move_assignment_empty_non_empty(); test_move_assignment_same_index(); test_move_assignment_different_index(); test_move_assignment_sfinae(); test_move_assignment_noexcept(); + test_constexpr_move_assignment_extension(); } Index: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/copy.pass.cpp (revision 319786) @@ -1,173 +1,264 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 // XFAIL: with_system_cxx_lib=macosx10.9 // XFAIL: with_system_cxx_lib=macosx10.7 // XFAIL: with_system_cxx_lib=macosx10.8 // // template class variant; // variant(variant const&); #include #include #include #include "test_macros.h" #include "test_workarounds.h" struct NonT { NonT(int v) : value(v) {} NonT(const NonT &o) : value(o.value) {} int value; }; static_assert(!std::is_trivially_copy_constructible::value, ""); struct NoCopy { NoCopy(const NoCopy &) = delete; }; struct MoveOnly { MoveOnly(const MoveOnly &) = delete; MoveOnly(MoveOnly &&) = default; }; struct MoveOnlyNT { MoveOnlyNT(const MoveOnlyNT &) = delete; MoveOnlyNT(MoveOnlyNT &&) {} }; +struct NTCopy { + constexpr NTCopy(int v) : value(v) {} + NTCopy(const NTCopy &that) : value(that.value) {} + NTCopy(NTCopy &&) = delete; + int value; +}; + +static_assert(!std::is_trivially_copy_constructible::value, ""); +static_assert(std::is_copy_constructible::value, ""); + +struct TCopy { + constexpr TCopy(int v) : value(v) {} + TCopy(TCopy const &) = default; + TCopy(TCopy &&) = delete; + int value; +}; + +static_assert(std::is_trivially_copy_constructible::value, ""); + +struct TCopyNTMove { + constexpr TCopyNTMove(int v) : value(v) {} + TCopyNTMove(const TCopyNTMove&) = default; + TCopyNTMove(TCopyNTMove&& that) : value(that.value) { that.value = -1; } + int value; +}; + +static_assert(std::is_trivially_copy_constructible::value, ""); + #ifndef TEST_HAS_NO_EXCEPTIONS struct MakeEmptyT { static int alive; MakeEmptyT() { ++alive; } MakeEmptyT(const MakeEmptyT &) { ++alive; // Don't throw from the copy constructor since variant's assignment // operator performs a copy before committing to the assignment. } MakeEmptyT(MakeEmptyT &&) { throw 42; } MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; } MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; } ~MakeEmptyT() { --alive; } }; int MakeEmptyT::alive = 0; template void makeEmpty(Variant &v) { Variant v2(std::in_place_type); try { - v = v2; + v = std::move(v2); assert(false); } catch (...) { assert(v.valueless_by_exception()); } } #endif // TEST_HAS_NO_EXCEPTIONS void test_copy_ctor_sfinae() { { using V = std::variant; static_assert(std::is_copy_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_copy_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_copy_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_copy_constructible::value, ""); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_copy_constructible::value, ""); + static_assert(std::is_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_copy_constructible::value, ""); + } } void test_copy_ctor_basic() { { std::variant v(std::in_place_index<0>, 42); std::variant v2 = v; assert(v2.index() == 0); assert(std::get<0>(v2) == 42); } { std::variant v(std::in_place_index<1>, 42); std::variant v2 = v; assert(v2.index() == 1); assert(std::get<1>(v2) == 42); } { std::variant v(std::in_place_index<0>, 42); assert(v.index() == 0); std::variant v2(v); assert(v2.index() == 0); assert(std::get<0>(v2).value == 42); } { std::variant v(std::in_place_index<1>, 42); assert(v.index() == 1); std::variant v2(v); assert(v2.index() == 1); assert(std::get<1>(v2).value == 42); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2 = v; + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2) == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2 = v; + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2) == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<0>, 42); + static_assert(v.index() == 0, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 0, ""); + static_assert(std::get<0>(v2).value == 42, ""); + } + { + constexpr std::variant v(std::in_place_index<1>, 42); + static_assert(v.index() == 1, ""); + constexpr std::variant v2(v); + static_assert(v2.index() == 1, ""); + static_assert(std::get<1>(v2).value == 42, ""); + } } void test_copy_ctor_valueless_by_exception() { #ifndef TEST_HAS_NO_EXCEPTIONS using V = std::variant; V v1; makeEmpty(v1); const V &cv1 = v1; V v(cv1); assert(v.valueless_by_exception()); -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } template constexpr bool test_constexpr_copy_ctor_extension_imp( std::variant const& v) { auto v2 = v; return v2.index() == v.index() && v2.index() == Idx && std::get(v2) == std::get(v); } void test_constexpr_copy_ctor_extension() { - // NOTE: This test is for not yet standardized behavior. + // NOTE: This test is for not yet standardized behavior. (P0602) using V = std::variant; #ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(std::is_trivially_destructible::value, ""); static_assert(std::is_trivially_copy_constructible::value, ""); static_assert(std::is_trivially_move_constructible::value, ""); static_assert(!std::is_copy_assignable::value, ""); static_assert(!std::is_move_assignable::value, ""); -#else +#else // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(std::is_trivially_copyable::value, ""); -#endif +#endif // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(test_constexpr_copy_ctor_extension_imp<0>(V(42l)), ""); static_assert(test_constexpr_copy_ctor_extension_imp<1>(V(nullptr)), ""); static_assert(test_constexpr_copy_ctor_extension_imp<2>(V(101)), ""); } int main() { test_copy_ctor_basic(); test_copy_ctor_valueless_by_exception(); test_copy_ctor_sfinae(); test_constexpr_copy_ctor_extension(); } Index: vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp =================================================================== --- vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/std/utilities/variant/variant.variant/variant.ctor/move.pass.cpp (revision 319786) @@ -1,212 +1,336 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // UNSUPPORTED: c++98, c++03, c++11, c++14 // XFAIL: with_system_cxx_lib=macosx10.12 // XFAIL: with_system_cxx_lib=macosx10.11 // XFAIL: with_system_cxx_lib=macosx10.10 // XFAIL: with_system_cxx_lib=macosx10.9 // XFAIL: with_system_cxx_lib=macosx10.7 // XFAIL: with_system_cxx_lib=macosx10.8 // // template class variant; // variant(variant&&) noexcept(see below); #include #include #include #include #include "test_macros.h" #include "test_workarounds.h" struct ThrowsMove { ThrowsMove(ThrowsMove &&) noexcept(false) {} }; struct NoCopy { NoCopy(const NoCopy &) = delete; }; struct MoveOnly { int value; MoveOnly(int v) : value(v) {} MoveOnly(const MoveOnly &) = delete; MoveOnly(MoveOnly &&) = default; }; struct MoveOnlyNT { int value; MoveOnlyNT(int v) : value(v) {} MoveOnlyNT(const MoveOnlyNT &) = delete; MoveOnlyNT(MoveOnlyNT &&other) : value(other.value) { other.value = -1; } }; +struct NTMove { + constexpr NTMove(int v) : value(v) {} + NTMove(const NTMove &) = delete; + NTMove(NTMove &&that) : value(that.value) { that.value = -1; } + int value; +}; + +static_assert(!std::is_trivially_move_constructible::value, ""); +static_assert(std::is_move_constructible::value, ""); + +struct TMove { + constexpr TMove(int v) : value(v) {} + TMove(const TMove &) = delete; + TMove(TMove &&) = default; + int value; +}; + +static_assert(std::is_trivially_move_constructible::value, ""); + +struct TMoveNTCopy { + constexpr TMoveNTCopy(int v) : value(v) {} + TMoveNTCopy(const TMoveNTCopy& that) : value(that.value) {} + TMoveNTCopy(TMoveNTCopy&&) = default; + int value; +}; + +static_assert(std::is_trivially_move_constructible::value, ""); + #ifndef TEST_HAS_NO_EXCEPTIONS struct MakeEmptyT { static int alive; MakeEmptyT() { ++alive; } MakeEmptyT(const MakeEmptyT &) { ++alive; // Don't throw from the copy constructor since variant's assignment // operator performs a copy before committing to the assignment. } MakeEmptyT(MakeEmptyT &&) { throw 42; } MakeEmptyT &operator=(const MakeEmptyT &) { throw 42; } MakeEmptyT &operator=(MakeEmptyT &&) { throw 42; } ~MakeEmptyT() { --alive; } }; int MakeEmptyT::alive = 0; template void makeEmpty(Variant &v) { Variant v2(std::in_place_type); try { - v = v2; + v = std::move(v2); assert(false); } catch (...) { assert(v.valueless_by_exception()); } } #endif // TEST_HAS_NO_EXCEPTIONS void test_move_noexcept() { { using V = std::variant; static_assert(std::is_nothrow_move_constructible::value, ""); } { using V = std::variant; static_assert(std::is_nothrow_move_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_move_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_nothrow_move_constructible::value, ""); } } void test_move_ctor_sfinae() { { using V = std::variant; static_assert(std::is_move_constructible::value, ""); } { using V = std::variant; static_assert(std::is_move_constructible::value, ""); } { using V = std::variant; static_assert(std::is_move_constructible::value, ""); } { using V = std::variant; static_assert(!std::is_move_constructible::value, ""); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(!std::is_trivially_move_constructible::value, ""); + static_assert(std::is_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } + { + using V = std::variant; + static_assert(std::is_trivially_move_constructible::value, ""); + } } +template +struct Result { size_t index; T value; }; + void test_move_ctor_basic() { { std::variant v(std::in_place_index<0>, 42); std::variant v2 = std::move(v); assert(v2.index() == 0); assert(std::get<0>(v2) == 42); } { std::variant v(std::in_place_index<1>, 42); std::variant v2 = std::move(v); assert(v2.index() == 1); assert(std::get<1>(v2) == 42); } { std::variant v(std::in_place_index<0>, 42); assert(v.index() == 0); std::variant v2(std::move(v)); assert(v2.index() == 0); assert(std::get<0>(v2).value == 42); } { std::variant v(std::in_place_index<1>, 42); assert(v.index() == 1); std::variant v2(std::move(v)); assert(v2.index() == 1); assert(std::get<1>(v2).value == 42); } { std::variant v(std::in_place_index<0>, 42); assert(v.index() == 0); std::variant v2(std::move(v)); assert(v2.index() == 0); assert(std::get<0>(v).value == -1); assert(std::get<0>(v2).value == 42); } { std::variant v(std::in_place_index<1>, 42); assert(v.index() == 1); std::variant v2(std::move(v)); assert(v2.index() == 1); assert(std::get<1>(v).value == -1); assert(std::get<1>(v2).value == 42); } + + // The following tests are for not-yet-standardized behavior (P0602): + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2 = std::move(v); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2 = std::move(v); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<0>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<0>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 0, ""); + static_assert(result.value.value == 42, ""); + } + { + struct { + constexpr Result operator()() const { + std::variant v(std::in_place_index<1>, 42); + std::variant v2(std::move(v)); + return {v2.index(), std::get<1>(std::move(v2))}; + } + } test; + constexpr auto result = test(); + static_assert(result.index == 1, ""); + static_assert(result.value.value == 42, ""); + } } void test_move_ctor_valueless_by_exception() { #ifndef TEST_HAS_NO_EXCEPTIONS using V = std::variant; V v1; makeEmpty(v1); V v(std::move(v1)); assert(v.valueless_by_exception()); -#endif +#endif // TEST_HAS_NO_EXCEPTIONS } template constexpr bool test_constexpr_ctor_extension_imp( std::variant const& v) { auto copy = v; auto v2 = std::move(copy); return v2.index() == v.index() && v2.index() == Idx && std::get(v2) == std::get(v); } void test_constexpr_move_ctor_extension() { - // NOTE: This test is for not yet standardized behavior. + // NOTE: This test is for not yet standardized behavior. (P0602) using V = std::variant; #ifdef TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(std::is_trivially_destructible::value, ""); static_assert(std::is_trivially_copy_constructible::value, ""); static_assert(std::is_trivially_move_constructible::value, ""); static_assert(!std::is_copy_assignable::value, ""); static_assert(!std::is_move_assignable::value, ""); -#else +#else // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(std::is_trivially_copyable::value, ""); -#endif +#endif // TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE static_assert(std::is_trivially_move_constructible::value, ""); static_assert(test_constexpr_ctor_extension_imp<0>(V(42l)), ""); static_assert(test_constexpr_ctor_extension_imp<1>(V(nullptr)), ""); static_assert(test_constexpr_ctor_extension_imp<2>(V(101)), ""); } int main() { test_move_ctor_basic(); test_move_ctor_valueless_by_exception(); test_move_noexcept(); test_move_ctor_sfinae(); test_constexpr_move_ctor_extension(); } Index: vendor/libc++/dist/test/support/msvc_stdlib_force_include.hpp =================================================================== --- vendor/libc++/dist/test/support/msvc_stdlib_force_include.hpp (revision 319785) +++ vendor/libc++/dist/test/support/msvc_stdlib_force_include.hpp (revision 319786) @@ -1,94 +1,92 @@ //===----------------------------------------------------------------------===// // // 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 SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP #define SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP // This header is force-included when running the libc++ tests against the // MSVC standard library. #ifndef _LIBCXX_IN_DEVCRT // Silence warnings about CRT machinery. #define _CRT_SECURE_NO_WARNINGS // Avoid assertion dialogs. #define _CRT_SECURE_INVALID_PARAMETER(EXPR) ::abort() #endif // _LIBCXX_IN_DEVCRT #include #include #if defined(_LIBCPP_VERSION) #error This header may not be used when targeting libc++ #endif -// Indicates that we are using the MSVC standard library. -#ifndef _MSVC_STL_VER - #define _MSVC_STL_VER 42 -#endif - #ifndef _LIBCXX_IN_DEVCRT struct AssertionDialogAvoider { AssertionDialogAvoider() { _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR); _CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_ERROR, _CRTDBG_FILE_STDERR); } }; const AssertionDialogAvoider assertion_dialog_avoider{}; #endif // _LIBCXX_IN_DEVCRT // MSVC frontend only configurations #if !defined(__clang__) // Simulate feature-test macros. #define __has_feature(X) _MSVC_HAS_FEATURE_ ## X #define _MSVC_HAS_FEATURE_cxx_exceptions 1 #define _MSVC_HAS_FEATURE_cxx_rtti 1 #define _MSVC_HAS_FEATURE_address_sanitizer 0 #define _MSVC_HAS_FEATURE_memory_sanitizer 0 #define _MSVC_HAS_FEATURE_thread_sanitizer 0 // Silence compiler warnings. #pragma warning(disable: 4180) // qualifier applied to function type has no meaning; ignored #pragma warning(disable: 4521) // multiple copy constructors specified #pragma warning(disable: 4702) // unreachable code #pragma warning(disable: 28251) // Inconsistent annotation for 'new': this instance has no annotations. #endif // !defined(__clang__) // MSVC doesn't have __int128_t. #define _LIBCPP_HAS_NO_INT128 // MSVC has quick_exit() and at_quick_exit(). #define _LIBCPP_HAS_QUICK_EXIT #ifndef _LIBCXX_IN_DEVCRT // atomic_is_lock_free.pass.cpp needs this VS 2015 Update 2 fix. #define _ENABLE_ATOMIC_ALIGNMENT_FIX // Enable features that /std:c++latest removes by default. #define _HAS_AUTO_PTR_ETC 1 #define _HAS_FUNCTION_ASSIGN 1 #define _HAS_OLD_IOSTREAMS_MEMBERS 1 // Silence warnings about raw pointers and other unchecked iterators. #define _SCL_SECURE_NO_WARNINGS + + // Silence warnings about features that are deprecated in C++17. + #define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS #endif // _LIBCXX_IN_DEVCRT #include #if _HAS_CXX17 #define TEST_STD_VER 17 #else // _HAS_CXX17 #define TEST_STD_VER 14 #endif // _HAS_CXX17 #endif // SUPPORT_MSVC_STDLIB_FORCE_INCLUDE_HPP Index: vendor/libc++/dist/test/support/platform_support.h =================================================================== --- vendor/libc++/dist/test/support/platform_support.h (revision 319785) +++ vendor/libc++/dist/test/support/platform_support.h (revision 319786) @@ -1,99 +1,102 @@ //===----------------------------------------------------------------------===// // // 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. // //===----------------------------------------------------------------------===// // Define a bunch of macros that can be used in the tests instead of // implementation defined assumptions: // - locale names // - floating point number string output #ifndef PLATFORM_SUPPORT_H #define PLATFORM_SUPPORT_H // locale names #ifdef _WIN32 // WARNING: Windows does not support UTF-8 codepages. // Locales are "converted" using http://docs.moodle.org/dev/Table_of_locales -#define LOCALE_en_US_UTF_8 "English_United States.1252" -#define LOCALE_cs_CZ_ISO8859_2 "Czech_Czech Republic.1250" -#define LOCALE_fr_FR_UTF_8 "French_France.1252" -#define LOCALE_fr_CA_ISO8859_1 "French_Canada.1252" -#define LOCALE_ru_RU_UTF_8 "Russian_Russia.1251" -#define LOCALE_zh_CN_UTF_8 "Chinese_China.936" +#define LOCALE_en_US "en-US" +#define LOCALE_en_US_UTF_8 "en-US" +#define LOCALE_cs_CZ_ISO8859_2 "cs-CZ" +#define LOCALE_fr_FR_UTF_8 "fr-FR" +#define LOCALE_fr_CA_ISO8859_1 "fr-CA" +#define LOCALE_ru_RU_UTF_8 "ru-RU" +#define LOCALE_zh_CN_UTF_8 "zh-CN" #elif defined(__CloudABI__) // Timezones are integrated into locales through LC_TIMEZONE_MASK on // CloudABI. LC_ALL_MASK can only be used if a timezone has also been // provided. UTC should be all right. +#define LOCALE_en_US "en_US" #define LOCALE_en_US_UTF_8 "en_US.UTF-8@UTC" #define LOCALE_fr_FR_UTF_8 "fr_FR.UTF-8@UTC" #define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1@UTC" #define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO-8859-2@UTC" #define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8@UTC" #define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8@UTC" #else +#define LOCALE_en_US "en_US" #define LOCALE_en_US_UTF_8 "en_US.UTF-8" #define LOCALE_fr_FR_UTF_8 "fr_FR.UTF-8" #ifdef __linux__ #define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO-8859-1" #define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO-8859-2" #else #define LOCALE_fr_CA_ISO8859_1 "fr_CA.ISO8859-1" #define LOCALE_cs_CZ_ISO8859_2 "cs_CZ.ISO8859-2" #endif #define LOCALE_ru_RU_UTF_8 "ru_RU.UTF-8" #define LOCALE_zh_CN_UTF_8 "zh_CN.UTF-8" #endif #include #include #include #if defined(_WIN32) || defined(__MINGW32__) #include // _mktemp_s #else #include // close #endif #if defined(_NEWLIB_VERSION) && defined(__STRICT_ANSI__) // Newlib provides this, but in the header it's under __STRICT_ANSI__ extern "C" { int mkstemp(char*); } #endif #ifndef __CloudABI__ inline std::string get_temp_file_name() { #if defined(__MINGW32__) char Path[MAX_PATH + 1]; char FN[MAX_PATH + 1]; do { } while (0 == GetTempPath(MAX_PATH+1, Path)); do { } while (0 == GetTempFileName(Path, "libcxx", 0, FN)); return FN; #elif defined(_WIN32) char Name[] = "libcxx.XXXXXX"; if (_mktemp_s(Name, sizeof(Name)) != 0) abort(); return Name; #else std::string Name; int FD = -1; do { Name = "libcxx.XXXXXX"; FD = mkstemp(&Name[0]); if (FD == -1 && errno == EINVAL) { perror("mkstemp"); abort(); } } while (FD == -1); close(FD); return Name; #endif } #endif // __CloudABI__ #endif // PLATFORM_SUPPORT_H Index: vendor/libc++/dist/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp =================================================================== --- vendor/libc++/dist/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp (revision 319785) +++ vendor/libc++/dist/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp (nonexistent) @@ -1,49 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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. -// -//===----------------------------------------------------------------------===// - -// UNSUPPORTED: c++98, c++03 - -// Verify TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION. - -#include - -#include "test_workarounds.h" - -template -struct identity { - using type = T; -}; - -template struct list {}; - -// C1XX believes this function template is not viable when LArgs is an empty -// parameter pack. -template -int f2(typename identity::type..., int i) { - return i; -} - -#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION -// C1XX believes this function template *is* viable when LArgs is an empty -// parameter pack. Conforming compilers believe the two overloads are -// ambiguous when LArgs is an empty pack. -template -int f2(int i) { - return i; -} -#endif - -template -int f1(list, Args&&... args) { - return f2(args...); -} - -int main() { - f1(list<>{}, 42); -} Property changes on: vendor/libc++/dist/test/support/test.workarounds/c1xx_empty_parameter_pack_expansion.pass.cpp ___________________________________________________________________ Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:keywords ## -1 +0,0 ## -FreeBSD=%H \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: vendor/libc++/dist/test/support/test_workarounds.h =================================================================== --- vendor/libc++/dist/test/support/test_workarounds.h (revision 319785) +++ vendor/libc++/dist/test/support/test_workarounds.h (revision 319786) @@ -1,28 +1,27 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SUPPORT_TEST_WORKAROUNDS_H #define SUPPORT_TEST_WORKAROUNDS_H #include "test_macros.h" #if defined(TEST_COMPILER_EDG) # define TEST_WORKAROUND_EDG_EXPLICIT_CONSTEXPR // VSO#424280 #endif #if defined(TEST_COMPILER_C1XX) # define TEST_WORKAROUND_C1XX_BROKEN_IS_TRIVIALLY_COPYABLE // VSO#117743 -# define TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION // VSO#109062 # ifndef _MSC_EXTENSIONS # define TEST_WORKAROUND_C1XX_BROKEN_ZA_CTOR_CHECK // VSO#119998 # endif #endif #endif // SUPPORT_TEST_WORKAROUNDS_H Index: vendor/libc++/dist/test/support/uses_alloc_types.hpp =================================================================== --- vendor/libc++/dist/test/support/uses_alloc_types.hpp (revision 319785) +++ vendor/libc++/dist/test/support/uses_alloc_types.hpp (revision 319786) @@ -1,398 +1,391 @@ //===----------------------------------------------------------------------===// // // 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 USES_ALLOC_TYPES_HPP #define USES_ALLOC_TYPES_HPP # include # include #include #include "test_macros.h" #include "test_workarounds.h" #include "type_id.h" // There are two forms of uses-allocator construction: // (1) UA_AllocArg: 'T(allocator_arg_t, Alloc const&, Args&&...)' // (2) UA_AllocLast: 'T(Args&&..., Alloc const&)' // 'UA_None' represents non-uses allocator construction. enum class UsesAllocatorType { UA_None = 0, UA_AllocArg = 2, UA_AllocLast = 4 }; constexpr UsesAllocatorType UA_None = UsesAllocatorType::UA_None; constexpr UsesAllocatorType UA_AllocArg = UsesAllocatorType::UA_AllocArg; constexpr UsesAllocatorType UA_AllocLast = UsesAllocatorType::UA_AllocLast; inline const char* toString(UsesAllocatorType UA) { switch (UA) { case UA_None: return "UA_None"; case UA_AllocArg: return "UA_AllocArg"; case UA_AllocLast: return "UA_AllocLast"; default: std::abort(); } } #define COMPARE_ALLOC_TYPE(LHS, RHS) CompareVerbose(#LHS, LHS, #RHS, RHS) inline bool CompareVerbose(const char* LHSString, UsesAllocatorType LHS, const char* RHSString, UsesAllocatorType RHS) { if (LHS == RHS) return true; std::printf("UsesAllocatorType's don't match:\n%s %s\n----------\n%s %s\n", LHSString, toString(LHS), RHSString, toString(RHS)); return false; } template class UsesAllocatorV1; // Implements form (1) of uses-allocator construction from the specified // 'Alloc' type and exactly 'N' additional arguments. It also provides // non-uses allocator construction from 'N' arguments. This test type // blows up when form (2) of uses-allocator is even considered. template class UsesAllocatorV2; // Implements form (2) of uses-allocator construction from the specified // 'Alloc' type and exactly 'N' additional arguments. It also provides // non-uses allocator construction from 'N' arguments. template class UsesAllocatorV3; // Implements both form (1) and (2) of uses-allocator construction from // the specified 'Alloc' type and exactly 'N' additional arguments. It also // provides non-uses allocator construction from 'N' arguments. template class NotUsesAllocator; // Implements both form (1) and (2) of uses-allocator construction from // the specified 'Alloc' type and exactly 'N' additional arguments. It also // provides non-uses allocator construction from 'N' arguments. However // 'NotUsesAllocator' never provides a 'allocator_type' typedef so it is // never automatically uses-allocator constructed. template bool checkConstruct(TestType& value, UsesAllocatorType form, typename TestType::CtorAlloc const& alloc) // Check that 'value' was constructed using the specified 'form' of // construction and with the specified 'ArgTypes...'. Additionally // check that 'value' was constructed using the specified 'alloc'. { if (form == UA_None) { return value.template checkConstruct(form); } else { return value.template checkConstruct(form, alloc); } } template bool checkConstruct(TestType& value, UsesAllocatorType form) { return value.template checkConstruct(form); } template bool checkConstructionEquiv(TestType& T, TestType& U) // check that 'T' and 'U' where initialized in the exact same manner. { return T.checkConstructEquiv(U); } //////////////////////////////////////////////////////////////////////////////// namespace detail { template struct TakeNImp; template struct TakeNImp { typedef ArgList type; }; template struct TakeNImp, F, R...> : TakeNImp, R...> {}; template struct TakeNArgs : TakeNImp, Args...> {}; template struct Identity { typedef T type; }; template using IdentityT = typename Identity::type; template using EnableIfB = typename std::enable_if::type; } // end namespace detail // FIXME: UsesAllocatorTestBase needs some special logic to deal with // polymorphic allocators. However we don't want to include // in this header. Therefore in order // to inject this behavior later we use a trait. // See test_memory_resource.hpp for more info. template struct TransformErasedTypeAlloc { using type = Alloc; }; using detail::EnableIfB; struct AllocLastTag {}; template ::value> struct UsesAllocatorTestBaseStorage { Alloc allocator; UsesAllocatorTestBaseStorage() = default; UsesAllocatorTestBaseStorage(Alloc const& a) : allocator(a) {} const Alloc* get_allocator() const { return &allocator; } }; template struct UsesAllocatorTestBaseStorage { union { char dummy; Alloc alloc; }; bool has_alloc = false; UsesAllocatorTestBaseStorage() : dummy(), has_alloc(false) {} UsesAllocatorTestBaseStorage(Alloc const& a) : alloc(a), has_alloc(true) {} ~UsesAllocatorTestBaseStorage() { if (has_alloc) alloc.~Alloc(); } Alloc const* get_allocator() const { if (!has_alloc) return nullptr; return &alloc; } }; template struct UsesAllocatorTestBase { public: using CtorAlloc = typename TransformErasedTypeAlloc::type; template bool checkConstruct(UsesAllocatorType expectType) const { auto expectArgs = &makeArgumentID(); return COMPARE_ALLOC_TYPE(expectType, constructor_called) && COMPARE_TYPEID(args_id, expectArgs); } template bool checkConstruct(UsesAllocatorType expectType, CtorAlloc const& expectAlloc) const { auto ExpectID = &makeArgumentID() ; return COMPARE_ALLOC_TYPE(expectType, constructor_called) && COMPARE_TYPEID(args_id, ExpectID) && has_alloc() && expectAlloc == *get_alloc(); } bool checkConstructEquiv(UsesAllocatorTestBase& O) const { if (has_alloc() != O.has_alloc()) return false; return COMPARE_ALLOC_TYPE(constructor_called, O.constructor_called) && COMPARE_TYPEID(args_id, O.args_id) && (!has_alloc() || *get_alloc() == *O.get_alloc()); } protected: explicit UsesAllocatorTestBase(const TypeID* aid) : args_id(aid), constructor_called(UA_None), alloc_store() {} UsesAllocatorTestBase(UsesAllocatorTestBase const&) : args_id(&makeArgumentID()), constructor_called(UA_None), alloc_store() {} UsesAllocatorTestBase(UsesAllocatorTestBase&&) : args_id(&makeArgumentID()), constructor_called(UA_None), alloc_store() {} template UsesAllocatorTestBase(std::allocator_arg_t, CtorAlloc const& a, Args&&...) : args_id(&makeArgumentID()), constructor_called(UA_AllocArg), alloc_store(a) {} template > UsesAllocatorTestBase(AllocLastTag, Args&&... args) : args_id(&makeTypeIDImp()), constructor_called(UA_AllocLast), alloc_store(UsesAllocatorTestBase::getAllocatorFromPack( typename ArgsIDL::type{}, std::forward(args)...)) { } private: template static CtorAlloc getAllocatorFromPack(ArgumentListID, Args&&... args) { return UsesAllocatorTestBase::getAllocatorFromPackImp(args...); } template static CtorAlloc getAllocatorFromPackImp( typename detail::Identity::type..., CtorAlloc const& alloc) { return alloc; } -#ifdef TEST_WORKAROUND_C1XX_EMPTY_PARAMETER_PACK_EXPANSION - template - static CtorAlloc getAllocatorFromPackImp(CtorAlloc const& alloc) { - return alloc; - } -#endif - bool has_alloc() const { return alloc_store.get_allocator() != nullptr; } const CtorAlloc *get_alloc() const { return alloc_store.get_allocator(); } public: const TypeID* args_id; UsesAllocatorType constructor_called = UA_None; UsesAllocatorTestBaseStorage alloc_store; }; template class UsesAllocatorV1 : public UsesAllocatorTestBase, Alloc> { public: typedef Alloc allocator_type; using Base = UsesAllocatorTestBase; using CtorAlloc = typename Base::CtorAlloc; UsesAllocatorV1() : Base(&makeArgumentID<>()) {} UsesAllocatorV1(UsesAllocatorV1 const&) : Base(&makeArgumentID()) {} UsesAllocatorV1(UsesAllocatorV1 &&) : Base(&makeArgumentID()) {} // Non-Uses Allocator Ctor template = false> UsesAllocatorV1(Args&&...) : Base(&makeArgumentID()) {} // Uses Allocator Arg Ctor template UsesAllocatorV1(std::allocator_arg_t tag, CtorAlloc const & a, Args&&... args) : Base(tag, a, std::forward(args)...) { } // BLOWS UP: Uses Allocator Last Ctor template Dummy = false> constexpr UsesAllocatorV1(First&&, Args&&...) { static_assert(!std::is_same::value, ""); } }; template class UsesAllocatorV2 : public UsesAllocatorTestBase, Alloc> { public: typedef Alloc allocator_type; using Base = UsesAllocatorTestBase; using CtorAlloc = typename Base::CtorAlloc; UsesAllocatorV2() : Base(&makeArgumentID<>()) {} UsesAllocatorV2(UsesAllocatorV2 const&) : Base(&makeArgumentID()) {} UsesAllocatorV2(UsesAllocatorV2 &&) : Base(&makeArgumentID()) {} // Non-Uses Allocator Ctor template = false> UsesAllocatorV2(Args&&...) : Base(&makeArgumentID()) {} // Uses Allocator Last Ctor template = false> UsesAllocatorV2(Args&&... args) : Base(AllocLastTag{}, std::forward(args)...) {} }; template class UsesAllocatorV3 : public UsesAllocatorTestBase, Alloc> { public: typedef Alloc allocator_type; using Base = UsesAllocatorTestBase; using CtorAlloc = typename Base::CtorAlloc; UsesAllocatorV3() : Base(&makeArgumentID<>()) {} UsesAllocatorV3(UsesAllocatorV3 const&) : Base(&makeArgumentID()) {} UsesAllocatorV3(UsesAllocatorV3 &&) : Base(&makeArgumentID()) {} // Non-Uses Allocator Ctor template = false> UsesAllocatorV3(Args&&...) : Base(&makeArgumentID()) {} // Uses Allocator Arg Ctor template UsesAllocatorV3(std::allocator_arg_t tag, CtorAlloc const& alloc, Args&&... args) : Base(tag, alloc, std::forward(args)...) {} // Uses Allocator Last Ctor template = false> UsesAllocatorV3(Args&&... args) : Base(AllocLastTag{}, std::forward(args)...) {} }; template class NotUsesAllocator : public UsesAllocatorTestBase, Alloc> { public: // no allocator_type typedef provided using Base = UsesAllocatorTestBase; using CtorAlloc = typename Base::CtorAlloc; NotUsesAllocator() : Base(&makeArgumentID<>()) {} NotUsesAllocator(NotUsesAllocator const&) : Base(&makeArgumentID()) {} NotUsesAllocator(NotUsesAllocator &&) : Base(&makeArgumentID()) {} // Non-Uses Allocator Ctor template = false> NotUsesAllocator(Args&&...) : Base(&makeArgumentID()) {} // Uses Allocator Arg Ctor template NotUsesAllocator(std::allocator_arg_t tag, CtorAlloc const& alloc, Args&&... args) : Base(tag, alloc, std::forward(args)...) {} // Uses Allocator Last Ctor template = false> NotUsesAllocator(Args&&... args) : Base(AllocLastTag{}, std::forward(args)...) {} }; #endif /* USES_ALLOC_TYPES_HPP */ Index: vendor/libc++/dist/test/support/variant_test_helpers.hpp =================================================================== --- vendor/libc++/dist/test/support/variant_test_helpers.hpp (revision 319785) +++ vendor/libc++/dist/test/support/variant_test_helpers.hpp (revision 319786) @@ -1,81 +1,81 @@ // -*- C++ -*- //===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SUPPORT_VARIANT_TEST_HELPERS_HPP #define SUPPORT_VARIANT_TEST_HELPERS_HPP #include #include #include #include "test_macros.h" #if TEST_STD_VER <= 14 #error This file requires C++17 #endif // FIXME: Currently the variant tests are disabled using this macro. #define TEST_VARIANT_HAS_NO_REFERENCES #ifndef TEST_HAS_NO_EXCEPTIONS struct CopyThrows { CopyThrows() = default; CopyThrows(CopyThrows const&) { throw 42; } CopyThrows& operator=(CopyThrows const&) { throw 42; } }; struct MoveThrows { static int alive; MoveThrows() { ++alive; } MoveThrows(MoveThrows const&) {++alive;} MoveThrows(MoveThrows&&) { throw 42; } MoveThrows& operator=(MoveThrows const&) { return *this; } MoveThrows& operator=(MoveThrows&&) { throw 42; } ~MoveThrows() { --alive; } }; int MoveThrows::alive = 0; struct MakeEmptyT { static int alive; MakeEmptyT() { ++alive; } MakeEmptyT(MakeEmptyT const&) { ++alive; // Don't throw from the copy constructor since variant's assignment // operator performs a copy before committing to the assignment. } MakeEmptyT(MakeEmptyT &&) { throw 42; } MakeEmptyT& operator=(MakeEmptyT const&) { throw 42; } MakeEmptyT& operator=(MakeEmptyT&&) { throw 42; } ~MakeEmptyT() { --alive; } }; static_assert(std::is_swappable_v, ""); // required for test int MakeEmptyT::alive = 0; template void makeEmpty(Variant& v) { Variant v2(std::in_place_type); try { - v = v2; + v = std::move(v2); assert(false); - } catch (...) { + } catch (...) { assert(v.valueless_by_exception()); } } #endif // TEST_HAS_NO_EXCEPTIONS #endif // SUPPORT_VARIANT_TEST_HELPERS_HPP Index: vendor/libc++/dist/www/cxx1z_status.html =================================================================== --- vendor/libc++/dist/www/cxx1z_status.html (revision 319785) +++ vendor/libc++/dist/www/cxx1z_status.html (revision 319786) @@ -1,495 +1,495 @@ libc++ C++1Z Status

libc++ C++1z Status

In November 2014, the C++ standard committee created a draft for the next version of the C++ standard, known here as "C++1z" (probably to be C++17).

In February 2017, the C++ standard committee approved this draft, and sent it to ISO for approval as C++17

This page shows the status of libc++; the status of clang's support of the language features is here.

The groups that have contributed papers:

  • LWG - Library working group
  • CWG - Core Language Working group
  • SG1 - Study group #1 (Concurrency working group)

- +

Paper Status

Paper #GroupPaper NameMeetingStatusFirst released version
N3911LWGTransformationTrait Alias void_t.UrbanaComplete3.6
N4089LWGSafe conversions in unique_ptr<T[]>.UrbanaIn progress3.9
N4169LWGA proposal to add invoke function templateUrbanaComplete3.7
N4190LWGRemoving auto_ptr, random_shuffle(), And Old Stuff.UrbanaIn progress
N4258LWGCleaning-up noexcept in the Library.UrbanaIn progress3.7
N4259CWGWording for std::uncaught_exceptionsUrbanaComplete3.7
N4277LWGTriviallyCopyable reference_wrapper.UrbanaComplete3.2
N4279LWGImproved insertion interface for unique-key maps.UrbanaComplete3.7
N4280LWGNon-member size() and moreUrbanaComplete3.6
N4284LWGContiguous Iterators.UrbanaComplete3.6
N4285CWGCleanup for exception-specification and throw-expression.UrbanaComplete4.0
N4387LWGimproving pair and tupleLenexaComplete4.0
N4389LWGbool_constantLenexaComplete3.7
N4508LWGshared_mutex for C++17LenexaComplete3.7
N4366LWGLWG 2228 missing SFINAE ruleLenexaComplete3.1
N4510LWGMinimal incomplete type support for standard containers, revision 4LenexaComplete3.6
P0004R1LWGRemove Deprecated iostreams aliases.KonaComplete3.8
P0006R0LWGAdopt Type Traits Variable Templates for C++17.KonaComplete3.8
P0092R1LWGPolishing <chrono>KonaComplete3.8
P0007R1LWGConstant View: A proposal for a std::as_const helper function template.KonaComplete3.8
P0156R0LWGVariadic lock_guard(rev 3).KonaReverted in Kona3.9
P0074R0LWGMaking std::owner_less more flexibleKonaComplete3.8
P0013R1LWGLogical type traits rev 2KonaComplete3.8
P0024R2LWGThe Parallelism TS Should be StandardizedJacksonville
P0226R1LWGMathematical Special Functions for C++17Jacksonville
P0220R1LWGAdopt Library Fundamentals V1 TS Components for C++17JacksonvilleIn Progress
P0218R1LWGAdopt the File System TS for C++17JacksonvilleIn Progress
P0033R1LWGRe-enabling shared_from_thisJacksonvilleComplete3.9
P0005R4LWGAdopt not_fn from Library Fundamentals 2 for C++17JacksonvilleComplete3.9
P0152R1LWGconstexpr atomic::is_always_lock_freeJacksonvilleComplete3.9
P0185R1LWGAdding [nothrow-]swappable traitsJacksonvilleComplete3.9
P0253R1LWGFixing a design mistake in the searchers interfaceJacksonvilleComplete3.9
P0025R0LWGAn algorithm to "clamp" a value between a pair of boundary valuesJacksonvilleComplete3.9
P0154R1LWGconstexpr std::hardware_{constructive,destructive}_interference_sizeJacksonville
P0030R1LWGProposal to Introduce a 3-Argument Overload to std::hypotJacksonvilleComplete3.9
P0031R0LWGA Proposal to Add Constexpr Modifiers to reverse_iterator, move_iterator, array and Range AccessJacksonvilleComplete4.0
P0272R1LWGGive std::string a non-const .data() member functionJacksonvilleComplete3.9
P0077R2LWGis_callable, the missing INVOKE related traitJacksonvilleComplete3.9
p0032r3LWGHomogeneous interface for variant, any and optionalOuluComplete4.0
p0040r3LWGExtending memory management toolsOuluComplete4.0
p0063r3LWGC++17 should refer to C11 instead of C99OuluNothing to don/a
p0067r3LWGElementary string conversionsOuluNow P0067R5
p0083r3LWGSplicing Maps and SetsOulu
p0084r2LWGEmplace Return TypeOuluComplete4.0
p0088r3LWGVariant: a type-safe union for C++17OuluComplete4.0
p0163r0LWGshared_ptr::weak_typeOuluComplete3.9
p0174r2LWGDeprecating Vestigial Library Parts in C++17Oulu
p0175r1LWGSynopses for the C libraryOulu
p0180r2LWGReserve a New Library Namespace for Future StandardizationOuluNothing to don/a
p0181r1LWGOrdered by DefaultOuluRemoved in Konan/a
p0209r2LWGmake_from_tuple: apply for constructionOuluComplete3.9
p0219r1LWGRelative Paths for FilesystemOulu
p0254r2LWGIntegrating std::string_view and std::stringOuluComplete4.0
p0258r2LWGhas_unique_object_representationsOulu
p0295r0LWGAdopt Selected Library Fundamentals V2 Components for C++17OuluComplete4.0
p0302r1LWGRemoving Allocator Support in std::functionOuluComplete4.0
p0307r2LWGMaking Optional Greater Equal AgainOuluComplete4.0
p0336r1LWGBetter Names for Parallel Execution Policies in C++17Oulu
p0337r0LWGDelete operator= for polymorphic_allocatorOuluComplete3.9
p0346r1LWGA <random> Nomenclature TweakOuluComplete3.9
p0358r1LWGFixes for not_fnOuluComplete3.9
p0371r1LWGTemporarily discourage memory_order_consumeOuluNothing to don/a
p0392r0LWGAdapting string_view by filesystem pathsOuluComplete4.0
p0393r3LWGMaking Variant Greater EqualOuluComplete4.0
P0394r4LWGHotel Parallelifornia: terminate() for Parallel Algorithms Exception HandlingOulu
P0003R5LWGRemoving Deprecated Exception Specifications from C++17IssaquahComplete5.0
P0067R5LWGElementary string conversions, revision 5Issaquah
P0403R1LWGLiteral suffixes for basic_string_viewIssaquahComplete4.0
P0414R2LWGMerging shared_ptr changes from Library Fundamentals to C++17Issaquah
P0418R2LWGFail or succeed: there is no atomic latticeIssaquah
P0426R1LWGConstexpr for std::char_traitsIssaquahComplete4.0
P0435R1LWGResolving LWG Issues re common_typeIssaquahComplete4.0
P0502R0LWGThrowing out of a parallel algorithm terminates - but how?Issaquah
P0503R0LWGCorrecting library usage of "literal type"IssaquahComplete4.0
P0504R0LWGRevisiting in-place tag types for any/optional/variantIssaquahComplete4.0
P0505R0LWGWording for GB 50 - constexpr for chronoIssaquahComplete4.0
P0508R0LWGWording for GB 58 - structured bindings for node_handlesIssaquah
P0509R1LWGUpdating “Restrictions on exception handling”IssaquahNothing to don/a
P0510R0LWGDisallowing references, incomplete types, arrays, and empty variantsIssaquahComplete4.0
P0513R0LWGPoisoning the HashIssaquahComplete5.0
P0516R0LWGClarify That shared_future’s Copy Operations have Wide ContractsIssaquahComplete4.0
P0517R0LWGMake future_error ConstructibleIssaquahComplete4.0
P0521R0LWGProposed Resolution for CA 14 (shared_ptr use_count/unique)IssaquahNothing to don/a
P0156R2LWGVariadic Lock guard(rev 5)KonaComplete5.0
P0270R3CWGRemoving C dependencies from signal handler wordingKona
P0298R3CWGA byte type definitionKonaComplete5.0
P0317R1LWGDirectory Entry Caching for FilesystemKona
P0430R2LWGFile system library on non-POSIX-like operating systemsKona
P0433R2LWGToward a resolution of US7 and US14: Integrating template deduction for class templates into the standard libraryKona
P0452R1LWGUnifying <numeric> Parallel AlgorithmsKona
P0467R2LWGIterator Concerns for Parallel AlgorithmsKona
P0492R2LWGProposed Resolution of C++17 National Body Comments for FilesystemsKona
P0518R1LWGAllowing copies as arguments to function objects given to parallel algorithms in response to CH11Kona
P0523R1LWGWording for CH 10: Complexity of parallel algorithmsKona
P0548R1LWGcommon_type and durationKonaComplete5.0
P0558R1LWGResolving atomic<T> named base class inconsistenciesKona
P0574R1LWGAlgorithm Complexity Constraints and Parallel OverloadsKona
P0599R1LWGnoexcept for hash functionsKonaComplete5.0
P0604R0LWGResolving GB 55, US 84, US 85, US 86Kona
P0607R0LWGInline Variables for the Standard LibraryKona
P0618R0LWGDeprecating <codecvt>Kona
P0623R0LWGFinal C++17 Parallel Algorithms FixesKona

[ Note: "Nothing to do" means that no library changes were needed to implement this change -- end note]

Library Working group Issues Status

- +
Issue #Issue NameMeetingStatus
2016Allocators must be no-throw swappableUrbanaComplete
2118unique_ptr for array does not support cv qualification conversion of actual argumentUrbanaComplete
2170Aggregates cannot be DefaultConstructibleUrbanaComplete
2308Clarify container destructor requirements w.r.t. std::arrayUrbanaComplete
2340Replacement allocation functions declared as inlineUrbanaComplete
2354Unnecessary copying when inserting into maps with braced-init syntaxUrbanaComplete
2377std::align requirements overly strictUrbanaComplete
2396underlying_type doesn't say what to do for an incomplete enumeration typeUrbanaComplete
2399shared_ptr's constructor from unique_ptr should be constrainedUrbanaComplete
2400shared_ptr's get_deleter() should use addressof()UrbanaComplete
2401std::function needs more noexceptUrbanaComplete
2404mismatch()'s complexity needs to be updatedUrbanaComplete
2408SFINAE-friendly common_type / iterator_traits is missing in C++14UrbanaComplete
2106move_iterator wrapping iterators returning prvaluesUrbanaComplete
2129User specializations of std::initializer_listUrbanaComplete
2212tuple_size for const pair request headerUrbanaComplete
2217operator==(sub_match, string) slices on embedded '\0'sUrbanaComplete
2230"see below" for initializer_list constructors of unordered containersUrbanaComplete
2233bad_function_call::what() unhelpfulUrbanaComplete
2266vector and deque have incorrect insert requirementsUrbanaComplete
2325minmax_element()'s behavior differing from max_element()'s should be notedUrbanaComplete
2361Apply 2299 resolution throughout libraryUrbanaComplete
2365Missing noexcept in shared_ptr::shared_ptr(nullptr_t)UrbanaComplete
2376bad_weak_ptr::what() overspecifiedUrbanaComplete
2387More nested types that must be accessible and unambiguousUrbanaComplete
2059C++0x ambiguity problem with map::eraseLenexaComplete
2063Contradictory requirements for string move assignmentLenexaComplete
2076Bad CopyConstructible requirement in set constructorsLenexaComplete
2160Unintended destruction ordering-specification of resizeLenexaComplete
2168Inconsistent specification of uniform_real_distribution constructorLenexaComplete
2239min/max/minmax requirementsLenexaComplete
2364deque and vector pop_back don't specify iterator invalidation requirementsLenexaComplete
2369constexpr max(initializer_list) vs max_elementLenexaComplete
2378Behaviour of standard exception typesLenexaComplete
2403stof() should call strtof() and wcstof()LenexaComplete
2406negative_binomial_distribution should reject p == 1LenexaComplete
2407packaged_task(allocator_arg_t, const Allocator&, F&&) should neither be constrained nor explicitLenexaComplete
2411shared_ptr is only contextually convertible to boolLenexaComplete
2415Inconsistency between unique_ptr and shared_ptrLenexaComplete
2420function does not discard the return value of the target objectLenexaComplete
2425operator delete(void*, size_t) doesn't invalidate pointers sufficientlyLenexaComplete
2427Container adaptors as sequence containers, reduxLenexaComplete
2428"External declaration" used without being definedLenexaComplete
2433uninitialized_copy()/etc. should tolerate overloaded operator&LenexaComplete
2434shared_ptr::use_count() is efficientLenexaComplete
2437iterator_traits::reference can and can't be voidLenexaComplete
2438std::iterator inheritance shouldn't be mandatedLenexaComplete
2439unique_copy() sometimes can't fall back to reading its outputLenexaComplete
2440seed_seq::size() should be noexceptLenexaComplete
2442call_once() shouldn't DECAY_COPY()LenexaComplete
2448Non-normative Container destructor specificationLenexaComplete
2454Add raw_storage_iterator::base() memberLenexaComplete
2455Allocator default construction should be allowed to throwLenexaComplete
2458N3778 and new library deallocation signaturesLenexaComplete
2459std::polar should require a non-negative rhoLenexaComplete
2464try_emplace and insert_or_assign misspecifiedLenexaComplete
2467is_always_equal has slightly inconsistent defaultLenexaComplete
2470Allocator's destroy function should be allowed to fail to instantiateLenexaComplete
2482[c.strings] Table 73 mentions nonexistent functionsLenexaComplete
2488Placeholders should be allowed and encouraged to be constexprLenexaComplete
1169num_get not fully compatible with strto*KonaComplete
2072Unclear wording about capacity of temporary buffersKonaComplete
2101Some transformation types can produce impossible typesKonaComplete
2111Which unexpected/terminate handler is called from the exception handling runtime?KonaComplete
2119Missing hash specializations for extended integer typesKonaComplete
2127Move-construction with raw_storage_iteratorKonaComplete
2133Attitude to overloaded comma for iteratorsKonaComplete
2156Unordered containers' reserve(n) reserves for n-1 elementsKonaComplete
2218Unclear how containers use allocator_traits::construct()KonaComplete
2219INVOKE-ing a pointer to member with a reference_wrapper as the object expressionKonaComplete
2224Ambiguous status of access to non-live objectsKonaComplete
2234assert() should allow usage in constant expressionsKonaComplete
2244Issue on basic_istream::seekgKonaComplete
2250Follow-up On Library Issue 2207KonaComplete
2259Issues in 17.6.5.5 rules for member functionsKonaComplete
2273regex_match ambiguityKona
2336is_trivially_constructible/is_trivially_assignable traits are always falseKonaComplete
2353std::next is over-constrainedKonaComplete
2367pair and tuple are not correctly implemented for is_constructible with no argsKonaComplete
2380May <cstdlib> provide long ::abs(long) and long long ::abs(long long)?KonaComplete
2384Allocator's deallocate function needs better specificationKonaComplete
2385function::assign allocator argument doesn't make senseKonaComplete
2435reference_wrapper::operator()'s Remark should be deletedKonaComplete
2447Allocators and volatile-qualified value typesKonaComplete
2462std::ios_base::failure is overspecifiedKonaComplete
2466allocator_traits::max_size() default behavior is incorrectKonaComplete
2469Wrong specification of Requires clause of operator[] for map and unordered_mapKonaComplete
2473basic_filebuf's relation to C FILE semanticsKonaComplete
2476scoped_allocator_adaptor is not assignableKonaComplete
2477Inconsistency of wordings in std::vector::erase() and std::deque::erase()KonaComplete
2483throw_with_nested() should use is_finalKonaComplete
2484rethrow_if_nested() is doubly unimplementableKonaComplete
2485get() should be overloaded for const tuple&&KonaComplete
2486mem_fn() should be required to use perfect forwardingKonaComplete
2487bind() should be const-overloaded, not cv-overloadedKonaComplete
2489mem_fn() should be noexceptKonaComplete
2492Clarify requirements for compKonaComplete
2495There is no such thing as an Exception Safety elementKonaComplete
2192Validity and return type of std::abs(0u) is unclearJacksonville
2276Missing requirement on std::promise::set_exceptionJacksonvilleComplete
2296std::addressof should be constexprJacksonvilleComplete (Clang Only)
2450(greater|less|greater_equal|less_equal)<void> do not yield a total order for pointersJacksonvilleComplete
2520N4089 broke initializing unique_ptr<T[]> from a nullptrJacksonvilleComplete
2522[fund.ts.v2] Contradiction in set_default_resource specificationJacksonvilleComplete
2523std::promise synopsis shows two set_value_at_thread_exit()'s for no apparent reasonJacksonvilleComplete
2537Constructors for priority_queue taking allocators should call make_heapJacksonvilleComplete
2539[fund.ts.v2] invocation_trait definition definition doesn't work for surrogate call functionsJacksonville
2545Simplify wording for bind without explicitly specified return typeJacksonvilleComplete
2557Logical operator traits are broken in the zero-argument caseJacksonvilleComplete
2558[fund.ts.v2] Logical operator traits are broken in the zero-argument caseJacksonvilleComplete
2559Error in LWG 2234's resolutionJacksonvilleComplete
2560is_constructible underspecified when applied to a function typeJacksonvilleBroken in 3.6; See r261653.
2565std::function's move constructor should guarantee nothrow for reference_wrappers and function pointersJacksonvilleComplete
2566Requirements on the first template parameter of container adaptorsJacksonvilleComplete
2571§[map.modifiers]/2 imposes nonsensical requirement on insert(InputIterator, InputIterator)JacksonvilleComplete
2572The remarks for shared_ptr::operator* should apply to cv-qualified void as wellJacksonvilleComplete
2574[fund.ts.v2] std::experimental::function::operator=(F&&) should be constrainedJacksonville
2575[fund.ts.v2] experimental::function::assign should be removedJacksonville
2576istream_iterator and ostream_iterator should use std::addressofJacksonvilleComplete
2577{shared,unique}_lock should use std::addressofJacksonvilleComplete
2579Inconsistency wrt Allocators in basic_string assignment vs. basic_string::assignJacksonvilleComplete
2581Specialization of <type_traits> variable templates should be prohibitedJacksonvilleComplete
2582§[res.on.functions]/2's prohibition against incomplete types shouldn't apply to type traitsJacksonvilleComplete
2583There is no way to supply an allocator for basic_string(str, pos)JacksonvilleComplete
2585forward_list::resize(size_type, const value_type&) effects incorrectJacksonvilleComplete
2586Wrong value category used in scoped_allocator_adaptor::construct()Jacksonville
2590Aggregate initialization for std::arrayJacksonvilleComplete
2181Exceptions from seed sequence operationsOuluComplete
2309mutex::lock() should not throw device_or_resource_busyOuluComplete
2310Public exposition only member in std::arrayOuluComplete
2312tuple's constructor constraints need to be phrased more preciselyOuluComplete
2328Rvalue stream extraction should use perfect forwardingOuluComplete
2393std::function's Callable definition is brokenOuluComplete
2422std::numeric_limits<T>::is_modulo description: "most machines" errataOuluComplete
2426Issue about compare_exchangeOulu
2436Comparators for associative containers should always be CopyConstructibleOuluComplete
2441Exact-width atomic typedefs should be providedOuluComplete
2451[fund.ts.v2] optional should 'forward' T's implicit conversionsOulu
2509[fund.ts.v2] any_cast doesn't work with rvalue reference targets and cannot move with a value targetOuluComplete
2516[fund.ts.v2] Public "exposition only" members in observer_ptrOulu
2542Missing const requirements for associative containersOulu
2549Tuple EXPLICIT constructor templates that take tuple parameters end up taking references to temporaries and will create dangling referencesOuluComplete
2550Wording of unordered container's clear() method complexityOuluComplete
2551[fund.ts.v2] "Exception safety" cleanup in library fundamentals requiredOuluComplete
2555[fund.ts.v2] No handling for over-aligned types in optionalOuluComplete
2573[fund.ts.v2] std::hash<std::experimental::shared_ptr> does not work for arraysOulu
2596vector::data() should use addressofOuluComplete
2667path::root_directory() description is confusingOuluComplete
2669recursive_directory_iterator effects refers to non-existent functionsOuluComplete
2670system_complete refers to undefined variable 'base'OuluComplete
2671Errors in CopyOuluComplete
2673status() effects cannot be implemented as specifiedOuluComplete
2674Bidirectional iterator requirement on path::iterator is very expensiveOuluComplete
2683filesystem::copy() says "no effects"OuluComplete
2684priority_queue lacking comparator typedefOuluComplete
2685shared_ptr deleters must not throw on move constructionOuluComplete
2687{inclusive,exclusive}_scan misspecifiedOulu
2688clamp misses preconditions and has extraneous condition on resultOuluComplete
2689Parallel versions of std::copy and std::move shouldn't be in orderOulu
2698Effect of assign() on iterators/pointers/referencesOuluComplete
2704recursive_directory_iterator's members should require '*this is dereferenceable'OuluComplete
2706Error reporting for recursive_directory_iterator::pop() is under-specifiedOuluComplete
2707path construction and assignment should have "string_type&&" overloadsOuluComplete
2709offsetof is unnecessarily impreciseOulu
2710"Effects: Equivalent to ..." doesn't count "Synchronization:" as determined semanticsOuluComplete
2711path is convertible from approximately everything under the sunOuluComplete
2716Specification of shuffle and sample disallows lvalue URNGsOuluComplete
2718Parallelism bug in [algorithms.parallel.exec] p2Oulu
2719permissions function should not be noexcept due to narrow contractOuluComplete
2720permissions function incorrectly specified for symlinksOuluComplete
2721remove_all has incorrect post conditionsOuluComplete
2723Do directory_iterator and recursive_directory_iterator become the end iterator upon error?OuluComplete
2724The protected virtual member functions of memory_resource should be privateOulu
2725filesystem::exists(const path&, error_code&) error reportingOuluComplete
2726[recursive_]directory_iterator::increment(error_code&) is underspecifiedOuluComplete
2727Parallel algorithms with constexpr specifierOulu
2728status(p).permissions() and symlink_status(p).permissions() are not specifiedOuluComplete
2062Effect contradictions w/o no-throw guarantee of std::function swapsIssaquahComplete
2166Heap property underspecified?Issaquah
2221No formatted output operator for nullptrIssaquah
2223shrink_to_fit effect on iterator validityIssaquahComplete
2261Are containers required to use their 'pointer' type internally?Issaquah
2394locale::name specification unclear - what is implementation-defined?IssaquahComplete
2460LWG issue 2408 and value categoriesIssaquahComplete
2468Self-move-assignment of library typesIssaquah
2475Allow overwriting of std::basic_string terminator with charT() to allow cleaner interoperation with legacy APIsIssaquahComplete
2503multiline option should be added to syntax_option_typeIssaquah
2510Tag types should not be DefaultConstructibleIssaquah
2514Type traits must not be finalIssaquahComplete
2518[fund.ts.v2] Non-member swap for propagate_const should call member swapIssaquah
2519Iterator operator-= has gratuitous undefined behaviourIssaquahComplete
2521[fund.ts.v2] weak_ptr's converting move constructor should be modified as well for array supportIssaquah
2525[fund.ts.v2] get_memory_resource should be const and noexceptIssaquah
2527[fund.ts.v2] ALLOCATOR_OF for function::operator= has incorrect defaultIssaquah
2531future::get should explicitly state that the shared state is releasedIssaquah
2534Constrain rvalue stream operatorsIssaquah
2536What should <complex.h> do?IssaquahComplete
2540unordered_multimap::insert hint iteratorIssaquahComplete
2543LWG 2148 (hash support for enum types) seems under-specifiedIssaquahComplete
2544istreambuf_iterator(basic_streambuf* s) effects unclear when s is 0IssaquahComplete
2556Wide contract for future::share()IssaquahComplete
2562Consistent total ordering of pointers by comparison functorsIssaquah
2567Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraitsIssaquahComplete
2568[fund.ts.v2] Specification of logical operator traits uses BaseCharacteristic, which is defined only for UnaryTypeTraits and BinaryTypeTraitsIssaquah
2569conjunction and disjunction requirements are too strictIssaquahComplete
2570[fund.ts.v2] conjunction and disjunction requirements are too strictIssaquah
2578Iterator requirements should reference iterator traitsIssaquahComplete
2584 ECMAScript IdentityEscape is ambiguousIssaquah
2588[fund.ts.v2] "Convertible to bool" requirement in conjunction and disjunctionIssaquah
2589match_results can't satisfy the requirements of a containerIssaquahComplete
2591std::function's member template target() should not lead to undefined behaviourIssaquahComplete
2598addressof works on temporariesIssaquahComplete
2664operator/ (and other append) semantics not useful if argument has rootIssaquahComplete
2665remove_filename() post condition is incorrectIssaquahComplete
2672Should is_empty use error_code in its specification?IssaquahComplete
2678std::filesystem enum classes overspecifiedIssaquahComplete
2679Inconsistent Use of Effects and Equivalent ToIssaquahComplete
2680Add "Equivalent to" to filesystemIssaquahComplete
2681filesystem::copy() cannot copy symlinksIssaquahComplete
2682filesystem::copy() won't create a symlink to a directoryIssaquahComplete
2686Why is std::hash specialized for error_code, but not error_condition?IssaquahComplete
2694Application of LWG 436 accidentally deleted definition of "facet"IssaquahComplete
2696Interaction between make_shared and enable_shared_from_this is underspecifiedIssaquah
2699Missing restriction in [numeric.requirements]IssaquahComplete
2712copy_file(from, to, ...) has a number of unspecified error conditionsIssaquahComplete
2722equivalent incorrectly specifies throws clauseIssaquahComplete
2729Missing SFINAE on std::pair::operator=Issaquah
2732Questionable specification of path::operator/= and path::appendIssaquahComplete
2733[fund.ts.v2] gcd / lcm and boolIssaquahComplete
2735std::abs(short), std::abs(signed char) and others should return int instead of double in order to be compatible with C++98 and CIssaquah
2736nullopt_t insufficiently constrainedIssaquahComplete
2738is_constructible with void typesIssaquahComplete
2739Issue with time_point non-member subtraction with an unsigned durationIssaquahComplete
2740constexpr optional::operator->IssaquahComplete
2742Inconsistent string interface taking string_viewIssaquahComplete
2744any's in_place constructorsIssaquahComplete
2745[fund.ts.v2] Implementability of LWG 2451Issaquah
2747Possibly redundant std::move in [alg.foreach]IssaquahComplete
2748swappable traits for optionalsIssaquahComplete
2749swappable traits for variantsIssaquahComplete
2750[fund.ts.v2] LWG 2451 conversion constructor constraintIssaquah
2752"Throws:" clauses of async and packaged_task are unimplementableIssaquah
2755[string.view.io] uses non-existent basic_string_view::to_string functionIssaquahComplete
2756C++ WP optional should 'forward' T's implicit conversionsIssaquahComplete
2758std::string{}.assign("ABCDE", 0, 1) is ambiguousIssaquahComplete
2759gcd / lcm and bool for the WPIssaquahComplete
2760non-const basic_string::data should not invalidate iteratorsIssaquahComplete
2765Did LWG 1123 go too far?IssaquahComplete
2767not_fn call_wrapper can form invalid typesIssaquahComplete
2769Redundant const in the return type of any_cast(const any&)IssaquahComplete
2771Broken Effects of some basic_string::compare functions in terms of basic_string_viewIssaquahComplete
2773Making std::ignore constexprIssaquahComplete
2777basic_string_view::copy should use char_traits::copyIssaquahComplete
2778basic_string_view is missing constexprIssaquahComplete
2260Missing requirement for Allocator::pointerKona
2676Provide filesystem::path overloads for File-based streamsKona
2768any_cast and move semanticsKonaComplete
2769Redundant const in the return type of any_cast(const any&)KonaComplete
2781Contradictory requirements for std::function and std::reference_wrapperKonaComplete
2782scoped_allocator_adaptor constructors must be constrainedKonaComplete
2784Resolution to LWG 2484 is missing "otherwise, no effects" and is hard to parseKonaComplete
2785quoted should work with basic_string_viewKonaComplete
2786Annex C should mention shared_ptr changes for array supportKonaComplete
2787§[file_status.cons] doesn't match class definitionKonaComplete
2788basic_string range mutators unintentionally require a default constructible allocatorKonaComplete
2789Equivalence of contained objectsKonaComplete
2790Missing specification of istreambuf_iterator::operator->KonaComplete
2794Missing requirements for allocator pointersKona
2795§[global.functions] provides incorrect example of ADL useKonaComplete
2796tuple should be a literal typeKonaComplete
2801Default-constructibility of unique_ptrKonaComplete
2802shared_ptr constructor requirements for a deleterKona
2804Unconditional constexpr default constructor for istream_iteratorKonaComplete
2806Base class of bad_optional_accessKonaComplete
2807std::invoke should use std::is_nothrow_callableKona
2812Range access is available with <string_view>KonaComplete
2824list::sort should say that the order of elements is unspecified if an exception is thrownKona
2826string_view iterators use old wordingKonaComplete
2834Resolution LWG 2223 is missing wording about end iteratorsKonaComplete
2835LWG 2536 seems to misspecify <tgmath.h>Kona
2837gcd and lcm should support a wider range of input valuesKonaComplete
2838is_literal_type specification needs a little cleanupKonaComplete
2842in_place_t check for optional::optional(U&&) should decay UKonaComplete
2850std::function move constructor does unnecessary workKonaComplete
2853Possible inconsistency in specification of erase in [vector.modifiers]KonaComplete
2855std::throw_with_nested("string_literal")KonaComplete
2857{variant,optional,any}::emplace should return the constructed valueKonaComplete
2861basic_string should require that charT match traits::char_typeKonaComplete
2866Incorrect derived classes constraintsKona
2868Missing specification of bad_any_cast::what()KonaComplete
2872Add definition for direct-non-list-initializationKonaComplete
2873Add noexcept to several shared_ptr related functionsKonaComplete
2874Constructor shared_ptr::shared_ptr(Y*) should be constrainedKona
2875shared_ptr::shared_ptr(Y*, D, […]) constructors should be constrainedKona
2876shared_ptr::shared_ptr(const weak_ptr<Y>&) constructor should be constrainedKona
2878Missing DefaultConstructible requirement for istream_iterator default constructorKona
2890The definition of 'object state' applies only to class typesKonaComplete
2900The copy and move constructors of optional are not constexprKonaComplete
2903The form of initialization for the emplace-constructors is not specifiedKona
2904Make variant move-assignment more exception safeKona
2904Make variant move-assignment more exception safeKonaComplete
2905is_constructible_v<unique_ptr<P, D>, P, D const &> should be false when D is not copy constructibleKonaComplete
2908The less-than operator for shared pointers could do moreKona
2911An is_aggregate type trait is neededKonaComplete
2921packaged_task and type-erased allocatorsKona
2934optional<const T> doesn't compare with TKonaComplete

Last Updated: 25-May-2017