svn commit: r353946 - in vendor/libc++/dist: include include/experimental include/ext src src/experimental src/filesystem

Dimitry Andric dim at FreeBSD.org
Wed Oct 23 17:52:34 UTC 2019


Author: dim
Date: Wed Oct 23 17:52:30 2019
New Revision: 353946
URL: https://svnweb.freebsd.org/changeset/base/353946

Log:
  Vendor import of stripped libc++ trunk r375505, the last commit before
  the upstream Subversion repository was made read-only, and the LLVM
  project migrated to GitHub:
  
  https://llvm.org/svn/llvm-project/libcxx/trunk@375505

Added:
  vendor/libc++/dist/include/execution
Modified:
  vendor/libc++/dist/include/__config
  vendor/libc++/dist/include/__functional_base
  vendor/libc++/dist/include/__libcpp_version
  vendor/libc++/dist/include/__locale
  vendor/libc++/dist/include/__mutex_base
  vendor/libc++/dist/include/__split_buffer
  vendor/libc++/dist/include/__string
  vendor/libc++/dist/include/__threading_support
  vendor/libc++/dist/include/__tuple
  vendor/libc++/dist/include/algorithm
  vendor/libc++/dist/include/atomic
  vendor/libc++/dist/include/bit
  vendor/libc++/dist/include/chrono
  vendor/libc++/dist/include/cmath
  vendor/libc++/dist/include/cstdio
  vendor/libc++/dist/include/deque
  vendor/libc++/dist/include/experimental/coroutine
  vendor/libc++/dist/include/ext/hash_map
  vendor/libc++/dist/include/ext/hash_set
  vendor/libc++/dist/include/filesystem
  vendor/libc++/dist/include/fstream
  vendor/libc++/dist/include/functional
  vendor/libc++/dist/include/istream
  vendor/libc++/dist/include/map
  vendor/libc++/dist/include/memory
  vendor/libc++/dist/include/module.modulemap
  vendor/libc++/dist/include/mutex
  vendor/libc++/dist/include/new
  vendor/libc++/dist/include/numeric
  vendor/libc++/dist/include/ostream
  vendor/libc++/dist/include/random
  vendor/libc++/dist/include/regex
  vendor/libc++/dist/include/set
  vendor/libc++/dist/include/string
  vendor/libc++/dist/include/string_view
  vendor/libc++/dist/include/thread
  vendor/libc++/dist/include/tuple
  vendor/libc++/dist/include/type_traits
  vendor/libc++/dist/include/utility
  vendor/libc++/dist/include/vector
  vendor/libc++/dist/src/CMakeLists.txt
  vendor/libc++/dist/src/algorithm.cpp
  vendor/libc++/dist/src/chrono.cpp
  vendor/libc++/dist/src/condition_variable.cpp
  vendor/libc++/dist/src/debug.cpp
  vendor/libc++/dist/src/experimental/memory_resource.cpp
  vendor/libc++/dist/src/filesystem/directory_iterator.cpp
  vendor/libc++/dist/src/filesystem/int128_builtins.cpp
  vendor/libc++/dist/src/filesystem/operations.cpp
  vendor/libc++/dist/src/iostream.cpp
  vendor/libc++/dist/src/memory.cpp
  vendor/libc++/dist/src/mutex.cpp
  vendor/libc++/dist/src/shared_mutex.cpp
  vendor/libc++/dist/src/thread.cpp
  vendor/libc++/dist/src/utility.cpp
  vendor/libc++/dist/src/valarray.cpp

Modified: vendor/libc++/dist/include/__config
==============================================================================
--- vendor/libc++/dist/include/__config	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__config	Wed Oct 23 17:52:30 2019	(r353946)
@@ -32,7 +32,7 @@
 #  define _GNUC_VER_NEW 0
 #endif
 
-#define _LIBCPP_VERSION 9000
+#define _LIBCPP_VERSION 10000
 
 #ifndef _LIBCPP_ABI_VERSION
 #  define _LIBCPP_ABI_VERSION 1
@@ -183,10 +183,6 @@
 #  define _LIBCPP_COMPILER_IBM
 #endif
 
-#ifndef _LIBCPP_CLANG_VER
-#define _LIBCPP_CLANG_VER 0
-#endif
-
 #if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L
 #error "libc++ does not support using GCC with C++03. Please enable C++11"
 #endif
@@ -246,6 +242,7 @@
 
 #ifdef __FreeBSD__
 #  include <sys/endian.h>
+#  include <osreldate.h>
 #  if _BYTE_ORDER == _LITTLE_ENDIAN
 #    define _LIBCPP_LITTLE_ENDIAN
 #  else  // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -483,11 +480,14 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
 
-// No apple compilers support ""d and ""y at this time.
-#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__)
-#define	_LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
+// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1
+#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \
+    (defined(__apple_build_version__) && __apple_build_version__ < 10010000)
+#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS
 #endif
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_GCC)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -523,6 +523,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__))
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__
+
 #elif defined(_LIBCPP_COMPILER_MSVC)
 
 #define _LIBCPP_TOSTRING2(x) #x
@@ -548,6 +550,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #elif defined(_LIBCPP_COMPILER_IBM)
 
 #define _ALIGNAS(x) __attribute__((__aligned__(x)))
@@ -568,6 +572,8 @@ typedef __char32_t char32_t;
 
 #define _LIBCPP_HAS_NO_VECTOR_EXTENSION
 
+#define _LIBCPP_DISABLE_EXTENSION_WARNING
+
 #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
 
 #if defined(_LIBCPP_OBJECT_FORMAT_COFF)
@@ -958,6 +964,20 @@ typedef unsigned int   char32_t;
 #  define _LIBCPP_DEPRECATED_IN_CXX17
 #endif
 
+// Macros to enter and leave a state where deprecation warnings are suppressed.
+#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
+    (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
+#  define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \
+    _Pragma("GCC diagnostic push") \
+    _Pragma("GCC diagnostic ignored \"-Wdeprecated\"")
+#  define _LIBCPP_SUPPRESS_DEPRECATED_POP \
+    _Pragma("GCC diagnostic pop")
+#endif
+#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH)
+#  define _LIBCPP_SUPPRESS_DEPRECATED_PUSH
+#  define _LIBCPP_SUPPRESS_DEPRECATED_POP
+#endif
+
 #if _LIBCPP_STD_VER <= 11
 #  define _LIBCPP_EXPLICIT_AFTER_CXX11
 #else
@@ -1082,6 +1102,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 #  endif // _LIBCPP_HAS_THREAD_API
 #endif // _LIBCPP_HAS_NO_THREADS
 
+#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+#if defined(__ANDROID__) && __ANDROID_API__ >= 30
+#define _LIBCPP_HAS_COND_CLOCKWAIT
+#elif defined(_LIBCPP_GLIBC_PREREQ)
+#if _LIBCPP_GLIBC_PREREQ(2, 30)
+#define _LIBCPP_HAS_COND_CLOCKWAIT
+#endif
+#endif
+#endif
+
 #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 #error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \
        _LIBCPP_HAS_NO_THREADS is not defined.
@@ -1097,17 +1127,35 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
        _LIBCPP_HAS_NO_THREADS is defined.
 #endif
 
-// The Apple, glibc, and Bionic implementation of pthreads implements
+#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
+#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
+#define __STDCPP_THREADS__ 1
+#endif
+
+// The glibc and Bionic implementation of pthreads implements
 // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32
 // mutexes have no destroy mechanism.
-// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after
-// speaking to their respective stakeholders.
+//
+// This optimization can't be performed on Apple platforms, where
+// pthread_mutex_destroy can allow the kernel to release resources.
+// See https://llvm.org/D64298 for details.
+//
+// TODO(EricWF): Enable this optimization on Bionic after speaking to their
+//               respective stakeholders.
 #if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \
   || defined(_LIBCPP_HAS_THREAD_API_WIN32)
 # define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION
 #endif
 
 // Destroying a condvar is a nop on Windows.
+//
+// This optimization can't be performed on Apple platforms, where
+// pthread_cond_destroy can allow the kernel to release resources.
+// See https://llvm.org/D64298 for details.
+//
 // TODO(EricWF): This is potentially true for some pthread implementations
 // as well.
 #if defined(_LIBCPP_HAS_THREAD_API_WIN32)
@@ -1129,6 +1177,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 #define _LIBCPP_HAS_NO_STDOUT
 #endif
 
+// Some systems do not provide gets() in their C library, for security reasons.
+#ifndef _LIBCPP_C_HAS_NO_GETS
+#  if defined(_LIBCPP_MSVCRT) || \
+      (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)
+#    define _LIBCPP_C_HAS_NO_GETS
+#  endif
+#endif
+
 #if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
     defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
@@ -1224,7 +1280,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 
 #ifndef _LIBCPP_NODEBUG_TYPE
 #if __has_attribute(__nodebug__) && \
-    (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900)
+    (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900)
 #define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug))
 #else
 #define _LIBCPP_NODEBUG_TYPE
@@ -1410,6 +1466,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 #endif // _LIBCPP_NO_AUTO_LINK
 
 #define _LIBCPP_UNUSED_VAR(x) ((void)(x))
+
+// Configures the fopen close-on-exec mode character, if any. This string will
+// be appended to any mode string used by fstream for fopen/fdopen.
+//
+// Not all platforms support this, but it helps avoid fd-leaks on platforms that
+// do.
+#if defined(__BIONIC__)
+#  define _LIBCPP_FOPEN_CLOEXEC_MODE "e"
+#else
+#  define _LIBCPP_FOPEN_CLOEXEC_MODE
+#endif
 
 #endif // __cplusplus
 

Modified: vendor/libc++/dist/include/__functional_base
==============================================================================
--- vendor/libc++/dist/include/__functional_base	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__functional_base	Wed Oct 23 17:52:30 2019	(r353946)
@@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up,
 
 // allocator_arg_t
 
-struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
+struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; };
 
 #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
 extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg;

Modified: vendor/libc++/dist/include/__libcpp_version
==============================================================================
--- vendor/libc++/dist/include/__libcpp_version	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__libcpp_version	Wed Oct 23 17:52:30 2019	(r353946)
@@ -1 +1 @@
-9000
+10000

Modified: vendor/libc++/dist/include/__locale
==============================================================================
--- vendor/libc++/dist/include/__locale	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__locale	Wed Oct 23 17:52:30 2019	(r353946)
@@ -409,7 +409,7 @@ class _LIBCPP_TYPE_VIS ctype_base (public)
     static const mask xdigit = _ISxdigit;
     static const mask blank  = _ISblank;
 #if defined(__mips__)
-    static const mask __regex_word = static_cast<char_class_type>(_ISbit(15));
+    static const mask __regex_word = static_cast<mask>(_ISbit(15));
 #else
     static const mask __regex_word = 0x80;
 #endif

Modified: vendor/libc++/dist/include/__mutex_base
==============================================================================
--- vendor/libc++/dist/include/__mutex_base	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__mutex_base	Wed Oct 23 17:52:30 2019	(r353946)
@@ -15,6 +15,7 @@
 #include <system_error>
 #include <__threading_support>
 
+#include <time.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -65,9 +66,9 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATIO
 static_assert(is_nothrow_default_constructible<mutex>::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 {};
+struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; };
+struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; };
+struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; };
 
 #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY)
 
@@ -94,10 +95,11 @@ lock_guard (private)
     mutex_type& __m_;
 public:
 
-    _LIBCPP_INLINE_VISIBILITY
+    _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
     explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m))
         : __m_(__m) {__m_.lock();}
-    _LIBCPP_INLINE_VISIBILITY
+
+    _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY
     lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
         : __m_(__m) {}
     _LIBCPP_INLINE_VISIBILITY
@@ -336,25 +338,77 @@ class _LIBCPP_TYPE_VIS condition_variable (public)
 private:
     void __do_timed_wait(unique_lock<mutex>& __lk,
        chrono::time_point<chrono::system_clock, chrono::nanoseconds>) _NOEXCEPT;
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+    void __do_timed_wait(unique_lock<mutex>& __lk,
+       chrono::time_point<chrono::steady_clock, chrono::nanoseconds>) _NOEXCEPT;
+#endif
+    template <class _Clock>
+    void __do_timed_wait(unique_lock<mutex>& __lk,
+       chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT;
 };
 #endif // !_LIBCPP_HAS_NO_THREADS
 
-template <class _To, class _Rep, class _Period>
+template <class _Rep, class _Period>
 inline _LIBCPP_INLINE_VISIBILITY
 typename enable_if
 <
-    chrono::__is_duration<_To>::value,
-    _To
+    is_floating_point<_Rep>::value,
+    chrono::nanoseconds
 >::type
-__ceil(chrono::duration<_Rep, _Period> __d)
+__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
 {
     using namespace chrono;
-    _To __r = duration_cast<_To>(__d);
-    if (__r < __d)
-        ++__r;
-    return __r;
+    using __ratio = ratio_divide<_Period, nano>;
+    using __ns_rep = nanoseconds::rep;
+    _Rep __result_float = __d.count() * __ratio::num / __ratio::den;
+
+    _Rep __result_max = numeric_limits<__ns_rep>::max();
+    if (__result_float >= __result_max) {
+        return nanoseconds::max();
+    }
+
+    _Rep __result_min = numeric_limits<__ns_rep>::min();
+    if (__result_float <= __result_min) {
+        return nanoseconds::min();
+    }
+
+    return nanoseconds(static_cast<__ns_rep>(__result_float));
 }
 
+template <class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY
+typename enable_if
+<
+    !is_floating_point<_Rep>::value,
+    chrono::nanoseconds
+>::type
+__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
+{
+    using namespace chrono;
+    if (__d.count() == 0) {
+        return nanoseconds(0);
+    }
+
+    using __ratio = ratio_divide<_Period, nano>;
+    using __ns_rep = nanoseconds::rep;
+    __ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
+    if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
+        return nanoseconds::max();
+    }
+
+    __ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
+    if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
+        return nanoseconds::min();
+    }
+
+    __ns_rep __result = __d.count() * __ratio::num / __ratio::den;
+    if (__result == 0) {
+        return nanoseconds(1);
+    }
+
+    return nanoseconds(__result);
+}
+
 #ifndef _LIBCPP_HAS_NO_THREADS
 template <class _Predicate>
 void
@@ -370,7 +424,15 @@ condition_variable::wait_until(unique_lock<mutex>& __l
                                const chrono::time_point<_Clock, _Duration>& __t)
 {
     using namespace chrono;
-    wait_for(__lk, __t - _Clock::now());
+    using __clock_tp_ns = time_point<_Clock, nanoseconds>;
+
+    typename _Clock::time_point __now = _Clock::now();
+    if (__t <= __now)
+        return cv_status::timeout;
+
+    __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch()));
+
+    __do_timed_wait(__lk, __t_ns);
     return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
 }
 
@@ -396,15 +458,25 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
     using namespace chrono;
     if (__d <= __d.zero())
         return cv_status::timeout;
-    typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
-    typedef time_point<system_clock, nanoseconds> __sys_tpi;
-    __sys_tpf _Max = __sys_tpi::max();
+    using __ns_rep = nanoseconds::rep;
     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<nanoseconds>(__d));
-    else
-        __do_timed_wait(__lk, __sys_tpi::max());
+
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+    using __clock_tp_ns = time_point<steady_clock, nanoseconds>;
+    __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count();
+#else
+    using __clock_tp_ns = time_point<system_clock, nanoseconds>;
+    __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count();
+#endif
+
+    __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count();
+
+    if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) {
+        __do_timed_wait(__lk, __clock_tp_ns::max());
+    } else {
+        __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count)));
+    }
+
     return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
                                                  cv_status::timeout;
 }
@@ -418,6 +490,46 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
 {
     return wait_until(__lk, chrono::steady_clock::now() + __d,
                       _VSTD::move(__pred));
+}
+
+#if defined(_LIBCPP_HAS_COND_CLOCKWAIT)
+inline
+void
+condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
+     chrono::time_point<chrono::steady_clock, chrono::nanoseconds> __tp) _NOEXCEPT
+{
+    using namespace chrono;
+    if (!__lk.owns_lock())
+        __throw_system_error(EPERM,
+                            "condition_variable::timed wait: mutex not locked");
+    nanoseconds __d = __tp.time_since_epoch();
+    timespec __ts;
+    seconds __s = duration_cast<seconds>(__d);
+    using __ts_sec = decltype(__ts.tv_sec);
+    const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max();
+    if (__s.count() < __ts_sec_max)
+    {
+        __ts.tv_sec = static_cast<__ts_sec>(__s.count());
+        __ts.tv_nsec = (__d - __s).count();
+    }
+    else
+    {
+        __ts.tv_sec = __ts_sec_max;
+        __ts.tv_nsec = giga::num - 1;
+    }
+    int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts);
+    if (__ec != 0 && __ec != ETIMEDOUT)
+        __throw_system_error(__ec, "condition_variable timed_wait failed");
+}
+#endif // _LIBCPP_HAS_COND_CLOCKWAIT
+
+template <class _Clock>
+inline
+void
+condition_variable::__do_timed_wait(unique_lock<mutex>& __lk,
+     chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT
+{
+    wait_for(__lk, __tp - _Clock::now());
 }
 
 #endif // !_LIBCPP_HAS_NO_THREADS

Modified: vendor/libc++/dist/include/__split_buffer
==============================================================================
--- vendor/libc++/dist/include/__split_buffer	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__split_buffer	Wed Oct 23 17:52:30 2019	(r353946)
@@ -161,6 +161,19 @@ struct __split_buffer (private)
     _LIBCPP_INLINE_VISIBILITY
     void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT
         {}
+
+    struct _ConstructTransaction {
+      explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT
+      : __pos_(*__p), __end_(*__p + __n), __dest_(__p) {
+      }
+      ~_ConstructTransaction() {
+        *__dest_ = __pos_;
+      }
+      pointer __pos_;
+     const pointer __end_;
+    private:
+     pointer *__dest_;
+    };
 };
 
 template <class _Tp, class _Allocator>
@@ -197,13 +210,10 @@ template <class _Tp, class _Allocator>
 void
 __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
 {
-    __alloc_rr& __a = this->__alloc();
-    do
-    {
-        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_));
-        ++this->__end_;
-        --__n;
-    } while (__n > 0);
+    _ConstructTransaction __tx(&this->__end_, __n);
+    for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+        __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(__tx.__pos_));
+    }
 }
 
 //  Copy constructs __n objects starting at __end_ from __x
@@ -216,13 +226,11 @@ template <class _Tp, class _Allocator>
 void
 __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
 {
-    __alloc_rr& __a = this->__alloc();
-    do
-    {
-        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x);
-        ++this->__end_;
-        --__n;
-    } while (__n > 0);
+    _ConstructTransaction __tx(&this->__end_, __n);
+    for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
+        __alloc_traits::construct(this->__alloc(),
+            _VSTD::__to_raw_pointer(__tx.__pos_), __x);
+    }
 }
 
 template <class _Tp, class _Allocator>
@@ -262,11 +270,10 @@ typename enable_if
 >::type
 __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
 {
-    __alloc_rr& __a = this->__alloc();
-    for (; __first != __last; ++__first)
-    {
-        __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first);
-        ++this->__end_;
+    _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
+    for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
+        __alloc_traits::construct(this->__alloc(),
+            _VSTD::__to_raw_pointer(__tx.__pos_), *__first);
     }
 }
 

Modified: vendor/libc++/dist/include/__string
==============================================================================
--- vendor/libc++/dist/include/__string	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__string	Wed Oct 23 17:52:30 2019	(r353946)
@@ -351,6 +351,18 @@ char_traits<wchar_t>::compare(const char_type* __s1, c
 #endif
 }
 
+
+template <class _Traits>
+_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR
+inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT {
+#if _LIBCPP_DEBUG_LEVEL >= 1
+  return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0);
+#else
+  return _Traits::length(__s);
+#endif
+}
+
 inline _LIBCPP_CONSTEXPR_AFTER_CXX14
 size_t
 char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT

Modified: vendor/libc++/dist/include/__threading_support
==============================================================================
--- vendor/libc++/dist/include/__threading_support	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__threading_support	Wed Oct 23 17:52:30 2019	(r353946)
@@ -12,6 +12,7 @@
 
 #include <__config>
 #include <chrono>
+#include <iosfwd>
 #include <errno.h>
 
 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
@@ -22,16 +23,11 @@
 # include <__external_threading>
 #elif !defined(_LIBCPP_HAS_NO_THREADS)
 
-typedef ::timespec __libcpp_timespec_t;
-
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 # include <pthread.h>
 # include <sched.h>
 #endif
 
-_LIBCPP_PUSH_MACROS
-#include <__undef_macros>
-
 #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
     defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \
     defined(_LIBCPP_HAS_THREAD_API_WIN32)
@@ -46,8 +42,16 @@ _LIBCPP_PUSH_MACROS
 #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
 #endif
 
+typedef ::timespec __libcpp_timespec_t;
+#endif // !defined(_LIBCPP_HAS_NO_THREADS)
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
+#if !defined(_LIBCPP_HAS_NO_THREADS)
+
 #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
 // Mutex
 typedef pthread_mutex_t __libcpp_mutex_t;
@@ -75,7 +79,7 @@ typedef pthread_t __libcpp_thread_t;
 typedef pthread_key_t __libcpp_tls_key;
 
 #define _LIBCPP_TLS_DESTRUCTOR_CC
-#else
+#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 // Mutex
 typedef void* __libcpp_mutex_t;
 #define _LIBCPP_MUTEX_INITIALIZER 0
@@ -108,8 +112,9 @@ typedef void* __libcpp_thread_t;
 typedef long __libcpp_tls_key;
 
 #define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall
-#endif
+#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 
+#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
 // Mutex
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m);
@@ -204,6 +209,8 @@ void *__libcpp_tls_get(__libcpp_tls_key __key);
 _LIBCPP_THREAD_ABI_VISIBILITY
 int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
 
+#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
+
 #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
      defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \
     defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
@@ -394,10 +401,90 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p
 
 #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL
 
-_LIBCPP_END_NAMESPACE_STD
+class _LIBCPP_TYPE_VIS thread;
+class _LIBCPP_TYPE_VIS __thread_id;
 
-_LIBCPP_POP_MACROS
+namespace this_thread
+{
 
+_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
+
+}  // this_thread
+
+template<> struct hash<__thread_id>;
+
+class _LIBCPP_TEMPLATE_VIS __thread_id
+{
+    // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
+    // NULL is the no-thread value on Darwin.  Someone needs to check
+    // on other platforms.  We assume 0 works everywhere for now.
+    __libcpp_thread_id __id_;
+
+public:
+    _LIBCPP_INLINE_VISIBILITY
+    __thread_id() _NOEXCEPT : __id_(0) {}
+
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT
+        { // don't pass id==0 to underlying routines
+        if (__x.__id_ == 0) return __y.__id_ == 0;
+        if (__y.__id_ == 0) return false;
+        return __libcpp_thread_id_equal(__x.__id_, __y.__id_);
+        }
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__x == __y);}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT
+        { // id==0 is always less than any other thread_id
+        if (__x.__id_ == 0) return __y.__id_ != 0;
+        if (__y.__id_ == 0) return false;
+        return  __libcpp_thread_id_less(__x.__id_, __y.__id_);
+        }
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__y < __x);}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return   __y < __x ;}
+    friend _LIBCPP_INLINE_VISIBILITY
+        bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT
+        {return !(__x < __y);}
+
+    _LIBCPP_INLINE_VISIBILITY
+    void __reset() { __id_ = 0; }
+    
+    template<class _CharT, class _Traits>
+    friend
+    _LIBCPP_INLINE_VISIBILITY
+    basic_ostream<_CharT, _Traits>&
+    operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id);
+
+private:
+    _LIBCPP_INLINE_VISIBILITY
+    __thread_id(__libcpp_thread_id __id) : __id_(__id) {}
+
+    friend __thread_id this_thread::get_id() _NOEXCEPT;
+    friend class _LIBCPP_TYPE_VIS thread;
+    friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>;
+};
+
+namespace this_thread
+{
+
+inline _LIBCPP_INLINE_VISIBILITY
+__thread_id
+get_id() _NOEXCEPT
+{
+    return __libcpp_thread_get_current_id();
+}
+
+}  // this_thread
+
 #endif // !_LIBCPP_HAS_NO_THREADS
+
+_LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
 
 #endif // _LIBCPP_THREADING_SUPPORT

Modified: vendor/libc++/dist/include/__tuple
==============================================================================
--- vendor/libc++/dist/include/__tuple	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/__tuple	Wed Oct 23 17:52:30 2019	(r353946)
@@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __
                               >;
 
 struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
-    template <class ...>
-    static constexpr bool __enable_default() { return false; }
+
+    static constexpr bool __enable_explicit_default() { return false; }
+    static constexpr bool __enable_implicit_default() { return false; }
     template <class ...>
     static constexpr bool __enable_explicit() { return false; }
     template <class ...>

Modified: vendor/libc++/dist/include/algorithm
==============================================================================
--- vendor/libc++/dist/include/algorithm	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/algorithm	Wed Oct 23 17:52:30 2019	(r353946)
@@ -3117,10 +3117,10 @@ _SampleIterator __sample(_PopulationIterator __first,
                          input_iterator_tag) {
 
   _Distance __k = 0;
-  for (; __first != __last && __k < __n; ++__first, (void)++__k)
+  for (; __first != __last && __k < __n; ++__first, (void) ++__k)
     __output_iter[__k] = *__first;
   _Distance __sz = __k;
-  for (; __first != __last; ++__first, (void)++__k) {
+  for (; __first != __last; ++__first, (void) ++__k) {
     _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
     if (__r < __sz)
       __output_iter[__r] = *__first;
@@ -3190,7 +3190,7 @@ template<class _RandomAccessIterator, class _UniformRa
     if (__d > 1)
     {
         _Dp __uid;
-        for (--__last, --__d; __first < __last; ++__first, --__d)
+        for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d)
         {
             difference_type __i = __uid(__g, _Pp(0, __d));
             if (__i != difference_type(0))
@@ -3373,7 +3373,7 @@ __stable_partition(_ForwardIterator __first, _ForwardI
         // All trues now at start of range, all falses in buffer
         // Move falses back into range, but don't mess up __first which points to first false
         __i = __first;
-        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
             *__i = _VSTD::move(*__t2);
         // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
         return __first;
@@ -3505,7 +3505,7 @@ __stable_partition(_BidirectionalIterator __first, _Bi
         __i = ++__first;
         // All trues now at start of range, all falses in buffer
         // Move falses back into range, but don't mess up __first which points to first false
-        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i)
+        for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i)
             *__i = _VSTD::move(*__t2);
         // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer
         return __first;
@@ -4382,7 +4382,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last
 {
     typedef typename iterator_traits<_InputIterator1>::value_type __v1;
     typedef typename iterator_traits<_InputIterator2>::value_type __v2;
-    return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
+    return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>());
 }
 
 // inplace_merge
@@ -4428,14 +4428,14 @@ __buffered_inplace_merge(_BidirectionalIterator __firs
     if (__len1 <= __len2)
     {
         value_type* __p = __buff;
-        for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+        for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
             ::new(__p) value_type(_VSTD::move(*__i));
         __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp);
     }
     else
     {
         value_type* __p = __buff;
-        for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p)
+        for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p)
             ::new(__p) value_type(_VSTD::move(*__i));
         typedef reverse_iterator<_BidirectionalIterator> _RBi;
         typedef reverse_iterator<value_type*> _Rv;
@@ -4575,14 +4575,14 @@ __merge_move_construct(_InputIterator1 __first1, _Inpu
     {
         if (__first1 == __last1)
         {
-            for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0))
+            for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0))
                 ::new (__result) value_type(_VSTD::move(*__first2));
             __h.release();
             return;
         }
         if (__first2 == __last2)
         {
-            for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0))
+            for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0))
                 ::new (__result) value_type(_VSTD::move(*__first1));
             __h.release();
             return;
@@ -4612,7 +4612,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt
     {
         if (__first2 == __last2)
         {
-            for (; __first1 != __last1; ++__first1, ++__result)
+            for (; __first1 != __last1; ++__first1, (void) ++__result)
                 *__result = _VSTD::move(*__first1);
             return;
         }
@@ -4627,7 +4627,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt
             ++__first1;
         }
     }
-    for (; __first2 != __last2; ++__first2, ++__result)
+    for (; __first2 != __last2; ++__first2, (void) ++__result)
         *__result = _VSTD::move(*__first2);
 }
 
@@ -4995,7 +4995,7 @@ void
 __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
 {
     typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
-    for (difference_type __n = __last - __first; __n > 1; --__last, --__n)
+    for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n)
         __pop_heap<_Compare>(__first, __last, __comp, __n);
 }
 
@@ -5065,7 +5065,7 @@ __partial_sort_copy(_InputIterator __first, _InputIter
     _RandomAccessIterator __r = __result_first;
     if (__r != __result_last)
     {
-        for (; __first != __last && __r != __result_last; (void) ++__first, ++__r)
+        for (; __first != __last && __r != __result_last; ++__first, (void) ++__r)
             *__r = *__first;
         __make_heap<_Compare>(__result_first, __r, __comp);
         typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first;
@@ -5677,5 +5677,9 @@ prev_permutation(_BidirectionalIterator __first, _Bidi
 _LIBCPP_END_NAMESPACE_STD
 
 _LIBCPP_POP_MACROS
+
+#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
+#   include <__pstl_algorithm>
+#endif
 
 #endif  // _LIBCPP_ALGORITHM

Modified: vendor/libc++/dist/include/atomic
==============================================================================
--- vendor/libc++/dist/include/atomic	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/atomic	Wed Oct 23 17:52:30 2019	(r353946)
@@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl {
 #endif // _LIBCPP_CXX03_LANG
   _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT
     : __a_value(value) {}
-  _Atomic(_Tp) __a_value;
+  _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value;
 };
 
 #define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s)

Modified: vendor/libc++/dist/include/bit
==============================================================================
--- vendor/libc++/dist/include/bit	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/bit	Wed Oct 23 17:52:30 2019	(r353946)
@@ -42,6 +42,13 @@ namespace std {
   template<class T>
     constexpr int popcount(T x) noexcept;     // C++20
 
+  // 20.15.9, endian 
+  enum class endian {
+    little = see below,        // C++20
+    big = see below,           // C++20
+    native = see below         // C++20
+};
+
 } // namespace std
 
 */
@@ -455,6 +462,20 @@ log2p1(_Tp __t) noexcept
 {
     return __t == 0 ? 0 : __bit_log2(__t) + 1;
 }
+
+
+enum class endian
+{
+    little = 0xDEAD,
+    big    = 0xFACE,
+#if defined(_LIBCPP_LITTLE_ENDIAN)
+    native = little
+#elif defined(_LIBCPP_BIG_ENDIAN)
+    native = big
+#else
+    native = 0xCAFE
+#endif
+};
 
 #endif // _LIBCPP_STD_VER > 17
 

Modified: vendor/libc++/dist/include/chrono
==============================================================================
--- vendor/libc++/dist/include/chrono	Wed Oct 23 17:52:26 2019	(r353945)
+++ vendor/libc++/dist/include/chrono	Wed Oct 23 17:52:30 2019	(r353946)
@@ -612,14 +612,44 @@ constexpr year_month_weekday_last
 constexpr year_month_weekday_last
   operator/(const month_weekday_last& mwdl, int y) noexcept;
 
-// 25.9, class template time_of_day    // C++20
-template<class Duration> class time_of_day;
+// 26.9, class template hh_mm_ss
+template <class Duration>
+class hh_mm_ss
+{
+    bool            is_neg; // exposition only
+    chrono::hours   h;      // exposition only
+    chrono::minutes m;      // exposition only
+    chrono::seconds s;      // exposition only
+    precision       ss;     // exposition only
 
-template<> class time_of_day<hours>;
-template<> class time_of_day<minutes>;
-template<> class time_of_day<seconds>;
-template<class Rep, class Period> class time_of_day<duration<Rep, Period>>;
+public:
+    static unsigned constexpr fractional_width = see below;
+    using precision                            = see below;
 
+    constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {}
+    constexpr explicit hh_mm_ss(Duration d) noexcept;
+
+    constexpr bool is_negative() const noexcept;
+    constexpr chrono::hours hours() const noexcept;
+    constexpr chrono::minutes minutes() const noexcept;
+    constexpr chrono::seconds seconds() const noexcept;
+    constexpr precision subseconds() const noexcept;
+
+    constexpr explicit operator  precision()   const noexcept;
+    constexpr          precision to_duration() const noexcept;
+};
+
+template <class charT, class traits, class Duration>
+  basic_ostream<charT, traits>&
+    operator<<(basic_ostream<charT, traits>& os, hh_mm_ss<Duration> const& hms);
+
+// 26.10, 12/24 hour functions
+constexpr bool is_am(hours const& h) noexcept;
+constexpr bool is_pm(hours const& h) noexcept;
+constexpr hours make12(const hours& h) noexcept;
+constexpr hours make24(const hours& h, bool is_pm) noexcept;
+
+
 // 25.10.2, time zone database     // C++20
 struct tzdb;
 class tzdb_list;
@@ -1428,7 +1458,7 @@ typename enable_if
 >::type
 abs(duration<_Rep, _Period> __d)
 {
-    return __d >= __d.zero() ? __d : -__d;
+    return __d >= __d.zero() ? +__d : -__d;
 }
 #endif
 
@@ -1810,7 +1840,7 @@ class weekday { (private)
     unsigned char __wd;
 public:
   weekday() = default;
-  inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val)) {}
+  inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast<unsigned char>(__val == 7 ? 0 : __val)) {}
   inline constexpr          weekday(const sys_days& __sysd) noexcept
           : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {}
   inline explicit constexpr weekday(const local_days& __locd) noexcept
@@ -1822,7 +1852,8 @@ class weekday { (private)
   inline constexpr weekday  operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; }
          constexpr weekday& operator+=(const days& __dd) noexcept;
          constexpr weekday& operator-=(const days& __dd) noexcept;
-  inline explicit constexpr operator unsigned() const noexcept { return __wd; }
+  inline constexpr unsigned c_encoding()   const noexcept { return __wd; }
+  inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; }
   inline constexpr bool ok() const noexcept { return __wd <= 6; }
          constexpr weekday_indexed operator[](unsigned __index) const noexcept;
          constexpr weekday_last    operator[](last_spec) const noexcept;
@@ -1842,7 +1873,7 @@ unsigned char weekday::__weekday_from_days(int __days)
 
 inline constexpr
 bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) == static_cast<unsigned>(__rhs); }
+{ return __lhs.c_encoding() == __rhs.c_encoding(); }
 
 inline constexpr
 bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept
@@ -1850,7 +1881,7 @@ bool operator!=(const weekday& __lhs, const weekday& _
 
 inline constexpr
 bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept
-{ return static_cast<unsigned>(__lhs) <  static_cast<unsigned>(__rhs); }
+{ return __lhs.c_encoding() < __rhs.c_encoding(); }
 
 inline constexpr
 bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept
@@ -1866,7 +1897,7 @@ bool operator>=(const weekday& __lhs, const weekday& _
 
 constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept
 {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list