summaryrefslogtreecommitdiffstats
path: root/contrib/libc++
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libc++')
-rw-r--r--contrib/libc++/CREDITS.TXT2
-rw-r--r--contrib/libc++/include/__bit_reference8
-rw-r--r--contrib/libc++/include/__bsd_locale_defaults.h4
-rw-r--r--contrib/libc++/include/__bsd_locale_fallbacks.h36
-rw-r--r--contrib/libc++/include/__config322
-rw-r--r--contrib/libc++/include/__debug2
-rw-r--r--contrib/libc++/include/__functional_038
-rw-r--r--contrib/libc++/include/__functional_base47
-rw-r--r--contrib/libc++/include/__hash_table76
-rw-r--r--contrib/libc++/include/__libcpp_version2
-rw-r--r--contrib/libc++/include/__locale35
-rw-r--r--contrib/libc++/include/__mutex_base42
-rw-r--r--contrib/libc++/include/__split_buffer37
-rw-r--r--contrib/libc++/include/__std_stream8
-rw-r--r--contrib/libc++/include/__string8
-rw-r--r--contrib/libc++/include/__threading_support126
-rw-r--r--contrib/libc++/include/__tree53
-rw-r--r--contrib/libc++/include/__tuple17
-rw-r--r--contrib/libc++/include/__undef_macros (renamed from contrib/libc++/include/__undef_min_max)11
-rw-r--r--contrib/libc++/include/algorithm194
-rw-r--r--contrib/libc++/include/any28
-rw-r--r--contrib/libc++/include/array7
-rw-r--r--contrib/libc++/include/atomic65
-rw-r--r--contrib/libc++/include/bitset30
-rw-r--r--contrib/libc++/include/chrono20
-rw-r--r--contrib/libc++/include/cmath18
-rw-r--r--contrib/libc++/include/complex158
-rw-r--r--contrib/libc++/include/condition_variable2
-rw-r--r--contrib/libc++/include/cstddef32
-rw-r--r--contrib/libc++/include/cstdio6
-rw-r--r--contrib/libc++/include/cstdlib2
-rw-r--r--contrib/libc++/include/ctype.h9
-rw-r--r--contrib/libc++/include/deque194
-rw-r--r--contrib/libc++/include/exception155
-rw-r--r--contrib/libc++/include/experimental/__config7
-rw-r--r--contrib/libc++/include/experimental/algorithm9
-rw-r--r--contrib/libc++/include/experimental/any9
-rw-r--r--contrib/libc++/include/experimental/coroutine296
-rw-r--r--contrib/libc++/include/experimental/dynarray7
-rw-r--r--contrib/libc++/include/experimental/filesystem52
-rw-r--r--contrib/libc++/include/experimental/functional9
-rw-r--r--contrib/libc++/include/experimental/memory_resource17
-rw-r--r--contrib/libc++/include/experimental/numeric44
-rw-r--r--contrib/libc++/include/experimental/optional37
-rw-r--r--contrib/libc++/include/experimental/string_view5
-rw-r--r--contrib/libc++/include/ext/hash_map8
-rw-r--r--contrib/libc++/include/ext/hash_set2
-rw-r--r--contrib/libc++/include/forward_list136
-rw-r--r--contrib/libc++/include/fstream47
-rw-r--r--contrib/libc++/include/functional321
-rw-r--r--contrib/libc++/include/future70
-rw-r--r--contrib/libc++/include/initializer_list4
-rw-r--r--contrib/libc++/include/ios5
-rw-r--r--contrib/libc++/include/istream35
-rw-r--r--contrib/libc++/include/iterator65
-rw-r--r--contrib/libc++/include/limits29
-rw-r--r--contrib/libc++/include/list116
-rw-r--r--contrib/libc++/include/locale140
-rw-r--r--contrib/libc++/include/map103
-rw-r--r--contrib/libc++/include/math.h503
-rw-r--r--contrib/libc++/include/memory2190
-rw-r--r--contrib/libc++/include/module.modulemap7
-rw-r--r--contrib/libc++/include/mutex192
-rw-r--r--contrib/libc++/include/new42
-rw-r--r--contrib/libc++/include/numeric291
-rw-r--r--contrib/libc++/include/optional325
-rw-r--r--contrib/libc++/include/ostream14
-rw-r--r--contrib/libc++/include/queue79
-rw-r--r--contrib/libc++/include/random304
-rw-r--r--contrib/libc++/include/ratio8
-rw-r--r--contrib/libc++/include/regex33
-rw-r--r--contrib/libc++/include/set91
-rw-r--r--contrib/libc++/include/shared_mutex22
-rw-r--r--contrib/libc++/include/sstream43
-rw-r--r--contrib/libc++/include/stack33
-rw-r--r--contrib/libc++/include/stddef.h3
-rw-r--r--contrib/libc++/include/stdexcept6
-rw-r--r--contrib/libc++/include/stdio.h6
-rw-r--r--contrib/libc++/include/stdlib.h4
-rw-r--r--contrib/libc++/include/streambuf7
-rw-r--r--contrib/libc++/include/string276
-rw-r--r--contrib/libc++/include/string_view33
-rw-r--r--contrib/libc++/include/strstream20
-rw-r--r--contrib/libc++/include/system_error2
-rw-r--r--contrib/libc++/include/thread62
-rw-r--r--contrib/libc++/include/tuple110
-rw-r--r--contrib/libc++/include/type_traits95
-rw-r--r--contrib/libc++/include/typeinfo8
-rw-r--r--contrib/libc++/include/unordered_map144
-rw-r--r--contrib/libc++/include/unordered_set130
-rw-r--r--contrib/libc++/include/utility703
-rw-r--r--contrib/libc++/include/valarray76
-rw-r--r--contrib/libc++/include/variant112
-rw-r--r--contrib/libc++/include/vector146
-rw-r--r--contrib/libc++/include/wchar.h9
-rw-r--r--contrib/libc++/src/chrono.cpp2
-rw-r--r--contrib/libc++/src/condition_variable.cpp2
-rw-r--r--contrib/libc++/src/exception.cpp327
-rw-r--r--contrib/libc++/src/experimental/filesystem/directory_iterator.cpp109
-rw-r--r--contrib/libc++/src/experimental/filesystem/filesystem_time_helper.h173
-rw-r--r--contrib/libc++/src/experimental/filesystem/operations.cpp213
-rw-r--r--contrib/libc++/src/experimental/filesystem/path.cpp27
-rw-r--r--contrib/libc++/src/functional.cpp26
-rw-r--r--contrib/libc++/src/include/atomic_support.h2
-rw-r--r--contrib/libc++/src/include/refstring.h (renamed from contrib/libc++/include/__refstring)6
-rw-r--r--contrib/libc++/src/ios.cpp1
-rw-r--r--contrib/libc++/src/iostream.cpp16
-rw-r--r--contrib/libc++/src/locale.cpp69
-rw-r--r--contrib/libc++/src/memory.cpp47
-rw-r--r--contrib/libc++/src/mutex.cpp12
-rw-r--r--contrib/libc++/src/new.cpp167
-rw-r--r--contrib/libc++/src/stdexcept.cpp2
-rw-r--r--contrib/libc++/src/string.cpp5
-rw-r--r--contrib/libc++/src/strstream.cpp1
-rw-r--r--contrib/libc++/src/support/runtime/exception_fallback.ipp182
-rw-r--r--contrib/libc++/src/support/runtime/exception_glibcxx.ipp38
-rw-r--r--contrib/libc++/src/support/runtime/exception_libcxxabi.ipp28
-rw-r--r--contrib/libc++/src/support/runtime/exception_libcxxrt.ipp41
-rw-r--r--contrib/libc++/src/support/runtime/exception_msvc.ipp89
-rw-r--r--contrib/libc++/src/support/runtime/exception_pointer_cxxabi.ipp74
-rw-r--r--contrib/libc++/src/support/runtime/exception_pointer_glibcxx.ipp78
-rw-r--r--contrib/libc++/src/support/runtime/exception_pointer_msvc.ipp95
-rw-r--r--contrib/libc++/src/support/runtime/exception_pointer_unimplemented.ipp80
-rw-r--r--contrib/libc++/src/support/runtime/new_handler_fallback.ipp27
-rw-r--r--contrib/libc++/src/system_error.cpp8
-rw-r--r--contrib/libc++/src/thread.cpp46
-rw-r--r--contrib/libc++/src/typeinfo.cpp68
-rw-r--r--contrib/libc++/src/vector.cpp16
128 files changed, 6859 insertions, 4684 deletions
diff --git a/contrib/libc++/CREDITS.TXT b/contrib/libc++/CREDITS.TXT
index 1311e05..92123d7 100644
--- a/contrib/libc++/CREDITS.TXT
+++ b/contrib/libc++/CREDITS.TXT
@@ -81,7 +81,7 @@ E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes.
N: Michael Park
-E: mpark@apache.org
+E: mcypark@gmail.com
D: Implementation of <variant>.
N: Arvid Picciani
diff --git a/contrib/libc++/include/__bit_reference b/contrib/libc++/include/__bit_reference
index 9aea961..3e4a21d 100644
--- a/contrib/libc++/include/__bit_reference
+++ b/contrib/libc++/include/__bit_reference
@@ -14,12 +14,14 @@
#include <__config>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
@@ -1273,4 +1275,6 @@ private:
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___BIT_REFERENCE
diff --git a/contrib/libc++/include/__bsd_locale_defaults.h b/contrib/libc++/include/__bsd_locale_defaults.h
index f315ca2..cbc407d 100644
--- a/contrib/libc++/include/__bsd_locale_defaults.h
+++ b/contrib/libc++/include/__bsd_locale_defaults.h
@@ -15,6 +15,10 @@
#ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H
#define _LIBCPP_BSD_LOCALE_DEFAULTS_H
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
diff --git a/contrib/libc++/include/__bsd_locale_fallbacks.h b/contrib/libc++/include/__bsd_locale_fallbacks.h
index cbc8ad2..5e9e094 100644
--- a/contrib/libc++/include/__bsd_locale_fallbacks.h
+++ b/contrib/libc++/include/__bsd_locale_fallbacks.h
@@ -15,31 +15,33 @@
#define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H
#include <stdlib.h>
+#include <stdarg.h>
#include <memory>
-_LIBCPP_BEGIN_NAMESPACE_STD
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
-typedef _VSTD::remove_pointer<locale_t>::type __use_locale_struct;
-typedef _VSTD::unique_ptr<__use_locale_struct, decltype(&uselocale)> __locale_raii;
+_LIBCPP_BEGIN_NAMESPACE_STD
inline _LIBCPP_ALWAYS_INLINE
decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return MB_CUR_MAX;
}
inline _LIBCPP_ALWAYS_INLINE
wint_t __libcpp_btowc_l(int __c, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return btowc(__c);
}
inline _LIBCPP_ALWAYS_INLINE
int __libcpp_wctob_l(wint_t __c, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return wctob(__c);
}
@@ -47,14 +49,14 @@ inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
size_t __len, mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
}
inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return wcrtomb(__s, __wc, __ps);
}
@@ -62,7 +64,7 @@ inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
size_t __len, mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
}
@@ -70,28 +72,28 @@ inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return mbrtowc(__pwc, __s, __n, __ps);
}
inline _LIBCPP_ALWAYS_INLINE
int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return mbtowc(__pwc, __pmb, __max);
}
inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return mbrlen(__s, __n, __ps);
}
inline _LIBCPP_ALWAYS_INLINE
lconv *__libcpp_localeconv_l(locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return localeconv();
}
@@ -99,7 +101,7 @@ inline _LIBCPP_ALWAYS_INLINE
size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l)
{
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
return mbsrtowcs(__dest, __src, __len, __ps);
}
@@ -107,7 +109,7 @@ inline
int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
int __res = vsnprintf(__s, __n, __format, __va);
va_end(__va);
return __res;
@@ -117,7 +119,7 @@ inline
int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
int __res = vasprintf(__s, __format, __va);
va_end(__va);
return __res;
@@ -127,7 +129,7 @@ inline
int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
va_list __va;
va_start(__va, __format);
- __locale_raii __current( uselocale(__l), uselocale );
+ __libcpp_locale_guard __current(__l);
int __res = vsscanf(__s, __format, __va);
va_end(__va);
return __res;
diff --git a/contrib/libc++/include/__config b/contrib/libc++/include/__config
index 340c573..f15d2d0 100644
--- a/contrib/libc++/include/__config
+++ b/contrib/libc++/include/__config
@@ -12,8 +12,10 @@
#define _LIBCPP_CONFIG
#if defined(_MSC_VER) && !defined(__clang__)
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#endif
+#endif
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
@@ -23,16 +25,30 @@
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
+// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
+// introduced in GCC 5.0.
+#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
#else
#define _GNUC_VER 0
+#define _GNUC_VER_NEW 0
#endif
-#define _LIBCPP_VERSION 4000
+#define _LIBCPP_VERSION 5000
#ifndef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
#endif
+#if defined(__ELF__)
+#define _LIBCPP_OBJECT_FORMAT_ELF 1
+#elif defined(__MACH__)
+#define _LIBCPP_OBJECT_FORMAT_MACHO 1
+#elif defined(_WIN32)
+#define _LIBCPP_OBJECT_FORMAT_COFF 1
+#else
+#error Unknown object file format
+#endif
+
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
// Change short string representation so that string data starts at offset 0,
// improving its alignment in some cases.
@@ -47,7 +63,6 @@
#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
-#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
// provided under the alternate keyword __nullptr, which changes the mangling
// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
@@ -57,10 +72,21 @@
// `pointer_safety` and `get_pointer_safety()` will no longer be available
// in C++03.
#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
+// Define a key function for `bad_function_call` in the library, to centralize
+// its vtable and typeinfo to libc++ rather than having all other libraries
+// using that class define their own copies.
+#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+
+// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
+#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
#elif _LIBCPP_ABI_VERSION == 1
-#if !defined(_WIN32)
-// Enable compiling a definition of error_category() into the libc++ dylib.
-#define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
+#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
+// Enable compiling copies of now inline methods into the dylib to support
+// applications compiled against older libraries. This is unnecessary with
+// COFF dllexport semantics, since dllexport forces a non-inline definition
+// of inline functions to be emitted anyway. Our own non-inline copy would
+// conflict with the dllexport-emitted copy, so we disable it.
+#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
#endif
// Feature macros for disabling pre ABI v1 features. All of these options
// are deprecated.
@@ -100,6 +126,17 @@
#ifndef __is_identifier
#define __is_identifier(__x) 1
#endif
+#ifndef __has_declspec_attribute
+#define __has_declspec_attribute(__x) 0
+#endif
+
+#define __has_keyword(__x) !(__is_identifier(__x))
+
+#ifdef __has_include
+#define __libcpp_has_include(__x) __has_include(__x)
+#else
+#define __libcpp_has_include(__x) 0
+#endif
#if defined(__clang__)
#define _LIBCPP_COMPILER_CLANG
@@ -115,7 +152,7 @@
#endif
#ifndef _LIBCPP_CLANG_VER
-# define _LIBCPP_CLANG_VER 0
+#define _LIBCPP_CLANG_VER 0
#endif
// FIXME: ABI detection should be done via compiler builtin macros. This
@@ -186,18 +223,33 @@
#endif // __NetBSD__
#if defined(_WIN32)
-# define _LIBCPP_WIN32API 1
+# define _LIBCPP_WIN32API
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# define _LIBCPP_SHORT_WCHAR 1
-
-// If mingw not explicitly detected, assume using MS C runtime only.
-# ifndef __MINGW32__
+// Both MinGW and native MSVC provide a "MSVC"-like enviroment
+# define _LIBCPP_MSVCRT_LIKE
+// If mingw not explicitly detected, assume using MS C runtime only if
+// a MS compatibility version is specified.
+# if defined(_MSC_VER) && !defined(__MINGW32__)
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
# endif
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
# define _LIBCPP_HAS_BITSCAN64
# endif
+# if defined(_LIBCPP_MSVCRT)
+# define _LIBCPP_HAS_QUICK_EXIT
+# endif
+
+// Some CRT APIs are unavailable to store apps
+#if defined(WINAPI_FAMILY)
+#include <winapifamily.h>
+#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
+ (!defined(WINAPI_PARTITION_SYSTEM) || \
+ !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
+#define _LIBCPP_WINDOWS_STORE_APP
+#endif
+#endif
#endif // defined(_WIN32)
#ifdef __sun__
@@ -241,7 +293,7 @@
# endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
-#if __has_attribute(__no_sanitize__)
+#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
#define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
#else
#define _LIBCPP_NO_CFI
@@ -252,7 +304,7 @@
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
- !defined(__arm__)) || \
+ (!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
#endif
@@ -274,7 +326,7 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_EXCEPTIONS
#endif
-#if !(__has_feature(cxx_rtti))
+#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
#define _LIBCPP_NO_RTTI
#endif
@@ -297,7 +349,7 @@ typedef __char32_t char32_t;
#endif
#if !(__has_feature(cxx_nullptr))
-# if __has_extension(cxx_nullptr) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
+# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
# define nullptr __nullptr
# else
# define _LIBCPP_HAS_NO_NULLPTR
@@ -335,7 +387,6 @@ typedef __char32_t char32_t;
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
-#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
@@ -472,14 +523,13 @@ namespace std {
#endif // __GXX_EXPERIMENTAL_CXX0X__
-#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
+#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
-namespace _LIBCPP_NAMESPACE {
-}
-using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
+ inline namespace _LIBCPP_NAMESPACE {
+ }
}
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
@@ -551,14 +601,6 @@ namespace std {
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
-#if defined(__ELF__)
-#define _LIBCPP_OBJECT_FORMAT_ELF 1
-#elif defined(__MACH__)
-#define _LIBCPP_OBJECT_FORMAT_MACHO 1
-#else
-#define _LIBCPP_OBJECT_FORMAT_COFF 1
-#endif
-
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
# define _LIBCPP_DLL_VIS
@@ -579,10 +621,11 @@ namespace std {
#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
+#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
#define _LIBCPP_HIDDEN
+#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
#define _LIBCPP_TEMPLATE_VIS
-#define _LIBCPP_FUNC_VIS_ONLY
#define _LIBCPP_ENUM_VIS
#if defined(_LIBCPP_COMPILER_MSVC)
@@ -604,6 +647,15 @@ namespace std {
#endif
#endif
+#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
+// The inline should be removed once PR32114 is resolved
+#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
+#else
+#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+#endif
+#endif
+
#ifndef _LIBCPP_FUNC_VIS
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
@@ -614,22 +666,26 @@ namespace std {
#ifndef _LIBCPP_TYPE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
-# if __has_attribute(__type_visibility__)
-# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
-# else
-# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
-# endif
+# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
# else
# define _LIBCPP_TYPE_VIS
# endif
#endif
#ifndef _LIBCPP_TEMPLATE_VIS
-# define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_VIS
+# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
+# if __has_attribute(__type_visibility__)
+# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
+# else
+# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
+# endif
+# else
+# define _LIBCPP_TEMPLATE_VIS
+# endif
#endif
-#ifndef _LIBCPP_FUNC_VIS_ONLY
-# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
+#ifndef _LIBCPP_EXTERN_VIS
+# define _LIBCPP_EXTERN_VIS
#endif
#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
@@ -654,7 +710,7 @@ namespace std {
#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
-# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default")))
+# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
# else
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
# endif
@@ -739,7 +795,7 @@ template <unsigned> struct __static_assert_check {};
#ifdef _LIBCPP_HAS_NO_DECLTYPE
// GCC 4.6 provides __decltype in all standard modes.
-#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
+#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
# define decltype(__x) __decltype(__x)
#else
# define decltype(__x) __typeof__(__x)
@@ -802,7 +858,14 @@ template <unsigned> struct __static_assert_check {};
# else
# error Supported values for _LIBCPP_DEBUG are 0 and 1
# endif
+# if !defined(_LIBCPP_BUILDING_LIBRARY)
# define _LIBCPP_EXTERN_TEMPLATE(...)
+# endif
+#endif
+
+#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
+#define _LIBCPP_EXTERN_TEMPLATE(...)
+#define _LIBCPP_EXTERN_TEMPLATE2(...)
#endif
#ifndef _LIBCPP_EXTERN_TEMPLATE
@@ -858,8 +921,10 @@ template <unsigned> struct __static_assert_check {};
# define _LIBCPP_STD_VER 11
# elif __cplusplus <= 201402L
# define _LIBCPP_STD_VER 14
+# elif __cplusplus <= 201703L
+# define _LIBCPP_STD_VER 17
# else
-# define _LIBCPP_STD_VER 16 // current year, or date of c++17 ratification
+# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
# endif
#endif // _LIBCPP_STD_VER
@@ -912,7 +977,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI
-# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
+# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
# define _LIBCPP_NO_RTTI
# endif
#endif
@@ -923,14 +988,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
// Thread API
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
- !defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
+ !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
+ !defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
+ !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
# if defined(__FreeBSD__) || \
defined(__Fuchsia__) || \
defined(__NetBSD__) || \
defined(__linux__) || \
defined(__APPLE__) || \
defined(__CloudABI__) || \
- defined(__sun__)
+ defined(__sun__) || \
+ (defined(__MINGW32__) && __libcpp_has_include(<pthread.h>))
# define _LIBCPP_HAS_THREAD_API_PTHREAD
# elif defined(_LIBCPP_WIN32API)
# define _LIBCPP_HAS_THREAD_API_WIN32
@@ -945,7 +1013,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#endif
#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
-# error _LIBCPP_HAS_EXTERNAL_THREAD_API may not be defined when \
+# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
_LIBCPP_HAS_NO_THREADS is defined.
#endif
@@ -970,7 +1038,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#endif
#if defined(__BIONIC__) || defined(__CloudABI__) || \
- defined(_LIBCPP_HAS_MUSL_LIBC)
+ defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
@@ -980,7 +1048,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif
-#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
+#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
#define _LIBCPP_HAS_C_ATOMIC_IMP
#elif _GNUC_VER > 407
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
@@ -995,10 +1063,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
#endif
-#if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
- && __has_attribute(acquire_capability))
+#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
+#if defined(__clang__) && __has_attribute(acquire_capability)
+// Work around the attribute handling in clang. When both __declspec and
+// __attribute__ are present, the processing goes awry preventing the definition
+// of the types.
+#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
#endif
+#endif
+#endif
#if __has_attribute(require_constant_initialization)
#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
@@ -1007,7 +1081,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#endif
#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
-#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
+# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
#endif
#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
@@ -1016,6 +1090,158 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
#endif
#endif
+#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
+# define _LIBCPP_DIAGNOSE_WARNING(...) \
+ __attribute__((diagnose_if(__VA_ARGS__, "warning")))
+# define _LIBCPP_DIAGNOSE_ERROR(...) \
+ __attribute__((diagnose_if(__VA_ARGS__, "error")))
+#else
+# define _LIBCPP_DIAGNOSE_WARNING(...)
+# define _LIBCPP_DIAGNOSE_ERROR(...)
+#endif
+
+#if __has_attribute(fallthough) || _GNUC_VER >= 700
+// Use a function like macro to imply that it must be followed by a semicolon
+#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
+#else
+#define _LIBCPP_FALLTHROUGH() ((void)0)
+#endif
+
+#if defined(_LIBCPP_ABI_MICROSOFT) && \
+ (defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
+# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
+#else
+# define _LIBCPP_DECLSPEC_EMPTY_BASES
+#endif
+
+#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
+# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
+# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
+# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
+# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
+#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
+
+#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
+# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
+#endif
+
+#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
+# define _LIBCPP_HAS_NO_IS_AGGREGATE
+#endif
+
+#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
+# define _LIBCPP_HAS_NO_COROUTINES
+#endif
+
+// Decide whether to use availability macros.
+#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
+ !defined(_LIBCPP_DISABLE_AVAILABILITY) && \
+ __has_feature(attribute_availability_with_strict) && \
+ __has_feature(attribute_availability_in_templates)
+#ifdef __APPLE__
+#define _LIBCPP_USE_AVAILABILITY_APPLE
+#endif
+#endif
+
+// Define availability macros.
+#if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
+#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
+ __attribute__((availability(macosx,strict,introduced=10.12))) \
+ __attribute__((availability(ios,strict,introduced=10.0))) \
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
+ __attribute__((availability(watchos,strict,introduced=3.0)))
+#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
+#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
+#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
+#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
+ __attribute__((availability(macosx,strict,introduced=10.12))) \
+ __attribute__((availability(ios,strict,introduced=10.0))) \
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
+ __attribute__((availability(watchos,strict,introduced=3.0)))
+#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
+ __attribute__((availability(macosx,strict,introduced=10.12))) \
+ __attribute__((availability(ios,strict,introduced=10.0))) \
+ __attribute__((availability(tvos,strict,introduced=10.0))) \
+ __attribute__((availability(watchos,strict,introduced=3.0)))
+#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
+ __attribute__((availability(ios,strict,introduced=6.0)))
+#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
+ __attribute__((availability(macosx,strict,introduced=10.9))) \
+ __attribute__((availability(ios,strict,introduced=7.0)))
+#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
+ __attribute__((availability(macosx,strict,introduced=10.9))) \
+ __attribute__((availability(ios,strict,introduced=7.0)))
+#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
+ __attribute__((availability(macosx,strict,introduced=10.9))) \
+ __attribute__((availability(ios,strict,introduced=7.0)))
+#else
+#define _LIBCPP_AVAILABILITY_SHARED_MUTEX
+#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
+#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
+#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
+#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
+#define _LIBCPP_AVAILABILITY_FUTURE_ERROR
+#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
+#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
+#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
+#endif
+
+// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
+#ifdef _LIBCPP_NO_EXCEPTIONS
+#define _LIBCPP_AVAILABILITY_DYNARRAY
+#define _LIBCPP_AVAILABILITY_FUTURE
+#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
+#else
+#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
+#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
+#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \
+ _LIBCPP_AVAILABILITY_BAD_ANY_CAST
+#endif
+
+// Availability of stream API in the dylib got dropped and re-added. The
+// extern template should effectively be available at:
+// availability(macosx,introduced=10.9)
+// availability(ios,introduced=7.0)
+#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \
+ ((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
+ __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
+ (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
+ __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
+#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
+#endif
+
+#if defined(_LIBCPP_COMPILER_IBM)
+#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
+#endif
+
+#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
+# define _LIBCPP_PUSH_MACROS
+# define _LIBCPP_POP_MACROS
+#else
+ // Don't warn about macro conflicts when we can restore them at the
+ // end of the header.
+# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
+# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
+# endif
+# if defined(_LIBCPP_COMPILER_MSVC)
+# define _LIBCPP_PUSH_MACROS \
+ __pragma(push_macro("min")) \
+ __pragma(push_macro("max"))
+# define _LIBCPP_POP_MACROS \
+ __pragma(pop_macro("min")) \
+ __pragma(pop_macro("max"))
+# else
+# define _LIBCPP_PUSH_MACROS \
+ _Pragma("push_macro(\"min\")") \
+ _Pragma("push_macro(\"max\")")
+# define _LIBCPP_POP_MACROS \
+ _Pragma("pop_macro(\"min\")") \
+ _Pragma("pop_macro(\"max\")")
+# endif
+#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
+
+
#endif // __cplusplus
#endif // _LIBCPP_CONFIG
diff --git a/contrib/libc++/include/__debug b/contrib/libc++/include/__debug
index d95e339..d01bacd 100644
--- a/contrib/libc++/include/__debug
+++ b/contrib/libc++/include/__debug
@@ -74,7 +74,7 @@ typedef void(*__libcpp_debug_function_type)(__libcpp_debug_info const&);
/// __libcpp_debug_function - The handler function called when a _LIBCPP_ASSERT
/// fails.
-extern __libcpp_debug_function_type __libcpp_debug_function;
+extern _LIBCPP_EXTERN_VIS __libcpp_debug_function_type __libcpp_debug_function;
/// __libcpp_abort_debug_function - A debug handler that aborts when called.
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
diff --git a/contrib/libc++/include/__functional_03 b/contrib/libc++/include/__functional_03
index 1db7082..13d8a3d 100644
--- a/contrib/libc++/include/__functional_03
+++ b/contrib/libc++/include/__functional_03
@@ -704,7 +704,7 @@ function<_Rp()>::target()
{
if (__f_ == 0)
return (_Tp*)0;
- return (_Tp*)__f_->target(typeid(_Tp));
+ return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
}
template<class _Rp>
@@ -980,7 +980,7 @@ function<_Rp(_A0)>::target()
{
if (__f_ == 0)
return (_Tp*)0;
- return (_Tp*)__f_->target(typeid(_Tp));
+ return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
}
template<class _Rp, class _A0>
@@ -1256,7 +1256,7 @@ function<_Rp(_A0, _A1)>::target()
{
if (__f_ == 0)
return (_Tp*)0;
- return (_Tp*)__f_->target(typeid(_Tp));
+ return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
}
template<class _Rp, class _A0, class _A1>
@@ -1532,7 +1532,7 @@ function<_Rp(_A0, _A1, _A2)>::target()
{
if (__f_ == 0)
return (_Tp*)0;
- return (_Tp*)__f_->target(typeid(_Tp));
+ return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
}
template<class _Rp, class _A0, class _A1, class _A2>
diff --git a/contrib/libc++/include/__functional_base b/contrib/libc++/include/__functional_base
index 05c9f06..79017fe 100644
--- a/contrib/libc++/include/__functional_base
+++ b/contrib/libc++/include/__functional_base
@@ -16,6 +16,7 @@
#include <typeinfo>
#include <exception>
#include <new>
+#include <utility>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -23,13 +24,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Arg, class _Result>
-struct _LIBCPP_TEMPLATE_VIS unary_function
-{
- typedef _Arg argument_type;
- typedef _Result result_type;
-};
-
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_TEMPLATE_VIS binary_function
{
@@ -257,7 +251,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
@@ -302,10 +296,6 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
typedef _Rp result_type;
};
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_CXX03_LANG
-
template <class _Tp, class ..._Args>
struct __invoke_return
{
@@ -322,7 +312,7 @@ struct __invoke_return
template <class _Ret>
struct __invoke_void_return_wrapper
{
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class ..._Args>
static _Ret __call(_Args&&... __args) {
return __invoke(_VSTD::forward<_Args>(__args)...);
@@ -353,7 +343,7 @@ struct __invoke_void_return_wrapper
template <>
struct __invoke_void_return_wrapper<void>
{
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class ..._Args>
static void __call(_Args&&... __args) {
__invoke(_VSTD::forward<_Args>(__args)...);
@@ -395,7 +385,7 @@ public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
: __f_(_VSTD::addressof(__f)) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
@@ -403,7 +393,7 @@ public:
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
@@ -516,7 +506,7 @@ public:
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
return __invoke(get(), __a0, __a1, __a2);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
};
@@ -558,23 +548,20 @@ template <class _Tp> void cref(const _Tp&&) = delete;
#endif
#if _LIBCPP_STD_VER > 11
-template <class _Tp1, class _Tp2 = void>
-struct __is_transparent
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_transparent* = 0);
-public:
- static const bool value = sizeof(__test<_Tp1>(0)) == 1;
-};
+template <class _Tp, class, class = void>
+struct __is_transparent : false_type {};
+
+template <class _Tp, class _Up>
+struct __is_transparent<_Tp, _Up,
+ typename __void_t<typename _Tp::is_transparent>::type>
+ : true_type {};
#endif
// allocator_arg_t
struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
-#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
+#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
#else
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
@@ -617,7 +604,7 @@ template <class _Tp, class _Alloc>
constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
#endif
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
// allocator construction
@@ -669,7 +656,7 @@ void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&...
__storage, __a, _VSTD::forward<_Args>(__args)...
);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/__hash_table b/contrib/libc++/include/__hash_table
index e082e6c..3f430af 100644
--- a/contrib/libc++/include/__hash_table
+++ b/contrib/libc++/include/__hash_table
@@ -18,8 +18,7 @@
#include <algorithm>
#include <cmath>
#include <utility>
-
-#include <__undef_min_max>
+#include <type_traits>
#include <__debug>
@@ -27,9 +26,12 @@
#pragma GCC system_header
#endif
-_LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+_LIBCPP_BEGIN_NAMESPACE_STD
+
#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp>
union __hash_value_type;
@@ -38,6 +40,15 @@ template <class _Key, class _Tp>
struct __hash_value_type;
#endif
+template <class _Key, class _Cp, class _Hash,
+ bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
+class __unordered_map_hasher;
+
+template <class _Key, class _Cp, class _Pred,
+ bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
+ >
+class __unordered_map_equal;
+
#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
struct __is_hash_value_type_imp : false_type {};
@@ -126,7 +137,7 @@ inline _LIBCPP_INLINE_VISIBILITY
size_t
__next_hash_pow2(size_t __n)
{
- return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
+ return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));
}
@@ -788,8 +799,7 @@ public:
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
: __data_(__size, __a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
@@ -797,8 +807,7 @@ public:
{
__x.size() = 0;
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
_LIBCPP_INLINE_VISIBILITY
size_type& size() _NOEXCEPT {return __data_.first();}
@@ -856,6 +865,37 @@ public:
template <class> friend class __hash_map_node_destructor;
};
+
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Key, class _Hash, class _Equal, class _Alloc>
+struct __diagnose_hash_table_helper {
+ static constexpr bool __trigger_diagnostics()
+ _LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key, _Hash>::value
+ && !__invokable<_Hash const&, _Key const&>::value,
+ "the specified hash functor does not provide a const call operator")
+ _LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
+ && !__invokable<_Equal const&, _Key const&, _Key const&>::value,
+ "the specified comparator type does not provide a const call operator")
+ {
+ static_assert(__check_hash_requirements<_Key, _Hash>::value,
+ "the specified hash does not meet the Hash requirements");
+ static_assert(is_copy_constructible<_Equal>::value,
+ "the specified comparator is required to be copy constructible");
+ return true;
+ }
+};
+
+template <class _Key, class _Value, class _Hash, class _Equal, class _Alloc>
+struct __diagnose_hash_table_helper<
+ __hash_value_type<_Key, _Value>,
+ __unordered_map_hasher<_Key, __hash_value_type<_Key, _Value>, _Hash>,
+ __unordered_map_equal<_Key, __hash_value_type<_Key, _Value>, _Equal>,
+ _Alloc>
+: __diagnose_hash_table_helper<_Key, _Hash, _Equal, _Alloc>
+{
+};
+#endif // _LIBCPP_CXX03_LANG
+
template <class _Tp, class _Hash, class _Equal, class _Alloc>
class __hash_table
{
@@ -918,6 +958,10 @@ private:
typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
+#ifndef _LIBCPP_CXX03_LANG
+ static_assert(__diagnose_hash_table_helper<_Tp, _Hash, _Equal, _Alloc>::__trigger_diagnostics(), "");
+#endif
+
// --- Member data begin ---
__bucket_list __bucket_list_;
__compressed_pair<__first_node, __node_allocator> __p1_;
@@ -1357,7 +1401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql,
const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
- __p1_(__node_allocator(__a)),
+ __p1_(__second_tag(), __node_allocator(__a)),
__p2_(0, __hf),
__p3_(1.0f, __eql)
{
@@ -1366,7 +1410,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
- __p1_(__node_allocator(__a)),
+ __p1_(__second_tag(), __node_allocator(__a)),
__p2_(0),
__p3_(1.0f)
{
@@ -1378,7 +1422,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
__bucket_list_deleter(allocator_traits<__pointer_allocator>::
select_on_container_copy_construction(
__u.__bucket_list_.get_deleter().__alloc()), 0)),
- __p1_(allocator_traits<__node_allocator>::
+ __p1_(__second_tag(), allocator_traits<__node_allocator>::
select_on_container_copy_construction(__u.__node_alloc())),
__p2_(0, __u.hash_function()),
__p3_(__u.__p3_)
@@ -1389,7 +1433,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
- __p1_(__node_allocator(__a)),
+ __p1_(__second_tag(), __node_allocator(__a)),
__p2_(0, __u.hash_function()),
__p3_(__u.__p3_)
{
@@ -1423,7 +1467,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
const allocator_type& __a)
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
- __p1_(__node_allocator(__a)),
+ __p1_(__second_tag(), __node_allocator(__a)),
__p2_(0, _VSTD::move(__u.hash_function())),
__p3_(_VSTD::move(__u.__p3_))
{
@@ -1449,10 +1493,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
template <class _Tp, class _Hash, class _Equal, class _Alloc>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
{
+#if defined(_LIBCPP_CXX03_LANG)
static_assert((is_copy_constructible<key_equal>::value),
"Predicate must be copy-constructible.");
static_assert((is_copy_constructible<hasher>::value),
"Hasher must be copy-constructible.");
+#endif
+
__deallocate_node(__p1_.first().__next_);
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__erase_c(this);
@@ -2621,6 +2668,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
}
#endif // _LIBCPP_DEBUG_LEVEL >= 2
+
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP__HASH_TABLE
diff --git a/contrib/libc++/include/__libcpp_version b/contrib/libc++/include/__libcpp_version
index a211371..e9c02da 100644
--- a/contrib/libc++/include/__libcpp_version
+++ b/contrib/libc++/include/__libcpp_version
@@ -1 +1 @@
-4000 \ No newline at end of file
+5000
diff --git a/contrib/libc++/include/__locale b/contrib/libc++/include/__locale
index f4882de..91ed9e7 100644
--- a/contrib/libc++/include/__locale
+++ b/contrib/libc++/include/__locale
@@ -19,7 +19,7 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
+#if defined(_LIBCPP_MSVCRT_LIKE)
# include <support/win32/locale_win32.h>
#elif defined(_AIX)
# include <support/ibm/xlocale.h>
@@ -34,12 +34,14 @@
# include <support/solaris/xlocale.h>
#elif defined(_NEWLIB_VERSION)
# include <support/newlib/xlocale.h>
-#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
+#elif (defined(__APPLE__) || defined(__FreeBSD__) \
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
# include <xlocale.h>
+#elif defined(__Fuchsia__)
+# include <support/fuchsia/xlocale.h>
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
# include <support/musl/xlocale.h>
-#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -47,6 +49,25 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS) || defined(_LIBCPP_MSVCRT)
+struct __libcpp_locale_guard {
+ _LIBCPP_INLINE_VISIBILITY
+ __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ ~__libcpp_locale_guard() {
+ if (__old_loc_)
+ uselocale(__old_loc_);
+ }
+
+ locale_t __old_loc_;
+private:
+ __libcpp_locale_guard(__libcpp_locale_guard const&);
+ __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
+};
+#endif
+
+
class _LIBCPP_TYPE_VIS locale;
template <class _Facet>
@@ -67,6 +88,7 @@ public:
class _LIBCPP_TYPE_VIS id;
typedef int category;
+ _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
static const category // values assigned here are for exposition only
none = 0,
collate = LC_COLLATE_MASK,
@@ -92,13 +114,16 @@ public:
const locale& operator=(const locale&) _NOEXCEPT;
- template <class _Facet> locale combine(const locale&) const;
+ template <class _Facet>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ locale combine(const locale&) const;
// locale operations:
string name() const;
bool operator==(const locale&) const;
bool operator!=(const locale& __y) const {return !(*this == __y);}
template <class _CharT, class _Traits, class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
const basic_string<_CharT, _Traits, _Allocator>&) const;
@@ -342,7 +367,7 @@ public:
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
-#elif defined(_LIBCPP_MSVCRT)
+#elif defined(_LIBCPP_MSVCRT_LIKE)
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
diff --git a/contrib/libc++/include/__mutex_base b/contrib/libc++/include/__mutex_base
index 21638ee..3b2453f 100644
--- a/contrib/libc++/include/__mutex_base
+++ b/contrib/libc++/include/__mutex_base
@@ -16,10 +16,15 @@
#include <system_error>
#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
@@ -34,7 +39,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
{
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
__libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
#else
__libcpp_mutex_t __m_;
@@ -42,8 +47,8 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut
public:
_LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
- constexpr mutex() _NOEXCEPT = default;
+#ifndef _LIBCPP_CXX03_LANG
+ constexpr mutex() = default;
#else
mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
#endif
@@ -62,11 +67,14 @@ public:
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
};
+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 {};
-#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
+#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;
@@ -80,21 +88,9 @@ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
#endif
-
-// Forward declare lock_guard as a variadic template even in C++03 to keep
-// the mangling consistent between dialects.
-#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
-template <class ..._Mutexes>
-class _LIBCPP_TEMPLATE_VIS lock_guard;
-#endif
-
template <class _Mutex>
class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable)
-#if !defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
lock_guard
-#else
-lock_guard<_Mutex>
-#endif
{
public:
typedef _Mutex mutex_type;
@@ -162,7 +158,7 @@ private:
unique_lock& operator=(unique_lock const&); // = delete;
public:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u) _NOEXCEPT
: __m_(__u.__m_), __owns_(__u.__owns_)
@@ -179,7 +175,7 @@ public:
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
void lock();
bool try_lock();
@@ -291,7 +287,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
class _LIBCPP_TYPE_VIS condition_variable
{
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
__libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
#else
__libcpp_condvar_t __cv_;
@@ -299,7 +295,7 @@ class _LIBCPP_TYPE_VIS condition_variable
public:
_LIBCPP_INLINE_VISIBILITY
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
constexpr condition_variable() _NOEXCEPT = default;
#else
condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
@@ -316,20 +312,24 @@ public:
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
template <class _Predicate>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t);
template <class _Clock, class _Duration, class _Predicate>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
template <class _Rep, class _Period>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d);
@@ -435,4 +435,6 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___MUTEX_BASE
diff --git a/contrib/libc++/include/__split_buffer b/contrib/libc++/include/__split_buffer
index 79d1aa1..1daa4e5 100644
--- a/contrib/libc++/include/__split_buffer
+++ b/contrib/libc++/include/__split_buffer
@@ -6,12 +6,14 @@
#include <type_traits>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <bool>
@@ -66,7 +68,7 @@ public:
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
@@ -74,7 +76,7 @@ public:
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
@@ -99,14 +101,12 @@ public:
void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#ifndef _LIBCPP_CXX03_LANG
void push_front(value_type&& __x);
void push_back(value_type&& __x);
-#if !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args>
void emplace_back(_Args&&... __args);
-#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#endif // !defined(_LIBCPP_CXX03_LANG)
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
@@ -343,7 +343,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
__alloc_traits::deallocate(__alloc(), __first_, capacity());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
@@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
- : __end_cap_(__a)
+ : __end_cap_(__second_tag(), __a)
{
if (__a == __c.__alloc())
{
@@ -405,7 +405,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
void
@@ -492,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
--__begin_;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
void
@@ -524,7 +524,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
--__begin_;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -556,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
++__end_;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
void
@@ -588,8 +588,6 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
++__end_;
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -621,9 +619,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
++__end_;
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -634,7 +630,8 @@ swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
__x.swap(__y);
}
-
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SPLIT_BUFFER
diff --git a/contrib/libc++/include/__std_stream b/contrib/libc++/include/__std_stream
index fb5a346..db90795 100644
--- a/contrib/libc++/include/__std_stream
+++ b/contrib/libc++/include/__std_stream
@@ -17,12 +17,14 @@
#include <__locale>
#include <cstdio>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8;
@@ -355,4 +357,6 @@ __stdoutbuf<_CharT>::imbue(const locale& __loc)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___STD_STREAM
diff --git a/contrib/libc++/include/__string b/contrib/libc++/include/__string
index 75608ce..d30c7fd 100644
--- a/contrib/libc++/include/__string
+++ b/contrib/libc++/include/__string
@@ -57,14 +57,16 @@ template <> struct char_traits<wchar_t>;
#include <cstdio> // For EOF.
#include <memory> // for __murmur2_or_cityhash
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// char_traits
@@ -870,4 +872,6 @@ struct __quoted_output_proxy
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___STRING
diff --git a/contrib/libc++/include/__threading_support b/contrib/libc++/include/__threading_support
index 817a2cf..5d4c907 100644
--- a/contrib/libc++/include/__threading_support
+++ b/contrib/libc++/include/__threading_support
@@ -12,6 +12,8 @@
#define _LIBCPP_THREADING_SUPPORT
#include <__config>
+#include <chrono>
+#include <errno.h>
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
@@ -25,14 +27,15 @@
# include <pthread.h>
# include <sched.h>
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
-#include <assert.h>
-#include <Windows.h>
+#include <windows.h>
#include <process.h>
#include <fibersapi.h>
-
-#include <chrono>
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
@@ -67,6 +70,8 @@ typedef pthread_once_t __libcpp_exec_once_flag;
typedef pthread_t __libcpp_thread_id;
// Thread
+#define _LIBCPP_NULL_THREAD 0U
+
typedef pthread_t __libcpp_thread_t;
// Thrad Local Storage
@@ -92,6 +97,8 @@ typedef INIT_ONCE __libcpp_exec_once_flag;
typedef DWORD __libcpp_thread_id;
// Thread
+#define _LIBCPP_NULL_THREAD 0U
+
typedef HANDLE __libcpp_thread_t;
// Thread Local Storage
@@ -108,7 +115,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
@@ -120,7 +127,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
-int __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
+bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
@@ -151,11 +158,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
void (*init_routine)(void));
// Thread id
-#if defined(__APPLE__) && !defined(__arm__)
-_LIBCPP_THREAD_ABI_VISIBILITY
-mach_port_t __libcpp_thread_get_port();
-#endif
-
_LIBCPP_THREAD_ABI_VISIBILITY
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
@@ -164,6 +166,9 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2);
// Thread
_LIBCPP_THREAD_ABI_VISIBILITY
+bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
+
+_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
void *__arg);
@@ -182,6 +187,9 @@ int __libcpp_thread_detach(__libcpp_thread_t *__t);
_LIBCPP_THREAD_ABI_VISIBILITY
void __libcpp_thread_yield();
+_LIBCPP_THREAD_ABI_VISIBILITY
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
+
// Thread local storage
_LIBCPP_THREAD_ABI_VISIBILITY
int __libcpp_tls_create(__libcpp_tls_key* __key,
@@ -227,9 +235,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
return pthread_mutex_lock(__m);
}
-int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
{
- return pthread_mutex_trylock(__m);
+ return pthread_mutex_trylock(__m) == 0;
}
int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
@@ -247,9 +255,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
return pthread_mutex_lock(__m);
}
-int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
+bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
{
- return pthread_mutex_trylock(__m);
+ return pthread_mutex_trylock(__m) == 0;
}
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
@@ -296,12 +304,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
}
// Thread id
-#if defined(__APPLE__) && !defined(__arm__)
-mach_port_t __libcpp_thread_get_port() {
- return pthread_mach_thread_np(pthread_self());
-}
-#endif
-
// Returns non-zero if the thread ids are equal, otherwise 0
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
{
@@ -315,6 +317,10 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
}
// Thread
+bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
+ return *__t == 0;
+}
+
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
void *__arg)
{
@@ -346,6 +352,28 @@ void __libcpp_thread_yield()
sched_yield();
}
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+ using namespace chrono;
+ seconds __s = duration_cast<seconds>(__ns);
+ timespec __ts;
+ typedef decltype(__ts.tv_sec) ts_sec;
+ _LIBCPP_CONSTEXPR 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 = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
+ }
+ else
+ {
+ __ts.tv_sec = __ts_sec_max;
+ __ts.tv_nsec = 999999999; // (10^9 - 1)
+ }
+
+ while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
+}
+
// Thread local storage
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
{
@@ -377,10 +405,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
return 0;
}
-int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
+bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
{
- TryEnterCriticalSection(__m);
- return 0;
+ return TryEnterCriticalSection(__m) != 0;
}
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
@@ -401,10 +428,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
return 0;
}
-int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
+bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
{
- TryAcquireSRWLockExclusive(__m);
- return 0;
+ return TryAcquireSRWLockExclusive(__m) != 0;
}
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
@@ -452,7 +478,10 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
timeout_ms.count() > 0 ? timeout_ms.count()
: 0,
0))
- return GetLastError();
+ {
+ auto __ec = GetLastError();
+ return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec;
+ }
return 0;
}
@@ -503,25 +532,32 @@ struct __libcpp_beginthreadex_thunk_data
void *__arg;
};
-static inline _LIBCPP_ALWAYS_INLINE unsigned int WINAPI
-__libcpp_beginthreadex_thunk(void *__data)
+static inline _LIBCPP_ALWAYS_INLINE unsigned WINAPI
+__libcpp_beginthreadex_thunk(void *__raw_data)
{
- __libcpp_beginthreadex_thunk_data data =
- *reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
- delete reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
- return reinterpret_cast<unsigned int>(data.__func(data.__arg));
+ auto *__data =
+ static_cast<__libcpp_beginthreadex_thunk_data *>(__raw_data);
+ auto *__func = __data->__func;
+ void *__arg = __data->__arg;
+ delete __data;
+ return static_cast<unsigned>(reinterpret_cast<uintptr_t>(__func(__arg)));
+}
+
+bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
+ return *__t == 0;
}
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
void *__arg)
{
- auto *data = new __libcpp_beginthreadex_thunk_data;
- data->__func = __func;
- data->__arg = __arg;
+ auto *__data = new __libcpp_beginthreadex_thunk_data;
+ __data->__func = __func;
+ __data->__arg = __arg;
- *__t = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
+ *__t = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0,
__libcpp_beginthreadex_thunk,
- data, 0, NULL));
+ __data, 0, nullptr));
+
if (*__t)
return 0;
return GetLastError();
@@ -558,6 +594,16 @@ void __libcpp_thread_yield()
SwitchToThread();
}
+void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
+{
+ using namespace chrono;
+ // round-up to the nearest milisecond
+ milliseconds __ms =
+ duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
+ // FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx)
+ Sleep(__ms.count());
+}
+
// Thread Local Storage
int __libcpp_tls_create(__libcpp_tls_key* __key,
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
@@ -586,6 +632,8 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // !_LIBCPP_HAS_NO_THREADS
#endif // _LIBCPP_THREADING_SUPPORT
diff --git a/contrib/libc++/include/__tree b/contrib/libc++/include/__tree
index 2fbb479..792870a 100644
--- a/contrib/libc++/include/__tree
+++ b/contrib/libc++/include/__tree
@@ -17,12 +17,14 @@
#include <stdexcept>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree;
@@ -43,6 +45,10 @@ template <class _Key, class _Value>
struct __value_type;
#endif
+template <class _Key, class _CP, class _Compare,
+ bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
+class __map_value_compare;
+
template <class _Allocator> class __map_node_destructor;
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
@@ -957,6 +963,25 @@ private:
};
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Tp, class _Compare, class _Allocator>
+struct __diagnose_tree_helper {
+ static constexpr bool __trigger_diagnostics()
+ _LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
+ "the specified comparator type does not provide a const call operator")
+ { return true; }
+};
+
+template <class _Key, class _Value, class _KeyComp, class _Alloc>
+struct __diagnose_tree_helper<
+ __value_type<_Key, _Value>,
+ __map_value_compare<_Key, __value_type<_Key, _Value>, _KeyComp>,
+ _Alloc
+> : __diagnose_tree_helper<_Key, _KeyComp, _Alloc>
+{
+};
+#endif // !_LIBCPP_CXX03_LANG
+
template <class _Tp, class _Compare, class _Allocator>
class __tree
{
@@ -1082,7 +1107,7 @@ public:
void __assign_unique(_InputIterator __first, _InputIterator __last);
template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
__tree(__tree&& __t)
_NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value &&
@@ -1093,7 +1118,7 @@ public:
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
~__tree();
@@ -1479,7 +1504,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
: __begin_node_(__iter_pointer()),
- __pair1_(__node_allocator(__a)),
+ __pair1_(__second_tag(), __node_allocator(__a)),
__pair3_(0)
{
__begin_node() = __end_node();
@@ -1489,7 +1514,7 @@ template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
const allocator_type& __a)
: __begin_node_(__iter_pointer()),
- __pair1_(__node_allocator(__a)),
+ __pair1_(__second_tag(), __node_allocator(__a)),
__pair3_(0, __comp)
{
__begin_node() = __end_node();
@@ -1646,13 +1671,13 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
: __begin_node_(__iter_pointer()),
- __pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
+ __pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
__pair3_(0, __t.value_comp())
{
__begin_node() = __end_node();
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
@@ -1676,7 +1701,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
- : __pair1_(__node_allocator(__a)),
+ : __pair1_(__second_tag(), __node_allocator(__a)),
__pair3_(0, _VSTD::move(__t.value_comp()))
{
if (__a == __t.__alloc())
@@ -1782,14 +1807,18 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::~__tree()
{
static_assert((is_copy_constructible<value_compare>::value),
"Comparator must be copy-constructible.");
- destroy(__root());
+#ifndef _LIBCPP_CXX03_LANG
+ static_assert((__diagnose_tree_helper<_Tp, _Compare, _Allocator>::
+ __trigger_diagnostics()), "");
+#endif
+ destroy(__root());
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2658,4 +2687,6 @@ swap(__tree<_Tp, _Compare, _Allocator>& __x,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP___TREE
diff --git a/contrib/libc++/include/__tuple b/contrib/libc++/include/__tuple
index 4193d2c..69d6ee9 100644
--- a/contrib/libc++/include/__tuple
+++ b/contrib/libc++/include/__tuple
@@ -85,7 +85,7 @@ template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_li
// tuple specializations
-#if !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_CXX03_LANG
template <size_t...> struct __tuple_indices {};
@@ -189,7 +189,8 @@ template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(const tuple<_Tp...>&&) _NOEXCEPT;
-#endif
+
+#endif // !defined(_LIBCPP_CXX03_LANG)
// pair specializations
@@ -205,7 +206,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
@@ -233,7 +234,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT;
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp&&
@@ -245,8 +246,7 @@ const _Tp&&
get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
-#if !defined(_LIBCPP_HAS_NO_VARIADICS)
-
+#ifndef _LIBCPP_CXX03_LANG
// __tuple_types
@@ -468,9 +468,6 @@ template <size_t _Ip, class ..._Tp>
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
#endif
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_CXX03_LANG
template <bool _IsTuple, class _SizeTrait, size_t _Expected>
struct __tuple_like_with_size_imp : false_type {};
@@ -495,7 +492,7 @@ struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
template <class ...>
static constexpr bool __enable_assign() { return false; }
};
-#endif
+#endif // !defined(_LIBCPP_CXX03_LANG)
#if _LIBCPP_STD_VER > 14
diff --git a/contrib/libc++/include/__undef_min_max b/contrib/libc++/include/__undef_macros
index d3c3138..60ab1db 100644
--- a/contrib/libc++/include/__undef_min_max
+++ b/contrib/libc++/include/__undef_macros
@@ -1,16 +1,17 @@
// -*- C++ -*-
-//===----------------------------------------------------------------------===//
+//===------------------------ __undef_macros ------------------------------===//
//
// 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.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
+
#ifdef min
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing min")
#else
@@ -22,7 +23,7 @@ _LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
#ifdef max
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing max")
#else
diff --git a/contrib/libc++/include/algorithm b/contrib/libc++/include/algorithm
index 5eec80c..4542275 100644
--- a/contrib/libc++/include/algorithm
+++ b/contrib/libc++/include/algorithm
@@ -35,6 +35,9 @@ template <class InputIterator, class Function>
Function
for_each(InputIterator first, InputIterator last, Function f);
+template<class InputIterator, class Size, class Function>
+ InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17
+
template <class InputIterator, class T>
InputIterator
find(InputIterator first, InputIterator last, const T& value);
@@ -281,12 +284,12 @@ template <class ForwardIterator, class OutputIterator>
template <class RandomAccessIterator>
void
- random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14
+ random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
template <class RandomAccessIterator, class RandomNumberGenerator>
void
random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
- RandomNumberGenerator& rand); // deprecated in C++14
+ RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
template<class PopulationIterator, class SampleIterator,
class Distance, class UniformRandomBitGenerator>
@@ -644,18 +647,20 @@ template <class BidirectionalIterator, class Compare>
#if defined(__IBMCPP__)
#include "support/ibm/support.h"
#endif
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#include "support/win32/support.h"
+#if defined(_LIBCPP_COMPILER_MSVC)
+#include <intrin.h>
#endif
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
@@ -783,51 +788,132 @@ struct __debug_less
// Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY
-unsigned
-__ctz(unsigned __x)
-{
+unsigned __ctz(unsigned __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned>(__builtin_ctz(__x));
+#else
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+ static_assert(sizeof(unsigned long) == 4, "");
+ unsigned long where;
+ // Search from LSB to MSB for first set bit.
+ // Returns zero if no set bit is found.
+ if (_BitScanForward(&where, mask))
+ return where;
+ return 32;
+#endif
}
inline _LIBCPP_INLINE_VISIBILITY
-unsigned long
-__ctz(unsigned long __x)
-{
+unsigned long __ctz(unsigned long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned long>(__builtin_ctzl(__x));
+#else
+ static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
+ return __ctz(static_cast<unsigned>(__x));
+#endif
}
inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long
-__ctz(unsigned long long __x)
-{
+unsigned long long __ctz(unsigned long long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned long long>(__builtin_ctzll(__x));
+#else
+ unsigned long where;
+// Search from LSB to MSB for first set bit.
+// Returns zero if no set bit is found.
+#if defined(_LIBCPP_HAS_BITSCAN64)
+ (defined(_M_AMD64) || defined(__x86_64__))
+ if (_BitScanForward64(&where, mask))
+ return static_cast<int>(where);
+#else
+ // Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
+ // Scan the Low Word.
+ if (_BitScanForward(&where, static_cast<unsigned long>(mask)))
+ return where;
+ // Scan the High Word.
+ if (_BitScanForward(&where, static_cast<unsigned long>(mask >> 32)))
+ return where + 32; // Create a bit offset from the LSB.
+#endif
+ return 64;
+#endif // _LIBCPP_COMPILER_MSVC
}
// Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY
-unsigned
-__clz(unsigned __x)
-{
+unsigned __clz(unsigned __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned>(__builtin_clz(__x));
+#else
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+ static_assert(sizeof(unsigned long) == 4, "");
+ unsigned long where;
+ // Search from LSB to MSB for first set bit.
+ // Returns zero if no set bit is found.
+ if (_BitScanReverse(&where, mask))
+ return 31 - where;
+ return 32; // Undefined Behavior.
+#endif
}
inline _LIBCPP_INLINE_VISIBILITY
-unsigned long
-__clz(unsigned long __x)
-{
+unsigned long __clz(unsigned long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned long>(__builtin_clzl (__x));
+#else
+ static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
+ return __clz(static_cast<unsigned>(__x));
+#endif
}
inline _LIBCPP_INLINE_VISIBILITY
-unsigned long long
-__clz(unsigned long long __x)
-{
+unsigned long long __clz(unsigned long long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
return static_cast<unsigned long long>(__builtin_clzll(__x));
+#else
+ unsigned long where;
+// BitScanReverse scans from MSB to LSB for first set bit.
+// Returns 0 if no set bit is found.
+#if defined(_LIBCPP_HAS_BITSCAN64)
+ if (_BitScanReverse64(&where, mask))
+ return static_cast<int>(63 - where);
+#else
+ // Scan the high 32 bits.
+ if (_BitScanReverse(&where, static_cast<unsigned long>(mask >> 32)))
+ return 63 - (where + 32); // Create a bit offset from the MSB.
+ // Scan the low 32 bits.
+ if (_BitScanReverse(&where, static_cast<unsigned long>(mask)))
+ return 63 - where;
+#endif
+ return 64; // Undefined Behavior.
+#endif // _LIBCPP_COMPILER_MSVC
}
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
-inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {return __builtin_popcountll(__x);}
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
+ return __builtin_popcount (__x);
+#else
+ static_assert(sizeof(unsigned) == 4, "");
+ return __popcnt(__x);
+#endif
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
+ return __builtin_popcountl (__x);
+#else
+ static_assert(sizeof(unsigned long) == 4, "");
+ return __popcnt(__x);
+#endif
+}
+
+inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {
+#ifndef _LIBCPP_COMPILER_MSVC
+ return __builtin_popcountll(__x);
+#else
+ static_assert(sizeof(unsigned long long) == 8, "");
+ return __popcnt64(__x);
+#endif
+}
// all_of
@@ -880,6 +966,26 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
return __f;
}
+#if _LIBCPP_STD_VER > 14
+// for_each_n
+
+template <class _InputIterator, class _Size, class _Function>
+inline _LIBCPP_INLINE_VISIBILITY
+_InputIterator
+for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
+{
+ typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
+ _IntegralSize __n = __orig_n;
+ while (__n > 0)
+ {
+ __f(*__first);
+ ++__first;
+ --__n;
+ }
+ return __first;
+}
+#endif
+
// find
template <class _InputIterator, class _Tp>
@@ -2548,7 +2654,7 @@ min(const _Tp& __a, const _Tp& __b)
return _VSTD::min(__a, __b, __less<_Tp>());
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -2566,7 +2672,7 @@ min(initializer_list<_Tp> __t)
return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// max_element
@@ -2613,7 +2719,7 @@ max(const _Tp& __a, const _Tp& __b)
return _VSTD::max(__a, __b, __less<_Tp>());
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -2631,7 +2737,7 @@ max(initializer_list<_Tp> __t)
return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
// clamp
@@ -2732,7 +2838,7 @@ minmax(const _Tp& __a, const _Tp& __b)
return _VSTD::minmax(__a, __b, __less<_Tp>());
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -2779,7 +2885,7 @@ minmax(initializer_list<_Tp> __t)
return _VSTD::minmax(__t, __less<_Tp>());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// random_shuffle
@@ -2804,11 +2910,11 @@ struct __log2_imp<0, _Rp>
static const size_t value = _Rp + 1;
};
-template <class _UI, _UI _Xp>
+template <class _UIntType, _UIntType _Xp>
struct __log2
{
static const size_t value = __log2_imp<_Xp,
- sizeof(_UI) * __CHAR_BIT__ - 1>::value;
+ sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
};
template<class _Engine, class _UIntType>
@@ -2837,7 +2943,7 @@ private:
_Engine_result_type __mask0_;
_Engine_result_type __mask1_;
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
#else
@@ -3026,6 +3132,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
return static_cast<result_type>(__u + __p.a());
}
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
+ || defined(_LIBCPP_BUILDING_LIBRARY)
class _LIBCPP_TYPE_VIS __rs_default;
_LIBCPP_FUNC_VIS __rs_default __rs_get();
@@ -3078,7 +3186,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
template <class _RandomAccessIterator, class _RandomNumberGenerator>
void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_RandomNumberGenerator&& __rand)
#else
_RandomNumberGenerator& __rand)
@@ -3095,6 +3203,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
}
}
}
+#endif
template <class _PopulationIterator, class _SampleIterator, class _Distance,
class _UniformRandomNumberGenerator>
@@ -3170,7 +3279,7 @@ _SampleIterator sample(_PopulationIterator __first,
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_UniformRandomNumberGenerator&& __g)
#else
_UniformRandomNumberGenerator& __g)
@@ -4125,10 +4234,6 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
}
-#ifdef _LIBCPP_MSVC
-#pragma warning( push )
-#pragma warning( disable: 4231)
-#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
@@ -4162,9 +4267,6 @@ _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
-#ifdef _LIBCPP_MSVC
-#pragma warning( pop )
-#endif // _LIBCPP_MSVC
// lower_bound
@@ -5797,4 +5899,6 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_ALGORITHM
diff --git a/contrib/libc++/include/any b/contrib/libc++/include/any
index 823e130..d7161b0 100644
--- a/contrib/libc++/include/any
+++ b/contrib/libc++/include/any
@@ -45,6 +45,10 @@ namespace std {
any& operator=(ValueType&& rhs);
// 6.3.3 any modifiers
+ template <class ValueType, class... Args>
+ decay_t<ValueType>& emplace(Args&&... args);
+ template <class ValueType, class U, class... Args>
+ decay_t<ValueType>& emplace(initializer_list<U>, Args&&...);
void reset() noexcept;
void swap(any& rhs) noexcept;
@@ -73,8 +77,6 @@ namespace std {
template<class ValueType>
ValueType* any_cast(any* operand) noexcept;
-} // namespace fundamentals_v1
-} // namespace experimental
} // namespace std
*/
@@ -258,7 +260,7 @@ public:
is_copy_constructible<_Tp>::value>
>
_LIBCPP_INLINE_VISIBILITY
- void emplace(_Args&&... args);
+ _Tp& emplace(_Args&&... args);
template <class _ValueType, class _Up, class ..._Args,
class _Tp = decay_t<_ValueType>,
@@ -267,7 +269,7 @@ public:
is_copy_constructible<_Tp>::value>
>
_LIBCPP_INLINE_VISIBILITY
- void emplace(initializer_list<_Up>, _Args&&...);
+ _Tp& emplace(initializer_list<_Up>, _Args&&...);
// 6.3.3 any modifiers
_LIBCPP_INLINE_VISIBILITY
@@ -364,9 +366,10 @@ namespace __any_imp
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
- static void __create(any & __dest, _Args&&... __args) {
- ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
+ static _Tp& __create(any & __dest, _Args&&... __args) {
+ _Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
__dest.__h = &_SmallHandler::__handle;
+ return *__ret;
}
private:
@@ -439,14 +442,15 @@ namespace __any_imp
template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY
- static void __create(any & __dest, _Args&&... __args) {
+ static _Tp& __create(any & __dest, _Args&&... __args) {
typedef allocator<_Tp> _Alloc;
typedef __allocator_destructor<_Alloc> _Dp;
_Alloc __a;
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
- ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
+ _Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
__dest.__s.__ptr = __hold.release();
__dest.__h = &_LargeHandler::__handle;
+ return *__ret;
}
private:
@@ -519,16 +523,16 @@ any & any::operator=(_ValueType && __v)
template <class _ValueType, class ..._Args, class _Tp, class>
inline _LIBCPP_INLINE_VISIBILITY
-void any::emplace(_Args&&... __args) {
+_Tp& any::emplace(_Args&&... __args) {
reset();
- __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
+ return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
}
template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
inline _LIBCPP_INLINE_VISIBILITY
-void any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
+_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
reset();
- __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
+ return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
}
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/contrib/libc++/include/array b/contrib/libc++/include/array
index 165ffad..1278099 100644
--- a/contrib/libc++/include/array
+++ b/contrib/libc++/include/array
@@ -113,6 +113,8 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
#pragma GCC system_header
#endif
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
@@ -294,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
{
+ static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
public:
typedef _Tp type;
};
@@ -316,7 +319,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
return __a.__elems_[_Ip];
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -336,7 +339,7 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
return _VSTD::move(__a.__elems_[_Ip]);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/atomic b/contrib/libc++/include/atomic
index 83889fb..f55e28f 100644
--- a/contrib/libc++/include/atomic
+++ b/contrib/libc++/include/atomic
@@ -560,6 +560,22 @@ void atomic_signal_fence(memory_order m) noexcept;
# define __cpp_lib_atomic_is_always_lock_free 201603L
#endif
+#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
+ __m == memory_order_acquire || \
+ __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
+
+#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
+ _LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
+ __m == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
+
+#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
+ _LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
+ __f == memory_order_acq_rel, \
+ "memory order argument to atomic operation is invalid")
+
_LIBCPP_BEGIN_NAMESPACE_STD
typedef enum memory_order
@@ -845,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT
return __y;
}
-#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
-#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
-#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
-#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
-#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
-#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
-#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
-#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
-#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
-#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
+# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
+# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
+#else
+# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
+# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
+# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
+# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
+# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
+# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
+# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
+# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
+# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
+# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
+#endif
// general atomic<T>
@@ -881,15 +910,19 @@ struct __atomic_base // false
{return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
_LIBCPP_INLINE_VISIBILITY
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
{__c11_atomic_store(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
{__c11_atomic_store(&__a_, __d, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
{return __c11_atomic_load(&__a_, __m);}
_LIBCPP_INLINE_VISIBILITY
_Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
{return __c11_atomic_load(&__a_, __m);}
_LIBCPP_INLINE_VISIBILITY
operator _Tp() const volatile _NOEXCEPT {return load();}
@@ -904,18 +937,22 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) volatile _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_strong(_Tp& __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
_LIBCPP_INLINE_VISIBILITY
bool compare_exchange_weak(_Tp& __e, _Tp __d,
@@ -1181,6 +1218,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
{
__o->store(__d, __m);
}
@@ -1189,6 +1227,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
{
__o->store(__d, __m);
}
@@ -1217,6 +1256,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
{
return __o->load(__m);
}
@@ -1225,6 +1265,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
+ _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
{
return __o->load(__m);
}
@@ -1309,6 +1350,7 @@ bool
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
_Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{
return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
@@ -1318,6 +1360,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{
return __o->compare_exchange_weak(*__e, __d, __s, __f);
}
@@ -1330,6 +1373,7 @@ bool
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
_Tp* __e, _Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{
return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
@@ -1340,6 +1384,7 @@ bool
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
_Tp __d,
memory_order __s, memory_order __f) _NOEXCEPT
+ _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
{
return __o->compare_exchange_strong(*__e, __d, __s, __f);
}
diff --git a/contrib/libc++/include/bitset b/contrib/libc++/include/bitset
index 827a901..583122f 100644
--- a/contrib/libc++/include/bitset
+++ b/contrib/libc++/include/bitset
@@ -113,10 +113,6 @@ template <size_t N> struct hash<std::bitset<N>>;
*/
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <__config>
#include <__bit_reference>
#include <cstddef>
@@ -126,7 +122,13 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <iosfwd>
#include <__functional_base>
-#include <__undef_min_max>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -197,11 +199,11 @@ protected:
_LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
private:
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
void __init(unsigned long long __v, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __init(unsigned long long __v, true_type) _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_CONSTEXPR
+#endif // _LIBCPP_CXX03_LANG
unsigned long to_ulong(false_type) const;
_LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong(true_type) const;
@@ -217,16 +219,16 @@ template <size_t _N_words, size_t _Size>
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
: __first_{0}
#endif
{
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
#endif
}
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
void
@@ -249,13 +251,13 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
}
-#endif // _LIBCPP_HAS_NO_CONSTEXPR
+#endif // _LIBCPP_CXX03_LANG
template <size_t _N_words, size_t _Size>
inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
-#ifndef _LIBCPP_HAS_NO_CONSTEXPR
+#ifndef _LIBCPP_CXX03_LANG
#if __SIZEOF_SIZE_T__ == 8
: __first_{__v}
#elif __SIZEOF_SIZE_T__ == 4
@@ -265,7 +267,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#endif
#endif
{
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
}
@@ -1090,4 +1092,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_BITSET
diff --git a/contrib/libc++/include/chrono b/contrib/libc++/include/chrono
index 4e82ef2..4b793c7 100644
--- a/contrib/libc++/include/chrono
+++ b/contrib/libc++/include/chrono
@@ -48,7 +48,7 @@ class duration
static_assert(Period::num > 0, "duration period must be positive");
public:
typedef Rep rep;
- typedef Period period;
+ typedef typename _Period::type period;
constexpr duration() = default;
template <class Rep2>
@@ -75,8 +75,8 @@ public:
// arithmetic
- constexpr duration operator+() const;
- constexpr duration operator-() const;
+ constexpr common_type<duration>::type operator+() const;
+ constexpr common_type<duration>::type operator-() const;
constexpr duration& operator++();
constexpr duration operator++(int);
constexpr duration& operator--();
@@ -305,12 +305,14 @@ constexpr chrono::duration<unspecified , nano> operator "" ns(long doub
#include <ratio>
#include <limits>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
@@ -523,7 +525,7 @@ class _LIBCPP_TEMPLATE_VIS duration
public:
typedef _Rep rep;
- typedef _Period period;
+ typedef typename _Period::type period;
private:
rep __rep_;
public:
@@ -565,8 +567,8 @@ public:
// arithmetic
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;}
@@ -1160,4 +1162,6 @@ namespace chrono { // hoist the literals into namespace std::chrono
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_CHRONO
diff --git a/contrib/libc++/include/cmath b/contrib/libc++/include/cmath
index 7249356..917928a 100644
--- a/contrib/libc++/include/cmath
+++ b/contrib/libc++/include/cmath
@@ -398,7 +398,6 @@ using ::cbrtf;
using ::copysign;
using ::copysignf;
-#ifndef _LIBCPP_MSVCRT
using ::erf;
using ::erff;
using ::erfc;
@@ -435,12 +434,10 @@ using ::lrint;
using ::lrintf;
using ::lround;
using ::lroundf;
-#endif // _LIBCPP_MSVCRT
using ::nan;
using ::nanf;
-#ifndef _LIBCPP_MSVCRT
using ::nearbyint;
using ::nearbyintf;
using ::nextafter;
@@ -463,7 +460,6 @@ using ::tgamma;
using ::tgammaf;
using ::trunc;
using ::truncf;
-#endif // !_LIBCPP_MSVCRT
using ::acosl;
using ::asinl;
@@ -495,7 +491,6 @@ using ::cbrtl;
using ::copysignl;
-#ifndef _LIBCPP_MSVCRT
using ::erfl;
using ::erfcl;
using ::exp2l;
@@ -526,7 +521,6 @@ using ::scalblnl;
using ::scalbnl;
using ::tgammal;
using ::truncl;
-#endif // !_LIBCPP_MSVCRT
#if _LIBCPP_STD_VER > 14
inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); }
@@ -555,7 +549,7 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
#if __has_builtin(__builtin_isnan)
return __builtin_isnan(__lcpp_x);
@@ -567,7 +561,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
return isnan(__lcpp_x);
}
@@ -575,7 +569,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
#if __has_builtin(__builtin_isinf)
return __builtin_isinf(__lcpp_x);
@@ -587,7 +581,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
return isinf(__lcpp_x);
}
@@ -595,7 +589,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
-__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
#if __has_builtin(__builtin_isfinite)
return __builtin_isfinite(__lcpp_x);
@@ -607,7 +601,7 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
-__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
{
return isfinite(__lcpp_x);
}
diff --git a/contrib/libc++/include/complex b/contrib/libc++/include/complex
index d41971b..41a47cf 100644
--- a/contrib/libc++/include/complex
+++ b/contrib/libc++/include/complex
@@ -599,39 +599,39 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
_Tp __bc = __b * __c;
_Tp __x = __ac - __bd;
_Tp __y = __ad + __bc;
- if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
+ if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
{
bool __recalc = false;
- if (__libcpp_isinf(__a) || __libcpp_isinf(__b))
+ if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b))
{
- __a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
- if (__libcpp_isnan(__c))
+ __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
+ if (__libcpp_isnan_or_builtin(__c))
__c = copysign(_Tp(0), __c);
- if (__libcpp_isnan(__d))
+ if (__libcpp_isnan_or_builtin(__d))
__d = copysign(_Tp(0), __d);
__recalc = true;
}
- if (__libcpp_isinf(__c) || __libcpp_isinf(__d))
+ if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d))
{
- __c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
- if (__libcpp_isnan(__a))
+ __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
+ if (__libcpp_isnan_or_builtin(__a))
__a = copysign(_Tp(0), __a);
- if (__libcpp_isnan(__b))
+ if (__libcpp_isnan_or_builtin(__b))
__b = copysign(_Tp(0), __b);
__recalc = true;
}
- if (!__recalc && (__libcpp_isinf(__ac) || __libcpp_isinf(__bd) ||
- __libcpp_isinf(__ad) || __libcpp_isinf(__bc)))
+ if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) ||
+ __libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc)))
{
- if (__libcpp_isnan(__a))
+ if (__libcpp_isnan_or_builtin(__a))
__a = copysign(_Tp(0), __a);
- if (__libcpp_isnan(__b))
+ if (__libcpp_isnan_or_builtin(__b))
__b = copysign(_Tp(0), __b);
- if (__libcpp_isnan(__c))
+ if (__libcpp_isnan_or_builtin(__c))
__c = copysign(_Tp(0), __c);
- if (__libcpp_isnan(__d))
+ if (__libcpp_isnan_or_builtin(__d))
__d = copysign(_Tp(0), __d);
__recalc = true;
}
@@ -674,7 +674,7 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
_Tp __c = __w.real();
_Tp __d = __w.imag();
_Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
- if (__libcpp_isfinite(__logbw))
+ if (__libcpp_isfinite_or_builtin(__logbw))
{
__ilogbw = static_cast<int>(__logbw);
__c = scalbn(__c, -__ilogbw);
@@ -683,24 +683,24 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
_Tp __denom = __c * __c + __d * __d;
_Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
_Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
- if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
+ if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
{
- if ((__denom == _Tp(0)) && (!__libcpp_isnan(__a) || !__libcpp_isnan(__b)))
+ if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b)))
{
__x = copysign(_Tp(INFINITY), __c) * __a;
__y = copysign(_Tp(INFINITY), __c) * __b;
}
- else if ((__libcpp_isinf(__a) || __libcpp_isinf(__b)) && __libcpp_isfinite(__c) && __libcpp_isfinite(__d))
+ else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d))
{
- __a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
- __b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
+ __a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
+ __b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
__x = _Tp(INFINITY) * (__a * __c + __b * __d);
__y = _Tp(INFINITY) * (__b * __c - __a * __d);
}
- else if (__libcpp_isinf(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite(__a) && __libcpp_isfinite(__b))
+ else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b))
{
- __c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
- __d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
+ __c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
+ __d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
__x = _Tp(0) * (__a * __c + __b * __d);
__y = _Tp(0) * (__b * __c - __a * __d);
}
@@ -910,9 +910,9 @@ inline _LIBCPP_INLINE_VISIBILITY
_Tp
norm(const complex<_Tp>& __c)
{
- if (__libcpp_isinf(__c.real()))
+ if (__libcpp_isinf_or_builtin(__c.real()))
return abs(__c.real());
- if (__libcpp_isinf(__c.imag()))
+ if (__libcpp_isinf_or_builtin(__c.imag()))
return abs(__c.imag());
return __c.real() * __c.real() + __c.imag() * __c.imag();
}
@@ -955,7 +955,7 @@ complex<_Tp>
proj(const complex<_Tp>& __c)
{
std::complex<_Tp> __r = __c;
- if (__libcpp_isinf(__c.real()) || __libcpp_isinf(__c.imag()))
+ if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
__r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
return __r;
}
@@ -969,7 +969,7 @@ typename enable_if
>::type
proj(_Tp __re)
{
- if (__libcpp_isinf(__re))
+ if (__libcpp_isinf_or_builtin(__re))
__re = abs(__re);
return complex<_Tp>(__re);
}
@@ -993,25 +993,25 @@ template<class _Tp>
complex<_Tp>
polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
{
- if (__libcpp_isnan(__rho) || signbit(__rho))
+ if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
- if (__libcpp_isnan(__theta))
+ if (__libcpp_isnan_or_builtin(__theta))
{
- if (__libcpp_isinf(__rho))
+ if (__libcpp_isinf_or_builtin(__rho))
return complex<_Tp>(__rho, __theta);
return complex<_Tp>(__theta, __theta);
}
- if (__libcpp_isinf(__theta))
+ if (__libcpp_isinf_or_builtin(__theta))
{
- if (__libcpp_isinf(__rho))
+ if (__libcpp_isinf_or_builtin(__rho))
return complex<_Tp>(__rho, _Tp(NAN));
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
}
_Tp __x = __rho * cos(__theta);
- if (__libcpp_isnan(__x))
+ if (__libcpp_isnan_or_builtin(__x))
__x = 0;
_Tp __y = __rho * sin(__theta);
- if (__libcpp_isnan(__y))
+ if (__libcpp_isnan_or_builtin(__y))
__y = 0;
return complex<_Tp>(__x, __y);
}
@@ -1042,13 +1042,13 @@ template<class _Tp>
complex<_Tp>
sqrt(const complex<_Tp>& __x)
{
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(_Tp(INFINITY), __x.imag());
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
if (__x.real() > _Tp(0))
- return complex<_Tp>(__x.real(), __libcpp_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
- return complex<_Tp>(__libcpp_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
+ return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
+ return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
}
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
}
@@ -1060,21 +1060,21 @@ complex<_Tp>
exp(const complex<_Tp>& __x)
{
_Tp __i = __x.imag();
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
if (__x.real() < _Tp(0))
{
- if (!__libcpp_isfinite(__i))
+ if (!__libcpp_isfinite_or_builtin(__i))
__i = _Tp(1);
}
- else if (__i == 0 || !__libcpp_isfinite(__i))
+ else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i))
{
- if (__libcpp_isinf(__i))
+ if (__libcpp_isinf_or_builtin(__i))
__i = _Tp(NAN);
return complex<_Tp>(__x.real(), __i);
}
}
- else if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
+ else if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
return __x;
_Tp __e = exp(__x.real());
return complex<_Tp>(__e * cos(__i), __e * sin(__i));
@@ -1132,23 +1132,23 @@ complex<_Tp>
asinh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
- if (__libcpp_isnan(__x.imag()))
+ if (__libcpp_isnan_or_builtin(__x.imag()))
return __x;
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
}
- if (__libcpp_isnan(__x.real()))
+ if (__libcpp_isnan_or_builtin(__x.real()))
{
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(__x.imag(), __x.real());
if (__x.imag() == 0)
return __x;
return complex<_Tp>(__x.real(), __x.real());
}
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
@@ -1161,11 +1161,11 @@ complex<_Tp>
acosh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
- if (__libcpp_isnan(__x.imag()))
+ if (__libcpp_isnan_or_builtin(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag());
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
{
if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
@@ -1176,13 +1176,13 @@ acosh(const complex<_Tp>& __x)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
}
- if (__libcpp_isnan(__x.real()))
+ if (__libcpp_isnan_or_builtin(__x.real()))
{
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(abs(__x.imag()), __x.real());
return complex<_Tp>(__x.real(), __x.real());
}
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
@@ -1195,21 +1195,21 @@ complex<_Tp>
atanh(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
{
return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
}
- if (__libcpp_isnan(__x.imag()))
+ if (__libcpp_isnan_or_builtin(__x.imag()))
{
- if (__libcpp_isinf(__x.real()) || __x.real() == 0)
+ if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0)
return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
return complex<_Tp>(__x.imag(), __x.imag());
}
- if (__libcpp_isnan(__x.real()))
+ if (__libcpp_isnan_or_builtin(__x.real()))
{
return complex<_Tp>(__x.real(), __x.real());
}
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
}
@@ -1227,11 +1227,11 @@ template<class _Tp>
complex<_Tp>
sinh(const complex<_Tp>& __x)
{
- if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
+ if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
return complex<_Tp>(__x.real(), _Tp(NAN));
- if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
+ if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
return __x;
return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
}
@@ -1242,13 +1242,13 @@ template<class _Tp>
complex<_Tp>
cosh(const complex<_Tp>& __x)
{
- if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
return complex<_Tp>(abs(__x.real()), _Tp(NAN));
- if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
+ if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
return complex<_Tp>(_Tp(NAN), __x.real());
if (__x.real() == 0 && __x.imag() == 0)
return complex<_Tp>(_Tp(1), __x.imag());
- if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
+ if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
return complex<_Tp>(abs(__x.real()), __x.imag());
return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
}
@@ -1259,19 +1259,19 @@ template<class _Tp>
complex<_Tp>
tanh(const complex<_Tp>& __x)
{
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
- if (!__libcpp_isfinite(__x.imag()))
+ if (!__libcpp_isfinite_or_builtin(__x.imag()))
return complex<_Tp>(_Tp(1), _Tp(0));
return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
}
- if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
+ if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
return __x;
_Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i));
_Tp __2rsh(sinh(__2r));
- if (__libcpp_isinf(__2rsh) && __libcpp_isinf(__d))
+ if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
@@ -1294,11 +1294,11 @@ complex<_Tp>
acos(const complex<_Tp>& __x)
{
const _Tp __pi(atan2(+0., -0.));
- if (__libcpp_isinf(__x.real()))
+ if (__libcpp_isinf_or_builtin(__x.real()))
{
- if (__libcpp_isnan(__x.imag()))
+ if (__libcpp_isnan_or_builtin(__x.imag()))
return complex<_Tp>(__x.imag(), __x.real());
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
{
if (__x.real() < _Tp(0))
return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
@@ -1308,13 +1308,13 @@ acos(const complex<_Tp>& __x)
return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
}
- if (__libcpp_isnan(__x.real()))
+ if (__libcpp_isnan_or_builtin(__x.real()))
{
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(__x.real(), -__x.imag());
return complex<_Tp>(__x.real(), __x.real());
}
- if (__libcpp_isinf(__x.imag()))
+ if (__libcpp_isinf_or_builtin(__x.imag()))
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
diff --git a/contrib/libc++/include/condition_variable b/contrib/libc++/include/condition_variable
index 10e0077..c45a326 100644
--- a/contrib/libc++/include/condition_variable
+++ b/contrib/libc++/include/condition_variable
@@ -133,12 +133,14 @@ public:
void notify_all() _NOEXCEPT;
template <class _Lock>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
void wait(_Lock& __lock);
template <class _Lock, class _Predicate>
_LIBCPP_INLINE_VISIBILITY
void wait(_Lock& __lock, _Predicate __pred);
template <class _Lock, class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
cv_status
wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t);
diff --git a/contrib/libc++/include/cstddef b/contrib/libc++/include/cstddef
index edd106c..6258449 100644
--- a/contrib/libc++/include/cstddef
+++ b/contrib/libc++/include/cstddef
@@ -28,6 +28,7 @@ Types:
size_t
max_align_t
nullptr_t
+ byte // C++17
} // std
@@ -48,7 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
using ::size_t;
-#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
+#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
+ defined(__DEFINED_max_align_t)
// Re-use the compiler's <stddef.h> max_align_t where possible.
using ::max_align_t;
#else
@@ -57,4 +59,32 @@ typedef long double max_align_t;
_LIBCPP_END_NAMESPACE_STD
+#if _LIBCPP_STD_VER > 14
+namespace std // purposefully not versioned
+{
+enum class byte : unsigned char {};
+
+constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
+constexpr byte operator| (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) | static_cast<unsigned char>(__rhs)); }
+
+constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
+constexpr byte operator& (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) & static_cast<unsigned char>(__rhs)); }
+
+constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
+{ return __lhs = byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
+constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
+{ return byte(static_cast<unsigned char>(__lhs) ^ static_cast<unsigned char>(__rhs)); }
+
+constexpr byte operator~ (byte __b) noexcept
+{ return byte(~static_cast<unsigned char>(__b)); }
+
+}
+
+#include <type_traits> // rest of byte
+#endif
+
#endif // _LIBCPP_CSTDDEF
diff --git a/contrib/libc++/include/cstdio b/contrib/libc++/include/cstdio
index 35941ce..00b989f 100644
--- a/contrib/libc++/include/cstdio
+++ b/contrib/libc++/include/cstdio
@@ -98,9 +98,6 @@ void perror(const char* s);
#include <__config>
#include <stdio.h>
-#if defined(_LIBCPP_MSVCRT)
-#include <crtversion.h>
-#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -156,8 +153,7 @@ using ::tmpnam;
#ifndef _LIBCPP_HAS_NO_STDIN
using ::getchar;
-#if _LIBCPP_STD_VER <= 11 && \
- (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
+#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
using ::gets;
#endif
using ::scanf;
diff --git a/contrib/libc++/include/cstdlib b/contrib/libc++/include/cstdlib
index 2ca25ed..78c4284 100644
--- a/contrib/libc++/include/cstdlib
+++ b/contrib/libc++/include/cstdlib
@@ -130,8 +130,10 @@ using ::abort;
using ::atexit;
using ::exit;
using ::_Exit;
+#ifndef _LIBCPP_WINDOWS_STORE_APP
using ::getenv;
using ::system;
+#endif
using ::bsearch;
using ::qsort;
using ::abs;
diff --git a/contrib/libc++/include/ctype.h b/contrib/libc++/include/ctype.h
index 22d6c49..e97ff3c 100644
--- a/contrib/libc++/include/ctype.h
+++ b/contrib/libc++/include/ctype.h
@@ -40,15 +40,6 @@ int toupper(int c);
#ifdef __cplusplus
-#if defined(_LIBCPP_MSVCRT)
-// We support including .h headers inside 'extern "C"' contexts, so switch
-// back to C++ linkage before including these C++ headers.
-extern "C++" {
- #include "support/win32/support.h"
- #include "support/win32/locale_win32.h"
-}
-#endif // _LIBCPP_MSVCRT
-
#undef isalnum
#undef isalpha
#undef isblank
diff --git a/contrib/libc++/include/deque b/contrib/libc++/include/deque
index 9280154..f795b48 100644
--- a/contrib/libc++/include/deque
+++ b/contrib/libc++/include/deque
@@ -150,10 +150,6 @@ template <class T, class Allocator>
*/
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <__config>
#include <__split_buffer>
#include <type_traits>
@@ -162,7 +158,13 @@ template <class T, class Allocator>
#include <algorithm>
#include <stdexcept>
-#include <__undef_min_max>
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -968,13 +970,12 @@ protected:
public:
~__deque_base();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
__deque_base(__deque_base&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__deque_base(__deque_base&& __c, const allocator_type& __a);
+#endif // _LIBCPP_CXX03_LANG
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void swap(__deque_base& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
@@ -1108,7 +1109,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base()
__alloc_traits::deallocate(__alloc(), *__i, __block_size);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
@@ -1140,7 +1141,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
void
@@ -1230,18 +1231,16 @@ public:
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
deque(const deque& __c);
deque(const deque& __c, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+ deque& operator=(const deque& __c);
+
+#ifndef _LIBCPP_CXX03_LANG
deque(initializer_list<value_type> __il);
deque(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- deque& operator=(const deque& __c);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
_LIBCPP_INLINE_VISIBILITY
@@ -1250,7 +1249,10 @@ public:
deque& operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
template <class _InputIter>
void assign(_InputIter __f, _InputIter __l,
@@ -1260,10 +1262,6 @@ public:
void assign(_RAIter __f, _RAIter __l,
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT;
@@ -1340,8 +1338,7 @@ public:
// 23.2.2.3 modifiers:
void push_front(const value_type& __v);
void push_back(const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
template <class... _Args> reference emplace_front(_Args&&... __args);
template <class... _Args> reference emplace_back (_Args&&... __args);
@@ -1350,11 +1347,16 @@ public:
template <class... _Args> void emplace_back (_Args&&... __args);
#endif
template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
-#endif // _LIBCPP_HAS_NO_VARIADICS
+
void push_front(value_type&& __v);
void push_back(value_type&& __v);
iterator insert(const_iterator __p, value_type&& __v);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator __p, initializer_list<value_type> __il)
+ {return insert(__p, __il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
+
iterator insert(const_iterator __p, const value_type& __v);
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIter>
@@ -1368,11 +1370,7 @@ public:
template <class _BiIter>
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
void pop_front();
void pop_back();
iterator erase(const_iterator __p);
@@ -1527,7 +1525,19 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
__append(__c.begin(), __c.end());
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+template <class _Tp, class _Allocator>
+deque<_Tp, _Allocator>&
+deque<_Tp, _Allocator>::operator=(const deque& __c)
+{
+ if (this != &__c)
+ {
+ __copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
+}
+
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
@@ -1542,22 +1552,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
__append(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-template <class _Tp, class _Allocator>
-deque<_Tp, _Allocator>&
-deque<_Tp, _Allocator>::operator=(const deque& __c)
-{
- if (this != &__c)
- {
- __copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
-}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Allocator>
inline
deque<_Tp, _Allocator>::deque(deque&& __c)
@@ -1613,7 +1607,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
__base::__move_assign(__c);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
template <class _InputIter>
@@ -1809,8 +1803,20 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
++__base::size();
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp, class _Allocator>
+void
+deque<_Tp, _Allocator>::push_front(const value_type& __v)
+{
+ allocator_type& __a = __base::__alloc();
+ if (__front_spare() == 0)
+ __add_front_capacity();
+ // __front_spare() >= 1
+ __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
+ --__base::__start_;
+ ++__base::size();
+}
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
void
deque<_Tp, _Allocator>::push_back(value_type&& __v)
@@ -1823,8 +1829,6 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
++__base::size();
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Allocator>
template <class... _Args>
#if _LIBCPP_STD_VER > 14
@@ -1846,24 +1850,6 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-template <class _Tp, class _Allocator>
-void
-deque<_Tp, _Allocator>::push_front(const value_type& __v)
-{
- allocator_type& __a = __base::__alloc();
- if (__front_spare() == 0)
- __add_front_capacity();
- // __front_spare() >= 1
- __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
- --__base::__start_;
- ++__base::size();
-}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Allocator>
void
deque<_Tp, _Allocator>::push_front(value_type&& __v)
@@ -1877,7 +1863,6 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
++__base::size();
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Allocator>
template <class... _Args>
@@ -1900,12 +1885,9 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
#endif
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
+deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
{
size_type __pos = __p - __base::begin();
size_type __to_end = __base::size() - __pos;
@@ -1917,23 +1899,20 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
// __front_spare() >= 1
if (__pos == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
+ __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
--__base::__start_;
++__base::size();
}
else
{
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
- __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
- __b = __move_and_check(_VSTD::next(__b), __b + __pos, __b, __vt);
- *__b = *__vt;
+ __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
+ *__b = _VSTD::move(__v);
}
}
else
@@ -1944,31 +1923,27 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
+ __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
++__base::size();
}
else
{
- const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e);
- if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
- __vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
- __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
- *--__e = *__vt;
+ __e = _VSTD::move_backward(__e - __de, __em1, __e);
+ *--__e = _VSTD::move(__v);
}
}
return __base::begin() + __pos;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Allocator>
+template <class... _Args>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
+deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
{
size_type __pos = __p - __base::begin();
size_type __to_end = __base::size() - __pos;
@@ -1980,12 +1955,13 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
// __front_spare() >= 1
if (__pos == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
+ __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
--__base::__start_;
++__base::size();
}
else
{
+ __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
@@ -1993,7 +1969,7 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
++__base::size();
if (__pos > 1)
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
- *__b = _VSTD::move(__v);
+ *__b = _VSTD::move(__tmp.get());
}
}
else
@@ -2004,29 +1980,30 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
+ __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
++__base::size();
}
else
{
+ __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
__e = _VSTD::move_backward(__e - __de, __em1, __e);
- *--__e = _VSTD::move(__v);
+ *--__e = _VSTD::move(__tmp.get());
}
}
return __base::begin() + __pos;
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
+
template <class _Tp, class _Allocator>
-template <class... _Args>
typename deque<_Tp, _Allocator>::iterator
-deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
+deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
{
size_type __pos = __p - __base::begin();
size_type __to_end = __base::size() - __pos;
@@ -2038,21 +2015,23 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
// __front_spare() >= 1
if (__pos == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
+ __alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
--__base::__start_;
++__base::size();
}
else
{
- __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__b))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__bm1);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
--__base::__start_;
++__base::size();
if (__pos > 1)
- __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
- *__b = _VSTD::move(__tmp.get());
+ __b = __move_and_check(_VSTD::next(__b), __b + __pos, __b, __vt);
+ *__b = *__vt;
}
}
else
@@ -2063,27 +2042,26 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
size_type __de = __base::size() - __pos;
if (__de == 0)
{
- __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
+ __alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), __v);
++__base::size();
}
else
{
- __temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
+ const_pointer __vt = pointer_traits<const_pointer>::pointer_to(__v);
iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e);
+ if (__vt == pointer_traits<const_pointer>::pointer_to(*__em1))
+ __vt = pointer_traits<const_pointer>::pointer_to(*__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size();
if (__de > 1)
- __e = _VSTD::move_backward(__e - __de, __em1, __e);
- *--__e = _VSTD::move(__tmp.get());
+ __e = __move_backward_and_check(__e - __de, __em1, __e, __vt);
+ *--__e = *__vt;
}
}
return __base::begin() + __pos;
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
@@ -2924,4 +2902,6 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_DEQUE
diff --git a/contrib/libc++/include/exception b/contrib/libc++/include/exception
index 98e1f37..ca2eaf5 100644
--- a/contrib/libc++/include/exception
+++ b/contrib/libc++/include/exception
@@ -82,6 +82,10 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstdlib>
#include <type_traits>
+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include <vcruntime_exception.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -89,6 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
namespace std // purposefully not using versioning namespace
{
+#if !defined(_LIBCPP_ABI_MICROSOFT)
class _LIBCPP_EXCEPTION_ABI exception
{
public:
@@ -105,11 +110,16 @@ public:
virtual ~bad_exception() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
+#endif // !_LIBCPP_ABI_MICROSOFT
+#if _LIBCPP_STD_VER <= 14 \
+ || defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
+ || defined(_LIBCPP_BUILDING_LIBRARY)
typedef void (*unexpected_handler)();
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
+#endif
typedef void (*terminate_handler)();
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
@@ -117,30 +127,33 @@ _LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
-_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
+_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;
class _LIBCPP_TYPE_VIS exception_ptr;
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
+#ifndef _LIBCPP_ABI_MICROSOFT
+
class _LIBCPP_TYPE_VIS exception_ptr
{
void* __ptr_;
public:
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
+
exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_EXPLICIT
- operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
+ {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return __x.__ptr_ == __y.__ptr_;}
+
friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return !(__x == __y);}
@@ -168,6 +181,54 @@ make_exception_ptr(_Ep __e) _NOEXCEPT
#endif
}
+#else // _LIBCPP_ABI_MICROSOFT
+
+class _LIBCPP_TYPE_VIS exception_ptr
+{
+#if defined(__clang__)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wunused-private-field"
+#endif
+ void* __ptr1_;
+ void* __ptr2_;
+#if defined(__clang__)
+#pragma clang diagnostic pop
+#endif
+public:
+ exception_ptr() _NOEXCEPT;
+ exception_ptr(nullptr_t) _NOEXCEPT;
+ exception_ptr(const exception_ptr& __other) _NOEXCEPT;
+ exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT;
+ exception_ptr& operator=(nullptr_t) _NOEXCEPT;
+ ~exception_ptr() _NOEXCEPT;
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT;
+};
+
+_LIBCPP_FUNC_VIS
+bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT;
+
+inline _LIBCPP_INLINE_VISIBILITY
+bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
+ {return !(__x == __y);}
+
+_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
+
+_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr);
+_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
+_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr p);
+
+// This is a built-in template function which automagically extracts the required
+// information.
+template <class _E> void *__GetExceptionInfo(_E);
+
+template<class _Ep>
+exception_ptr
+make_exception_ptr(_Ep __e) _NOEXCEPT
+{
+ return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e));
+}
+
+#endif // _LIBCPP_ABI_MICROSOFT
// nested_exception
class _LIBCPP_EXCEPTION_ABI nested_exception
@@ -192,58 +253,71 @@ struct __nested
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
};
-template <class _Tp>
-_LIBCPP_NORETURN
-void
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-throw_with_nested(_Tp&& __t, typename enable_if<
- is_class<typename remove_reference<_Tp>::type>::value &&
- !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
- && !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
- >::type* = 0)
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-throw_with_nested (_Tp& __t, typename enable_if<
- is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
- >::type* = 0)
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-{
#ifndef _LIBCPP_NO_EXCEPTIONS
- throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
+template <class _Tp, class _Up, bool>
+struct __throw_with_nested;
+
+template <class _Tp, class _Up>
+struct __throw_with_nested<_Tp, _Up, true> {
+ _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
+#ifndef _LIBCPP_CXX03_LANG
+ __do_throw(_Tp&& __t)
#else
- ((void)__t);
- // FIXME: Make this abort.
+ __do_throw (_Tp& __t)
+#endif // _LIBCPP_CXX03_LANG
+ {
+ throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
+ }
+};
+
+template <class _Tp, class _Up>
+struct __throw_with_nested<_Tp, _Up, false> {
+ _LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
+#ifndef _LIBCPP_CXX03_LANG
+ __do_throw(_Tp&& __t)
+#else
+ __do_throw (_Tp& __t)
+#endif // _LIBCPP_CXX03_LANG
+ {
+ throw _VSTD::forward<_Tp>(__t);
+ }
+};
#endif
-}
template <class _Tp>
_LIBCPP_NORETURN
void
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-throw_with_nested(_Tp&& __t, typename enable_if<
- !is_class<typename remove_reference<_Tp>::type>::value ||
- is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
- || __libcpp_is_final<typename remove_reference<_Tp>::type>::value
- >::type* = 0)
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-throw_with_nested (_Tp& __t, typename enable_if<
- !is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
- >::type* = 0)
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
+throw_with_nested(_Tp&& __t)
+#else
+throw_with_nested (_Tp& __t)
+#endif // _LIBCPP_CXX03_LANG
{
#ifndef _LIBCPP_NO_EXCEPTIONS
- throw _VSTD::forward<_Tp>(__t);
+ typedef typename decay<_Tp>::type _Up;
+ static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
+ __throw_with_nested<_Tp, _Up,
+ is_class<_Up>::value &&
+ !is_base_of<nested_exception, _Up>::value &&
+ !__libcpp_is_final<_Up>::value>::
+ __do_throw(_VSTD::forward<_Tp>(__t));
#else
((void)__t);
// FIXME: Make this abort
#endif
}
+template <class _From, class _To>
+struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT(
+ is_polymorphic<_From>::value &&
+ (!is_base_of<_To, _From>::value ||
+ is_convertible<const _From*, const _To*>::value)) {};
+
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _Ep& __e, typename enable_if<
- is_polymorphic<_Ep>::value
- >::type* = 0)
+rethrow_if_nested(const _Ep& __e,
+ typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
{
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
@@ -253,9 +327,8 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
void
-rethrow_if_nested(const _Ep&, typename enable_if<
- !is_polymorphic<_Ep>::value
- >::type* = 0)
+rethrow_if_nested(const _Ep&,
+ typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
{
}
diff --git a/contrib/libc++/include/experimental/__config b/contrib/libc++/include/experimental/__config
index 9a7bbe8..37f88c1 100644
--- a/contrib/libc++/include/experimental/__config
+++ b/contrib/libc++/include/experimental/__config
@@ -44,6 +44,13 @@
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
} } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \
+ _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 {
+
+#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \
+ } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
+
+#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1
#define _VSTD_FS ::std::experimental::filesystem::v1
diff --git a/contrib/libc++/include/experimental/algorithm b/contrib/libc++/include/experimental/algorithm
index b32d7ca..3801cae 100644
--- a/contrib/libc++/include/experimental/algorithm
+++ b/contrib/libc++/include/experimental/algorithm
@@ -39,17 +39,18 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last,
#include <algorithm>
#include <type_traits>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-_LIBCPP_BEGIN_NAMESPACE_LFTS
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
template <class _ForwardIterator, class _Searcher>
_LIBCPP_INLINE_VISIBILITY
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
@@ -67,4 +68,6 @@ _SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
_LIBCPP_END_NAMESPACE_LFTS
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
diff --git a/contrib/libc++/include/experimental/any b/contrib/libc++/include/experimental/any
index 022b379..083a290 100644
--- a/contrib/libc++/include/experimental/any
+++ b/contrib/libc++/include/experimental/any
@@ -89,7 +89,7 @@ inline namespace fundamentals_v1 {
_LIBCPP_BEGIN_NAMESPACE_LFTS
-class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
{
public:
virtual const char* what() const _NOEXCEPT;
@@ -98,6 +98,7 @@ public:
#if _LIBCPP_STD_VER > 11 // C++ > 11
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
void __throw_bad_any_cast()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -506,7 +507,7 @@ void swap(any & __lhs, any & __rhs) _NOEXCEPT
}
template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any const & __v)
{
static_assert(
@@ -522,7 +523,7 @@ _ValueType any_cast(any const & __v)
}
template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any & __v)
{
static_assert(
@@ -537,7 +538,7 @@ _ValueType any_cast(any & __v)
}
template <class _ValueType>
-_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
_ValueType any_cast(any && __v)
{
static_assert(
diff --git a/contrib/libc++/include/experimental/coroutine b/contrib/libc++/include/experimental/coroutine
new file mode 100644
index 0000000..ce795ad
--- /dev/null
+++ b/contrib/libc++/include/experimental/coroutine
@@ -0,0 +1,296 @@
+// -*- C++ -*-
+//===----------------------------- coroutine -----------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE
+#define _LIBCPP_EXPERIMENTAL_COROUTINE
+
+/**
+ experimental/coroutine synopsis
+
+// C++next
+
+namespace std {
+namespace experimental {
+inline namespace coroutines_v1 {
+
+ // 18.11.1 coroutine traits
+template <typename R, typename... ArgTypes>
+class coroutine_traits;
+// 18.11.2 coroutine handle
+template <typename Promise = void>
+class coroutine_handle;
+// 18.11.2.7 comparison operators:
+bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
+// 18.11.3 trivial awaitables
+struct suspend_never;
+struct suspend_always;
+// 18.11.2.8 hash support:
+template <class T> struct hash;
+template <class P> struct hash<coroutine_handle<P>>;
+
+} // namespace coroutines_v1
+} // namespace experimental
+} // namespace std
+
+ */
+
+#include <experimental/__config>
+#include <new>
+#include <type_traits>
+#include <functional>
+#include <memory> // for hash<T*>
+#include <cstddef>
+#include <cassert>
+#include <__debug>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_COROUTINES
+# if defined(_LIBCPP_WARNING)
+ _LIBCPP_WARNING("<experimental/coroutine> cannot be used with this compiler")
+# else
+# warning <experimental/coroutine> cannot be used with this compiler
+# endif
+#endif
+
+#ifndef _LIBCPP_HAS_NO_COROUTINES
+
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES
+
+template <class _Tp, class = void>
+struct __coroutine_traits_sfinae {};
+
+template <class _Tp>
+struct __coroutine_traits_sfinae<
+ _Tp, typename __void_t<typename _Tp::promise_type>::type>
+{
+ using promise_type = typename _Tp::promise_type;
+};
+
+template <typename _Ret, typename... _Args>
+struct _LIBCPP_TEMPLATE_VIS coroutine_traits
+ : public __coroutine_traits_sfinae<_Ret>
+{
+};
+
+template <typename _Promise = void>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle;
+
+template <>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
+public:
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {}
+
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {}
+
+ _LIBCPP_ALWAYS_INLINE
+ coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
+ __handle_ = nullptr;
+ return *this;
+ }
+
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; }
+
+ _LIBCPP_ALWAYS_INLINE
+ _LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; }
+
+ _LIBCPP_ALWAYS_INLINE
+ void operator()() { resume(); }
+
+ _LIBCPP_ALWAYS_INLINE
+ void resume() {
+ _LIBCPP_ASSERT(__is_suspended(),
+ "resume() can only be called on suspended coroutines");
+ _LIBCPP_ASSERT(!done(),
+ "resume() has undefined behavior when the coroutine is done");
+ __builtin_coro_resume(__handle_);
+ }
+
+ _LIBCPP_ALWAYS_INLINE
+ void destroy() {
+ _LIBCPP_ASSERT(__is_suspended(),
+ "destroy() can only be called on suspended coroutines");
+ __builtin_coro_destroy(__handle_);
+ }
+
+ _LIBCPP_ALWAYS_INLINE
+ bool done() const {
+ _LIBCPP_ASSERT(__is_suspended(),
+ "done() can only be called on suspended coroutines");
+ return __builtin_coro_done(__handle_);
+ }
+
+public:
+ _LIBCPP_ALWAYS_INLINE
+ static coroutine_handle from_address(void* __addr) _NOEXCEPT {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // FIXME: Should from_address(nullptr) be allowed?
+ _LIBCPP_ALWAYS_INLINE
+ static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
+ return coroutine_handle(nullptr);
+ }
+
+ template <class _Tp, bool _CallIsValid = false>
+ static coroutine_handle from_address(_Tp*) {
+ static_assert(_CallIsValid,
+ "coroutine_handle<void>::from_address cannot be called with "
+ "non-void pointers");
+ }
+
+private:
+ bool __is_suspended() const _NOEXCEPT {
+ // FIXME actually implement a check for if the coro is suspended.
+ return __handle_;
+ }
+
+ template <class _PromiseT> friend class coroutine_handle;
+ void* __handle_;
+};
+
+// 18.11.2.7 comparison operators:
+inline _LIBCPP_ALWAYS_INLINE
+bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return __x.address() == __y.address();
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return !(__x == __y);
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return less<void*>()(__x.address(), __y.address());
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return __y < __x;
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return !(__x > __y);
+}
+inline _LIBCPP_ALWAYS_INLINE
+bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
+ return !(__x < __y);
+}
+
+template <typename _Promise>
+class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> {
+ using _Base = coroutine_handle<>;
+public:
+#ifndef _LIBCPP_CXX03_LANG
+ // 18.11.2.1 construct/reset
+ using coroutine_handle<>::coroutine_handle;
+#else
+ _LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {}
+ _LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {}
+#endif
+ _LIBCPP_INLINE_VISIBILITY
+ coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
+ _Base::operator=(nullptr);
+ return *this;
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ _Promise& promise() const {
+ return *reinterpret_cast<_Promise*>(
+ __builtin_coro_promise(this->__handle_, __alignof(_Promise), false));
+ }
+
+public:
+ _LIBCPP_ALWAYS_INLINE
+ static coroutine_handle from_address(void* __addr) _NOEXCEPT {
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __addr;
+ return __tmp;
+ }
+
+ // NOTE: this overload isn't required by the standard but is needed so
+ // the deleted _Promise* overload doesn't make from_address(nullptr)
+ // ambiguous.
+ // FIXME: should from_address work with nullptr?
+ _LIBCPP_ALWAYS_INLINE
+ static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
+ return coroutine_handle(nullptr);
+ }
+
+ template <class _Tp, bool _CallIsValid = false>
+ static coroutine_handle from_address(_Tp*) {
+ static_assert(_CallIsValid,
+ "coroutine_handle<promise_type>::from_address cannot be called with "
+ "non-void pointers");
+ }
+
+ template <bool _CallIsValid = false>
+ static coroutine_handle from_address(_Promise*) {
+ static_assert(_CallIsValid,
+ "coroutine_handle<promise_type>::from_address cannot be used with "
+ "pointers to the coroutine's promise type; use 'from_promise' instead");
+ }
+
+ _LIBCPP_ALWAYS_INLINE
+ static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT {
+ typedef typename remove_cv<_Promise>::type _RawPromise;
+ coroutine_handle __tmp;
+ __tmp.__handle_ = __builtin_coro_promise(
+ _VSTD::addressof(const_cast<_RawPromise&>(__promise)),
+ __alignof(_Promise), true);
+ return __tmp;
+ }
+};
+
+struct _LIBCPP_TYPE_VIS suspend_never {
+ _LIBCPP_ALWAYS_INLINE
+ bool await_ready() const _NOEXCEPT { return true; }
+ _LIBCPP_ALWAYS_INLINE
+ void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
+ _LIBCPP_ALWAYS_INLINE
+ void await_resume() const _NOEXCEPT {}
+};
+
+struct _LIBCPP_TYPE_VIS suspend_always {
+ _LIBCPP_ALWAYS_INLINE
+ bool await_ready() const _NOEXCEPT { return false; }
+ _LIBCPP_ALWAYS_INLINE
+ void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
+ _LIBCPP_ALWAYS_INLINE
+ void await_resume() const _NOEXCEPT {}
+};
+
+_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Tp>
+struct hash<_VSTD_CORO::coroutine_handle<_Tp> > {
+ using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>;
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(__arg_type const& __v) const _NOEXCEPT
+ {return hash<void*>()(__v.address());}
+};
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // !defined(_LIBCPP_HAS_NO_COROUTINES)
+
+#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */
diff --git a/contrib/libc++/include/experimental/dynarray b/contrib/libc++/include/experimental/dynarray
index 8c97337..1619331 100644
--- a/contrib/libc++/include/experimental/dynarray
+++ b/contrib/libc++/include/experimental/dynarray
@@ -107,10 +107,13 @@ public:
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS dynarray
+struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray
{
public:
// types:
@@ -295,5 +298,7 @@ template <class _Tp, class _Alloc>
struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // if _LIBCPP_STD_VER > 11
#endif // _LIBCPP_DYNARRAY
diff --git a/contrib/libc++/include/experimental/filesystem b/contrib/libc++/include/experimental/filesystem
index 739918b..42157ba 100644
--- a/contrib/libc++/include/experimental/filesystem
+++ b/contrib/libc++/include/experimental/filesystem
@@ -408,8 +408,10 @@ class _LIBCPP_TYPE_VIS file_status
public:
// constructors
_LIBCPP_INLINE_VISIBILITY
- explicit file_status(file_type __ft = file_type::none,
- perms __prms = perms::unknown) _NOEXCEPT
+ file_status() _NOEXCEPT : file_status(file_type::none) {}
+ _LIBCPP_INLINE_VISIBILITY
+ explicit file_status(file_type __ft,
+ perms __prms = perms::unknown) _NOEXCEPT
: __ft_(__ft), __prms_(__prms)
{}
@@ -720,6 +722,7 @@ public:
return *this;
}
+ template <class = void>
_LIBCPP_INLINE_VISIBILITY
path& operator=(string_type&& __s) _NOEXCEPT {
__pn_ = _VSTD::move(__s);
@@ -941,15 +944,15 @@ public:
std::u32string generic_u32string() const { return string<char32_t>(); }
private:
- _LIBCPP_FUNC_VIS int __compare(__string_view) const;
- _LIBCPP_FUNC_VIS __string_view __root_name() const;
- _LIBCPP_FUNC_VIS __string_view __root_directory() const;
- _LIBCPP_FUNC_VIS __string_view __root_path_raw() const;
- _LIBCPP_FUNC_VIS __string_view __relative_path() const;
- _LIBCPP_FUNC_VIS __string_view __parent_path() const;
- _LIBCPP_FUNC_VIS __string_view __filename() const;
- _LIBCPP_FUNC_VIS __string_view __stem() const;
- _LIBCPP_FUNC_VIS __string_view __extension() const;
+ int __compare(__string_view) const;
+ __string_view __root_name() const;
+ __string_view __root_directory() const;
+ __string_view __root_path_raw() const;
+ __string_view __relative_path() const;
+ __string_view __parent_path() const;
+ __string_view __filename() const;
+ __string_view __stem() const;
+ __string_view __extension() const;
public:
// compare
@@ -987,8 +990,8 @@ public:
class _LIBCPP_TYPE_VIS iterator;
typedef iterator const_iterator;
- _LIBCPP_FUNC_VIS iterator begin() const;
- _LIBCPP_FUNC_VIS iterator end() const;
+ iterator begin() const;
+ iterator end() const;
private:
inline _LIBCPP_INLINE_VISIBILITY
@@ -1088,10 +1091,13 @@ class _LIBCPP_TYPE_VIS path::iterator
{
public:
typedef bidirectional_iterator_tag iterator_category;
+
typedef path value_type;
typedef std::ptrdiff_t difference_type;
typedef const path* pointer;
typedef const path& reference;
+
+ typedef void __stashing_iterator_tag; // See reverse_iterator and __is_stashing_iterator
public:
_LIBCPP_INLINE_VISIBILITY
iterator() : __stashed_elem_(), __path_ptr_(nullptr),
@@ -1153,8 +1159,8 @@ private:
inline _LIBCPP_INLINE_VISIBILITY
friend bool operator==(const iterator&, const iterator&);
- _LIBCPP_FUNC_VIS iterator& __increment();
- _LIBCPP_FUNC_VIS iterator& __decrement();
+ iterator& __increment();
+ iterator& __decrement();
path __stashed_elem_;
const path* __path_ptr_;
@@ -1205,7 +1211,6 @@ public:
return __paths_->second;
}
- _LIBCPP_FUNC_VIS
~filesystem_error() override; // key function
// TODO(ericwf): Create a custom error message.
@@ -1923,7 +1928,7 @@ public:
const directory_entry& operator*() const {
_LIBCPP_ASSERT(__imp_, "The end iterator cannot be dereferenced");
- return __deref();
+ return __dereference();
}
const directory_entry* operator->() const
@@ -1948,11 +1953,14 @@ private:
// construct the dir_stream
_LIBCPP_FUNC_VIS
- directory_iterator(const path&, error_code *, directory_options = directory_options::none);
+ directory_iterator(const path&, error_code *,
+ directory_options = directory_options::none);
+
_LIBCPP_FUNC_VIS
directory_iterator& __increment(error_code * __ec = nullptr);
+
_LIBCPP_FUNC_VIS
- const directory_entry& __deref() const;
+ const directory_entry& __dereference() const;
private:
shared_ptr<__dir_stream> __imp_;
@@ -2035,11 +2043,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
const directory_entry& operator*() const
- { return __deref(); }
+ { return __dereference(); }
_LIBCPP_INLINE_VISIBILITY
const directory_entry* operator->() const
- { return &__deref(); }
+ { return &__dereference(); }
recursive_directory_iterator& operator++()
{ return __increment(); }
@@ -2078,7 +2086,7 @@ private:
error_code *__ec);
_LIBCPP_FUNC_VIS
- const directory_entry& __deref() const;
+ const directory_entry& __dereference() const;
_LIBCPP_FUNC_VIS
bool __try_recursion(error_code* __ec);
diff --git a/contrib/libc++/include/experimental/functional b/contrib/libc++/include/experimental/functional
index 75fc8e9..a136cbb 100644
--- a/contrib/libc++/include/experimental/functional
+++ b/contrib/libc++/include/experimental/functional
@@ -89,21 +89,22 @@ inline namespace fundamentals_v1 {
#include <experimental/__config>
#include <functional>
-
#include <algorithm>
#include <type_traits>
#include <vector>
#include <array>
#include <unordered_map>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_LFTS
#if _LIBCPP_STD_VER > 11
@@ -456,4 +457,6 @@ make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIter
_LIBCPP_END_NAMESPACE_LFTS
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
diff --git a/contrib/libc++/include/experimental/memory_resource b/contrib/libc++/include/experimental/memory_resource
index b3d9ca8..d101f3e 100644
--- a/contrib/libc++/include/experimental/memory_resource
+++ b/contrib/libc++/include/experimental/memory_resource
@@ -82,6 +82,9 @@ namespace pmr {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
// Round __s up to next multiple of __a.
@@ -181,7 +184,7 @@ public:
// 8.6.3, memory.polymorphic.allocator.mem
_LIBCPP_INLINE_VISIBILITY
_ValueType* allocate(size_t __n) {
- if (__n > max_size()) {
+ if (__n > __max_size()) {
__throw_length_error(
"std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)"
" 'n' exceeds maximum supported size");
@@ -193,7 +196,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT {
- _LIBCPP_ASSERT(__n <= max_size(),
+ _LIBCPP_ASSERT(__n <= __max_size(),
"deallocate called for size which exceeds max_size()");
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
}
@@ -266,10 +269,6 @@ public:
{ __p->~_Tp(); }
_LIBCPP_INLINE_VISIBILITY
- size_t max_size() const _NOEXCEPT
- { return numeric_limits<size_t>::max() / sizeof(value_type); }
-
- _LIBCPP_INLINE_VISIBILITY
polymorphic_allocator
select_on_container_copy_construction() const _NOEXCEPT
{ return polymorphic_allocator(); }
@@ -309,6 +308,10 @@ private:
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource());
}
+ _LIBCPP_INLINE_VISIBILITY
+ size_t __max_size() const _NOEXCEPT
+ { return numeric_limits<size_t>::max() / sizeof(value_type); }
+
memory_resource * __res_;
};
@@ -419,4 +422,6 @@ using resource_adaptor = __resource_adaptor_imp<
_LIBCPP_END_NAMESPACE_LFTS_PMR
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */
diff --git a/contrib/libc++/include/experimental/numeric b/contrib/libc++/include/experimental/numeric
index 32b19a4..d784c08 100644
--- a/contrib/libc++/include/experimental/numeric
+++ b/contrib/libc++/include/experimental/numeric
@@ -41,31 +41,39 @@ inline namespace fundamentals_v2 {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#if _LIBCPP_STD_VER > 11
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
-template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs;
+template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
-template <typename _Tp>
-struct __abs<_Tp, true> {
+template <typename _Result, typename _Source>
+struct __abs<_Result, _Source, true> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; }
+ _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 <typename _Tp>
-struct __abs<_Tp, false> {
+template <typename _Result, typename _Source>
+struct __abs<_Result, _Source, false> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(_Tp __t) const noexcept { return __t; }
+ _Result operator()(_Source __t) const noexcept { return __t; }
};
template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
-_Tp __gcd(_Tp __m, _Tp __n)
+_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
+inline _Tp __gcd(_Tp __m, _Tp __n)
{
static_assert((!is_signed<_Tp>::value), "" );
- return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n);
+ return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n);
}
@@ -75,10 +83,13 @@ 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<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" );
+ static_assert((!is_same<typename remove_cv<_Up>::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>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
- static_cast<_Wp>(__abs<_Up>()(__n))));
+ return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd(
+ static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
+ static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
}
template<class _Tp, class _Up>
@@ -87,12 +98,14 @@ 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<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" );
+ static_assert((!is_same<typename remove_cv<_Up>::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<_Tp>()(__m) / gcd(__m,__n);
- _Up __val2 = __abs<_Up>()(__n);
+ _Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n);
+ _Rp __val2 = __abs<_Rp, _Up>()(__n);
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
return __val1 * __val2;
}
@@ -100,4 +113,7 @@ lcm(_Tp __m, _Up __n)
_LIBCPP_END_NAMESPACE_LFTS_V2
#endif /* _LIBCPP_STD_VER > 11 */
+
+_LIBCPP_POP_MACROS
+
#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */
diff --git a/contrib/libc++/include/experimental/optional b/contrib/libc++/include/experimental/optional
index f32941b..b251748 100644
--- a/contrib/libc++/include/experimental/optional
+++ b/contrib/libc++/include/experimental/optional
@@ -143,9 +143,24 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 {
#include <experimental/__config>
#include <functional>
#include <stdexcept>
+#if _LIBCPP_STD_VER > 11
+#include <initializer_list>
+#include <type_traits>
+#include <new>
+#include <__functional_base>
+#include <__debug>
+#endif
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
-class _LIBCPP_EXCEPTION_ABI bad_optional_access
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
: public std::logic_error
{
public:
@@ -160,17 +175,6 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL
#if _LIBCPP_STD_VER > 11
-#include <initializer_list>
-#include <type_traits>
-#include <new>
-#include <__functional_base>
-#include <__undef_min_max>
-#include <__debug>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
_LIBCPP_BEGIN_NAMESPACE_LFTS
struct in_place_t {};
@@ -523,6 +527,9 @@ public:
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_NO_EXCEPTIONS
+_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
+#endif
constexpr void __throw_bad_optional_access() const
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -532,7 +539,7 @@ public:
#endif
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
constexpr value_type const& value() const
{
if (!this->__engaged_)
@@ -540,7 +547,7 @@ public:
return this->__val_;
}
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
value_type& value()
{
if (!this->__engaged_)
@@ -910,4 +917,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
diff --git a/contrib/libc++/include/experimental/string_view b/contrib/libc++/include/experimental/string_view
index 41c0d34..da104f9 100644
--- a/contrib/libc++/include/experimental/string_view
+++ b/contrib/libc++/include/experimental/string_view
@@ -189,6 +189,9 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_LFTS
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
@@ -810,4 +813,6 @@ quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LFTS_STRING_VIEW
diff --git a/contrib/libc++/include/ext/hash_map b/contrib/libc++/include/ext/hash_map
index 8998bec..998e8f6 100644
--- a/contrib/libc++/include/ext/hash_map
+++ b/contrib/libc++/include/ext/hash_map
@@ -207,7 +207,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <ext/__hash>
#if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
#else
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
@@ -331,7 +331,7 @@ public:
__second_constructed(false)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
: __na_(__x.__na_),
@@ -340,7 +340,7 @@ public:
{
__x.__value_constructed = false;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
@@ -349,7 +349,7 @@ public:
{
const_cast<bool&>(__x.__value_constructed) = false;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p)
diff --git a/contrib/libc++/include/ext/hash_set b/contrib/libc++/include/ext/hash_set
index 7c6a8bf..38f81ed 100644
--- a/contrib/libc++/include/ext/hash_set
+++ b/contrib/libc++/include/ext/hash_set
@@ -199,7 +199,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <ext/__hash>
#if __DEPRECATED
-#if defined(_MSC_VER) && ! defined(__clang__)
+#if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
#else
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
diff --git a/contrib/libc++/include/forward_list b/contrib/libc++/include/forward_list
index 879f2d3..8bfa9a0 100644
--- a/contrib/libc++/include/forward_list
+++ b/contrib/libc++/include/forward_list
@@ -167,19 +167,20 @@ template <class T, class Allocator>
*/
#include <__config>
-
#include <initializer_list>
#include <memory>
#include <limits>
#include <iterator>
#include <algorithm>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __forward_list_node;
@@ -478,14 +479,14 @@ protected:
__forward_list_base(const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
public:
_LIBCPP_INLINE_VISIBILITY
__forward_list_base(__forward_list_base&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
_LIBCPP_INLINE_VISIBILITY
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
private:
__forward_list_base(const __forward_list_base&);
@@ -539,7 +540,7 @@ private:
{__alloc() = _VSTD::move(__x.__alloc());}
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
inline
@@ -563,7 +564,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
@@ -656,32 +657,33 @@ public:
>::type* = nullptr);
forward_list(const forward_list& __x);
forward_list(const forward_list& __x, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ forward_list& operator=(const forward_list& __x);
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
forward_list(forward_list&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- // ~forward_list() = default;
-
- forward_list& operator=(const forward_list& __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
forward_list& operator=(forward_list&& __x)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
_LIBCPP_INLINE_VISIBILITY
forward_list& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+ _LIBCPP_INLINE_VISIBILITY
+ void assign(initializer_list<value_type> __il);
+#endif // _LIBCPP_CXX03_LANG
+
+ // ~forward_list() = default;
template <class _InputIterator>
typename enable_if
@@ -691,10 +693,6 @@ public:
>::type
assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- void assign(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -745,27 +743,26 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_reference front() const {return base::__before_begin()->__next_->__value_;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
template <class... _Args> reference emplace_front(_Args&&... __args);
#else
template <class... _Args> void emplace_front(_Args&&... __args);
#endif
-#endif
void push_front(value_type&& __v);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
void push_front(const value_type& __v);
void pop_front();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
iterator emplace_after(const_iterator __p, _Args&&... __args);
-#endif // _LIBCPP_HAS_NO_VARIADICS
+
iterator insert_after(const_iterator __p, value_type&& __v);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
+ {return insert_after(__p, __il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
iterator insert_after(const_iterator __p, const value_type& __v);
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
template <class _InputIterator>
@@ -776,10 +773,6 @@ public:
iterator
>::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
- {return insert_after(__p, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l);
@@ -799,7 +792,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {base::clear();}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x);
_LIBCPP_INLINE_VISIBILITY
@@ -807,7 +800,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
void splice_after(const_iterator __p, forward_list&& __x,
const_iterator __f, const_iterator __l);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
void splice_after(const_iterator __p, forward_list& __x);
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
void splice_after(const_iterator __p, forward_list& __x,
@@ -817,14 +810,14 @@ public:
_LIBCPP_INLINE_VISIBILITY
void unique() {unique(__equal_to<value_type>());}
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
template <class _Compare>
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _VSTD::move(__comp));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
@@ -835,11 +828,11 @@ public:
private:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
void __move_assign(forward_list& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(forward_list& __x, false_type);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Compare>
static
@@ -955,8 +948,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
insert_after(cbefore_begin(), __x.begin(), __x.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp, class _Alloc>
+forward_list<_Tp, _Alloc>&
+forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
+{
+ if (this != &__x)
+ {
+ base::__copy_assign_alloc(__x);
+ assign(__x.begin(), __x.end());
+ }
+ return *this;
+}
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
const allocator_type& __a)
@@ -969,10 +973,6 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{
@@ -987,22 +987,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-template <class _Tp, class _Alloc>
-forward_list<_Tp, _Alloc>&
-forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
-{
- if (this != &__x)
- {
- base::__copy_assign_alloc(__x);
- assign(__x.begin(), __x.end());
- }
- return *this;
-}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
@@ -1040,10 +1024,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp, class _Alloc>
inline
forward_list<_Tp, _Alloc>&
@@ -1053,7 +1033,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
template <class _InputIterator>
@@ -1090,7 +1070,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
inline
@@ -1100,11 +1080,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Alloc>
template <class... _Args>
#if _LIBCPP_STD_VER > 14
@@ -1126,8 +1101,6 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
#endif
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Alloc>
void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
@@ -1140,7 +1113,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
base::__before_begin()->__next_ = __h.release();
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
void
@@ -1165,8 +1138,7 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_traits::deallocate(__a, __p, 1);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
template <class... _Args>
@@ -1184,8 +1156,6 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
return iterator(__r->__next_);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
@@ -1200,7 +1170,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
return iterator(__r->__next_);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
@@ -1468,7 +1438,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
}
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1499,7 +1469,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
splice_after(__p, __x, __f, __l);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
void
@@ -1750,4 +1720,6 @@ swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_FORWARD_LIST
diff --git a/contrib/libc++/include/fstream b/contrib/libc++/include/fstream
index 7bcc5d4..ffd5698 100644
--- a/contrib/libc++/include/fstream
+++ b/contrib/libc++/include/fstream
@@ -171,12 +171,14 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale>
#include <cstdio>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -193,13 +195,13 @@ public:
// 27.9.1.2 Constructors/destructor:
basic_filebuf();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
basic_filebuf(basic_filebuf&& __rhs);
#endif
virtual ~basic_filebuf();
// 27.9.1.3 Assign/swap:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_filebuf& operator=(basic_filebuf&& __rhs);
#endif
@@ -276,7 +278,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
setbuf(0, 4096);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
@@ -352,7 +354,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
@@ -615,7 +617,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r;
__st_last_ = __st_;
- size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
+ size_t __nr = fread((void*) const_cast<char *>(__extbufnext_), 1, __nmemb, __file_);
if (__nr != 0)
{
if (!__cv_)
@@ -628,7 +630,8 @@ basic_filebuf<_CharT, _Traits>::underflow()
this->eback() + __ibs_, __inext);
if (__r == codecvt_base::noconv)
{
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
+ (char_type*)const_cast<char *>(__extbufend_));
__c = traits_type::to_int_type(*this->gptr());
}
else if (__inext != this->eback() + __unget_sz)
@@ -720,7 +723,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
return traits_type::eof();
if (__r == codecvt_base::partial)
{
- this->setp((char_type*)__e, this->pptr());
+ this->setp(const_cast<char_type*>(__e), this->pptr());
this->pbump(this->epptr() - this->pbase());
}
}
@@ -1017,12 +1020,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_ifstream(basic_ifstream&& __rhs);
-#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ifstream& operator=(basic_ifstream&& __rhs);
#endif
@@ -1071,7 +1072,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
}
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1092,7 +1093,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1177,12 +1178,10 @@ public:
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
_LIBCPP_INLINE_VISIBILITY
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_ofstream(basic_ofstream&& __rhs);
-#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ofstream& operator=(basic_ofstream&& __rhs);
#endif
@@ -1231,7 +1230,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
}
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1252,7 +1251,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1339,12 +1338,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_fstream(basic_fstream&& __rhs);
-#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_fstream& operator=(basic_fstream&& __rhs);
#endif
@@ -1393,7 +1390,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
}
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1414,7 +1411,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
inline
@@ -1482,4 +1479,6 @@ basic_fstream<_CharT, _Traits>::close()
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_FSTREAM
diff --git a/contrib/libc++/include/functional b/contrib/libc++/include/functional
index 4f8ec65..83a2e5a 100644
--- a/contrib/libc++/include/functional
+++ b/contrib/libc++/include/functional
@@ -235,7 +235,7 @@ namespace placeholders {
}
template <class Operation>
-class binder1st
+class binder1st // deprecated in C++11, removed in C++17
: public unary_function<typename Operation::second_argument_type,
typename Operation::result_type>
{
@@ -249,10 +249,10 @@ public:
};
template <class Operation, class T>
-binder1st<Operation> bind1st(const Operation& op, const T& x);
+binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
template <class Operation>
-class binder2nd
+class binder2nd // deprecated in C++11, removed in C++17
: public unary_function<typename Operation::first_argument_type,
typename Operation::result_type>
{
@@ -266,9 +266,9 @@ public:
};
template <class Operation, class T>
-binder2nd<Operation> bind2nd(const Operation& op, const T& x);
+binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
-template <class Arg, class Result>
+template <class Arg, class Result> // deprecated in C++11, removed in C++17
class pointer_to_unary_function : public unary_function<Arg, Result>
{
public:
@@ -277,9 +277,9 @@ public:
};
template <class Arg, class Result>
-pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg));
+pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17
-template <class Arg1, class Arg2, class Result>
+template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17
class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
{
public:
@@ -288,9 +288,9 @@ public:
};
template <class Arg1, class Arg2, class Result>
-pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2));
+pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17
-template<class S, class T>
+template<class S, class T> // deprecated in C++11, removed in C++17
class mem_fun_t : public unary_function<T*, S>
{
public:
@@ -299,18 +299,18 @@ public:
};
template<class S, class T, class A>
-class mem_fun1_t : public binary_function<T*, A, S>
+class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17
{
public:
explicit mem_fun1_t(S (T::*p)(A));
S operator()(T* p, A x) const;
};
-template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)());
-template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));
+template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17
+template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17
template<class S, class T>
-class mem_fun_ref_t : public unary_function<T, S>
+class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
{
public:
explicit mem_fun_ref_t(S (T::*p)());
@@ -318,18 +318,18 @@ public:
};
template<class S, class T, class A>
-class mem_fun1_ref_t : public binary_function<T, A, S>
+class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
{
public:
explicit mem_fun1_ref_t(S (T::*p)(A));
S operator()(T& p, A x) const;
};
-template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)());
-template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));
+template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17
+template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17
template <class S, class T>
-class const_mem_fun_t : public unary_function<const T*, S>
+class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17
{
public:
explicit const_mem_fun_t(S (T::*p)() const);
@@ -337,18 +337,18 @@ public:
};
template <class S, class T, class A>
-class const_mem_fun1_t : public binary_function<const T*, A, S>
+class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17
{
public:
explicit const_mem_fun1_t(S (T::*p)(A) const);
S operator()(const T* p, A x) const;
};
-template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const);
-template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);
+template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17
+template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
template <class S, class T>
-class const_mem_fun_ref_t : public unary_function<T, S>
+class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
{
public:
explicit const_mem_fun_ref_t(S (T::*p)() const);
@@ -356,15 +356,15 @@ public:
};
template <class S, class T, class A>
-class const_mem_fun1_ref_t : public binary_function<T, A, S>
+class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
{
public:
explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
S operator()(const T& p, A x) const;
};
-template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const);
-template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);
+template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17
+template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
template<class R, class T> unspecified mem_fn(R T::*);
@@ -470,6 +470,7 @@ template <> struct hash<double>;
template <> struct hash<long double>;
template<class T> struct hash<T*>;
+template <> struct hash<nullptr_t>; // C++17
} // std
@@ -485,6 +486,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
#include <exception>
#include <memory>
#include <tuple>
+#include <utility>
#include <__functional_base>
@@ -1018,6 +1020,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
binary_negate<_Predicate>
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
template <class __Operation>
class _LIBCPP_TEMPLATE_VIS binder1st
: public unary_function<typename __Operation::second_argument_type,
@@ -1242,6 +1245,7 @@ inline _LIBCPP_INLINE_VISIBILITY
const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
+#endif
////////////////////////////////////////////////////////////////////////////////
// MEMFUN
@@ -1260,7 +1264,7 @@ private:
public:
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
// invoke
template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY
@@ -1387,6 +1391,12 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
class _LIBCPP_EXCEPTION_ABI bad_function_call
: public exception
{
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+public:
+ virtual ~bad_function_call() _NOEXCEPT;
+
+ virtual const char* what() const _NOEXCEPT;
+#endif
};
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
@@ -1444,7 +1454,7 @@ bool __not_null(function<_Fp> const& __f) { return !!__f; }
} // namespace __function
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
namespace __function {
@@ -1931,8 +1941,8 @@ _Tp*
function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
{
if (__f_ == 0)
- return (_Tp*)0;
- return (_Tp*)__f_->target(typeid(_Tp));
+ return nullptr;
+ return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
}
template<class _Rp, class ..._ArgTypes>
@@ -1941,7 +1951,7 @@ const _Tp*
function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
{
if (__f_ == 0)
- return (const _Tp*)0;
+ return nullptr;
return (const _Tp*)__f_->target(typeid(_Tp));
}
@@ -1973,7 +1983,7 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
-#else // _LIBCPP_HAS_NO_VARIADICS
+#else // _LIBCPP_CXX03_LANG
#include <__functional_03>
@@ -2037,7 +2047,7 @@ struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2214,7 +2224,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
_Args&& __args)
{
- return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
+ return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...);
}
template<class _Fp, class ..._BoundArgs>
@@ -2247,7 +2257,7 @@ public:
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
operator()(_Args&& ...__args)
{
- return __apply_functor(__f_, __bound_args_, __indices(),
+ return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
}
@@ -2256,7 +2266,7 @@ public:
typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
operator()(_Args&& ...__args) const
{
- return __apply_functor(__f_, __bound_args_, __indices(),
+ return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
}
};
@@ -2337,248 +2347,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<bool>
- : public unary_function<bool, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char>
- : public unary_function<char, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<signed char>
- : public unary_function<signed char, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
- : public unary_function<unsigned char, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
- : public unary_function<char16_t, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
- : public unary_function<char32_t, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
- : public unary_function<wchar_t, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<short>
- : public unary_function<short, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
- : public unary_function<unsigned short, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<int>
- : public unary_function<int, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
- : public unary_function<unsigned int, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long>
- : public unary_function<long, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
- : public unary_function<unsigned long, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long long>
- : public __scalar_hash<long long>
-{
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
- : public __scalar_hash<unsigned long long>
-{
-};
-
-#ifndef _LIBCPP_HAS_NO_INT128
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
- : public __scalar_hash<__int128_t>
-{
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
- : public __scalar_hash<__uint128_t>
-{
-};
-
-#endif
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<float>
- : public __scalar_hash<float>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(float __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0)
- return 0;
- return __scalar_hash<float>::operator()(__v);
- }
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<double>
- : public __scalar_hash<double>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0)
- return 0;
- return __scalar_hash<double>::operator()(__v);
- }
-};
-
-template <>
-struct _LIBCPP_TEMPLATE_VIS hash<long double>
- : public __scalar_hash<long double>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(long double __v) const _NOEXCEPT
- {
- // -0.0 and 0.0 should return same hash
- if (__v == 0)
- return 0;
-#if defined(__i386__)
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__s.__c = 0;
- __u.__s.__d = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
-#elif defined(__x86_64__)
- // Zero out padding bits
- union
- {
- long double __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__s.__a = 0;
- __u.__s.__b = 0;
- __u.__t = __v;
- return __u.__s.__a ^ __u.__s.__b;
-#else
- return __scalar_hash<long double>::operator()(__v);
-#endif
- }
-};
-
-#if _LIBCPP_STD_VER > 11
-
-template <class _Tp, bool = is_enum<_Tp>::value>
-struct _LIBCPP_TEMPLATE_VIS __enum_hash
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- typedef typename underlying_type<_Tp>::type type;
- return hash<type>{}(static_cast<type>(__v));
- }
-};
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
- __enum_hash() = delete;
- __enum_hash(__enum_hash const&) = delete;
- __enum_hash& operator=(__enum_hash const&) = delete;
-};
-
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
-{
-};
-#endif
-
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
diff --git a/contrib/libc++/include/future b/contrib/libc++/include/future
index 48550a3..e388767 100644
--- a/contrib/libc++/include/future
+++ b/contrib/libc++/include/future
@@ -156,7 +156,7 @@ public:
~future();
future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept;
- shared_future<R> share();
+ shared_future<R> share() noexcept;
// retrieving the value
R get();
@@ -183,7 +183,7 @@ public:
~future();
future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept;
- shared_future<R&> share();
+ shared_future<R&> share() noexcept;
// retrieving the value
R& get();
@@ -210,7 +210,7 @@ public:
~future();
future& operator=(const future& rhs) = delete;
future& operator=(future&&) noexcept;
- shared_future<void> share();
+ shared_future<void> share() noexcept;
// retrieving the value
void get();
@@ -499,7 +499,7 @@ make_error_condition(future_errc __e) _NOEXCEPT
return error_condition(static_cast<int>(__e), future_category());
}
-class _LIBCPP_EXCEPTION_ABI future_error
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_FUTURE_ERROR future_error
: public logic_error
{
error_code __ec_;
@@ -515,6 +515,9 @@ public:
};
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+#ifndef _LIBCPP_NO_EXCEPTIONS
+_LIBCPP_AVAILABILITY_FUTURE_ERROR
+#endif
void __throw_future_error(future_errc _Ev)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
@@ -525,7 +528,7 @@ void __throw_future_error(future_errc _Ev)
#endif
}
-class _LIBCPP_TYPE_VIS __assoc_sub_state
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state
: public __shared_count
{
protected:
@@ -582,6 +585,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
future_status
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
@@ -611,7 +615,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c
}
template <class _Rp>
-class __assoc_state
+class _LIBCPP_AVAILABILITY_FUTURE __assoc_state
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
@@ -651,6 +655,7 @@ __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
template <class _Rp>
template <class _Arg>
+_LIBCPP_AVAILABILITY_FUTURE
void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__assoc_state<_Rp>::set_value(_Arg&& __arg)
@@ -706,7 +711,7 @@ __assoc_state<_Rp>::copy()
}
template <class _Rp>
-class __assoc_state<_Rp&>
+class _LIBCPP_AVAILABILITY_FUTURE __assoc_state<_Rp&>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
@@ -766,7 +771,7 @@ __assoc_state<_Rp&>::copy()
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc
+class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc
: public __assoc_state<_Rp>
{
typedef __assoc_state<_Rp> base;
@@ -794,7 +799,7 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
}
template <class _Rp, class _Alloc>
-class __assoc_state_alloc<_Rp&, _Alloc>
+class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc<_Rp&, _Alloc>
: public __assoc_state<_Rp&>
{
typedef __assoc_state<_Rp&> base;
@@ -820,7 +825,7 @@ __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
}
template <class _Alloc>
-class __assoc_sub_state_alloc
+class _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state_alloc
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
@@ -846,7 +851,7 @@ __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
}
template <class _Rp, class _Fp>
-class __deferred_assoc_state
+class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state
: public __assoc_state<_Rp>
{
typedef __assoc_state<_Rp> base;
@@ -893,7 +898,7 @@ __deferred_assoc_state<_Rp, _Fp>::__execute()
}
template <class _Fp>
-class __deferred_assoc_state<void, _Fp>
+class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state<void, _Fp>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
@@ -941,7 +946,7 @@ __deferred_assoc_state<void, _Fp>::__execute()
}
template <class _Rp, class _Fp>
-class __async_assoc_state
+class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state
: public __assoc_state<_Rp>
{
typedef __assoc_state<_Rp> base;
@@ -996,7 +1001,7 @@ __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
}
template <class _Fp>
-class __async_assoc_state<void, _Fp>
+class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp>
: public __assoc_sub_state
{
typedef __assoc_sub_state base;
@@ -1075,7 +1080,7 @@ __make_async_assoc_state(_Fp __f);
#endif
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
{
__assoc_state<_Rp>* __state_;
@@ -1119,7 +1124,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
- shared_future<_Rp> share();
+ shared_future<_Rp> share() _NOEXCEPT;
// retrieving the value
_Rp get();
@@ -1178,7 +1183,7 @@ future<_Rp>::get()
}
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS future<_Rp&>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&>
{
__assoc_state<_Rp&>* __state_;
@@ -1222,7 +1227,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
- shared_future<_Rp&> share();
+ shared_future<_Rp&> share() _NOEXCEPT;
// retrieving the value
_Rp& get();
@@ -1276,7 +1281,7 @@ future<_Rp&>::get()
}
template <>
-class _LIBCPP_TYPE_VIS future<void>
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future<void>
{
__assoc_sub_state* __state_;
@@ -1320,7 +1325,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
_LIBCPP_INLINE_VISIBILITY
- shared_future<void> share();
+ shared_future<void> share() _NOEXCEPT;
// retrieving the value
void get();
@@ -1359,7 +1364,7 @@ swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
template <class _Callable> class packaged_task;
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise
{
__assoc_state<_Rp>* __state_;
@@ -1526,7 +1531,7 @@ promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
// promise<R&>
template <class _Rp>
-class _LIBCPP_TEMPLATE_VIS promise<_Rp&>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<_Rp&>
{
__assoc_state<_Rp&>* __state_;
@@ -1662,7 +1667,7 @@ promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
// promise<void>
template <>
-class _LIBCPP_TYPE_VIS promise<void>
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<void>
{
__assoc_sub_state* __state_;
@@ -1674,6 +1679,7 @@ class _LIBCPP_TYPE_VIS promise<void>
public:
promise();
template <class _Allocator>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
promise(allocator_arg_t, const _Allocator& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
@@ -1747,7 +1753,7 @@ template <class _Rp, class _Alloc>
template<class _Fp> class __packaged_task_base;
template<class _Rp, class ..._ArgTypes>
-class __packaged_task_base<_Rp(_ArgTypes...)>
+class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)>
{
__packaged_task_base(const __packaged_task_base&);
__packaged_task_base& operator=(const __packaged_task_base&);
@@ -1765,7 +1771,7 @@ public:
template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
-class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
+class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
: public __packaged_task_base<_Rp(_ArgTypes...)>
{
__compressed_pair<_Fp, _Alloc> __f_;
@@ -1823,7 +1829,7 @@ __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ...
template <class _Callable> class __packaged_task_function;
template<class _Rp, class ..._ArgTypes>
-class __packaged_task_function<_Rp(_ArgTypes...)>
+class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)>
{
typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
typename aligned_storage<3*sizeof(void*)>::type __buf_;
@@ -1998,7 +2004,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) cons
}
template<class _Rp, class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<_Rp(_ArgTypes...)>
{
public:
typedef _Rp result_type; // extension
@@ -2127,7 +2133,7 @@ packaged_task<_Rp(_ArgTypes...)>::reset()
}
template<class ..._ArgTypes>
-class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)>
+class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<void(_ArgTypes...)>
{
public:
typedef void result_type; // extension
@@ -2515,7 +2521,7 @@ shared_future<_Rp&>::operator=(const shared_future& __rhs)
}
template <>
-class _LIBCPP_TYPE_VIS shared_future<void>
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE shared_future<void>
{
__assoc_sub_state* __state_;
@@ -2580,7 +2586,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
template <class _Rp>
inline
shared_future<_Rp>
-future<_Rp>::share()
+future<_Rp>::share() _NOEXCEPT
{
return shared_future<_Rp>(_VSTD::move(*this));
}
@@ -2588,7 +2594,7 @@ future<_Rp>::share()
template <class _Rp>
inline
shared_future<_Rp&>
-future<_Rp&>::share()
+future<_Rp&>::share() _NOEXCEPT
{
return shared_future<_Rp&>(_VSTD::move(*this));
}
@@ -2597,7 +2603,7 @@ future<_Rp&>::share()
inline
shared_future<void>
-future<void>::share()
+future<void>::share() _NOEXCEPT
{
return shared_future<void>(_VSTD::move(*this));
}
diff --git a/contrib/libc++/include/initializer_list b/contrib/libc++/include/initializer_list
index d6dfa80..8c234aa 100644
--- a/contrib/libc++/include/initializer_list
+++ b/contrib/libc++/include/initializer_list
@@ -53,7 +53,7 @@ template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in
namespace std // purposefully not versioned
{
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Ep>
class _LIBCPP_TEMPLATE_VIS initializer_list
@@ -111,7 +111,7 @@ end(initializer_list<_Ep> __il) _NOEXCEPT
return __il.end();
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // !defined(_LIBCPP_CXX03_LANG)
} // std
diff --git a/contrib/libc++/include/ios b/contrib/libc++/include/ios
index bb5ca72..61d00b9 100644
--- a/contrib/libc++/include/ios
+++ b/contrib/libc++/include/ios
@@ -592,6 +592,9 @@ public:
typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type;
+ // __true_value will generate undefined references when linking unless
+ // we give it internal linkage.
+
#if defined(_LIBCPP_CXX03_LANG)
_LIBCPP_ALWAYS_INLINE
operator __cxx03_bool::__bool_type() const {
@@ -654,7 +657,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY
void move(basic_ios& __rhs);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_ALWAYS_INLINE
void move(basic_ios&& __rhs) {move(__rhs);}
#endif
diff --git a/contrib/libc++/include/istream b/contrib/libc++/include/istream
index 774f38d..0b8e05d 100644
--- a/contrib/libc++/include/istream
+++ b/contrib/libc++/include/istream
@@ -162,12 +162,14 @@ template <class charT, class traits, class T>
#include <__config>
#include <ostream>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -189,12 +191,11 @@ public:
{ this->init(__sb); }
virtual ~basic_istream();
protected:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_istream(basic_istream&& __rhs);
-#endif
+
// 27.7.1.1.2 Assign/swap:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
basic_istream& operator=(basic_istream&& __rhs);
#endif
@@ -332,7 +333,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.setstate(ios_base::failbit);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
@@ -350,7 +351,7 @@ basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_istream<_CharT, _Traits>::~basic_istream()
@@ -1424,7 +1425,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
return __is;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1435,7 +1436,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
return __is;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS basic_iostream
@@ -1458,13 +1459,11 @@ public:
virtual ~basic_iostream();
protected:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_iostream(basic_iostream&& __rhs);
-#endif
// assign/swap
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
basic_iostream& operator=(basic_iostream&& __rhs);
#endif
@@ -1474,7 +1473,7 @@ protected:
public:
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
@@ -1490,7 +1489,7 @@ basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_iostream<_CharT, _Traits>::~basic_iostream()
@@ -1607,7 +1606,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
return getline(__is, __str, __is.widen('\n'));
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1627,7 +1626,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
return getline(__is, __str, __is.widen('\n'));
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
@@ -1678,10 +1677,14 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is;
}
+#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
+#endif
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_ISTREAM
diff --git a/contrib/libc++/include/iterator b/contrib/libc++/include/iterator
index b8f6570..d163ab1 100644
--- a/contrib/libc++/include/iterator
+++ b/contrib/libc++/include/iterator
@@ -64,14 +64,23 @@ struct forward_iterator_tag : public input_iterator_tag {};
struct bidirectional_iterator_tag : public forward_iterator_tag {};
struct random_access_iterator_tag : public bidirectional_iterator_tag {};
+// 27.4.3, iterator operations
// extension: second argument not conforming to C++03
-template <class InputIterator>
-void advance(InputIterator& i,
+template <class InputIterator> // constexpr in C++17
+ constexpr void advance(InputIterator& i,
typename iterator_traits<InputIterator>::difference_type n);
-template <class InputIterator>
-typename iterator_traits<InputIterator>::difference_type
-distance(InputIterator first, InputIterator last);
+template <class InputIterator> // constexpr in C++17
+ constexpr typename iterator_traits<InputIterator>::difference_type
+ distance(InputIterator first, InputIterator last);
+
+template <class InputIterator> // constexpr in C++17
+ constexpr InputIterator next(InputIterator x,
+typename iterator_traits<InputIterator>::difference_type n = 1);
+
+template <class BidirectionalIterator> // constexpr in C++17
+ constexpr BidirectionalIterator prev(BidirectionalIterator x,
+ typename iterator_traits<BidirectionalIterator>::difference_type n = 1);
template <class Iterator>
class reverse_iterator
@@ -529,7 +538,7 @@ struct _LIBCPP_TEMPLATE_VIS iterator
};
template <class _InputIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
void __advance(_InputIter& __i,
typename iterator_traits<_InputIter>::difference_type __n, input_iterator_tag)
{
@@ -538,7 +547,7 @@ void __advance(_InputIter& __i,
}
template <class _BiDirIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
void __advance(_BiDirIter& __i,
typename iterator_traits<_BiDirIter>::difference_type __n, bidirectional_iterator_tag)
{
@@ -551,7 +560,7 @@ void __advance(_BiDirIter& __i,
}
template <class _RandIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
void __advance(_RandIter& __i,
typename iterator_traits<_RandIter>::difference_type __n, random_access_iterator_tag)
{
@@ -559,7 +568,7 @@ void __advance(_RandIter& __i,
}
template <class _InputIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
void advance(_InputIter& __i,
typename iterator_traits<_InputIter>::difference_type __n)
{
@@ -567,7 +576,7 @@ void advance(_InputIter& __i,
}
template <class _InputIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
typename iterator_traits<_InputIter>::difference_type
__distance(_InputIter __first, _InputIter __last, input_iterator_tag)
{
@@ -578,7 +587,7 @@ __distance(_InputIter __first, _InputIter __last, input_iterator_tag)
}
template <class _RandIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
typename iterator_traits<_RandIter>::difference_type
__distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)
{
@@ -586,7 +595,7 @@ __distance(_RandIter __first, _RandIter __last, random_access_iterator_tag)
}
template <class _InputIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
typename iterator_traits<_InputIter>::difference_type
distance(_InputIter __first, _InputIter __last)
{
@@ -594,7 +603,7 @@ distance(_InputIter __first, _InputIter __last)
}
template <class _InputIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
_InputIter
next(_InputIter __x,
typename iterator_traits<_InputIter>::difference_type __n = 1,
@@ -605,7 +614,7 @@ next(_InputIter __x,
}
template <class _BidiretionalIter>
-inline _LIBCPP_INLINE_VISIBILITY
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
_BidiretionalIter
prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
@@ -615,6 +624,14 @@ prev(_BidiretionalIter __x,
return __x;
}
+
+template <class _Tp, class = void>
+struct __is_stashing_iterator : false_type {};
+
+template <class _Tp>
+struct __is_stashing_iterator<_Tp, typename __void_t<typename _Tp::__stashing_iterator_tag>::type>
+ : true_type {};
+
template <class _Iter>
class _LIBCPP_TEMPLATE_VIS reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
@@ -625,6 +642,11 @@ class _LIBCPP_TEMPLATE_VIS reverse_iterator
{
private:
/*mutable*/ _Iter __t; // no longer used as of LWG #2360, not removed due to ABI break
+
+ static_assert(!__is_stashing_iterator<_Iter>::value,
+ "The specified iterator type cannot be used with reverse_iterator; "
+ "Using stashing iterators with reverse_iterator causes undefined behavior");
+
protected:
_Iter current;
public:
@@ -770,10 +792,10 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_back(__value_); return *this;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_back(_VSTD::move(__value_)); return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator operator++(int) {return *this;}
@@ -803,10 +825,10 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(_VSTD::addressof(__x)) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_)
{container->push_front(__value_); return *this;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_)
{container->push_front(_VSTD::move(__value_)); return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator operator++(int) {return *this;}
@@ -838,10 +860,10 @@ public:
: container(_VSTD::addressof(__x)), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_)
{iter = container->insert(iter, __value_); ++iter; return *this;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_)
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++(int) {return *this;}
@@ -968,7 +990,6 @@ public:
_LIBCPP_INLINE_VISIBILITY char_type operator*() const
{return static_cast<char_type>(__sbuf_->sgetc());}
- _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{
__sbuf_->sbumpc();
@@ -1047,7 +1068,7 @@ public:
typedef typename iterator_traits<iterator_type>::value_type value_type;
typedef typename iterator_traits<iterator_type>::difference_type difference_type;
typedef iterator_type pointer;
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
typedef typename iterator_traits<iterator_type>::reference __reference;
typedef typename conditional<
is_reference<__reference>::value,
diff --git a/contrib/libc++/include/limits b/contrib/libc++/include/limits
index b15f8f1..f530507 100644
--- a/contrib/libc++/include/limits
+++ b/contrib/libc++/include/limits
@@ -101,24 +101,25 @@ template<> class numeric_limits<cv long double>;
} // std
*/
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#include <__config>
#include <type_traits>
-#include <__undef_min_max>
-
-#if defined(_LIBCPP_MSVCRT)
-#include "support/win32/limits_win32.h"
+#if defined(_LIBCPP_COMPILER_MSVC)
+#include "support/win32/limits_msvc_win32.h"
#endif // _LIBCPP_MSVCRT
#if defined(__IBMCPP__)
#include "support/ibm/limits.h"
#endif // __IBMCPP__
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
enum float_round_style
@@ -182,14 +183,14 @@ protected:
static _LIBCPP_CONSTEXPR const float_round_style round_style = round_toward_zero;
};
-template <class _Tp, int digits, bool _IsSigned>
+template <class _Tp, int __digits, bool _IsSigned>
struct __libcpp_compute_min
{
- static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << digits);
+ static _LIBCPP_CONSTEXPR const _Tp value = _Tp(_Tp(1) << __digits);
};
-template <class _Tp, int digits>
-struct __libcpp_compute_min<_Tp, digits, false>
+template <class _Tp, int __digits>
+struct __libcpp_compute_min<_Tp, __digits, false>
{
static _LIBCPP_CONSTEXPR const _Tp value = _Tp(0);
};
@@ -811,4 +812,6 @@ template <class _Tp>
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LIMITS
diff --git a/contrib/libc++/include/list b/contrib/libc++/include/list
index fa148db..20a66c3 100644
--- a/contrib/libc++/include/list
+++ b/contrib/libc++/include/list
@@ -177,14 +177,16 @@ template <class T, class Alloc>
#include <algorithm>
#include <type_traits>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __list_node;
@@ -860,11 +862,10 @@ public:
list(const list& __c, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
list& operator=(const list& __c);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
list(initializer_list<value_type> __il);
list(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
_LIBCPP_INLINE_VISIBILITY
list(list&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
@@ -875,22 +876,20 @@ public:
_NOEXCEPT_(
__node_alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<__node_allocator>::value);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
_LIBCPP_INLINE_VISIBILITY
list& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+ _LIBCPP_INLINE_VISIBILITY
+ void assign(initializer_list<value_type> __il)
+ {assign(__il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
template <class _InpIter>
void assign(_InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
void assign(size_type __n, const value_type& __x);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- void assign(initializer_list<value_type> __il)
- {assign(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT;
@@ -964,10 +963,10 @@ public:
return base::__end_.__prev_->__as_node()->__value_;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
void push_front(value_type&& __x);
void push_back(value_type&& __x);
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
template <class... _Args>
#if _LIBCPP_STD_VER > 14
reference emplace_front(_Args&&... __args);
@@ -982,9 +981,13 @@ public:
#endif
template <class... _Args>
iterator emplace(const_iterator __p, _Args&&... __args);
-#endif // _LIBCPP_HAS_NO_VARIADICS
+
iterator insert(const_iterator __p, value_type&& __x);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator __p, initializer_list<value_type> __il)
+ {return insert(__p, __il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
void push_front(const value_type& __x);
void push_back(const value_type& __x);
@@ -994,11 +997,6 @@ public:
template <class _InpIter>
iterator insert(const_iterator __p, _InpIter __f, _InpIter __l,
typename enable_if<__is_input_iterator<_InpIter>::value>::type* = 0);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, initializer_list<value_type> __il)
- {return insert(__p, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void swap(list& __c)
@@ -1022,22 +1020,18 @@ public:
void resize(size_type __n, const value_type& __x);
void splice(const_iterator __p, list& __c);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c) {splice(__p, __c);}
-#endif
- void splice(const_iterator __p, list& __c, const_iterator __i);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __i)
{splice(__p, __c, __i);}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
void splice(const_iterator __p, list&& __c, const_iterator __f, const_iterator __l)
{splice(__p, __c, __f, __l);}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+ void splice(const_iterator __p, list& __c, const_iterator __i);
+ void splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l);
void remove(const value_type& __x);
template <class _Pred> void remove_if(_Pred __pred);
@@ -1047,17 +1041,17 @@ public:
void unique(_BinaryPred __binary_pred);
_LIBCPP_INLINE_VISIBILITY
void merge(list& __c);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c) {merge(__c);}
-#endif
- template <class _Comp>
- void merge(list& __c, _Comp __comp);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
template <class _Comp>
_LIBCPP_INLINE_VISIBILITY
void merge(list&& __c, _Comp __comp) {merge(__c, __comp);}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif
+ template <class _Comp>
+ void merge(list& __c, _Comp __comp);
+
_LIBCPP_INLINE_VISIBILITY
void sort();
template <class _Comp>
@@ -1146,7 +1140,7 @@ list<_Tp, _Alloc>::list(size_type __n)
__get_db()->__insert_c(this);
#endif
for (; __n > 0; --__n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
emplace_back();
#else
push_back(value_type());
@@ -1161,11 +1155,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
__get_db()->__insert_c(this);
#endif
for (; __n > 0; --__n)
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
emplace_back();
-#else
- push_back(value_type());
-#endif
}
#endif
@@ -1239,7 +1229,7 @@ list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a)
push_back(*__i);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
@@ -1264,23 +1254,6 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
push_back(*__i);
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-template <class _Tp, class _Alloc>
-inline
-list<_Tp, _Alloc>&
-list<_Tp, _Alloc>::operator=(const list& __c)
-{
- if (this != &__c)
- {
- base::__copy_assign_alloc(__c);
- assign(__c.begin(), __c.end());
- }
- return *this;
-}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Tp, class _Alloc>
inline
list<_Tp, _Alloc>::list(list&& __c)
@@ -1346,7 +1319,20 @@ list<_Tp, _Alloc>::__move_assign(list& __c, true_type)
splice(end(), __c);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
+
+template <class _Tp, class _Alloc>
+inline
+list<_Tp, _Alloc>&
+list<_Tp, _Alloc>::operator=(const list& __c)
+{
+ if (this != &__c)
+ {
+ base::__copy_assign_alloc(__c);
+ assign(__c.begin(), __c.end());
+ }
+ return *this;
+}
template <class _Tp, class _Alloc>
template <class _InpIter>
@@ -1576,7 +1562,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
__hold.release();
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
void
@@ -1604,8 +1590,6 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
__hold.release();
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Alloc>
template <class... _Args>
#if _LIBCPP_STD_VER > 14
@@ -1677,8 +1661,6 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
#endif
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Alloc>
typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
@@ -1704,7 +1686,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Alloc>
void
@@ -2435,4 +2417,6 @@ swap(list<_Tp, _Alloc>& __x, list<_Tp, _Alloc>& __y)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LIST
diff --git a/contrib/libc++/include/locale b/contrib/libc++/include/locale
index d2d35ff..d30d950 100644
--- a/contrib/libc++/include/locale
+++ b/contrib/libc++/include/locale
@@ -192,14 +192,7 @@ template <class charT> class messages_byname;
#endif
#include <cstdlib>
#include <ctime>
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#include <support/win32/locale_win32.h>
-#elif defined(_NEWLIB_VERSION)
-// FIXME: replace all the uses of _NEWLIB_VERSION with __NEWLIB__ preceded by an
-// include of <sys/cdefs.h> once https://sourceware.org/ml/newlib-cvs/2014-q3/msg00038.html
-// has had a chance to bake for a bit
-#include <support/newlib/xlocale.h>
-#endif
+#include <cstdio>
#ifdef _LIBCPP_HAS_CATOPEN
#include <nl_types.h>
#endif
@@ -208,18 +201,20 @@ template <class charT> class messages_byname;
#include <Availability.h>
#endif
-#include <__undef_min_max>
-
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
#include <__bsd_locale_defaults.h>
#else
#include <__bsd_locale_fallbacks.h>
#endif
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__)
@@ -233,9 +228,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#define __cloc_defined
#endif
-typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
-typedef _VSTD::unique_ptr<__locale_struct, decltype(&freelocale)> __locale_unique_ptr;
-
// __scan_keyword
// Scans [__b, __e) until a match is found in the basic_strings range
// [__kb, __ke) or until it can be shown that there is no match in [__kb, __ke).
@@ -380,19 +372,57 @@ template <class _CharT>
struct __num_get
: protected __num_get_base
{
- static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point,
_CharT& __thousands_sep);
- static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
- unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
- unsigned* __g, unsigned*& __g_end, _CharT* __atoms);
+
static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp,
char* __a, char*& __a_end,
_CharT __decimal_point, _CharT __thousands_sep,
const string& __grouping, unsigned* __g,
unsigned*& __g_end, unsigned& __dc, _CharT* __atoms);
+#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
+ static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep);
+ static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
+ unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
+ unsigned* __g, unsigned*& __g_end, _CharT* __atoms);
+
+#else
+ static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep)
+ {
+ locale __loc = __iob.getloc();
+ const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__loc);
+ __thousands_sep = __np.thousands_sep();
+ return __np.grouping();
+ }
+
+ const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const
+ {
+ return __do_widen_p(__iob, __atoms);
+ }
+
+
+ static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
+ unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
+ unsigned* __g, unsigned*& __g_end, const _CharT* __atoms);
+private:
+ template<typename T>
+ const T* __do_widen_p(ios_base& __iob, T* __atoms) const
+ {
+ locale __loc = __iob.getloc();
+ use_facet<ctype<T> >(__loc).widen(__src, __src + 26, __atoms);
+ return __atoms;
+ }
+
+ const char* __do_widen_p(ios_base& __iob, char* __atoms) const
+ {
+ (void)__iob;
+ (void)__atoms;
+ return __src;
+ }
+#endif
};
+#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
template <class _CharT>
string
__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep)
@@ -403,6 +433,7 @@ __num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& _
__thousands_sep = __np.thousands_sep();
return __np.grouping();
}
+#endif
template <class _CharT>
string
@@ -419,9 +450,16 @@ __num_get<_CharT>::__stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT&
template <class _CharT>
int
+#ifndef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
+#else
+__num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end,
+ unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
+ unsigned* __g, unsigned*& __g_end, const _CharT* __atoms)
+
+#endif
{
if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
{
@@ -623,16 +661,19 @@ protected:
~num_get() {}
template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_floating_point
(iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Fp& __v) const;
template <class _Signed>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_signed
(iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Signed& __v) const;
template <class _Unsigned>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
iter_type __do_get_unsigned
(iter_type __b, iter_type __e, ios_base& __iob,
ios_base::iostate& __err, _Unsigned& __v) const;
@@ -854,9 +895,16 @@ num_get<_CharT, _InputIterator>::__do_get_signed(iter_type __b, iter_type __e,
// Stage 1
int __base = this->__get_base(__iob);
// Stage 2
- char_type __atoms[26];
char_type __thousands_sep;
+ const int __atoms_size = 26;
+#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
+ char_type __atoms1[__atoms_size];
+ const char_type *__atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+#else
+ char_type __atoms[__atoms_size];
string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+#endif
string __buf;
__buf.resize(__buf.capacity());
char* __a = &__buf[0];
@@ -904,9 +952,16 @@ num_get<_CharT, _InputIterator>::__do_get_unsigned(iter_type __b, iter_type __e,
// Stage 1
int __base = this->__get_base(__iob);
// Stage 2
- char_type __atoms[26];
char_type __thousands_sep;
+ const int __atoms_size = 26;
+#ifdef _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
+ char_type __atoms1[__atoms_size];
+ const char_type *__atoms = this->__do_widen(__iob, __atoms1);
+ string __grouping = this->__stage2_int_prep(__iob, __thousands_sep);
+#else
+ char_type __atoms[__atoms_size];
string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep);
+#endif
string __buf;
__buf.resize(__buf.capacity());
char* __a = &__buf[0];
@@ -1686,6 +1741,22 @@ protected:
~__time_get_c_storage() {}
};
+template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__weeks() const;
+template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__months() const;
+template <> _LIBCPP_FUNC_VIS const string* __time_get_c_storage<char>::__am_pm() const;
+template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__c() const;
+template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__r() const;
+template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__x() const;
+template <> _LIBCPP_FUNC_VIS const string& __time_get_c_storage<char>::__X() const;
+
+template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__weeks() const;
+template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__months() const;
+template <> _LIBCPP_FUNC_VIS const wstring* __time_get_c_storage<wchar_t>::__am_pm() const;
+template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__c() const;
+template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__r() const;
+template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__x() const;
+template <> _LIBCPP_FUNC_VIS const wstring& __time_get_c_storage<wchar_t>::__X() const;
+
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
class _LIBCPP_TEMPLATE_VIS time_get
: public locale::facet,
@@ -2632,10 +2703,10 @@ private:
void init(const char*);
};
-template<> void moneypunct_byname<char, false>::init(const char*);
-template<> void moneypunct_byname<char, true>::init(const char*);
-template<> void moneypunct_byname<wchar_t, false>::init(const char*);
-template<> void moneypunct_byname<wchar_t, true>::init(const char*);
+template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, false>::init(const char*);
+template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*);
+template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
+template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>)
@@ -2826,7 +2897,7 @@ money_get<_CharT, _InputIterator>::__do_get(iter_type& __b, iter_type __e,
return false;
}
}
- // drop through
+ _LIBCPP_FALLTHROUGH();
case money_base::none:
if (__p != 3)
{
@@ -3571,7 +3642,7 @@ public:
wstring_convert(_Codecvt* __pcvt, state_type __state);
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(const byte_string& __byte_err,
const wide_string& __wide_err = wide_string());
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_ALWAYS_INLINE
wstring_convert(wstring_convert&& __wc);
#endif
@@ -3630,7 +3701,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
__cvtptr_ = new _Codecvt;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
inline
@@ -3644,7 +3715,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
__wc.__cvtptr_ = nullptr;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::~wstring_convert()
@@ -3949,7 +4020,8 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
this->egptr(), __inext);
if (__r == codecvt_base::noconv)
{
- this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
+ this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
+ (char_type*) const_cast<char *>(__extbufend_));
__c = *this->gptr();
}
else if (__inext != this->eback() + __unget_sz)
@@ -4037,7 +4109,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::overflow(int_type __c)
return traits_type::eof();
if (__r == codecvt_base::partial)
{
- this->setp((char_type*)__e, this->pptr());
+ this->setp(const_cast<char_type *>(__e), this->pptr());
this->pbump(this->epptr() - this->pbase());
}
}
@@ -4258,4 +4330,6 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_LOCALE
diff --git a/contrib/libc++/include/map b/contrib/libc++/include/map
index 9555aad..71f1869 100644
--- a/contrib/libc++/include/map
+++ b/contrib/libc++/include/map
@@ -453,9 +453,7 @@ swap(multimap<Key, T, Compare, Allocator>& x,
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _CP, class _Compare,
- bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value
- >
+template <class _Key, class _CP, class _Compare, bool _IsSmall>
class __map_value_compare
: private _Compare
{
@@ -482,8 +480,8 @@ public:
void swap(__map_value_compare&__y)
_NOEXCEPT_(__is_nothrow_swappable<_Compare>::value)
{
- using _VSTD::swap;
- swap(static_cast<const _Compare&>(*this), static_cast<const _Compare&>(__y));
+ using _VSTD::swap;
+ swap(static_cast<_Compare&>(*this), static_cast<_Compare&>(__y));
}
#if _LIBCPP_STD_VER > 11
@@ -584,7 +582,7 @@ public:
__second_constructed(false)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__map_node_destructor(__tree_node_destructor<allocator_type>&& __x) _NOEXCEPT
: __na_(__x.__na_),
@@ -593,7 +591,7 @@ public:
{
__x.__value_constructed = false;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) _NOEXCEPT
@@ -669,7 +667,7 @@ private:
~__value_type();
};
-#endif
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
struct __extract_key_value_types;
@@ -923,7 +921,7 @@ public:
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
map(map&& __m)
@@ -942,10 +940,6 @@ public:
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
_LIBCPP_INLINE_VISIBILITY
map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -973,7 +967,7 @@ public:
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit map(const allocator_type& __a)
@@ -1084,6 +1078,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p.__i_, _VSTD::move(__v));}
+
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(initializer_list<value_type> __il)
+ {insert(__il.begin(), __il.end());}
#endif
template <class _InputIterator>
@@ -1094,14 +1092,6 @@ public:
insert(__e.__i_, *__f);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
#if _LIBCPP_STD_VER > 14
template <class... _Args>
@@ -1196,7 +1186,7 @@ public:
return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
}
-#endif
+#endif // _LIBCPP_STD_VER > 14
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
@@ -1309,7 +1299,6 @@ private:
#ifndef _LIBCPP_CXX03_LANG
-
template <class _Key, class _Tp, class _Compare, class _Allocator>
map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
: __tree_(_VSTD::move(__m.__tree_), typename __base::allocator_type(__a))
@@ -1323,10 +1312,27 @@ map<_Key, _Tp, _Compare, _Allocator>::map(map&& __m, const allocator_type& __a)
}
}
-#endif // !_LIBCPP_CXX03_LANG
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+_Tp&
+map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
+{
+ return __tree_.__emplace_unique_key_args(__k,
+ _VSTD::piecewise_construct,
+ _VSTD::forward_as_tuple(__k),
+ _VSTD::forward_as_tuple()).first->__cc.second;
+}
+template <class _Key, class _Tp, class _Compare, class _Allocator>
+_Tp&
+map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
+{
+ return __tree_.__emplace_unique_key_args(__k,
+ _VSTD::piecewise_construct,
+ _VSTD::forward_as_tuple(_VSTD::move(__k)),
+ _VSTD::forward_as_tuple()).first->__cc.second;
+}
-#ifdef _LIBCPP_CXX03_LANG
+#else // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
@@ -1357,29 +1363,7 @@ map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
return __r->__value_.__cc.second;
}
-#else
-
-template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](const key_type& __k)
-{
- return __tree_.__emplace_unique_key_args(__k,
- _VSTD::piecewise_construct,
- _VSTD::forward_as_tuple(__k),
- _VSTD::forward_as_tuple()).first->__cc.second;
-}
-
-template <class _Key, class _Tp, class _Compare, class _Allocator>
-_Tp&
-map<_Key, _Tp, _Compare, _Allocator>::operator[](key_type&& __k)
-{
- return __tree_.__emplace_unique_key_args(__k,
- _VSTD::piecewise_construct,
- _VSTD::forward_as_tuple(_VSTD::move(__k)),
- _VSTD::forward_as_tuple()).first->__cc.second;
-}
-
-#endif // !_LIBCPP_CXX03_LANG
+#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Compare, class _Allocator>
_Tp&
@@ -1595,7 +1579,7 @@ public:
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
multimap(multimap&& __m)
@@ -1614,10 +1598,6 @@ public:
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
_LIBCPP_INLINE_VISIBILITY
multimap(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
: __tree_(__vc(__comp))
@@ -1645,7 +1625,7 @@ public:
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit multimap(const allocator_type& __a)
@@ -1738,6 +1718,11 @@ public:
iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(__p.__i_, _VSTD::move(__v));}
+
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(initializer_list<value_type> __il)
+ {insert(__il.begin(), __il.end());}
+
#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
@@ -1755,14 +1740,6 @@ public:
__tree_.__insert_multi(__e.__i_, *__f);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p.__i_);}
_LIBCPP_INLINE_VISIBILITY
diff --git a/contrib/libc++/include/math.h b/contrib/libc++/include/math.h
index fb0b608..8c30ba8 100644
--- a/contrib/libc++/include/math.h
+++ b/contrib/libc++/include/math.h
@@ -307,6 +307,7 @@ long double truncl(long double x);
extern "C++" {
#include <type_traits>
+#include <limits>
// signbit
@@ -324,12 +325,50 @@ __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
signbit(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x < 0; }
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
+signbit(_A1) _NOEXCEPT
+{ return false; }
+
+#elif defined(_LIBCPP_MSVCRT)
+
+template <typename _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+ return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
+}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x < 0; }
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
+signbit(_A1) _NOEXCEPT
+{ return false; }
+
#endif // signbit
// fpclassify
@@ -348,12 +387,34 @@ __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
+typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
fpclassify(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_integral<_A1>::value, int>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
+
+#elif defined(_LIBCPP_MSVCRT)
+
+template <typename _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+ return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
+}
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_integral<_A1>::value, int>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x == 0 ? FP_ZERO : FP_NORMAL; }
+
#endif // fpclassify
// isfinite
@@ -372,12 +433,22 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+typename std::enable_if<
+ std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
+ bool>::type
isfinite(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
+ bool>::type
+isfinite(_A1) _NOEXCEPT
+{ return true; }
+
#endif // isfinite
// isinf
@@ -396,12 +467,22 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+typename std::enable_if<
+ std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity,
+ bool>::type
isinf(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<
+ std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity,
+ bool>::type
+isinf(_A1) _NOEXCEPT
+{ return false; }
+
#endif // isinf
// isnan
@@ -420,12 +501,18 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnan(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_integral<_A1>::value, bool>::type
+isnan(_A1) _NOEXCEPT
+{ return false; }
+
#endif // isnan
// isnormal
@@ -444,12 +531,18 @@ __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
isnormal(_A1 __lcpp_x) _NOEXCEPT
{
return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
}
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_integral<_A1>::value, bool>::type
+isnormal(_A1 __lcpp_x) _NOEXCEPT
+{ return __lcpp_x != 0; }
+
#endif // isnormal
// isgreater
@@ -637,58 +730,58 @@ isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
#if !(defined(_AIX) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY
float
-abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+abs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY
double
-abs(double __lcpp_x) _NOEXCEPT {return fabs(__lcpp_x);}
+abs(double __lcpp_x) _NOEXCEPT {return ::fabs(__lcpp_x);}
inline _LIBCPP_INLINE_VISIBILITY
long double
-abs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+abs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
#endif // !(defined(_AIX) || defined(__sun__))
// acos
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return acosf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return acosl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float acos(float __lcpp_x) _NOEXCEPT {return ::acosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __lcpp_x) _NOEXCEPT {return ::acosl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
+acos(_A1 __lcpp_x) _NOEXCEPT {return ::acos((double)__lcpp_x);}
// asin
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return asinf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return asinl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float asin(float __lcpp_x) _NOEXCEPT {return ::asinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __lcpp_x) _NOEXCEPT {return ::asinl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
+asin(_A1 __lcpp_x) _NOEXCEPT {return ::asin((double)__lcpp_x);}
// atan
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return atanf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return atanl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float atan(float __lcpp_x) _NOEXCEPT {return ::atanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __lcpp_x) _NOEXCEPT {return ::atanl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
+atan(_A1 __lcpp_x) _NOEXCEPT {return ::atan((double)__lcpp_x);}
// atan2
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return atan2f(__lcpp_y, __lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return atan2l(__lcpp_y, __lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float atan2(float __lcpp_y, float __lcpp_x) _NOEXCEPT {return ::atan2f(__lcpp_y, __lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __lcpp_y, long double __lcpp_x) _NOEXCEPT {return ::atan2l(__lcpp_y, __lcpp_x);}
#endif
template <class _A1, class _A2>
@@ -704,86 +797,86 @@ atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
+ return ::atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
}
// ceil
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ceilf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ceill(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float ceil(float __lcpp_x) _NOEXCEPT {return ::ceilf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __lcpp_x) _NOEXCEPT {return ::ceill(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
+ceil(_A1 __lcpp_x) _NOEXCEPT {return ::ceil((double)__lcpp_x);}
// cos
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return cosf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return cosl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float cos(float __lcpp_x) _NOEXCEPT {return ::cosf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __lcpp_x) _NOEXCEPT {return ::cosl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
+cos(_A1 __lcpp_x) _NOEXCEPT {return ::cos((double)__lcpp_x);}
// cosh
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return coshf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return coshl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float cosh(float __lcpp_x) _NOEXCEPT {return ::coshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __lcpp_x) _NOEXCEPT {return ::coshl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
+cosh(_A1 __lcpp_x) _NOEXCEPT {return ::cosh((double)__lcpp_x);}
// exp
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return expf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return expl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float exp(float __lcpp_x) _NOEXCEPT {return ::expf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __lcpp_x) _NOEXCEPT {return ::expl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
+exp(_A1 __lcpp_x) _NOEXCEPT {return ::exp((double)__lcpp_x);}
// fabs
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return fabsl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float fabs(float __lcpp_x) _NOEXCEPT {return ::fabsf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __lcpp_x) _NOEXCEPT {return ::fabsl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
+fabs(_A1 __lcpp_x) _NOEXCEPT {return ::fabs((double)__lcpp_x);}
// floor
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return floorf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return floorl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float floor(float __lcpp_x) _NOEXCEPT {return ::floorf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __lcpp_x) _NOEXCEPT {return ::floorl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
+floor(_A1 __lcpp_x) _NOEXCEPT {return ::floor((double)__lcpp_x);}
// fmod
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmodf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmodl(__lcpp_x, __lcpp_y);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float fmod(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmodf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmodl(__lcpp_x, __lcpp_y);}
#endif
template <class _A1, class _A2>
@@ -799,69 +892,69 @@ fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// frexp
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpf(__lcpp_x, __lcpp_e);}
-inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexpl(__lcpp_x, __lcpp_e);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float frexp(float __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexpl(__lcpp_x, __lcpp_e);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
+frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return ::frexp((double)__lcpp_x, __lcpp_e);}
// ldexp
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpf(__lcpp_x, __lcpp_e);}
-inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexpl(__lcpp_x, __lcpp_e);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpf(__lcpp_x, __lcpp_e);}
+inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexpl(__lcpp_x, __lcpp_e);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
+ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ::ldexp((double)__lcpp_x, __lcpp_e);}
// log
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return logf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return logl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float log(float __lcpp_x) _NOEXCEPT {return ::logf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log(long double __lcpp_x) _NOEXCEPT {return ::logl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
+log(_A1 __lcpp_x) _NOEXCEPT {return ::log((double)__lcpp_x);}
// log10
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return log10f(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return log10l(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float log10(float __lcpp_x) _NOEXCEPT {return ::log10f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __lcpp_x) _NOEXCEPT {return ::log10l(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
+log10(_A1 __lcpp_x) _NOEXCEPT {return ::log10((double)__lcpp_x);}
// modf
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return modff(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return modfl(__lcpp_x, __lcpp_y);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float modf(float __lcpp_x, float* __lcpp_y) _NOEXCEPT {return ::modff(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __lcpp_x, long double* __lcpp_y) _NOEXCEPT {return ::modfl(__lcpp_x, __lcpp_y);}
#endif
// pow
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return powf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return powl(__lcpp_x, __lcpp_y);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float pow(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::powf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::powl(__lcpp_x, __lcpp_y);}
#endif
template <class _A1, class _A2>
@@ -877,129 +970,119 @@ pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// sin
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return sinf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return sinl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float sin(float __lcpp_x) _NOEXCEPT {return ::sinf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __lcpp_x) _NOEXCEPT {return ::sinl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
+sin(_A1 __lcpp_x) _NOEXCEPT {return ::sin((double)__lcpp_x);}
// sinh
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return sinhf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return sinhl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float sinh(float __lcpp_x) _NOEXCEPT {return ::sinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __lcpp_x) _NOEXCEPT {return ::sinhl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
+sinh(_A1 __lcpp_x) _NOEXCEPT {return ::sinh((double)__lcpp_x);}
// sqrt
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return sqrtf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return sqrtl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __lcpp_x) _NOEXCEPT {return ::sqrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __lcpp_x) _NOEXCEPT {return ::sqrtl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
+sqrt(_A1 __lcpp_x) _NOEXCEPT {return ::sqrt((double)__lcpp_x);}
// tan
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return tanf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return tanl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float tan(float __lcpp_x) _NOEXCEPT {return ::tanf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __lcpp_x) _NOEXCEPT {return ::tanl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
+tan(_A1 __lcpp_x) _NOEXCEPT {return ::tan((double)__lcpp_x);}
// tanh
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX) || defined(__sun__))
-inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return tanhf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return tanhl(__lcpp_x);}
+#if !(defined(_AIX) || defined(__sun__))
+inline _LIBCPP_INLINE_VISIBILITY float tanh(float __lcpp_x) _NOEXCEPT {return ::tanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __lcpp_x) _NOEXCEPT {return ::tanhl(__lcpp_x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
+tanh(_A1 __lcpp_x) _NOEXCEPT {return ::tanh((double)__lcpp_x);}
// acosh
-#ifndef _LIBCPP_MSVCRT
-inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return acoshf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return acoshl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float acosh(float __lcpp_x) _NOEXCEPT {return ::acoshf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double acosh(long double __lcpp_x) _NOEXCEPT {return ::acoshl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
-#endif
+acosh(_A1 __lcpp_x) _NOEXCEPT {return ::acosh((double)__lcpp_x);}
// asinh
-#ifndef _LIBCPP_MSVCRT
-inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return asinhf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return asinhl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float asinh(float __lcpp_x) _NOEXCEPT {return ::asinhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double asinh(long double __lcpp_x) _NOEXCEPT {return ::asinhl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
-#endif
+asinh(_A1 __lcpp_x) _NOEXCEPT {return ::asinh((double)__lcpp_x);}
// atanh
-#ifndef _LIBCPP_MSVCRT
-inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return atanhf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return atanhl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float atanh(float __lcpp_x) _NOEXCEPT {return ::atanhf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double atanh(long double __lcpp_x) _NOEXCEPT {return ::atanhl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
-#endif
+atanh(_A1 __lcpp_x) _NOEXCEPT {return ::atanh((double)__lcpp_x);}
// cbrt
-#ifndef _LIBCPP_MSVCRT
-inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return cbrtf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return cbrtl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float cbrt(float __lcpp_x) _NOEXCEPT {return ::cbrtf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double cbrt(long double __lcpp_x) _NOEXCEPT {return ::cbrtl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
-#endif
+cbrt(_A1 __lcpp_x) _NOEXCEPT {return ::cbrt((double)__lcpp_x);}
// copysign
-#if !defined(_VC_CRT_MAJOR_VERSION) || (_VC_CRT_MAJOR_VERSION < 12)
inline _LIBCPP_INLINE_VISIBILITY float copysign(float __lcpp_x,
float __lcpp_y) _NOEXCEPT {
- return copysignf(__lcpp_x, __lcpp_y);
+ return ::copysignf(__lcpp_x, __lcpp_y);
}
inline _LIBCPP_INLINE_VISIBILITY long double
copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
- return copysignl(__lcpp_x, __lcpp_y);
+ return ::copysignl(__lcpp_x, __lcpp_y);
}
-#endif
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1014,55 +1097,53 @@ copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
-#ifndef _LIBCPP_MSVCRT
-
// erf
-inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return erff(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return erfl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float erf(float __lcpp_x) _NOEXCEPT {return ::erff(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erf(long double __lcpp_x) _NOEXCEPT {return ::erfl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
+erf(_A1 __lcpp_x) _NOEXCEPT {return ::erf((double)__lcpp_x);}
// erfc
-inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return erfcf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return erfcl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float erfc(float __lcpp_x) _NOEXCEPT {return ::erfcf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double erfc(long double __lcpp_x) _NOEXCEPT {return ::erfcl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
+erfc(_A1 __lcpp_x) _NOEXCEPT {return ::erfc((double)__lcpp_x);}
// exp2
-inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return exp2f(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return exp2l(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float exp2(float __lcpp_x) _NOEXCEPT {return ::exp2f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double exp2(long double __lcpp_x) _NOEXCEPT {return ::exp2l(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
+exp2(_A1 __lcpp_x) _NOEXCEPT {return ::exp2((double)__lcpp_x);}
// expm1
-inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return expm1f(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return expm1l(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float expm1(float __lcpp_x) _NOEXCEPT {return ::expm1f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double expm1(long double __lcpp_x) _NOEXCEPT {return ::expm1l(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
+expm1(_A1 __lcpp_x) _NOEXCEPT {return ::expm1((double)__lcpp_x);}
// fdim
-inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fdimf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fdiml(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float fdim(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fdimf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fdim(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fdiml(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1077,13 +1158,13 @@ fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// fma
-inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
-inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY float fma(float __lcpp_x, float __lcpp_y, float __lcpp_z) _NOEXCEPT {return ::fmaf(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double fma(long double __lcpp_x, long double __lcpp_y, long double __lcpp_z) _NOEXCEPT {return ::fmal(__lcpp_x, __lcpp_y, __lcpp_z);}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1100,13 +1181,13 @@ fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value &&
std::is_same<_A3, __result_type>::value)), "");
- return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
+ return ::fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
// fmax
-inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fmaxf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fmaxl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float fmax(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fmaxf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmax(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fmaxl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1121,13 +1202,13 @@ fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// fmin
-inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return fminf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return fminl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float fmin(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::fminf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double fmin(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::fminl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1142,13 +1223,13 @@ fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// hypot
-inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return hypotf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return hypotl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float hypot(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::hypotf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double hypot(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::hypotl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1163,115 +1244,115 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// ilogb
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ilogbf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ilogbl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(float __lcpp_x) _NOEXCEPT {return ::ilogbf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY int ilogb(long double __lcpp_x) _NOEXCEPT {return ::ilogbl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, int>::type
-ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
+ilogb(_A1 __lcpp_x) _NOEXCEPT {return ::ilogb((double)__lcpp_x);}
// lgamma
-inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return lgammaf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return lgammal(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float lgamma(float __lcpp_x) _NOEXCEPT {return ::lgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double lgamma(long double __lcpp_x) _NOEXCEPT {return ::lgammal(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
+lgamma(_A1 __lcpp_x) _NOEXCEPT {return ::lgamma((double)__lcpp_x);}
// llrint
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return llrintf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return llrintl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(float __lcpp_x) _NOEXCEPT {return ::llrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llrint(long double __lcpp_x) _NOEXCEPT {return ::llrintl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long long>::type
-llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
+llrint(_A1 __lcpp_x) _NOEXCEPT {return ::llrint((double)__lcpp_x);}
// llround
-inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return llroundf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return llroundl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(float __lcpp_x) _NOEXCEPT {return ::llroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long long llround(long double __lcpp_x) _NOEXCEPT {return ::llroundl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long long>::type
-llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
+llround(_A1 __lcpp_x) _NOEXCEPT {return ::llround((double)__lcpp_x);}
// log1p
-inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return log1pf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return log1pl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float log1p(float __lcpp_x) _NOEXCEPT {return ::log1pf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log1p(long double __lcpp_x) _NOEXCEPT {return ::log1pl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
+log1p(_A1 __lcpp_x) _NOEXCEPT {return ::log1p((double)__lcpp_x);}
// log2
-inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return log2f(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return log2l(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float log2(float __lcpp_x) _NOEXCEPT {return ::log2f(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double log2(long double __lcpp_x) _NOEXCEPT {return ::log2l(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
+log2(_A1 __lcpp_x) _NOEXCEPT {return ::log2((double)__lcpp_x);}
// logb
-inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return logbf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return logbl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float logb(float __lcpp_x) _NOEXCEPT {return ::logbf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double logb(long double __lcpp_x) _NOEXCEPT {return ::logbl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
+logb(_A1 __lcpp_x) _NOEXCEPT {return ::logb((double)__lcpp_x);}
// lrint
-inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return lrintf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return lrintl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(float __lcpp_x) _NOEXCEPT {return ::lrintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lrint(long double __lcpp_x) _NOEXCEPT {return ::lrintl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long>::type
-lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
+lrint(_A1 __lcpp_x) _NOEXCEPT {return ::lrint((double)__lcpp_x);}
// lround
-inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return lroundf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return lroundl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(float __lcpp_x) _NOEXCEPT {return ::lroundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long lround(long double __lcpp_x) _NOEXCEPT {return ::lroundl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, long>::type
-lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
+lround(_A1 __lcpp_x) _NOEXCEPT {return ::lround((double)__lcpp_x);}
// nan
// nearbyint
-inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return nearbyintf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return nearbyintl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float nearbyint(float __lcpp_x) _NOEXCEPT {return ::nearbyintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double nearbyint(long double __lcpp_x) _NOEXCEPT {return ::nearbyintl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
+nearbyint(_A1 __lcpp_x) _NOEXCEPT {return ::nearbyint((double)__lcpp_x);}
// nextafter
-inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return nextafterf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nextafterl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float nextafter(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::nextafterf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nextafter(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nextafterl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1286,23 +1367,23 @@ nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// nexttoward
-inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttowardl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float nexttoward(float __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double nexttoward(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttowardl(__lcpp_x, __lcpp_y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
+nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::nexttoward((double)__lcpp_x, __lcpp_y);}
// remainder
-inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return remainderf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return remainderl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float remainder(float __lcpp_x, float __lcpp_y) _NOEXCEPT {return ::remainderf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double remainder(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {return ::remainderl(__lcpp_x, __lcpp_y);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1317,13 +1398,13 @@ remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
+ return ::remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
}
// remquo
-inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
-inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY float remquo(float __lcpp_x, float __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquof(__lcpp_x, __lcpp_y, __lcpp_z);}
+inline _LIBCPP_INLINE_VISIBILITY long double remquo(long double __lcpp_x, long double __lcpp_y, int* __lcpp_z) _NOEXCEPT {return ::remquol(__lcpp_x, __lcpp_y, __lcpp_z);}
template <class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1338,70 +1419,68 @@ remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
typedef typename std::__promote<_A1, _A2>::type __result_type;
static_assert((!(std::is_same<_A1, __result_type>::value &&
std::is_same<_A2, __result_type>::value)), "");
- return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
+ return ::remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
}
// rint
-inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return rintf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return rintl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float rint(float __lcpp_x) _NOEXCEPT {return ::rintf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double rint(long double __lcpp_x) _NOEXCEPT {return ::rintl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
+rint(_A1 __lcpp_x) _NOEXCEPT {return ::rint((double)__lcpp_x);}
// round
-inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return roundf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return roundl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float round(float __lcpp_x) _NOEXCEPT {return ::roundf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double round(long double __lcpp_x) _NOEXCEPT {return ::roundl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
+round(_A1 __lcpp_x) _NOEXCEPT {return ::round((double)__lcpp_x);}
// scalbln
-inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalblnl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float scalbln(float __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbln(long double __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalblnl(__lcpp_x, __lcpp_y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
+scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return ::scalbln((double)__lcpp_x, __lcpp_y);}
// scalbn
-inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnf(__lcpp_x, __lcpp_y);}
-inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbnl(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY float scalbn(float __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnf(__lcpp_x, __lcpp_y);}
+inline _LIBCPP_INLINE_VISIBILITY long double scalbn(long double __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbnl(__lcpp_x, __lcpp_y);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
+scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return ::scalbn((double)__lcpp_x, __lcpp_y);}
// tgamma
-inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return tgammaf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return tgammal(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float tgamma(float __lcpp_x) _NOEXCEPT {return ::tgammaf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double tgamma(long double __lcpp_x) _NOEXCEPT {return ::tgammal(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
+tgamma(_A1 __lcpp_x) _NOEXCEPT {return ::tgamma((double)__lcpp_x);}
// trunc
-inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return truncf(__lcpp_x);}
-inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return truncl(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY float trunc(float __lcpp_x) _NOEXCEPT {return ::truncf(__lcpp_x);}
+inline _LIBCPP_INLINE_VISIBILITY long double trunc(long double __lcpp_x) _NOEXCEPT {return ::truncl(__lcpp_x);}
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
typename std::enable_if<std::is_integral<_A1>::value, double>::type
-trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
-
-#endif // !_LIBCPP_MSVCRT
+trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);}
} // extern "C++"
diff --git a/contrib/libc++/include/memory b/contrib/libc++/include/memory
index 2a25f0e..22706d0 100644
--- a/contrib/libc++/include/memory
+++ b/contrib/libc++/include/memory
@@ -208,10 +208,10 @@ template <class ForwardIterator>
template <class ForwardIterator, class Size>
ForwardIterator uninitialized_default_construct_n(ForwardIterator first, Size n);
-template <class Y> struct auto_ptr_ref {};
+template <class Y> struct auto_ptr_ref {}; // removed in C++17
template<class X>
-class auto_ptr
+class auto_ptr // removed in C++17
{
public:
typedef X element_type;
@@ -270,7 +270,7 @@ public:
template <class U, class E>
unique_ptr(unique_ptr<U, E>&& u) noexcept;
template <class U>
- unique_ptr(auto_ptr<U>&& u) noexcept;
+ unique_ptr(auto_ptr<U>&& u) noexcept; // removed in C++17
// destructor
~unique_ptr();
@@ -404,7 +404,7 @@ public:
shared_ptr(shared_ptr&& r) noexcept;
template<class Y> shared_ptr(shared_ptr<Y>&& r) noexcept;
template<class Y> explicit shared_ptr(const weak_ptr<Y>& r);
- template<class Y> shared_ptr(auto_ptr<Y>&& r);
+ template<class Y> shared_ptr(auto_ptr<Y>&& r); // removed in C++17
template <class Y, class D> shared_ptr(unique_ptr<Y, D>&& r);
shared_ptr(nullptr_t) : shared_ptr() { }
@@ -416,7 +416,7 @@ public:
template<class Y> shared_ptr& operator=(const shared_ptr<Y>& r) noexcept;
shared_ptr& operator=(shared_ptr&& r) noexcept;
template<class Y> shared_ptr& operator=(shared_ptr<Y>&& r);
- template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r);
+ template<class Y> shared_ptr& operator=(auto_ptr<Y>&& r); // removed in C++17
template <class Y, class D> shared_ptr& operator=(unique_ptr<Y, D>&& r);
// modifiers:
@@ -433,8 +433,8 @@ public:
long use_count() const noexcept;
bool unique() const noexcept;
explicit operator bool() const noexcept;
- template<class U> bool owner_before(shared_ptr<U> const& b) const;
- template<class U> bool owner_before(weak_ptr<U> const& b) const;
+ template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
+ template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
};
// shared_ptr comparisons:
@@ -531,8 +531,8 @@ public:
long use_count() const noexcept;
bool expired() const noexcept;
shared_ptr<T> lock() const noexcept;
- template<class U> bool owner_before(shared_ptr<U> const& b) const;
- template<class U> bool owner_before(weak_ptr<U> const& b) const;
+ template<class U> bool owner_before(shared_ptr<U> const& b) const noexcept;
+ template<class U> bool owner_before(weak_ptr<U> const& b) const noexcept;
};
// weak_ptr specialized algorithms:
@@ -546,9 +546,9 @@ struct owner_less<shared_ptr<T>>
: binary_function<shared_ptr<T>, shared_ptr<T>, bool>
{
typedef bool result_type;
- bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const;
- bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
- bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+ bool operator()(shared_ptr<T> const&, shared_ptr<T> const&) const noexcept;
+ bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+ bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
};
template<class T>
@@ -556,9 +556,24 @@ struct owner_less<weak_ptr<T>>
: binary_function<weak_ptr<T>, weak_ptr<T>, bool>
{
typedef bool result_type;
- bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const;
- bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const;
- bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const;
+ bool operator()(weak_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+ bool operator()(shared_ptr<T> const&, weak_ptr<T> const&) const noexcept;
+ bool operator()(weak_ptr<T> const&, shared_ptr<T> const&) const noexcept;
+};
+
+template <> // Added in C++14
+struct owner_less<void>
+{
+ template <class _Tp, class _Up>
+ bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept;
+ template <class _Tp, class _Up>
+ bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept;
+ template <class _Tp, class _Up>
+ bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const noexcept;
+ template <class _Tp, class _Up>
+ bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const noexcept;
+
+ typedef void is_transparent;
};
template<class T>
@@ -638,17 +653,19 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <tuple>
#include <stdexcept>
#include <cstring>
-
+#include <cassert>
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _ValueType>
@@ -703,16 +720,12 @@ public:
// pointer_traits
+template <class _Tp, class = void>
+struct __has_element_type : false_type {};
+
template <class _Tp>
-struct __has_element_type
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::element_type* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_element_type<_Tp,
+ typename __void_t<typename _Tp::element_type>::type> : true_type {};
template <class _Ptr, bool = __has_element_type<_Ptr>::value>
struct __pointer_traits_element_type;
@@ -791,16 +804,12 @@ struct __pointer_traits_element_type<_Sp<_Tp, _A0, _A1, _A2>, false>
#endif // _LIBCPP_HAS_NO_VARIADICS
+template <class _Tp, class = void>
+struct __has_difference_type : false_type {};
+
template <class _Tp>
-struct __has_difference_type
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::difference_type* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_difference_type<_Tp,
+ typename __void_t<typename _Tp::difference_type>::type> : true_type {};
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
struct __pointer_traits_difference_type
@@ -981,17 +990,12 @@ struct __rebind_pointer {
// allocator_traits
-namespace __has_pointer_type_imp
-{
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::pointer* = 0);
-}
+template <class _Tp, class = void>
+struct __has_pointer_type : false_type {};
template <class _Tp>
-struct __has_pointer_type
- : public integral_constant<bool, sizeof(__has_pointer_type_imp::__test<_Tp>(0)) == 1>
-{
-};
+struct __has_pointer_type<_Tp,
+ typename __void_t<typename _Tp::pointer>::type> : true_type {};
namespace __pointer_type_imp
{
@@ -1016,16 +1020,12 @@ struct __pointer_type
typedef typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
};
+template <class _Tp, class = void>
+struct __has_const_pointer : false_type {};
+
template <class _Tp>
-struct __has_const_pointer
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::const_pointer* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_const_pointer<_Tp,
+ typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
struct __const_pointer
@@ -1043,16 +1043,12 @@ struct __const_pointer<_Tp, _Ptr, _Alloc, false>
#endif
};
+template <class _Tp, class = void>
+struct __has_void_pointer : false_type {};
+
template <class _Tp>
-struct __has_void_pointer
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::void_pointer* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_void_pointer<_Tp,
+ typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
struct __void_pointer
@@ -1070,16 +1066,12 @@ struct __void_pointer<_Ptr, _Alloc, false>
#endif
};
+template <class _Tp, class = void>
+struct __has_const_void_pointer : false_type {};
+
template <class _Tp>
-struct __has_const_void_pointer
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::const_void_pointer* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_const_void_pointer<_Tp,
+ typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
struct __const_void_pointer
@@ -1113,16 +1105,12 @@ __to_raw_pointer(_Pointer __p) _NOEXCEPT
return _VSTD::__to_raw_pointer(__p.operator->());
}
+template <class _Tp, class = void>
+struct __has_size_type : false_type {};
+
template <class _Tp>
-struct __has_size_type
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::size_type* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_size_type<_Tp,
+ typename __void_t<typename _Tp::size_type>::type> : true_type {};
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
struct __size_type
@@ -1136,16 +1124,13 @@ struct __size_type<_Alloc, _DiffType, true>
typedef typename _Alloc::size_type type;
};
+template <class _Tp, class = void>
+struct __has_propagate_on_container_copy_assignment : false_type {};
+
template <class _Tp>
-struct __has_propagate_on_container_copy_assignment
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::propagate_on_container_copy_assignment* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_propagate_on_container_copy_assignment<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
+ : true_type {};
template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
struct __propagate_on_container_copy_assignment
@@ -1159,16 +1144,13 @@ struct __propagate_on_container_copy_assignment<_Alloc, true>
typedef typename _Alloc::propagate_on_container_copy_assignment type;
};
+template <class _Tp, class = void>
+struct __has_propagate_on_container_move_assignment : false_type {};
+
template <class _Tp>
-struct __has_propagate_on_container_move_assignment
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::propagate_on_container_move_assignment* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_propagate_on_container_move_assignment<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
+ : true_type {};
template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
struct __propagate_on_container_move_assignment
@@ -1182,16 +1164,13 @@ struct __propagate_on_container_move_assignment<_Alloc, true>
typedef typename _Alloc::propagate_on_container_move_assignment type;
};
+template <class _Tp, class = void>
+struct __has_propagate_on_container_swap : false_type {};
+
template <class _Tp>
-struct __has_propagate_on_container_swap
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::propagate_on_container_swap* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_propagate_on_container_swap<_Tp,
+ typename __void_t<typename _Tp::propagate_on_container_swap>::type>
+ : true_type {};
template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
struct __propagate_on_container_swap
@@ -1205,16 +1184,13 @@ struct __propagate_on_container_swap<_Alloc, true>
typedef typename _Alloc::propagate_on_container_swap type;
};
+template <class _Tp, class = void>
+struct __has_is_always_equal : false_type {};
+
template <class _Tp>
-struct __has_is_always_equal
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::is_always_equal* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
+struct __has_is_always_equal<_Tp,
+ typename __void_t<typename _Tp::is_always_equal>::type>
+ : true_type {};
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
struct __is_always_equal
@@ -1526,7 +1502,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
{return __a.allocate(__n);}
_LIBCPP_INLINE_VISIBILITY
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
- {return allocate(__a, __n, __hint,
+ {return __allocate(__a, __n, __hint,
__has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
_LIBCPP_INLINE_VISIBILITY
@@ -1542,26 +1518,26 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
#else // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
- static void construct(allocator_type& __a, _Tp* __p)
+ static void construct(allocator_type&, _Tp* __p)
{
::new ((void*)__p) _Tp();
}
template <class _Tp, class _A0>
_LIBCPP_INLINE_VISIBILITY
- static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0)
+ static void construct(allocator_type&, _Tp* __p, const _A0& __a0)
{
::new ((void*)__p) _Tp(__a0);
}
template <class _Tp, class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
- static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
+ static void construct(allocator_type&, _Tp* __p, const _A0& __a0,
const _A1& __a1)
{
::new ((void*)__p) _Tp(__a0, __a1);
}
template <class _Tp, class _A0, class _A1, class _A2>
_LIBCPP_INLINE_VISIBILITY
- static void construct(allocator_type& __a, _Tp* __p, const _A0& __a0,
+ static void construct(allocator_type&, _Tp* __p, const _A0& __a0,
const _A1& __a1, const _A2& __a2)
{
::new ((void*)__p) _Tp(__a0, __a1, __a2);
@@ -1580,7 +1556,7 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
_LIBCPP_INLINE_VISIBILITY
static allocator_type
select_on_container_copy_construction(const allocator_type& __a)
- {return select_on_container_copy_construction(
+ {return __select_on_container_copy_construction(
__has_select_on_container_copy_construction<const allocator_type>(),
__a);}
@@ -1679,11 +1655,11 @@ struct _LIBCPP_TEMPLATE_VIS allocator_traits
private:
_LIBCPP_INLINE_VISIBILITY
- static pointer allocate(allocator_type& __a, size_type __n,
+ static pointer __allocate(allocator_type& __a, size_type __n,
const_void_pointer __hint, true_type)
{return __a.allocate(__n, __hint);}
_LIBCPP_INLINE_VISIBILITY
- static pointer allocate(allocator_type& __a, size_type __n,
+ static pointer __allocate(allocator_type& __a, size_type __n,
const_void_pointer, false_type)
{return __a.allocate(__n);}
@@ -1720,11 +1696,11 @@ private:
_LIBCPP_INLINE_VISIBILITY
static allocator_type
- select_on_container_copy_construction(true_type, const allocator_type& __a)
+ __select_on_container_copy_construction(true_type, const allocator_type& __a)
{return __a.select_on_container_copy_construction();}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
- select_on_container_copy_construction(false_type, const allocator_type& __a)
+ __select_on_container_copy_construction(false_type, const allocator_type& __a)
{return __a;}
};
@@ -1867,7 +1843,7 @@ public:
return static_cast<pointer>(_VSTD::__allocate(__n * sizeof(_Tp)));
}
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type) _NOEXCEPT
- {_VSTD::__libcpp_deallocate((void*)__p);}
+ {_VSTD::__libcpp_deallocate((void*) const_cast<_Tp *>(__p));}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT
{return size_type(~0) / sizeof(_Tp);}
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
@@ -1883,7 +1859,7 @@ public:
void
construct(pointer __p)
{
- ::new((void*)__p) _Tp();
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp();
}
# if defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
@@ -1892,14 +1868,14 @@ public:
void
construct(pointer __p, _A0& __a0)
{
- ::new((void*)__p) _Tp(__a0);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0);
}
template <class _A0>
_LIBCPP_INLINE_VISIBILITY
void
construct(pointer __p, const _A0& __a0)
{
- ::new((void*)__p) _Tp(__a0);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0);
}
# endif // defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
template <class _A0, class _A1>
@@ -1907,28 +1883,28 @@ public:
void
construct(pointer __p, _A0& __a0, _A1& __a1)
{
- ::new((void*)__p) _Tp(__a0, __a1);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
void
construct(pointer __p, const _A0& __a0, _A1& __a1)
{
- ::new((void*)__p) _Tp(__a0, __a1);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
void
construct(pointer __p, _A0& __a0, const _A1& __a1)
{
- ::new((void*)__p) _Tp(__a0, __a1);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1);
}
template <class _A0, class _A1>
_LIBCPP_INLINE_VISIBILITY
void
construct(pointer __p, const _A0& __a0, const _A1& __a1)
{
- ::new((void*)__p) _Tp(__a0, __a1);
+ ::new((void*) const_cast<_Tp *>(__p)) _Tp(__a0, __a1);
}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY void destroy(pointer __p) {__p->~_Tp();}
@@ -1996,6 +1972,7 @@ template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void return_temporary_buffer(_Tp* __p) _NOEXCEPT {::operator delete(__p);}
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template <class _Tp>
struct auto_ptr_ref
{
@@ -2052,776 +2029,819 @@ class _LIBCPP_TEMPLATE_VIS auto_ptr<void>
public:
typedef void element_type;
};
+#endif
-template <class _T1, class _T2, bool = is_same<typename remove_cv<_T1>::type,
- typename remove_cv<_T2>::type>::value,
- bool = is_empty<_T1>::value
- && !__libcpp_is_final<_T1>::value,
- bool = is_empty<_T2>::value
- && !__libcpp_is_final<_T2>::value
- >
-struct __libcpp_compressed_pair_switch;
+template <class _Tp, int _Idx,
+ bool _CanBeEmptyBase =
+ is_empty<_Tp>::value && !__libcpp_is_final<_Tp>::value>
+struct __compressed_pair_elem {
+ typedef _Tp _ParamT;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
-template <class _T1, class _T2, bool IsSame>
-struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, false> {enum {value = 0};};
+#ifndef _LIBCPP_CXX03_LANG
+ constexpr __compressed_pair_elem() : __value_() {}
+
+ template <class _Up, class = typename enable_if<
+ !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
+ >::type>
+ constexpr explicit
+ __compressed_pair_elem(_Up&& __u)
+ : __value_(_VSTD::forward<_Up>(__u)){};
+
+ template <class... _Args, size_t... _Indexes>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+ __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
+ __tuple_indices<_Indexes...>)
+ : __value_(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
+#else
+ __compressed_pair_elem() : __value_() {}
+ __compressed_pair_elem(_ParamT __p) : __value_(std::forward<_ParamT>(__p)) {}
+#endif
-template <class _T1, class _T2, bool IsSame>
-struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, true, false> {enum {value = 1};};
+ reference __get() _NOEXCEPT { return __value_; }
+ const_reference __get() const _NOEXCEPT { return __value_; }
-template <class _T1, class _T2, bool IsSame>
-struct __libcpp_compressed_pair_switch<_T1, _T2, IsSame, false, true> {enum {value = 2};};
+private:
+ _Tp __value_;
+};
-template <class _T1, class _T2>
-struct __libcpp_compressed_pair_switch<_T1, _T2, false, true, true> {enum {value = 3};};
+template <class _Tp, int _Idx>
+struct __compressed_pair_elem<_Tp, _Idx, true> : private _Tp {
+ typedef _Tp _ParamT;
+ typedef _Tp& reference;
+ typedef const _Tp& const_reference;
+ typedef _Tp __value_type;
-template <class _T1, class _T2>
-struct __libcpp_compressed_pair_switch<_T1, _T2, true, true, true> {enum {value = 1};};
+#ifndef _LIBCPP_CXX03_LANG
+ constexpr __compressed_pair_elem() = default;
+
+ template <class _Up, class = typename enable_if<
+ !is_same<__compressed_pair_elem, typename decay<_Up>::type>::value
+ >::type>
+ constexpr explicit
+ __compressed_pair_elem(_Up&& __u)
+ : __value_type(_VSTD::forward<_Up>(__u)){};
+
+ template <class... _Args, size_t... _Indexes>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+ __compressed_pair_elem(piecewise_construct_t, tuple<_Args...> __args,
+ __tuple_indices<_Indexes...>)
+ : __value_type(_VSTD::forward<_Args>(_VSTD::get<_Indexes>(__args))...) {}
+#else
+ __compressed_pair_elem() : __value_type() {}
+ __compressed_pair_elem(_ParamT __p)
+ : __value_type(std::forward<_ParamT>(__p)) {}
+#endif
-template <class _T1, class _T2, unsigned = __libcpp_compressed_pair_switch<_T1, _T2>::value>
-class __libcpp_compressed_pair_imp;
+ reference __get() _NOEXCEPT { return *this; }
+ const_reference __get() const _NOEXCEPT { return *this; }
+};
+
+// Tag used to construct the second element of the compressed pair.
+struct __second_tag {};
template <class _T1, class _T2>
-class __libcpp_compressed_pair_imp<_T1, _T2, 0>
-{
-private:
- _T1 __first_;
- _T2 __second_;
+class __compressed_pair : private __compressed_pair_elem<_T1, 0>,
+ private __compressed_pair_elem<_T2, 1> {
+ typedef __compressed_pair_elem<_T1, 0> _Base1;
+ typedef __compressed_pair_elem<_T2, 1> _Base2;
+
+ // NOTE: This static assert should never fire because __compressed_pair
+ // is *almost never* used in a scenario where it's possible for T1 == T2.
+ // (The exception is std::function where it is possible that the function
+ // object and the allocator have the same type).
+ static_assert((!is_same<_T1, _T2>::value),
+ "__compressed_pair cannot be instantated when T1 and T2 are the same type; "
+ "The current implementation is NOT ABI-compatible with the previous "
+ "implementation for this configuration");
+
public:
- typedef _T1 _T1_param;
- typedef _T2 _T2_param;
+#ifndef _LIBCPP_CXX03_LANG
+ template <bool _Dummy = true,
+ class = typename enable_if<
+ __dependent_type<is_default_constructible<_T1>, _Dummy>::value &&
+ __dependent_type<is_default_constructible<_T2>, _Dummy>::value
+ >::type
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ constexpr __compressed_pair() {}
+
+ template <class _Tp, typename enable_if<!is_same<typename decay<_Tp>::type,
+ __compressed_pair>::value,
+ bool>::type = true>
+ _LIBCPP_INLINE_VISIBILITY constexpr explicit
+ __compressed_pair(_Tp&& __t)
+ : _Base1(std::forward<_Tp>(__t)), _Base2() {}
+
+ template <class _Tp>
+ _LIBCPP_INLINE_VISIBILITY constexpr
+ __compressed_pair(__second_tag, _Tp&& __t)
+ : _Base1(), _Base2(std::forward<_Tp>(__t)) {}
+
+ template <class _U1, class _U2>
+ _LIBCPP_INLINE_VISIBILITY constexpr
+ __compressed_pair(_U1&& __t1, _U2&& __t2)
+ : _Base1(std::forward<_U1>(__t1)), _Base2(std::forward<_U2>(__t2)) {}
+
+ template <class... _Args1, class... _Args2>
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
+ __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
+ tuple<_Args2...> __second_args)
+ : _Base1(__pc, _VSTD::move(__first_args),
+ typename __make_tuple_indices<sizeof...(_Args1)>::type()),
+ _Base2(__pc, _VSTD::move(__second_args),
+ typename __make_tuple_indices<sizeof...(_Args2)>::type()) {}
- typedef typename remove_reference<_T1>::type& _T1_reference;
- typedef typename remove_reference<_T2>::type& _T2_reference;
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ __compressed_pair() {}
- typedef const typename remove_reference<_T1>::type& _T1_const_reference;
- typedef const typename remove_reference<_T2>::type& _T2_const_reference;
+ _LIBCPP_INLINE_VISIBILITY explicit
+ __compressed_pair(_T1 __t1) : _Base1(_VSTD::forward<_T1>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_(), __second_() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : __first_(_VSTD::forward<_T1_param>(__t1)), __second_() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : __first_(), __second_(_VSTD::forward<_T2_param>(__t2)) {}
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
- : __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
+ _LIBCPP_INLINE_VISIBILITY
+ __compressed_pair(__second_tag, _T2 __t2)
+ : _Base1(), _Base2(_VSTD::forward<_T2>(__t2)) {}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ _LIBCPP_INLINE_VISIBILITY
+ __compressed_pair(_T1 __t1, _T2 __t2)
+ : _Base1(_VSTD::forward<_T1>(__t1)), _Base2(_VSTD::forward<_T2>(__t2)) {}
+#endif
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_INLINE_VISIBILITY
- __libcpp_compressed_pair_imp(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))...)
- {}
+ _LIBCPP_INLINE_VISIBILITY
+ typename _Base1::reference first() _NOEXCEPT {
+ return static_cast<_Base1&>(*this).__get();
+ }
-#endif // _LIBCPP_HAS_NO_VARIADICS
+ _LIBCPP_INLINE_VISIBILITY
+ typename _Base1::const_reference first() const _NOEXCEPT {
+ return static_cast<_Base1 const&>(*this).__get();
+ }
- _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;}
- _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;}
+ _LIBCPP_INLINE_VISIBILITY
+ typename _Base2::reference second() _NOEXCEPT {
+ return static_cast<_Base2&>(*this).__get();
+ }
- _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;}
- _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;}
+ _LIBCPP_INLINE_VISIBILITY
+ typename _Base2::const_reference second() const _NOEXCEPT {
+ return static_cast<_Base2 const&>(*this).__get();
+ }
- _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {
- using _VSTD::swap;
- swap(__first_, __x.__first_);
- swap(__second_, __x.__second_);
- }
+ _LIBCPP_INLINE_VISIBILITY
+ void swap(__compressed_pair& __x)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+ __is_nothrow_swappable<_T2>::value)
+ {
+ using std::swap;
+ swap(first(), __x.first());
+ swap(second(), __x.second());
+ }
};
template <class _T1, class _T2>
-class __libcpp_compressed_pair_imp<_T1, _T2, 1>
- : private _T1
-{
-private:
- _T2 __second_;
-public:
- typedef _T1 _T1_param;
- typedef _T2 _T2_param;
-
- typedef _T1& _T1_reference;
- typedef typename remove_reference<_T2>::type& _T2_reference;
-
- typedef const _T1& _T1_const_reference;
- typedef const typename remove_reference<_T2>::type& _T2_const_reference;
-
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __second_() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : _T1(_VSTD::forward<_T1_param>(__t1)), __second_() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : __second_(_VSTD::forward<_T2_param>(__t2)) {}
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
- : _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_INLINE_VISIBILITY
- __libcpp_compressed_pair_imp(piecewise_construct_t,
- tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args,
- __tuple_indices<_I1...>,
- __tuple_indices<_I2...>)
- : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
- __second_(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
- {}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
- _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;}
+inline _LIBCPP_INLINE_VISIBILITY
+void swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
+ _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
+ __is_nothrow_swappable<_T2>::value) {
+ __x.swap(__y);
+}
- _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return __second_;}
- _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return __second_;}
+// default_delete
- _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {
- using _VSTD::swap;
- swap(__second_, __x.__second_);
- }
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS default_delete {
+ static_assert(!is_function<_Tp>::value,
+ "default_delete cannot be instantiated for function types");
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
+#else
+ _LIBCPP_INLINE_VISIBILITY default_delete() {}
+#endif
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ default_delete(const default_delete<_Up>&,
+ typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* =
+ 0) _NOEXCEPT {}
+
+ _LIBCPP_INLINE_VISIBILITY void operator()(_Tp* __ptr) const _NOEXCEPT {
+ static_assert(sizeof(_Tp) > 0,
+ "default_delete can not delete incomplete type");
+ static_assert(!is_void<_Tp>::value,
+ "default_delete can not delete incomplete type");
+ delete __ptr;
+ }
};
-template <class _T1, class _T2>
-class __libcpp_compressed_pair_imp<_T1, _T2, 2>
- : private _T2
-{
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]> {
private:
- _T1 __first_;
-public:
- typedef _T1 _T1_param;
- typedef _T2 _T2_param;
-
- typedef typename remove_reference<_T1>::type& _T1_reference;
- typedef _T2& _T2_reference;
+ template <class _Up>
+ struct _EnableIfConvertible
+ : enable_if<is_convertible<_Up(*)[], _Tp(*)[]>::value> {};
- typedef const typename remove_reference<_T1>::type& _T1_const_reference;
- typedef const _T2& _T2_const_reference;
+public:
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY constexpr default_delete() noexcept = default;
+#else
+ _LIBCPP_INLINE_VISIBILITY default_delete() {}
+#endif
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() : __first_() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : __first_(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : _T2(_VSTD::forward<_T2_param>(__t2)), __first_() {}
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
- _NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
- is_nothrow_move_constructible<_T2>::value)
- : _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {}
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ default_delete(const default_delete<_Up[]>&,
+ typename _EnableIfConvertible<_Up>::type* = 0) _NOEXCEPT {}
+
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ typename _EnableIfConvertible<_Up>::type
+ operator()(_Up* __ptr) const _NOEXCEPT {
+ static_assert(sizeof(_Tp) > 0,
+ "default_delete can not delete incomplete type");
+ static_assert(!is_void<_Tp>::value,
+ "default_delete can not delete void type");
+ delete[] __ptr;
+ }
+};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_INLINE_VISIBILITY
- __libcpp_compressed_pair_imp(piecewise_construct_t,
- tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args,
- __tuple_indices<_I1...>,
- __tuple_indices<_I2...>)
- : _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...),
- __first_(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...)
-
- {}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
- _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return __first_;}
- _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return __first_;}
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Deleter>
+struct __unique_ptr_deleter_sfinae {
+ static_assert(!is_reference<_Deleter>::value, "incorrect specialization");
+ typedef const _Deleter& __lval_ref_type;
+ typedef _Deleter&& __good_rval_ref_type;
+ typedef true_type __enable_rval_overload;
+};
- _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
+template <class _Deleter>
+struct __unique_ptr_deleter_sfinae<_Deleter const&> {
+ typedef const _Deleter& __lval_ref_type;
+ typedef const _Deleter&& __bad_rval_ref_type;
+ typedef false_type __enable_rval_overload;
+};
- _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {
- using _VSTD::swap;
- swap(__first_, __x.__first_);
- }
+template <class _Deleter>
+struct __unique_ptr_deleter_sfinae<_Deleter&> {
+ typedef _Deleter& __lval_ref_type;
+ typedef _Deleter&& __bad_rval_ref_type;
+ typedef false_type __enable_rval_overload;
};
+#endif // !defined(_LIBCPP_CXX03_LANG)
-template <class _T1, class _T2>
-class __libcpp_compressed_pair_imp<_T1, _T2, 3>
- : private _T1,
- private _T2
-{
+template <class _Tp, class _Dp = default_delete<_Tp> >
+class _LIBCPP_TEMPLATE_VIS unique_ptr {
public:
- typedef _T1 _T1_param;
- typedef _T2 _T2_param;
-
- typedef _T1& _T1_reference;
- typedef _T2& _T2_reference;
-
- typedef const _T1& _T1_const_reference;
- typedef const _T2& _T2_const_reference;
+ typedef _Tp element_type;
+ typedef _Dp deleter_type;
+ typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp() {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T1_param __t1)
- : _T1(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __libcpp_compressed_pair_imp(_T2_param __t2)
- : _T2(_VSTD::forward<_T2_param>(__t2)) {}
- _LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
- : _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {}
-
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
- template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
- _LIBCPP_INLINE_VISIBILITY
- __libcpp_compressed_pair_imp(piecewise_construct_t,
- tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args,
- __tuple_indices<_I1...>,
- __tuple_indices<_I2...>)
- : _T1(_VSTD::forward<_Args1>(_VSTD::get<_I1>(__first_args))...),
- _T2(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
- {}
-
-#endif // _LIBCPP_HAS_NO_VARIADICS
+ static_assert(!is_rvalue_reference<deleter_type>::value,
+ "the specified deleter type cannot be an rvalue reference");
- _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return *this;}
+private:
+ __compressed_pair<pointer, deleter_type> __ptr_;
- _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return *this;}
- _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return *this;}
+ struct __nat { int __for_bool_; };
- _LIBCPP_INLINE_VISIBILITY void swap(__libcpp_compressed_pair_imp&)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {
- }
-};
+#ifndef _LIBCPP_CXX03_LANG
+ typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
+
+ template <bool _Dummy>
+ using _LValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+
+ template <bool _Dummy>
+ using _GoodRValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+
+ template <bool _Dummy>
+ using _BadRValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+
+ template <bool _Dummy, class _Deleter = typename __dependent_type<
+ __identity<deleter_type>, _Dummy>::type>
+ using _EnableIfDeleterDefaultConstructible =
+ typename enable_if<is_default_constructible<_Deleter>::value &&
+ !is_pointer<_Deleter>::value>::type;
+
+ template <class _ArgType>
+ using _EnableIfDeleterConstructible =
+ typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
+
+ template <class _UPtr, class _Up>
+ using _EnableIfMoveConvertible = typename enable_if<
+ is_convertible<typename _UPtr::pointer, pointer>::value &&
+ !is_array<_Up>::value
+ >::type;
+
+ template <class _UDel>
+ using _EnableIfDeleterConvertible = typename enable_if<
+ (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
+ >::type;
+
+ template <class _UDel>
+ using _EnableIfDeleterAssignable = typename enable_if<
+ is_assignable<_Dp&, _UDel&&>::value
+ >::type;
-template <class _T1, class _T2>
-class __compressed_pair
- : private __libcpp_compressed_pair_imp<_T1, _T2>
-{
- typedef __libcpp_compressed_pair_imp<_T1, _T2> base;
public:
- typedef typename base::_T1_param _T1_param;
- typedef typename base::_T2_param _T2_param;
-
- typedef typename base::_T1_reference _T1_reference;
- typedef typename base::_T2_reference _T2_reference;
-
- typedef typename base::_T1_const_reference _T1_const_reference;
- typedef typename base::_T2_const_reference _T2_const_reference;
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+ _LIBCPP_INLINE_VISIBILITY
+ constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+ _LIBCPP_INLINE_VISIBILITY
+ constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+ _LIBCPP_INLINE_VISIBILITY
+ explicit unique_ptr(pointer __p) noexcept : __ptr_(__p) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(pointer __p, _LValRefType<_Dummy> __d) noexcept
+ : __ptr_(__p, __d) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(pointer __p, _GoodRValRefType<_Dummy> __d) noexcept
+ : __ptr_(__p, _VSTD::move(__d)) {
+ static_assert(!is_reference<deleter_type>::value,
+ "rvalue deleter bound to reference");
+ }
- _LIBCPP_INLINE_VISIBILITY __compressed_pair() {}
- _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T1_param __t1)
- : base(_VSTD::forward<_T1_param>(__t1)) {}
- _LIBCPP_INLINE_VISIBILITY explicit __compressed_pair(_T2_param __t2)
- : base(_VSTD::forward<_T2_param>(__t2)) {}
- _LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
- : base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {}
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(pointer __p, _BadRValRefType<_Dummy> __d) = delete;
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(unique_ptr&& __u) noexcept
+ : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
+ }
- template <class... _Args1, class... _Args2>
- _LIBCPP_INLINE_VISIBILITY
- __compressed_pair(piecewise_construct_t __pc, tuple<_Args1...> __first_args,
- tuple<_Args2...> __second_args)
- : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
- typename __make_tuple_indices<sizeof...(_Args1)>::type(),
- typename __make_tuple_indices<sizeof...(_Args2) >::type())
- {}
+ template <class _Up, class _Ep,
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
+ class = _EnableIfDeleterConvertible<_Ep>
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
+ : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {}
+
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(auto_ptr<_Up>&& __p,
+ typename enable_if<is_convertible<_Up*, _Tp*>::value &&
+ is_same<_Dp, default_delete<_Tp>>::value,
+ __nat>::type = __nat()) _NOEXCEPT
+ : __ptr_(__p.release()) {}
+#endif
-#endif // _LIBCPP_HAS_NO_VARIADICS
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+ return *this;
+ }
- _LIBCPP_INLINE_VISIBILITY _T1_reference first() _NOEXCEPT {return base::first();}
- _LIBCPP_INLINE_VISIBILITY _T1_const_reference first() const _NOEXCEPT {return base::first();}
+ template <class _Up, class _Ep,
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
+ class = _EnableIfDeleterAssignable<_Ep>
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+ return *this;
+ }
- _LIBCPP_INLINE_VISIBILITY _T2_reference second() _NOEXCEPT {return base::second();}
- _LIBCPP_INLINE_VISIBILITY _T2_const_reference second() const _NOEXCEPT {return base::second();}
+#else // _LIBCPP_CXX03_LANG
+private:
+ unique_ptr(unique_ptr&);
+ template <class _Up, class _Ep> unique_ptr(unique_ptr<_Up, _Ep>&);
- _LIBCPP_INLINE_VISIBILITY void swap(__compressed_pair& __x)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {base::swap(__x);}
-};
+ unique_ptr& operator=(unique_ptr&);
+ template <class _Up, class _Ep> unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
-template <class _T1, class _T2>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-swap(__compressed_pair<_T1, _T2>& __x, __compressed_pair<_T1, _T2>& __y)
- _NOEXCEPT_(__is_nothrow_swappable<_T1>::value &&
- __is_nothrow_swappable<_T2>::value)
- {__x.swap(__y);}
-
-// __same_or_less_cv_qualified
-
-template <class _Ptr1, class _Ptr2,
- bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type,
- typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type
- >::value
- >
-struct __same_or_less_cv_qualified_imp
- : is_convertible<_Ptr1, _Ptr2> {};
-
-template <class _Ptr1, class _Ptr2>
-struct __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false>
- : false_type {};
-
-template <class _Ptr1, class _Ptr2, bool = is_pointer<_Ptr1>::value ||
- is_same<_Ptr1, _Ptr2>::value ||
- __has_element_type<_Ptr1>::value>
-struct __same_or_less_cv_qualified
- : __same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {};
-
-template <class _Ptr1, class _Ptr2>
-struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, false>
- : false_type {};
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr() : __ptr_(pointer())
+ {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ static_assert(is_default_constructible<deleter_type>::value,
+ "unique_ptr::deleter_type is not default constructible");
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(nullptr_t) : __ptr_(pointer())
+ {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ explicit unique_ptr(pointer __p)
+ : __ptr_(_VSTD::move(__p)) {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ }
-// default_delete
+ _LIBCPP_INLINE_VISIBILITY
+ operator __rv<unique_ptr>() {
+ return __rv<unique_ptr>(*this);
+ }
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS default_delete
-{
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
-#else
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
-#endif
- template <class _Up>
- _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up>&,
- typename enable_if<is_convertible<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
- _LIBCPP_INLINE_VISIBILITY void operator() (_Tp* __ptr) const _NOEXCEPT
- {
- static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
- static_assert(!is_void<_Tp>::value, "default_delete can not delete incomplete type");
- delete __ptr;
- }
-};
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(__rv<unique_ptr> __u)
+ : __ptr_(__u->release(),
+ _VSTD::forward<deleter_type>(__u->get_deleter())) {}
+
+ template <class _Up, class _Ep>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<
+ !is_array<_Up>::value &&
+ is_convertible<typename unique_ptr<_Up, _Ep>::pointer,
+ pointer>::value &&
+ is_assignable<deleter_type&, _Ep&>::value,
+ unique_ptr&>::type
+ operator=(unique_ptr<_Up, _Ep> __u) {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+ return *this;
+ }
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS default_delete<_Tp[]>
-{
-public:
-#ifndef _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
-#else
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT {}
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(pointer __p, deleter_type __d)
+ : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
+#endif // _LIBCPP_CXX03_LANG
+
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<is_convertible<_Up*, _Tp*>::value &&
+ is_same<_Dp, default_delete<_Tp> >::value,
+ unique_ptr&>::type
+ operator=(auto_ptr<_Up> __p) {
+ reset(__p.release());
+ return *this;
+ }
#endif
- template <class _Up>
- _LIBCPP_INLINE_VISIBILITY default_delete(const default_delete<_Up[]>&,
- typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) _NOEXCEPT {}
- template <class _Up>
- _LIBCPP_INLINE_VISIBILITY
- void operator() (_Up* __ptr,
- typename enable_if<__same_or_less_cv_qualified<_Up*, _Tp*>::value>::type* = 0) const _NOEXCEPT
- {
- static_assert(sizeof(_Tp) > 0, "default_delete can not delete incomplete type");
- static_assert(!is_void<_Tp>::value, "default_delete can not delete void type");
- delete [] __ptr;
- }
-};
-template <class _Tp, class _Dp = default_delete<_Tp> >
-class _LIBCPP_TEMPLATE_VIS unique_ptr
-{
-public:
- typedef _Tp element_type;
- typedef _Dp deleter_type;
- typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
-private:
- __compressed_pair<pointer, deleter_type> __ptr_;
+ _LIBCPP_INLINE_VISIBILITY
+ ~unique_ptr() { reset(); }
-#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- unique_ptr(unique_ptr&);
- template <class _Up, class _Ep>
- unique_ptr(unique_ptr<_Up, _Ep>&);
- unique_ptr& operator=(unique_ptr&);
- template <class _Up, class _Ep>
- unique_ptr& operator=(unique_ptr<_Up, _Ep>&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- struct __nat {int __for_bool_;};
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(nullptr_t) _NOEXCEPT {
+ reset();
+ return *this;
+ }
- typedef typename remove_reference<deleter_type>::type& _Dp_reference;
- typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
-public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
- : __ptr_(pointer())
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
- : __ptr_(pointer())
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
- _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p) _NOEXCEPT
- : __ptr_(_VSTD::move(__p))
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
+ _LIBCPP_INLINE_VISIBILITY
+ typename add_lvalue_reference<_Tp>::type
+ operator*() const {
+ return *__ptr_.first();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer operator->() const _NOEXCEPT {
+ return __ptr_.first();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer get() const _NOEXCEPT {
+ return __ptr_.first();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ deleter_type& get_deleter() _NOEXCEPT {
+ return __ptr_.second();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ const deleter_type& get_deleter() const _NOEXCEPT {
+ return __ptr_.second();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {
+ return __ptr_.first() != nullptr;
+ }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename conditional<
- is_reference<deleter_type>::value,
- deleter_type,
- typename add_lvalue_reference<const deleter_type>::type>::type __d)
- _NOEXCEPT
- : __ptr_(__p, __d) {}
+ _LIBCPP_INLINE_VISIBILITY
+ pointer release() _NOEXCEPT {
+ pointer __t = __ptr_.first();
+ __ptr_.first() = pointer();
+ return __t;
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, typename remove_reference<deleter_type>::type&& __d)
- _NOEXCEPT
- : __ptr_(__p, _VSTD::move(__d))
- {
- static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
- }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT
- : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
- template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY
- unique_ptr(unique_ptr<_Up, _Ep>&& __u,
- typename enable_if
- <
- !is_array<_Up>::value &&
- is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
- is_convertible<_Ep, deleter_type>::value &&
- (
- !is_reference<deleter_type>::value ||
- is_same<deleter_type, _Ep>::value
- ),
- __nat
- >::type = __nat()) _NOEXCEPT
- : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {}
+ _LIBCPP_INLINE_VISIBILITY
+ void reset(pointer __p = pointer()) _NOEXCEPT {
+ pointer __tmp = __ptr_.first();
+ __ptr_.first() = __p;
+ if (__tmp)
+ __ptr_.second()(__tmp);
+ }
- template <class _Up>
- _LIBCPP_INLINE_VISIBILITY unique_ptr(auto_ptr<_Up>&& __p,
- typename enable_if<
- is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value,
- __nat
- >::type = __nat()) _NOEXCEPT
- : __ptr_(__p.release())
- {
- }
+ _LIBCPP_INLINE_VISIBILITY
+ void swap(unique_ptr& __u) _NOEXCEPT {
+ __ptr_.swap(__u.__ptr_);
+ }
+};
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT
- {
- reset(__u.release());
- __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
- return *this;
- }
- template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if
- <
- !is_array<_Up>::value &&
- is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
- is_assignable<deleter_type&, _Ep&&>::value,
- unique_ptr&
- >::type
- operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
- {
- reset(__u.release());
- __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
- return *this;
- }
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+template <class _Tp, class _Dp>
+class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp> {
+public:
+ typedef _Tp element_type;
+ typedef _Dp deleter_type;
+ typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
- _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>()
- {
- return __rv<unique_ptr>(*this);
- }
+private:
+ __compressed_pair<pointer, deleter_type> __ptr_;
- _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u)
- : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
+ template <class _From>
+ struct _CheckArrayPointerConversion : is_same<_From, pointer> {};
- template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<
- !is_array<_Up>::value &&
- is_convertible<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
- is_assignable<deleter_type&, _Ep&>::value,
- unique_ptr&
- >::type
- operator=(unique_ptr<_Up, _Ep> __u)
- {
- reset(__u.release());
- __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
- return *this;
- }
+ template <class _FromElem>
+ struct _CheckArrayPointerConversion<_FromElem*>
+ : integral_constant<bool,
+ is_same<_FromElem*, pointer>::value ||
+ (is_same<pointer, element_type*>::value &&
+ is_convertible<_FromElem(*)[], element_type(*)[]>::value)
+ >
+ {};
- _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d)
- : __ptr_(_VSTD::move(__p), _VSTD::move(__d)) {}
+#ifndef _LIBCPP_CXX03_LANG
+ typedef __unique_ptr_deleter_sfinae<_Dp> _DeleterSFINAE;
+
+ template <bool _Dummy>
+ using _LValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__lval_ref_type;
+
+ template <bool _Dummy>
+ using _GoodRValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__good_rval_ref_type;
+
+ template <bool _Dummy>
+ using _BadRValRefType =
+ typename __dependent_type<_DeleterSFINAE, _Dummy>::__bad_rval_ref_type;
+
+ template <bool _Dummy, class _Deleter = typename __dependent_type<
+ __identity<deleter_type>, _Dummy>::type>
+ using _EnableIfDeleterDefaultConstructible =
+ typename enable_if<is_default_constructible<_Deleter>::value &&
+ !is_pointer<_Deleter>::value>::type;
+
+ template <class _ArgType>
+ using _EnableIfDeleterConstructible =
+ typename enable_if<is_constructible<deleter_type, _ArgType>::value>::type;
+
+ template <class _Pp>
+ using _EnableIfPointerConvertible = typename enable_if<
+ _CheckArrayPointerConversion<_Pp>::value
+ >::type;
+
+ template <class _UPtr, class _Up,
+ class _ElemT = typename _UPtr::element_type>
+ using _EnableIfMoveConvertible = typename enable_if<
+ is_array<_Up>::value &&
+ is_same<pointer, element_type*>::value &&
+ is_same<typename _UPtr::pointer, _ElemT*>::value &&
+ is_convertible<_ElemT(*)[], element_type(*)[]>::value
+ >::type;
+
+ template <class _UDel>
+ using _EnableIfDeleterConvertible = typename enable_if<
+ (is_reference<_Dp>::value && is_same<_Dp, _UDel>::value) ||
+ (!is_reference<_Dp>::value && is_convertible<_UDel, _Dp>::value)
+ >::type;
+
+ template <class _UDel>
+ using _EnableIfDeleterAssignable = typename enable_if<
+ is_assignable<_Dp&, _UDel&&>::value
+ >::type;
- template <class _Up>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<
- is_convertible<_Up*, _Tp*>::value &&
- is_same<_Dp, default_delete<_Tp> >::value,
- unique_ptr&
- >::type
- operator=(auto_ptr<_Up> __p)
- {reset(__p.release()); return *this;}
+public:
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+ _LIBCPP_INLINE_VISIBILITY
+ constexpr unique_ptr() noexcept : __ptr_(pointer()) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>>
+ _LIBCPP_INLINE_VISIBILITY
+ constexpr unique_ptr(nullptr_t) noexcept : __ptr_(pointer()) {}
+
+ template <class _Pp, bool _Dummy = true,
+ class = _EnableIfDeleterDefaultConstructible<_Dummy>,
+ class = _EnableIfPointerConvertible<_Pp>>
+ _LIBCPP_INLINE_VISIBILITY
+ explicit unique_ptr(_Pp __p) noexcept
+ : __ptr_(__p) {}
+
+ template <class _Pp, bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>,
+ class = _EnableIfPointerConvertible<_Pp>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(_Pp __p, _LValRefType<_Dummy> __d) noexcept
+ : __ptr_(__p, __d) {}
+
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_LValRefType<_Dummy>>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(nullptr_t, _LValRefType<_Dummy> __d) noexcept
+ : __ptr_(nullptr, __d) {}
+
+ template <class _Pp, bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>,
+ class = _EnableIfPointerConvertible<_Pp>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(_Pp __p, _GoodRValRefType<_Dummy> __d) noexcept
+ : __ptr_(__p, _VSTD::move(__d)) {
+ static_assert(!is_reference<deleter_type>::value,
+ "rvalue deleter bound to reference");
+ }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();}
+ template <bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_GoodRValRefType<_Dummy>>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(nullptr_t, _GoodRValRefType<_Dummy> __d) noexcept
+ : __ptr_(nullptr, _VSTD::move(__d)) {
+ static_assert(!is_reference<deleter_type>::value,
+ "rvalue deleter bound to reference");
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT
- {
- reset();
- return *this;
- }
+ template <class _Pp, bool _Dummy = true,
+ class = _EnableIfDeleterConstructible<_BadRValRefType<_Dummy>>,
+ class = _EnableIfPointerConvertible<_Pp>>
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(_Pp __p, _BadRValRefType<_Dummy> __d) = delete;
- _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator*() const
- {return *__ptr_.first();}
- _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();}
- _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();}
- _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT
- {return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
- {return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
- {return __ptr_.first() != nullptr;}
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(unique_ptr&& __u) noexcept
+ : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {
+ }
- _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
- {
- pointer __t = __ptr_.first();
- __ptr_.first() = pointer();
- return __t;
- }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(unique_ptr&& __u) noexcept {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
+ return *this;
+ }
- _LIBCPP_INLINE_VISIBILITY void reset(pointer __p = pointer()) _NOEXCEPT
- {
- pointer __tmp = __ptr_.first();
- __ptr_.first() = __p;
- if (__tmp)
- __ptr_.second()(__tmp);
- }
+ template <class _Up, class _Ep,
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
+ class = _EnableIfDeleterConvertible<_Ep>
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(unique_ptr<_Up, _Ep>&& __u) noexcept
+ : __ptr_(__u.release(), _VSTD::forward<_Ep>(__u.get_deleter())) {
+ }
- _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) _NOEXCEPT
- {__ptr_.swap(__u.__ptr_);}
-};
+ template <class _Up, class _Ep,
+ class = _EnableIfMoveConvertible<unique_ptr<_Up, _Ep>, _Up>,
+ class = _EnableIfDeleterAssignable<_Ep>
+ >
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr&
+ operator=(unique_ptr<_Up, _Ep>&& __u) noexcept {
+ reset(__u.release());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
+ return *this;
+ }
-template <class _Tp, class _Dp>
-class _LIBCPP_TEMPLATE_VIS unique_ptr<_Tp[], _Dp>
-{
-public:
- typedef _Tp element_type;
- typedef _Dp deleter_type;
- typedef typename __pointer_type<_Tp, deleter_type>::type pointer;
+#else // _LIBCPP_CXX03_LANG
private:
- __compressed_pair<pointer, deleter_type> __ptr_;
+ template <class _Up> explicit unique_ptr(_Up);
-#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- unique_ptr(unique_ptr&);
- template <class _Up>
- unique_ptr(unique_ptr<_Up>&);
- unique_ptr& operator=(unique_ptr&);
- template <class _Up>
- unique_ptr& operator=(unique_ptr<_Up>&);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ unique_ptr(unique_ptr&);
+ template <class _Up> unique_ptr(unique_ptr<_Up>&);
- struct __nat {int __for_bool_;};
+ unique_ptr& operator=(unique_ptr&);
+ template <class _Up> unique_ptr& operator=(unique_ptr<_Up>&);
- typedef typename remove_reference<deleter_type>::type& _Dp_reference;
- typedef const typename remove_reference<deleter_type>::type& _Dp_const_reference;
+ template <class _Up>
+ unique_ptr(_Up __u,
+ typename conditional<
+ is_reference<deleter_type>::value, deleter_type,
+ typename add_lvalue_reference<const deleter_type>::type>::type,
+ typename enable_if<is_convertible<_Up, pointer>::value,
+ __nat>::type = __nat());
public:
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr() _NOEXCEPT
- : __ptr_(pointer())
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
- _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR unique_ptr(nullptr_t) _NOEXCEPT
- : __ptr_(pointer())
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _Pp>
- _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(_Pp __p,
- typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat()) _NOEXCEPT
- : __ptr_(__p)
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
-
- template <class _Pp>
- _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p, typename conditional<
- is_reference<deleter_type>::value,
- deleter_type,
- typename add_lvalue_reference<const deleter_type>::type>::type __d,
- typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
- _NOEXCEPT
- : __ptr_(__p, __d) {}
-
- _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename conditional<
- is_reference<deleter_type>::value,
- deleter_type,
- typename add_lvalue_reference<const deleter_type>::type>::type __d)
- _NOEXCEPT
- : __ptr_(pointer(), __d) {}
-
- template <class _Pp>
- _LIBCPP_INLINE_VISIBILITY unique_ptr(_Pp __p,
- typename remove_reference<deleter_type>::type&& __d,
- typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, __nat>::type = __nat())
- _NOEXCEPT
- : __ptr_(__p, _VSTD::move(__d))
- {
- static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
- }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr() : __ptr_(pointer()) {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(nullptr_t) : __ptr_(pointer()) {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, typename remove_reference<deleter_type>::type&& __d)
- _NOEXCEPT
- : __ptr_(pointer(), _VSTD::move(__d))
- {
- static_assert(!is_reference<deleter_type>::value, "rvalue deleter bound to reference");
- }
+ _LIBCPP_INLINE_VISIBILITY
+ explicit unique_ptr(pointer __p) : __ptr_(__p) {
+ static_assert(!is_pointer<deleter_type>::value,
+ "unique_ptr constructed with null function pointer deleter");
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(unique_ptr&& __u) _NOEXCEPT
- : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(pointer __p, deleter_type __d)
+ : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr&& __u) _NOEXCEPT
- {
- reset(__u.release());
- __ptr_.second() = _VSTD::forward<deleter_type>(__u.get_deleter());
- return *this;
- }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(nullptr_t, deleter_type __d)
+ : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
- template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY
- unique_ptr(unique_ptr<_Up, _Ep>&& __u,
- typename enable_if
- <
- is_array<_Up>::value &&
- __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value
- && is_convertible<_Ep, deleter_type>::value &&
- (
- !is_reference<deleter_type>::value ||
- is_same<deleter_type, _Ep>::value
- ),
- __nat
- >::type = __nat()
- ) _NOEXCEPT
- : __ptr_(__u.release(), _VSTD::forward<deleter_type>(__u.get_deleter())) {}
-
-
- template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if
- <
- is_array<_Up>::value &&
- __same_or_less_cv_qualified<typename unique_ptr<_Up, _Ep>::pointer, pointer>::value &&
- is_assignable<deleter_type&, _Ep&&>::value,
- unique_ptr&
- >::type
- operator=(unique_ptr<_Up, _Ep>&& __u) _NOEXCEPT
- {
- reset(__u.release());
- __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
- return *this;
- }
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ operator __rv<unique_ptr>() {
+ return __rv<unique_ptr>(*this);
+ }
- _LIBCPP_INLINE_VISIBILITY explicit unique_ptr(pointer __p)
- : __ptr_(__p)
- {
- static_assert(!is_pointer<deleter_type>::value,
- "unique_ptr constructed with null function pointer deleter");
- }
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr(__rv<unique_ptr> __u)
+ : __ptr_(__u->release(),
+ _VSTD::forward<deleter_type>(__u->get_deleter())) {}
- _LIBCPP_INLINE_VISIBILITY unique_ptr(pointer __p, deleter_type __d)
- : __ptr_(__p, _VSTD::forward<deleter_type>(__d)) {}
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(__rv<unique_ptr> __u) {
+ reset(__u->release());
+ __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
+ return *this;
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(nullptr_t, deleter_type __d)
- : __ptr_(pointer(), _VSTD::forward<deleter_type>(__d)) {}
+#endif // _LIBCPP_CXX03_LANG
- _LIBCPP_INLINE_VISIBILITY operator __rv<unique_ptr>()
- {
- return __rv<unique_ptr>(*this);
- }
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ ~unique_ptr() { reset(); }
- _LIBCPP_INLINE_VISIBILITY unique_ptr(__rv<unique_ptr> __u)
- : __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
+ _LIBCPP_INLINE_VISIBILITY
+ unique_ptr& operator=(nullptr_t) _NOEXCEPT {
+ reset();
+ return *this;
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(__rv<unique_ptr> __u)
- {
- reset(__u->release());
- __ptr_.second() = _VSTD::forward<deleter_type>(__u->get_deleter());
- return *this;
- }
+ _LIBCPP_INLINE_VISIBILITY
+ typename add_lvalue_reference<_Tp>::type
+ operator[](size_t __i) const {
+ return __ptr_.first()[__i];
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ pointer get() const _NOEXCEPT {
+ return __ptr_.first();
+ }
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY ~unique_ptr() {reset();}
+ _LIBCPP_INLINE_VISIBILITY
+ deleter_type& get_deleter() _NOEXCEPT {
+ return __ptr_.second();
+ }
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(nullptr_t) _NOEXCEPT
- {
- reset();
- return *this;
- }
+ _LIBCPP_INLINE_VISIBILITY
+ const deleter_type& get_deleter() const _NOEXCEPT {
+ return __ptr_.second();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {
+ return __ptr_.first() != nullptr;
+ }
- _LIBCPP_INLINE_VISIBILITY typename add_lvalue_reference<_Tp>::type operator[](size_t __i) const
- {return __ptr_.first()[__i];}
- _LIBCPP_INLINE_VISIBILITY pointer get() const _NOEXCEPT {return __ptr_.first();}
- _LIBCPP_INLINE_VISIBILITY _Dp_reference get_deleter() _NOEXCEPT
- {return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY _Dp_const_reference get_deleter() const _NOEXCEPT
- {return __ptr_.second();}
- _LIBCPP_INLINE_VISIBILITY
- _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
- {return __ptr_.first() != nullptr;}
+ _LIBCPP_INLINE_VISIBILITY
+ pointer release() _NOEXCEPT {
+ pointer __t = __ptr_.first();
+ __ptr_.first() = pointer();
+ return __t;
+ }
- _LIBCPP_INLINE_VISIBILITY pointer release() _NOEXCEPT
- {
- pointer __t = __ptr_.first();
- __ptr_.first() = pointer();
- return __t;
- }
+ template <class _Pp>
+ _LIBCPP_INLINE_VISIBILITY
+ typename enable_if<
+ _CheckArrayPointerConversion<_Pp>::value
+ >::type
+ reset(_Pp __p) _NOEXCEPT {
+ pointer __tmp = __ptr_.first();
+ __ptr_.first() = __p;
+ if (__tmp)
+ __ptr_.second()(__tmp);
+ }
- template <class _Pp>
- _LIBCPP_INLINE_VISIBILITY
- typename enable_if<__same_or_less_cv_qualified<_Pp, pointer>::value, void>::type
- reset(_Pp __p) _NOEXCEPT
- {
- pointer __tmp = __ptr_.first();
- __ptr_.first() = __p;
- if (__tmp)
- __ptr_.second()(__tmp);
- }
- _LIBCPP_INLINE_VISIBILITY void reset(nullptr_t = nullptr) _NOEXCEPT
- {
- pointer __tmp = __ptr_.first();
- __ptr_.first() = nullptr;
- if (__tmp)
- __ptr_.second()(__tmp);
- }
+ _LIBCPP_INLINE_VISIBILITY
+ void reset(nullptr_t = nullptr) _NOEXCEPT {
+ pointer __tmp = __ptr_.first();
+ __ptr_.first() = nullptr;
+ if (__tmp)
+ __ptr_.second()(__tmp);
+ }
- _LIBCPP_INLINE_VISIBILITY void swap(unique_ptr& __u) {__ptr_.swap(__u.__ptr_);}
-private:
+ _LIBCPP_INLINE_VISIBILITY
+ void swap(unique_ptr& __u) _NOEXCEPT {
+ __ptr_.swap(__u.__ptr_);
+ }
-#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _Up>
- explicit unique_ptr(_Up);
- template <class _Up>
- unique_ptr(_Up __u,
- typename conditional<
- is_reference<deleter_type>::value,
- deleter_type,
- typename add_lvalue_reference<const deleter_type>::type>::type,
- typename enable_if
- <
- is_convertible<_Up, pointer>::value,
- __nat
- >::type = __nat());
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
};
template <class _Tp, class _Dp>
@@ -3021,365 +3041,18 @@ template<class _Tp, class... _Args>
#endif // _LIBCPP_STD_VER > 11
-template <class _Size>
-inline _LIBCPP_INLINE_VISIBILITY
-_Size
-__loadword(const void* __p)
-{
- _Size __r;
- std::memcpy(&__r, __p, sizeof(__r));
- return __r;
-}
-
-// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
-// is 64 bits. This is because cityhash64 uses 64bit x 64bit
-// multiplication, which can be very slow on 32-bit systems.
-template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
-struct __murmur2_or_cityhash;
-
-template <class _Size>
-struct __murmur2_or_cityhash<_Size, 32>
-{
- _Size operator()(const void* __key, _Size __len);
-};
-
-// murmur2
-template <class _Size>
-_Size
-__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- const _Size __m = 0x5bd1e995;
- const _Size __r = 24;
- _Size __h = __len;
- const unsigned char* __data = static_cast<const unsigned char*>(__key);
- for (; __len >= 4; __data += 4, __len -= 4)
- {
- _Size __k = __loadword<_Size>(__data);
- __k *= __m;
- __k ^= __k >> __r;
- __k *= __m;
- __h *= __m;
- __h ^= __k;
- }
- switch (__len)
- {
- case 3:
- __h ^= __data[2] << 16;
- case 2:
- __h ^= __data[1] << 8;
- case 1:
- __h ^= __data[0];
- __h *= __m;
- }
- __h ^= __h >> 13;
- __h *= __m;
- __h ^= __h >> 15;
- return __h;
-}
-
-template <class _Size>
-struct __murmur2_or_cityhash<_Size, 64>
-{
- _Size operator()(const void* __key, _Size __len);
-
- private:
- // Some primes between 2^63 and 2^64.
- static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
- static const _Size __k1 = 0xb492b66fbe98f273ULL;
- static const _Size __k2 = 0x9ae16a3b2f90404fULL;
- static const _Size __k3 = 0xc949d7c7509e6557ULL;
-
- static _Size __rotate(_Size __val, int __shift) {
- return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
- }
-
- static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
- return (__val >> __shift) | (__val << (64 - __shift));
- }
-
- static _Size __shift_mix(_Size __val) {
- return __val ^ (__val >> 47);
- }
-
- static _Size __hash_len_16(_Size __u, _Size __v) {
- const _Size __mul = 0x9ddfea08eb382d69ULL;
- _Size __a = (__u ^ __v) * __mul;
- __a ^= (__a >> 47);
- _Size __b = (__v ^ __a) * __mul;
- __b ^= (__b >> 47);
- __b *= __mul;
- return __b;
- }
-
- static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
- if (__len > 8) {
- const _Size __a = __loadword<_Size>(__s);
- const _Size __b = __loadword<_Size>(__s + __len - 8);
- return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
- }
- if (__len >= 4) {
- const uint32_t __a = __loadword<uint32_t>(__s);
- const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
- return __hash_len_16(__len + (__a << 3), __b);
- }
- if (__len > 0) {
- const unsigned char __a = __s[0];
- const unsigned char __b = __s[__len >> 1];
- const unsigned char __c = __s[__len - 1];
- const uint32_t __y = static_cast<uint32_t>(__a) +
- (static_cast<uint32_t>(__b) << 8);
- const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
- return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
- }
- return __k2;
- }
-
- static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
- const _Size __a = __loadword<_Size>(__s) * __k1;
- const _Size __b = __loadword<_Size>(__s + 8);
- const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
- const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
- return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
- __a + __rotate(__b ^ __k3, 20) - __c + __len);
- }
-
- // Return a 16-byte hash for 48 bytes. Quick and dirty.
- // Callers do best to use "random-looking" values for a and b.
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b) {
- __a += __w;
- __b = __rotate(__b + __a + __z, 21);
- const _Size __c = __a;
- __a += __x;
- __a += __y;
- __b += __rotate(__a, 44);
- return pair<_Size, _Size>(__a + __z, __b + __c);
- }
-
- // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
- static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
- const char* __s, _Size __a, _Size __b) {
- return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
- __loadword<_Size>(__s + 8),
- __loadword<_Size>(__s + 16),
- __loadword<_Size>(__s + 24),
- __a,
- __b);
- }
-
- // Return an 8-byte hash for 33 to 64 bytes.
- static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
- _Size __z = __loadword<_Size>(__s + 24);
- _Size __a = __loadword<_Size>(__s) +
- (__len + __loadword<_Size>(__s + __len - 16)) * __k0;
- _Size __b = __rotate(__a + __z, 52);
- _Size __c = __rotate(__a, 37);
- __a += __loadword<_Size>(__s + 8);
- __c += __rotate(__a, 7);
- __a += __loadword<_Size>(__s + 16);
- _Size __vf = __a + __z;
- _Size __vs = __b + __rotate(__a, 31) + __c;
- __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
- __z += __loadword<_Size>(__s + __len - 8);
- __b = __rotate(__a + __z, 52);
- __c = __rotate(__a, 37);
- __a += __loadword<_Size>(__s + __len - 24);
- __c += __rotate(__a, 7);
- __a += __loadword<_Size>(__s + __len - 16);
- _Size __wf = __a + __z;
- _Size __ws = __b + __rotate(__a, 31) + __c;
- _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
- return __shift_mix(__r * __k0 + __vs) * __k2;
- }
-};
-
-// cityhash64
-template <class _Size>
-_Size
-__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
-{
- const char* __s = static_cast<const char*>(__key);
- if (__len <= 32) {
- if (__len <= 16) {
- return __hash_len_0_to_16(__s, __len);
- } else {
- return __hash_len_17_to_32(__s, __len);
- }
- } else if (__len <= 64) {
- return __hash_len_33_to_64(__s, __len);
- }
-
- // For strings over 64 bytes we hash the end first, and then as we
- // loop we keep 56 bytes of state: v, w, x, y, and z.
- _Size __x = __loadword<_Size>(__s + __len - 40);
- _Size __y = __loadword<_Size>(__s + __len - 16) +
- __loadword<_Size>(__s + __len - 56);
- _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
- __loadword<_Size>(__s + __len - 24));
- pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
- pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
- __x = __x * __k1 + __loadword<_Size>(__s);
-
- // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
- __len = (__len - 1) & ~static_cast<_Size>(63);
- do {
- __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
- __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
- __x ^= __w.second;
- __y += __v.first + __loadword<_Size>(__s + 40);
- __z = __rotate(__z + __w.first, 33) * __k1;
- __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
- __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
- __y + __loadword<_Size>(__s + 16));
- std::swap(__z, __x);
- __s += 64;
- __len -= 64;
- } while (__len != 0);
- return __hash_len_16(
- __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
- __hash_len_16(__v.second, __w.second) + __x);
-}
-
-template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
-struct __scalar_hash;
-
-template <class _Tp>
-struct __scalar_hash<_Tp, 0>
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__a = 0;
- __u.__t = __v;
- return __u.__a;
- }
-};
-
-template <class _Tp>
-struct __scalar_hash<_Tp, 1>
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __u.__a;
- }
-};
-
-template <class _Tp>
-struct __scalar_hash<_Tp, 2>
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
-};
-
-template <class _Tp>
-struct __scalar_hash<_Tp, 3>
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
-};
-
-template <class _Tp>
-struct __scalar_hash<_Tp, 4>
- : public unary_function<_Tp, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp __v) const _NOEXCEPT
- {
- union
- {
- _Tp __t;
- struct
- {
- size_t __a;
- size_t __b;
- size_t __c;
- size_t __d;
- } __s;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
-};
-
-struct _PairT {
- size_t first;
- size_t second;
-};
-
-_LIBCPP_INLINE_VISIBILITY
-inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
- typedef __scalar_hash<_PairT> _HashT;
- const _PairT __p = {__lhs, __rhs};
- return _HashT()(__p);
-}
-
-template<class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
- : public unary_function<_Tp*, size_t>
-{
- _LIBCPP_INLINE_VISIBILITY
- size_t operator()(_Tp* __v) const _NOEXCEPT
- {
- union
- {
- _Tp* __t;
- size_t __a;
- } __u;
- __u.__t = __v;
- return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
- }
-};
-
template <class _Tp, class _Dp>
+#ifdef _LIBCPP_CXX03_LANG
struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
+#else
+struct _LIBCPP_TEMPLATE_VIS hash<__enable_hash_helper<
+ unique_ptr<_Tp, _Dp>, typename unique_ptr<_Tp, _Dp>::pointer>>
+#endif
{
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type& __ptr) const _NOEXCEPT
+ result_type operator()(const argument_type& __ptr) const
{
typedef typename argument_type::pointer pointer;
return hash<pointer>()(__ptr.get());
@@ -3389,28 +3062,28 @@ struct _LIBCPP_TEMPLATE_VIS hash<unique_ptr<_Tp, _Dp> >
struct __destruct_n
{
private:
- size_t size;
+ size_t __size_;
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void __process(_Tp* __p, false_type) _NOEXCEPT
- {for (size_t __i = 0; __i < size; ++__i, ++__p) __p->~_Tp();}
+ {for (size_t __i = 0; __i < __size_; ++__i, ++__p) __p->~_Tp();}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void __process(_Tp*, true_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY void __incr(false_type) _NOEXCEPT
- {++size;}
+ {++__size_;}
_LIBCPP_INLINE_VISIBILITY void __incr(true_type) _NOEXCEPT
{}
_LIBCPP_INLINE_VISIBILITY void __set(size_t __s, false_type) _NOEXCEPT
- {size = __s;}
+ {__size_ = __s;}
_LIBCPP_INLINE_VISIBILITY void __set(size_t, true_type) _NOEXCEPT
{}
public:
_LIBCPP_INLINE_VISIBILITY explicit __destruct_n(size_t __s) _NOEXCEPT
- : size(__s) {}
+ : __size_(__s) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY void __incr(_Tp*) _NOEXCEPT
@@ -3681,6 +3354,39 @@ uninitialized_move_n(_InputIt __first, _Size __n, _ForwardIt __first_res) {
#endif // _LIBCPP_STD_VER > 14
+// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
+// should be sufficient for thread safety.
+// See https://bugs.llvm.org/show_bug.cgi?id=22803
+#if defined(__clang__) && __has_builtin(__atomic_add_fetch) \
+ && defined(__ATOMIC_RELAXED) \
+ && defined(__ATOMIC_ACQ_REL)
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
+# define _LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _Tp
+__libcpp_atomic_refcount_increment(_Tp& __t) _NOEXCEPT
+{
+#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
+ return __atomic_add_fetch(&__t, 1, __ATOMIC_RELAXED);
+#else
+ return __t += 1;
+#endif
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY _Tp
+__libcpp_atomic_refcount_decrement(_Tp& __t) _NOEXCEPT
+{
+#if defined(_LIBCPP_HAS_BUILTIN_ATOMIC_SUPPORT) && !defined(_LIBCPP_HAS_NO_THREADS)
+ return __atomic_add_fetch(&__t, -1, __ATOMIC_ACQ_REL);
+#else
+ return __t -= 1;
+#endif
+}
+
class _LIBCPP_EXCEPTION_ABI bad_weak_ptr
: public std::exception
{
@@ -3717,8 +3423,24 @@ public:
explicit __shared_count(long __refs = 0) _NOEXCEPT
: __shared_owners_(__refs) {}
+#if defined(_LIBCPP_BUILDING_MEMORY) && \
+ defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void __add_shared() _NOEXCEPT;
bool __release_shared() _NOEXCEPT;
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ void __add_shared() _NOEXCEPT {
+ __libcpp_atomic_refcount_increment(__shared_owners_);
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ bool __release_shared() _NOEXCEPT {
+ if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1) {
+ __on_zero_shared();
+ return true;
+ }
+ return false;
+ }
+#endif
_LIBCPP_INLINE_VISIBILITY
long use_count() const _NOEXCEPT {
return __libcpp_relaxed_load(&__shared_owners_) + 1;
@@ -3739,9 +3461,26 @@ protected:
virtual ~__shared_weak_count();
public:
+#if defined(_LIBCPP_BUILDING_MEMORY) && \
+ defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void __add_shared() _NOEXCEPT;
void __add_weak() _NOEXCEPT;
void __release_shared() _NOEXCEPT;
+#else
+ _LIBCPP_INLINE_VISIBILITY
+ void __add_shared() _NOEXCEPT {
+ __shared_count::__add_shared();
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ void __add_weak() _NOEXCEPT {
+ __libcpp_atomic_refcount_increment(__shared_weak_owners_);
+ }
+ _LIBCPP_INLINE_VISIBILITY
+ void __release_shared() _NOEXCEPT {
+ if (__shared_count::__release_shared())
+ __release_weak();
+ }
+#endif
void __release_weak() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
long use_count() const _NOEXCEPT {return __shared_count::use_count();}
@@ -3783,7 +3522,7 @@ template <class _Tp, class _Dp, class _Alloc>
const void*
__shared_ptr_pointer<_Tp, _Dp, _Alloc>::__get_deleter(const type_info& __t) const _NOEXCEPT
{
- return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : 0;
+ return __t == typeid(_Dp) ? _VSTD::addressof(__data_.first().second()) : nullptr;
}
#endif // _LIBCPP_NO_RTTI
@@ -3877,6 +3616,18 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
__a.deallocate(_PTraits::pointer_to(*this), 1);
}
+struct __shared_ptr_dummy_rebind_allocator_type;
+template <>
+class _LIBCPP_TEMPLATE_VIS allocator<__shared_ptr_dummy_rebind_allocator_type>
+{
+public:
+ template <class _Other>
+ struct rebind
+ {
+ typedef allocator<_Other> other;
+ };
+};
+
template<class _Tp> class _LIBCPP_TEMPLATE_VIS enable_shared_from_this;
template<class _Tp>
@@ -3926,6 +3677,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp> explicit shared_ptr(const weak_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type= __nat());
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
shared_ptr(auto_ptr<_Yp>&& __r,
@@ -3935,6 +3687,7 @@ public:
shared_ptr(auto_ptr<_Yp> __r,
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
#endif
+#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Yp, class _Dp>
shared_ptr(unique_ptr<_Yp, _Dp>&&,
@@ -3998,6 +3751,7 @@ public:
>::type
_LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp>&& __r);
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template<class _Yp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -4007,7 +3761,9 @@ public:
shared_ptr
>::type&
operator=(auto_ptr<_Yp>&& __r);
+#endif
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template<class _Yp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -4018,6 +3774,7 @@ public:
>::type
operator=(auto_ptr<_Yp> __r);
#endif
+#endif
template <class _Yp, class _Dp>
typename enable_if
<
@@ -4077,11 +3834,11 @@ public:
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT {return get() != 0;}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(shared_ptr<_Up> const& __p) const
+ bool owner_before(shared_ptr<_Up> const& __p) const _NOEXCEPT
{return __cntrl_ < __p.__cntrl_;}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(weak_ptr<_Up> const& __p) const
+ bool owner_before(weak_ptr<_Up> const& __p) const _NOEXCEPT
{return __cntrl_ < __p.__cntrl_;}
_LIBCPP_INLINE_VISIBILITY
bool
@@ -4092,7 +3849,9 @@ public:
template <class _Dp>
_LIBCPP_INLINE_VISIBILITY
_Dp* __get_deleter() const _NOEXCEPT
- {return (_Dp*)(__cntrl_ ? __cntrl_->__get_deleter(typeid(_Dp)) : 0);}
+ {return static_cast<_Dp*>(__cntrl_
+ ? const_cast<void *>(__cntrl_->__get_deleter(typeid(_Dp)))
+ : nullptr);}
#endif // _LIBCPP_NO_RTTI
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -4139,10 +3898,24 @@ public:
#endif // _LIBCPP_HAS_NO_VARIADICS
private:
+ template <class _Yp, bool = is_function<_Yp>::value>
+ struct __shared_ptr_default_allocator
+ {
+ typedef allocator<_Yp> type;
+ };
+
+ template <class _Yp>
+ struct __shared_ptr_default_allocator<_Yp, true>
+ {
+ typedef allocator<__shared_ptr_dummy_rebind_allocator_type> type;
+ };
template <class _Yp, class _OrigPtr>
_LIBCPP_INLINE_VISIBILITY
- void
+ typename enable_if<is_convertible<_OrigPtr*,
+ const enable_shared_from_this<_Yp>*
+ >::value,
+ void>::type
__enable_weak_this(const enable_shared_from_this<_Yp>* __e,
_OrigPtr* __ptr) _NOEXCEPT
{
@@ -4154,13 +3927,13 @@ private:
}
}
- _LIBCPP_INLINE_VISIBILITY
- void __enable_weak_this(const volatile void*, const volatile void*) _NOEXCEPT {}
+ _LIBCPP_INLINE_VISIBILITY void __enable_weak_this(...) _NOEXCEPT {}
template <class _Up> friend class _LIBCPP_TEMPLATE_VIS shared_ptr;
template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
};
+
template<class _Tp>
inline
_LIBCPP_CONSTEXPR
@@ -4186,8 +3959,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p,
: __ptr_(__p)
{
unique_ptr<_Yp> __hold(__p);
- typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), allocator<_Yp>());
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, default_delete<_Yp>, _AllocT > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__p, default_delete<_Yp>(), _AllocT());
__hold.release();
__enable_weak_this(__p, __p);
}
@@ -4202,8 +3976,9 @@ shared_ptr<_Tp>::shared_ptr(_Yp* __p, _Dp __d,
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Yp>());
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
__enable_weak_this(__p, __p);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
@@ -4224,8 +3999,9 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
- typedef __shared_ptr_pointer<nullptr_t, _Dp, allocator<_Tp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__p, __d, allocator<_Tp>());
+ typedef typename __shared_ptr_default_allocator<_Tp>::type _AllocT;
+ typedef __shared_ptr_pointer<nullptr_t, _Dp, _AllocT > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__p, __d, _AllocT());
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -4353,6 +4129,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template<class _Tp>
template<class _Yp>
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -4368,6 +4145,7 @@ shared_ptr<_Tp>::shared_ptr(auto_ptr<_Yp> __r,
__enable_weak_this(__r.get(), __r.get());
__r.release();
}
+#endif
template<class _Tp>
template <class _Yp, class _Dp>
@@ -4391,8 +4169,9 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
else
#endif
{
- typedef __shared_ptr_pointer<_Yp*, _Dp, allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), allocator<_Yp>());
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
+ typedef __shared_ptr_pointer<_Yp*, _Dp, _AllocT > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), __r.get_deleter(), _AllocT());
__enable_weak_this(__r.get(), __r.get());
}
__r.release();
@@ -4420,10 +4199,11 @@ shared_ptr<_Tp>::shared_ptr(unique_ptr<_Yp, _Dp> __r,
else
#endif
{
+ typedef typename __shared_ptr_default_allocator<_Yp>::type _AllocT;
typedef __shared_ptr_pointer<_Yp*,
reference_wrapper<typename remove_reference<_Dp>::type>,
- allocator<_Yp> > _CntrlBlk;
- __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), allocator<_Yp>());
+ _AllocT > _CntrlBlk;
+ __cntrl_ = new _CntrlBlk(__r.get(), ref(__r.get_deleter()), _AllocT());
__enable_weak_this(__r.get(), __r.get());
}
__r.release();
@@ -4674,6 +4454,7 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
return *this;
}
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template<class _Tp>
template<class _Yp>
inline
@@ -4688,6 +4469,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
shared_ptr(_VSTD::move(__r)).swap(*this);
return *this;
}
+#endif
template<class _Tp>
template <class _Yp, class _Dp>
@@ -4707,6 +4489,7 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp>&& __r)
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR)
template<class _Tp>
template<class _Yp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -4721,6 +4504,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp> __r)
shared_ptr(__r).swap(*this);
return *this;
}
+#endif
template<class _Tp>
template <class _Yp, class _Dp>
@@ -5171,11 +4955,11 @@ public:
shared_ptr<_Tp> lock() const _NOEXCEPT;
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(const shared_ptr<_Up>& __r) const
+ bool owner_before(const shared_ptr<_Up>& __r) const _NOEXCEPT
{return __cntrl_ < __r.__cntrl_;}
template<class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool owner_before(const weak_ptr<_Up>& __r) const
+ bool owner_before(const weak_ptr<_Up>& __r) const _NOEXCEPT
{return __cntrl_ < __r.__cntrl_;}
template <class _Up> friend class _LIBCPP_TEMPLATE_VIS weak_ptr;
@@ -5384,13 +5168,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<shared_ptr<_Tp> >
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
- bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+ bool operator()(shared_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
+ bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+ bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
};
@@ -5400,13 +5184,13 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<weak_ptr<_Tp> >
{
typedef bool result_type;
_LIBCPP_INLINE_VISIBILITY
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
+ bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const
+ bool operator()(shared_ptr<_Tp> const& __x, weak_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
_LIBCPP_INLINE_VISIBILITY
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const
+ bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Tp> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
};
@@ -5416,19 +5200,19 @@ struct _LIBCPP_TEMPLATE_VIS owner_less<void>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
+ bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
+ bool operator()( shared_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
+ bool operator()( weak_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY
- bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const
+ bool operator()( weak_ptr<_Tp> const& __x, weak_ptr<_Up> const& __y) const _NOEXCEPT
{return __x.owner_before(__y);}
typedef void is_transparent;
};
@@ -5474,6 +5258,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<shared_ptr<_Tp> >
{
typedef shared_ptr<_Tp> argument_type;
typedef size_t result_type;
+
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __ptr) const _NOEXCEPT
{
@@ -5504,7 +5289,8 @@ private:
friend _LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*);
};
-_LIBCPP_FUNC_VIS __sp_mut& __get_sp_mut(const void*);
+_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
+__sp_mut& __get_sp_mut(const void*);
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -5515,6 +5301,7 @@ atomic_is_lock_free(const shared_ptr<_Tp>*)
}
template <class _Tp>
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_load(const shared_ptr<_Tp>* __p)
{
@@ -5527,6 +5314,7 @@ atomic_load(const shared_ptr<_Tp>* __p)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
{
@@ -5534,6 +5322,7 @@ atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
}
template <class _Tp>
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
void
atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{
@@ -5545,6 +5334,7 @@ atomic_store(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
void
atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
{
@@ -5552,6 +5342,7 @@ atomic_store_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
}
template <class _Tp>
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
{
@@ -5564,6 +5355,7 @@ atomic_exchange(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r)
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
shared_ptr<_Tp>
atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order)
{
@@ -5571,6 +5363,7 @@ atomic_exchange_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp> __r, memory_order
}
template <class _Tp>
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
bool
atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
{
@@ -5592,6 +5385,7 @@ atomic_compare_exchange_strong(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, share
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
bool
atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_ptr<_Tp> __w)
{
@@ -5600,6 +5394,7 @@ atomic_compare_exchange_weak(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v, shared_
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
bool
atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w, memory_order, memory_order)
@@ -5609,6 +5404,7 @@ atomic_compare_exchange_strong_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* _
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
bool
atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v,
shared_ptr<_Tp> __w, memory_order, memory_order)
@@ -5741,4 +5537,6 @@ struct __temp_value {
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_MEMORY
diff --git a/contrib/libc++/include/module.modulemap b/contrib/libc++/include/module.modulemap
index c354cae..3194b5c 100644
--- a/contrib/libc++/include/module.modulemap
+++ b/contrib/libc++/include/module.modulemap
@@ -484,7 +484,7 @@ module std [system] {
module __string { header "__string" export * }
module __tree { header "__tree" export * }
module __tuple { header "__tuple" export * }
- module __undef_min_max { header "__undef_min_max" export * }
+ module __undef_macros { header "__undef_macros" export * }
module experimental {
requires cplusplus11
@@ -501,6 +501,11 @@ module std [system] {
header "experimental/chrono"
export *
}
+ module coroutine {
+ requires coroutines
+ header "experimental/coroutine"
+ export *
+ }
module deque {
header "experimental/deque"
export *
diff --git a/contrib/libc++/include/mutex b/contrib/libc++/include/mutex
index 8526533..fbcc098 100644
--- a/contrib/libc++/include/mutex
+++ b/contrib/libc++/include/mutex
@@ -109,15 +109,17 @@ public:
lock_guard& operator=(lock_guard const&) = delete;
};
-template <class... MutexTypes> // Variadic lock_guard only provided in ABI V2.
-class lock_guard
+template <class... MutexTypes>
+class scoped_lock // C++17
{
public:
- explicit lock_guard(MutexTypes&... m);
- lock_guard(MutexTypes&... m, adopt_lock_t);
- ~lock_guard();
- lock_guard(lock_guard const&) = delete;
- lock_guard& operator=(lock_guard const&) = delete;
+ using mutex_type = Mutex; // If MutexTypes... consists of the single type Mutex
+
+ explicit scoped_lock(MutexTypes&... m);
+ scoped_lock(adopt_lock_t, MutexTypes&... m);
+ ~scoped_lock();
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
private:
tuple<MutexTypes&...> pm; // exposition only
};
@@ -189,17 +191,19 @@ template<class Callable, class ...Args>
#include <__mutex_base>
#include <functional>
#include <memory>
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
#include <tuple>
#endif
#include <__threading_support>
-#include <__undef_min_max>
-
#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
@@ -248,6 +252,7 @@ public:
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT;
};
@@ -291,6 +296,7 @@ public:
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT;
};
@@ -339,7 +345,7 @@ try_lock(_L0& __l0, _L1& __l1)
return 0;
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _L0, class _L1, class _L2, class... _L3>
int
@@ -358,7 +364,7 @@ try_lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3)
return __r;
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
template <class _L0, class _L1>
void
@@ -387,7 +393,7 @@ lock(_L0& __l0, _L1& __l1)
}
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _L0, class _L1, class _L2, class ..._L3>
void
@@ -462,19 +468,96 @@ void __unlock(_L0& __l0, _L1& __l1, _L2& __l2, _L3&... __l3) {
_VSTD::__unlock(__l2, __l3...);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
+
+#if _LIBCPP_STD_VER > 14
+template <class ..._Mutexes>
+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 _Mutex>
+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(adopt_lock_t, mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m))
+ : __m_(__m) {}
+
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
+};
+
+template <class ..._MArgs>
+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(adopt_lock_t, _MArgs&... __margs)
+ : __t_(__margs...)
+ {
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ ~scoped_lock() {
+ typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
+ __unlock_unpack(_Indices{}, __t_);
+ }
+
+ scoped_lock(scoped_lock const&) = delete;
+ scoped_lock& operator=(scoped_lock const&) = delete;
+
+private:
+ template <size_t ..._Indx>
+ _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_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Callable, class... _Args>
_LIBCPP_INLINE_VISIBILITY
void call_once(once_flag&, _Callable&&, _Args&&...);
-#else // _LIBCPP_HAS_NO_VARIADICS
+#else // _LIBCPP_CXX03_LANG
template<class _Callable>
_LIBCPP_INLINE_VISIBILITY
@@ -484,7 +567,7 @@ template<class _Callable>
_LIBCPP_INLINE_VISIBILITY
void call_once(once_flag&, const _Callable&);
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
struct _LIBCPP_TEMPLATE_VIS once_flag
{
@@ -498,11 +581,11 @@ private:
unsigned long __state_;
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Callable, class... _Args>
friend
void call_once(once_flag&, _Callable&&, _Args&&...);
-#else // _LIBCPP_HAS_NO_VARIADICS
+#else // _LIBCPP_CXX03_LANG
template<class _Callable>
friend
void call_once(once_flag&, _Callable&);
@@ -510,10 +593,10 @@ private:
template<class _Callable>
friend
void call_once(once_flag&, const _Callable&);
-#endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_CXX03_LANG
};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Fp>
class __call_once_param
@@ -568,7 +651,7 @@ __call_once_proxy(void* __vp)
_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Callable, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
@@ -584,7 +667,7 @@ call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
}
}
-#else // _LIBCPP_HAS_NO_VARIADICS
+#else // _LIBCPP_CXX03_LANG
template<class _Callable>
inline _LIBCPP_INLINE_VISIBILITY
@@ -603,72 +686,17 @@ inline _LIBCPP_INLINE_VISIBILITY
void
call_once(once_flag& __flag, const _Callable& __func)
{
- if (__flag.__state_ != ~0ul)
+ if (__libcpp_acquire_load(&__flag.__state_) != ~0ul)
{
__call_once_param<const _Callable> __p(__func);
__call_once(__flag.__state_, &__p, &__call_once_proxy<const _Callable>);
}
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-
-#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD) \
- && !defined(_LIBCPP_CXX03_LANG)
-template <>
-class _LIBCPP_TEMPLATE_VIS lock_guard<> {
-public:
- explicit lock_guard() {}
- ~lock_guard() = default;
-
- _LIBCPP_INLINE_VISIBILITY
- explicit lock_guard(adopt_lock_t) {}
-
- lock_guard(lock_guard const&) = delete;
- lock_guard& operator=(lock_guard const&) = delete;
-};
-
-template <class ..._MArgs>
-class _LIBCPP_TEMPLATE_VIS lock_guard
-{
- static_assert(sizeof...(_MArgs) >= 2, "At least 2 lock types required");
- typedef tuple<_MArgs&...> _MutexTuple;
-
-public:
- _LIBCPP_INLINE_VISIBILITY
- explicit lock_guard(_MArgs&... __margs)
- : __t_(__margs...)
- {
- _VSTD::lock(__margs...);
- }
-
- _LIBCPP_INLINE_VISIBILITY
- lock_guard(_MArgs&... __margs, adopt_lock_t)
- : __t_(__margs...)
- {
- }
-
- _LIBCPP_INLINE_VISIBILITY
- ~lock_guard() {
- typedef typename __make_tuple_indices<sizeof...(_MArgs)>::type _Indices;
- __unlock_unpack(_Indices{}, __t_);
- }
-
- lock_guard(lock_guard const&) = delete;
- lock_guard& operator=(lock_guard const&) = delete;
-
-private:
- template <size_t ..._Indx>
- _LIBCPP_INLINE_VISIBILITY
- static void __unlock_unpack(__tuple_indices<_Indx...>, _MutexTuple& __mt) {
- _VSTD::__unlock(_VSTD::get<_Indx>(__mt)...);
- }
-
- _MutexTuple __t_;
-};
-
-#endif // _LIBCPP_ABI_VARIADIC_LOCK_GUARD
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_MUTEX
diff --git a/contrib/libc++/include/new b/contrib/libc++/include/new
index 86428f2..34df2ef 100644
--- a/contrib/libc++/include/new
+++ b/contrib/libc++/include/new
@@ -92,6 +92,10 @@ void operator delete[](void* ptr, void*) noexcept;
#include <cstdlib>
#endif
+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include <new.h>
+#endif
+
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -110,6 +114,10 @@ void operator delete[](void* ptr, void*) noexcept;
namespace std // purposefully not using versioning namespace
{
+#if !defined(_LIBCPP_ABI_MICROSOFT)
+struct _LIBCPP_TYPE_VIS nothrow_t {};
+extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
+
class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception
{
@@ -128,13 +136,18 @@ public:
virtual const char* what() const _NOEXCEPT;
};
+typedef void (*new_handler)();
+_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
+_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
+
+#endif // !_LIBCPP_ABI_MICROSOFT
+
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
-#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+#if defined(_LIBCPP_BUILDING_LIBRARY) || (_LIBCPP_STD_VER > 11)
-class _LIBCPP_EXCEPTION_ABI bad_array_length
- : public bad_alloc
-{
+class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
+ bad_array_length : public bad_alloc {
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
@@ -153,12 +166,6 @@ enum align_val_t { __zero = 0, __max = (size_t)-1 };
#endif
#endif
-struct _LIBCPP_TYPE_VIS nothrow_t {};
-extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
-typedef void (*new_handler)();
-_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT;
-_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
-
} // std
#if defined(_LIBCPP_CXX03_LANG)
@@ -167,12 +174,14 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
#define _THROW_BAD_ALLOC
#endif
+#if !defined(_LIBCPP_ABI_MICROSOFT)
+
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz) _THROW_BAD_ALLOC;
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz) _NOEXCEPT;
#endif
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz) _THROW_BAD_ALLOC;
@@ -180,7 +189,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, const std::n
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz) _NOEXCEPT;
#endif
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
@@ -189,7 +198,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new(std::size_t __sz, std::align_val
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete(void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
#endif
_LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_val_t) _THROW_BAD_ALLOC;
@@ -197,7 +206,7 @@ _LIBCPP_OVERRIDABLE_FUNC_VIS void* operator new[](std::size_t __sz, std::align_v
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t) _NOEXCEPT;
_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::align_val_t, const std::nothrow_t&) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
-_LIBCPP_OVERRIDABLE_FUNC_VIS void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
+_LIBCPP_OVERRIDABLE_FUNC_VIS _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE void operator delete[](void* __p, std::size_t __sz, std::align_val_t) _NOEXCEPT;
#endif
#endif
@@ -206,6 +215,8 @@ inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _N
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _NOEXCEPT {}
+#endif // !_LIBCPP_ABI_MICROSOFT
+
_LIBCPP_BEGIN_NAMESPACE_STD
inline _LIBCPP_INLINE_VISIBILITY void *__allocate(size_t __size) {
@@ -226,6 +237,9 @@ inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void *__ptr) {
#ifdef _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
+#ifndef _LIBCPP_NO_EXCEPTIONS
+_LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
+#endif
void __throw_bad_array_length()
{
#ifndef _LIBCPP_NO_EXCEPTIONS
diff --git a/contrib/libc++/include/numeric b/contrib/libc++/include/numeric
index e005808..1b7d97c 100644
--- a/contrib/libc++/include/numeric
+++ b/contrib/libc++/include/numeric
@@ -25,6 +25,18 @@ template <class InputIterator, class T, class BinaryOperation>
T
accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
+template<class InputIterator>
+ typename iterator_traits<InputIterator>::value_type
+ reduce(InputIterator first, InputIterator last); // C++17
+
+template<class InputIterator, class T>
+ T
+ reduce(InputIterator first, InputIterator last, T init); // C++17
+
+template<class InputIterator, class T, class BinaryOperation>
+ T
+ reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17
+
template <class InputIterator1, class InputIterator2, class T>
T
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init);
@@ -34,6 +46,23 @@ template <class InputIterator1, class InputIterator2, class T, class BinaryOpera
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
+
+template<class InputIterator1, class InputIterator2, class T>
+ T
+ transform_reduce(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init); // C++17
+
+template<class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
+ T
+ transform_reduce(InputIterator1 first1, InputIterator1 last1,
+ InputIterator2 first2, T init,
+ BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17
+
+template<class InputIterator, class T, class BinaryOperation, class UnaryOperation>
+ T
+ transform_reduce(InputIterator first, InputIterator last, T init,
+ BinaryOperation binary_op, UnaryOperation unary_op); // C++17
+
template <class InputIterator, class OutputIterator>
OutputIterator
partial_sum(InputIterator first, InputIterator last, OutputIterator result);
@@ -42,6 +71,52 @@ template <class InputIterator, class OutputIterator, class BinaryOperation>
OutputIterator
partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
+template<class InputIterator, class OutputIterator, class T>
+ OutputIterator
+ exclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, T init); // C++17
+
+template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
+ OutputIterator
+ exclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, T init, BinaryOperation binary_op); // C++17
+
+template<class InputIterator, class OutputIterator>
+ OutputIterator
+ inclusive_scan(InputIterator first, InputIterator last, OutputIterator result); // C++17
+
+template<class InputIterator, class OutputIterator, class BinaryOperation>
+ OutputIterator
+ inclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, BinaryOperation binary_op); // C++17
+
+template<class InputIterator, class OutputIterator, class BinaryOperation, class T>
+ OutputIterator
+ inclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, BinaryOperation binary_op, T init); // C++17
+
+template<class InputIterator, class OutputIterator, class T,
+ class BinaryOperation, class UnaryOperation>
+ OutputIterator
+ transform_exclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result, T init,
+ BinaryOperation binary_op, UnaryOperation unary_op); // C++17
+
+template<class InputIterator, class OutputIterator,
+ class BinaryOperation, class UnaryOperation>
+ OutputIterator
+ transform_inclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result,
+ BinaryOperation binary_op, UnaryOperation unary_op); // C++17
+
+template<class InputIterator, class OutputIterator,
+ class BinaryOperation, class UnaryOperation, class T>
+ OutputIterator
+ transform_inclusive_scan(InputIterator first, InputIterator last,
+ OutputIterator result,
+ BinaryOperation binary_op, UnaryOperation unary_op,
+ T init); // C++17
+
template <class InputIterator, class OutputIterator>
OutputIterator
adjacent_difference(InputIterator first, InputIterator last, OutputIterator result);
@@ -65,11 +140,16 @@ template <class M, class N>
#include <__config>
#include <iterator>
+#include <limits> // for numeric_limits
+#include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _InputIterator, class _Tp>
@@ -92,6 +172,35 @@ accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOpe
return __init;
}
+#if _LIBCPP_STD_VER > 14
+template <class _InputIterator, class _Tp, class _BinaryOp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b)
+{
+ for (; __first != __last; ++__first)
+ __init = __b(__init, *__first);
+ return __init;
+}
+
+template <class _InputIterator, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+reduce(_InputIterator __first, _InputIterator __last, _Tp __init)
+{
+ return _VSTD::reduce(__first, __last, __init, _VSTD::plus<>());
+}
+
+template <class _InputIterator>
+inline _LIBCPP_INLINE_VISIBILITY
+typename iterator_traits<_InputIterator>::value_type
+reduce(_InputIterator __first, _InputIterator __last)
+{
+ return _VSTD::reduce(__first, __last,
+ typename iterator_traits<_InputIterator>::value_type{});
+}
+#endif
+
template <class _InputIterator1, class _InputIterator2, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp
@@ -113,6 +222,41 @@ inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2
return __init;
}
+#if _LIBCPP_STD_VER > 14
+template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+transform_reduce(_InputIterator __first, _InputIterator __last,
+ _Tp __init, _BinaryOp __b, _UnaryOp __u)
+{
+ for (; __first != __last; ++__first)
+ __init = __b(__init, __u(*__first));
+ return __init;
+}
+
+template <class _InputIterator1, class _InputIterator2,
+ class _Tp, class _BinaryOp1, class _BinaryOp2>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2)
+{
+ for (; __first1 != __last1; ++__first1, (void) ++__first2)
+ __init = __b1(__init, __b2(*__first1, *__first2));
+ return __init;
+}
+
+template <class _InputIterator1, class _InputIterator2, class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp
+transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
+ _InputIterator2 __first2, _Tp __init)
+{
+ return _VSTD::transform_reduce(__first1, __last1, __first2, __init,
+ _VSTD::plus<>(), _VSTD::multiplies<>());
+}
+#endif
+
template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
@@ -150,6 +294,117 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
return __result;
}
+#if _LIBCPP_STD_VER > 14
+template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
+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 <class _InputIterator, class _OutputIterator, class _Tp>
+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 <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
+_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOp __b, _Tp __init)
+{
+ for (; __first != __last; ++__first, (void) ++__result) {
+ __init = __b(__init, *__first);
+ *__result = __init;
+ }
+ return __result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOp>
+_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOp __b)
+{
+ if (__first != __last) {
+ typename std::iterator_traits<_InputIterator>::value_type __init = *__first;
+ *__result++ = __init;
+ if (++__first != __last)
+ return _VSTD::inclusive_scan(__first, __last, __result, __b, __init);
+ }
+
+ return __result;
+}
+
+template <class _InputIterator, class _OutputIterator>
+_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result)
+{
+ return _VSTD::inclusive_scan(__first, __last, __result, std::plus<>());
+}
+
+template <class _InputIterator, class _OutputIterator, class _Tp,
+ class _BinaryOp, class _UnaryOp>
+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;
+}
+
+template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
+_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init)
+{
+ for (; __first != __last; ++__first, (void) ++__result) {
+ __init = __b(__init, __u(*__first));
+ *__result = __init;
+ }
+
+ return __result;
+}
+
+template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp>
+_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
+ _OutputIterator __result, _BinaryOp __b, _UnaryOp __u)
+{
+ if (__first != __last) {
+ typename std::iterator_traits<_InputIterator>::value_type __init = __u(*__first);
+ *__result++ = __init;
+ if (++__first != __last)
+ return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
+ }
+
+ return __result;
+}
+#endif
+
template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
@@ -200,27 +455,32 @@ iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
#if _LIBCPP_STD_VER > 14
-template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs;
+template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
-template <typename _Tp>
-struct __abs<_Tp, true> {
+template <typename _Result, typename _Source>
+struct __abs<_Result, _Source, true> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; }
+ _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 <typename _Tp>
-struct __abs<_Tp, false> {
+template <typename _Result, typename _Source>
+struct __abs<_Result, _Source, false> {
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
- _Tp operator()(_Tp __t) const noexcept { return __t; }
+ _Result operator()(_Source __t) const noexcept { return __t; }
};
template<class _Tp>
-_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
_Tp __gcd(_Tp __m, _Tp __n)
{
- static_assert((!is_signed<_Tp>::value), "" );
- return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n);
+ static_assert((!is_signed<_Tp>::value), "");
+ return __n == 0 ? __m : _VSTD::__gcd<_Tp>(__n, __m % __n);
}
@@ -234,8 +494,9 @@ gcd(_Tp __m, _Up __n)
static_assert((!is_same<typename remove_cv<_Up>::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>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
- static_cast<_Wp>(__abs<_Up>()(__n))));
+ return static_cast<_Rp>(_VSTD::__gcd(
+ static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
+ static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
}
template<class _Tp, class _Up>
@@ -250,8 +511,8 @@ lcm(_Tp __m, _Up __n)
return 0;
using _Rp = common_type_t<_Tp,_Up>;
- _Rp __val1 = __abs<_Tp>()(__m) / gcd(__m,__n);
- _Up __val2 = __abs<_Up>()(__n);
+ _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;
}
@@ -260,4 +521,6 @@ lcm(_Tp __m, _Up __n)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_NUMERIC
diff --git a/contrib/libc++/include/optional b/contrib/libc++/include/optional
index 8f47986..1fb953b 100644
--- a/contrib/libc++/include/optional
+++ b/contrib/libc++/include/optional
@@ -17,29 +17,31 @@
// C++1z
namespace std {
- // 20.6.3, optional for object types
+ // 23.6.3, optional for object types
template <class T> class optional;
- // 20.6.4, no-value state indicator
+ // 23.6.4, no-value state indicator
struct nullopt_t{see below };
constexpr nullopt_t nullopt(unspecified );
- // 20.6.5, class bad_optional_access
+ // 23.6.5, class bad_optional_access
class bad_optional_access;
- // 20.6.6, relational operators
- template <class T>
- constexpr bool operator==(const optional<T>&, const optional<T>&);
- template <class T>
- constexpr bool operator!=(const optional<T>&, const optional<T>&);
- template <class T>
- constexpr bool operator<(const optional<T>&, const optional<T>&);
- template <class T>
- constexpr bool operator>(const optional<T>&, const optional<T>&);
- template <class T>
- constexpr bool operator<=(const optional<T>&, const optional<T>&);
- template <class T>
- constexpr bool operator>=(const optional<T>&, const optional<T>&);
+ // 23.6.6, relational operators
+ template <class T, class U>
+ constexpr bool operator==(const optional<T>&, const optional<U>&);
+ template <class T, class U>
+ constexpr bool operator!=(const optional<T>&, const optional<U>&);
+ template <class T, class U>
+ constexpr bool operator<(const optional<T>&, const optional<U>&);
+ template <class T, class U>
+ constexpr bool operator>(const optional<T>&, const optional<U>&);
+ template <class T, class U>
+ constexpr bool operator<=(const optional<T>&, const optional<U>&);
+ template <class T, class U>
+ constexpr bool operator>=(const optional<T>&, const optional<U>&);
+
+ // 23.6.7 comparison with nullopt
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
template <class T> constexpr bool operator!=(const optional<T>&, nullopt_t) noexcept;
@@ -53,21 +55,21 @@ namespace std {
template <class T> constexpr bool operator>=(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator>=(nullopt_t, const optional<T>&) noexcept;
- // 20.6.8, comparison with T
- template <class T> constexpr bool operator==(const optional<T>&, const T&);
- template <class T> constexpr bool operator==(const T&, const optional<T>&);
- template <class T> constexpr bool operator!=(const optional<T>&, const T&);
- template <class T> constexpr bool operator!=(const T&, const optional<T>&);
- template <class T> constexpr bool operator<(const optional<T>&, const T&);
- template <class T> constexpr bool operator<(const T&, const optional<T>&);
- template <class T> constexpr bool operator<=(const optional<T>&, const T&);
- template <class T> constexpr bool operator<=(const T&, const optional<T>&);
- template <class T> constexpr bool operator>(const optional<T>&, const T&);
- template <class T> constexpr bool operator>(const T&, const optional<T>&);
- template <class T> constexpr bool operator>=(const optional<T>&, const T&);
- template <class T> constexpr bool operator>=(const T&, const optional<T>&);
-
- // 20.6.9, specialized algorithms
+ // 23.6.8, comparison with T
+ template <class T, class U> constexpr bool operator==(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator==(const U&, const optional<T>&);
+ template <class T, class U> constexpr bool operator!=(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator!=(const U&, const optional<T>&);
+ template <class T, class U> constexpr bool operator<(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator<(const U&, const optional<T>&);
+ template <class T, class U> constexpr bool operator<=(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator<=(const U&, const optional<T>&);
+ template <class T, class U> constexpr bool operator>(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator>(const U&, const optional<T>&);
+ template <class T, class U> constexpr bool operator>=(const optional<T>&, const U&);
+ template <class T, class U> constexpr bool operator>=(const U&, const optional<T>&);
+
+ // 23.6.9, specialized algorithms
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below );
template <class T> constexpr optional<see below > make_optional(T&&);
template <class T, class... Args>
@@ -75,7 +77,7 @@ namespace std {
template <class T, class U, class... Args>
constexpr optional<T> make_optional(initializer_list<U> il, Args&&... args);
- // 20.6.10, hash support
+ // 23.6.10, hash support
template <class T> struct hash;
template <class T> struct hash<optional<T>>;
@@ -83,11 +85,11 @@ namespace std {
public:
using value_type = T;
- // 20.6.3.1, constructors
+ // 23.6.3.1, constructors
constexpr optional() noexcept;
constexpr optional(nullopt_t) noexcept;
optional(const optional &);
- optional(optional &&) noexcept(see below );
+ optional(optional &&) noexcept(see below);
template <class... Args> constexpr explicit optional(in_place_t, Args &&...);
template <class U, class... Args>
constexpr explicit optional(in_place_t, initializer_list<U>, Args &&...);
@@ -98,24 +100,24 @@ namespace std {
template <class U>
constexpr EXPLICIT optional(optional<U> &&);
- // 20.6.3.2, destructor
+ // 23.6.3.2, destructor
~optional();
- // 20.6.3.3, assignment
+ // 23.6.3.3, assignment
optional &operator=(nullopt_t) noexcept;
optional &operator=(const optional &);
optional &operator=(optional &&) noexcept(see below );
template <class U = T> optional &operator=(U &&);
template <class U> optional &operator=(const optional<U> &);
template <class U> optional &operator=(optional<U> &&);
- template <class... Args> void emplace(Args &&...);
+ template <class... Args> T& emplace(Args &&...);
template <class U, class... Args>
- void emplace(initializer_list<U>, Args &&...);
+ T& emplace(initializer_list<U>, Args &&...);
- // 20.6.3.4, swap
+ // 23.6.3.4, swap
void swap(optional &) noexcept(see below );
- // 20.6.3.5, observers
+ // 23.6.3.5, observers
constexpr T const *operator->() const;
constexpr T *operator->();
constexpr T const &operator*() const &;
@@ -131,7 +133,7 @@ namespace std {
template <class U> constexpr T value_or(U &&) const &;
template <class U> constexpr T value_or(U &&) &&;
- // 20.6.3.6, modifiers
+ // 23.6.3.6, modifiers
void reset() noexcept;
private:
@@ -144,7 +146,6 @@ namespace std {
#include <__config>
#include <__debug>
#include <__functional_base>
-#include <__undef_min_max>
#include <functional>
#include <initializer_list>
#include <new>
@@ -156,6 +157,10 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
namespace std // purposefully not using versioning namespace
{
@@ -434,46 +439,122 @@ struct __optional_storage_base<_Tp, true>
}
};
-template <class _Tp, bool = is_trivially_copyable<_Tp>::value>
-struct __optional_storage;
-
-template <class _Tp>
-struct __optional_storage<_Tp, true> : __optional_storage_base<_Tp>
+template <class _Tp, bool = is_trivially_copy_constructible<_Tp>::value>
+struct __optional_copy_base : __optional_storage_base<_Tp>
{
using __optional_storage_base<_Tp>::__optional_storage_base;
};
template <class _Tp>
-struct __optional_storage<_Tp, false> : __optional_storage_base<_Tp>
+struct __optional_copy_base<_Tp, false> : __optional_storage_base<_Tp>
{
- using value_type = _Tp;
using __optional_storage_base<_Tp>::__optional_storage_base;
_LIBCPP_INLINE_VISIBILITY
- __optional_storage() = default;
+ __optional_copy_base() = default;
_LIBCPP_INLINE_VISIBILITY
- __optional_storage(const __optional_storage& __opt)
+ __optional_copy_base(const __optional_copy_base& __opt)
{
this->__construct_from(__opt);
}
_LIBCPP_INLINE_VISIBILITY
- __optional_storage(__optional_storage&& __opt)
+ __optional_copy_base(__optional_copy_base&&) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_base& operator=(const __optional_copy_base&) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_base& operator=(__optional_copy_base&&) = default;
+};
+
+template <class _Tp, bool = is_trivially_move_constructible<_Tp>::value>
+struct __optional_move_base : __optional_copy_base<_Tp>
+{
+ using __optional_copy_base<_Tp>::__optional_copy_base;
+};
+
+template <class _Tp>
+struct __optional_move_base<_Tp, false> : __optional_copy_base<_Tp>
+{
+ using value_type = _Tp;
+ using __optional_copy_base<_Tp>::__optional_copy_base;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_base() = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_base(const __optional_move_base&) = default;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_base(__optional_move_base&& __opt)
noexcept(is_nothrow_move_constructible_v<value_type>)
{
this->__construct_from(_VSTD::move(__opt));
}
_LIBCPP_INLINE_VISIBILITY
- __optional_storage& operator=(const __optional_storage& __opt)
+ __optional_move_base& operator=(const __optional_move_base&) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_base& operator=(__optional_move_base&&) = default;
+};
+
+template <class _Tp, bool =
+ is_trivially_destructible<_Tp>::value &&
+ is_trivially_copy_constructible<_Tp>::value &&
+ is_trivially_copy_assignable<_Tp>::value>
+struct __optional_copy_assign_base : __optional_move_base<_Tp>
+{
+ using __optional_move_base<_Tp>::__optional_move_base;
+};
+
+template <class _Tp>
+struct __optional_copy_assign_base<_Tp, false> : __optional_move_base<_Tp>
+{
+ using __optional_move_base<_Tp>::__optional_move_base;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_assign_base() = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_assign_base(const __optional_copy_assign_base&) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_assign_base(__optional_copy_assign_base&&) = default;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_copy_assign_base& operator=(const __optional_copy_assign_base& __opt)
{
this->__assign_from(__opt);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
- __optional_storage& operator=(__optional_storage&& __opt)
+ __optional_copy_assign_base& operator=(__optional_copy_assign_base&&) = default;
+};
+
+template <class _Tp, bool =
+ is_trivially_destructible<_Tp>::value &&
+ is_trivially_move_constructible<_Tp>::value &&
+ is_trivially_move_assignable<_Tp>::value>
+struct __optional_move_assign_base : __optional_copy_assign_base<_Tp>
+{
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+};
+
+template <class _Tp>
+struct __optional_move_assign_base<_Tp, false> : __optional_copy_assign_base<_Tp>
+{
+ using value_type = _Tp;
+ using __optional_copy_assign_base<_Tp>::__optional_copy_assign_base;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_assign_base() = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_assign_base(const __optional_move_assign_base& __opt) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_assign_base(__optional_move_assign_base&&) = default;
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_assign_base& operator=(const __optional_move_assign_base&) = default;
+
+ _LIBCPP_INLINE_VISIBILITY
+ __optional_move_assign_base& operator=(__optional_move_assign_base&& __opt)
noexcept(is_nothrow_move_assignable_v<value_type> &&
is_nothrow_move_constructible_v<value_type>)
{
@@ -496,11 +577,11 @@ using __optional_sfinae_assign_base_t = __sfinae_assign_base<
template <class _Tp>
class optional
- : private __optional_storage<_Tp>
+ : private __optional_move_assign_base<_Tp>
, private __optional_sfinae_ctor_base_t<_Tp>
, private __optional_sfinae_assign_base_t<_Tp>
{
- using __base = __optional_storage<_Tp>;
+ using __base = __optional_move_assign_base<_Tp>;
public:
using value_type = _Tp;
@@ -531,7 +612,7 @@ private:
};
template <class _Up>
using _CheckOptionalArgsCtor = conditional_t<
- !is_same_v<in_place_t, _Up> &&
+ !is_same_v<decay_t<_Up>, in_place_t> &&
!is_same_v<decay_t<_Up>, optional>,
_CheckOptionalArgsConstructor,
__check_tuple_constructor_fail
@@ -597,8 +678,8 @@ private:
public:
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
- _LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
- _LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
+ _LIBCPP_INLINE_VISIBILITY constexpr optional(const optional&) = default;
+ _LIBCPP_INLINE_VISIBILITY constexpr optional(optional&&) = default;
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
template <class... _Args, class = enable_if_t<
@@ -729,11 +810,12 @@ public:
>
>
_LIBCPP_INLINE_VISIBILITY
- void
+ _Tp &
emplace(_Args&&... __args)
{
reset();
this->__construct(_VSTD::forward<_Args>(__args)...);
+ return this->__get();
}
template <class _Up, class... _Args,
@@ -743,11 +825,12 @@ public:
>
>
_LIBCPP_INLINE_VISIBILITY
- void
+ _Tp &
emplace(initializer_list<_Up> __il, _Args&&... __args)
{
reset();
this->__construct(__il, _VSTD::forward<_Args>(__args)...);
+ return this->__get();
}
_LIBCPP_INLINE_VISIBILITY
@@ -890,7 +973,7 @@ public:
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
- value_type value_or(_Up&& __v) &&
+ constexpr value_type value_or(_Up&& __v) &&
{
static_assert(is_move_constructible_v<value_type>,
"optional<T>::value_or: T must be move constructible");
@@ -921,14 +1004,14 @@ private:
};
// Comparisons between optionals
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator==(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (static_cast<bool>(__x) != static_cast<bool>(__y))
return false;
@@ -937,14 +1020,14 @@ operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
return *__x == *__y;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator!=(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (static_cast<bool>(__x) != static_cast<bool>(__y))
return true;
@@ -953,14 +1036,14 @@ operator!=(const optional<_Tp>& __x, const optional<_Tp>& __y)
return *__x != *__y;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator<(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (!static_cast<bool>(__y))
return false;
@@ -969,14 +1052,14 @@ operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
return *__x < *__y;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator>(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (!static_cast<bool>(__x))
return false;
@@ -985,14 +1068,14 @@ operator>(const optional<_Tp>& __x, const optional<_Tp>& __y)
return *__x > *__y;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator<=(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (!static_cast<bool>(__x))
return true;
@@ -1001,14 +1084,14 @@ operator<=(const optional<_Tp>& __x, const optional<_Tp>& __y)
return *__x <= *__y;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>=(const optional<_Tp>& __x, const optional<_Tp>& __y)
+operator>=(const optional<_Tp>& __x, const optional<_Up>& __y)
{
if (!static_cast<bool>(__y))
return true;
@@ -1115,146 +1198,146 @@ operator>=(nullopt_t, const optional<_Tp>& __x) noexcept
}
// Comparisons with T
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator==(const optional<_Tp>& __x, const _Tp& __v)
+operator==(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x == __v : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() ==
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator==(const _Tp& __v, const optional<_Tp>& __x)
+operator==(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v == *__x : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator!=(const optional<_Tp>& __x, const _Tp& __v)
+operator!=(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x != __v : true;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() !=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator!=(const _Tp& __v, const optional<_Tp>& __x)
+operator!=(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v != *__x : true;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<(const optional<_Tp>& __x, const _Tp& __v)
+operator<(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x < __v : true;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<(const _Tp& __v, const optional<_Tp>& __x)
+operator<(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v < *__x : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<=(const optional<_Tp>& __x, const _Tp& __v)
+operator<=(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x <= __v : true;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() <=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator<=(const _Tp& __v, const optional<_Tp>& __x)
+operator<=(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v <= *__x : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>(const optional<_Tp>& __x, const _Tp& __v)
+operator>(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x > __v : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>(const _Tp& __v, const optional<_Tp>& __x)
+operator>(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v > *__x : true;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>=(const optional<_Tp>& __x, const _Tp& __v)
+operator>=(const optional<_Tp>& __x, const _Up& __v)
{
return static_cast<bool>(__x) ? *__x >= __v : false;
}
-template <class _Tp>
+template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY constexpr
enable_if_t<
is_convertible_v<decltype(_VSTD::declval<const _Tp&>() >=
- _VSTD::declval<const _Tp&>()), bool>,
+ _VSTD::declval<const _Up&>()), bool>,
bool
>
-operator>=(const _Tp& __v, const optional<_Tp>& __x)
+operator>=(const _Tp& __v, const optional<_Up>& __x)
{
return static_cast<bool>(__x) ? __v >= *__x : true;
}
@@ -1293,15 +1376,17 @@ optional<_Tp> make_optional(initializer_list<_Up> __il, _Args&&... __args)
}
template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS hash<optional<_Tp> >
+struct _LIBCPP_TEMPLATE_VIS hash<
+ __enable_hash_helper<optional<_Tp>, 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 _NOEXCEPT
+ result_type operator()(const argument_type& __opt) const
{
- return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
+ return static_cast<bool>(__opt) ? hash<remove_const_t<_Tp>>()(*__opt) : 0;
}
};
@@ -1309,4 +1394,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 14
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_OPTIONAL
diff --git a/contrib/libc++/include/ostream b/contrib/libc++/include/ostream
index 3d9be8b..9bf8d3c 100644
--- a/contrib/libc++/include/ostream
+++ b/contrib/libc++/include/ostream
@@ -165,13 +165,11 @@ public:
{ this->init(__sb); }
virtual ~basic_ostream();
protected:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream(basic_ostream&& __rhs);
-#endif
// 27.7.2.3 Assign/swap
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs);
#endif
@@ -290,7 +288,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
}
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
@@ -306,7 +304,7 @@ basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>::~basic_ostream()
@@ -1023,7 +1021,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
return __os;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Stream, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1039,7 +1037,7 @@ operator<<(_Stream&& __os, const _Tp& __x)
return _VSTD::move(__os);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
basic_ostream<_CharT, _Traits>&
@@ -1082,8 +1080,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
+#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>)
+#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/include/queue b/contrib/libc++/include/queue
index 57d420c..feaae89 100644
--- a/contrib/libc++/include/queue
+++ b/contrib/libc++/include/queue
@@ -213,29 +213,27 @@ public:
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q) : c(__q.c) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ queue& operator=(const queue& __q) {c = __q.c; return *this;}
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- queue& operator=(const queue& __q) {c = __q.c; return *this;}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit queue(const _Alloc& __a,
@@ -254,7 +252,7 @@ public:
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__c, __a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
queue(container_type&& __c, const _Alloc& __a,
@@ -268,7 +266,7 @@ public:
_Alloc>::value>::type* = 0)
: c(_VSTD::move(__q.c), __a) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
@@ -286,10 +284,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_STD_VER > 14
@@ -299,8 +296,7 @@ public:
void emplace(_Args&&... __args)
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_front();}
@@ -418,32 +414,30 @@ public:
_LIBCPP_INLINE_VISIBILITY
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ priority_queue& operator=(const priority_queue& __q)
+ {c = __q.c; comp = __q.comp; return *this;}
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
priority_queue(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
is_nothrow_move_constructible<value_compare>::value)
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- _LIBCPP_INLINE_VISIBILITY
- priority_queue& operator=(const priority_queue& __q)
- {c = __q.c; comp = __q.comp; return *this;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp)
: c(), comp(__comp) {}
_LIBCPP_INLINE_VISIBILITY
priority_queue(const value_compare& __comp, const container_type& __c);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp, container_type&& __c);
#endif
@@ -455,12 +449,12 @@ public:
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const container_type& __c);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _InputIter>
_LIBCPP_INLINE_VISIBILITY
priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const _Alloc& __a,
@@ -482,7 +476,7 @@ public:
priority_queue(const priority_queue& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
priority_queue(const value_compare& __comp, container_type&& __c,
@@ -494,7 +488,7 @@ public:
priority_queue(priority_queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
@@ -505,13 +499,13 @@ public:
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v);
-#ifndef _LIBCPP_HAS_NO_VARIADICS
- template <class... _Args> _LIBCPP_INLINE_VISIBILITY void emplace(_Args&&... __args);
-#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ template <class... _Args>
+ _LIBCPP_INLINE_VISIBILITY
+ void emplace(_Args&&... __args);
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void pop();
@@ -531,7 +525,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline
@@ -543,7 +537,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
@@ -569,7 +563,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _InputIter>
@@ -584,7 +578,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
@@ -635,7 +629,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
template <class _Alloc>
@@ -664,7 +658,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
_VSTD::make_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline
@@ -675,7 +669,7 @@ priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
_VSTD::push_heap(c.begin(), c.end(), comp);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline
@@ -686,8 +680,6 @@ priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
_VSTD::push_heap(c.begin(), c.end(), comp);
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Container, class _Compare>
template <class... _Args>
inline
@@ -698,8 +690,7 @@ priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
_VSTD::push_heap(c.begin(), c.end(), comp);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp, class _Container, class _Compare>
inline
diff --git a/contrib/libc++/include/random b/contrib/libc++/include/random
index 835ebdb..ba8a088 100644
--- a/contrib/libc++/include/random
+++ b/contrib/libc++/include/random
@@ -1646,12 +1646,14 @@ class piecewise_linear_distribution
#include <istream>
#include <ostream>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// __is_seed_sequence
@@ -2013,41 +2015,41 @@ template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
class _LIBCPP_TEMPLATE_VIS mersenne_twister_engine;
-template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
bool
-operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y);
-template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
_LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
@@ -2129,44 +2131,44 @@ public:
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
- template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
friend
bool
- operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y);
- template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
friend
bool
- operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x);
private:
@@ -2384,13 +2386,13 @@ mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b,
return __z ^ __rshift<__l>(__z);
}
-template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
bool
-operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+operator==(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y)
{
if (__x.__i_ == __y.__i_)
@@ -2428,26 +2430,26 @@ operator==(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp,
__x.__x_ + (_Np - (__y.__i_ + __j)));
}
-template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+template <class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
inline _LIBCPP_INLINE_VISIBILITY
bool
-operator!=(const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+operator!=(const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ const mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
__save_flags<_CharT, _Traits> __lx(__os);
@@ -2463,17 +2465,17 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
- _UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
- _UI _Bp, size_t _Tp, _UI _Cp, size_t _Lp, _UI _Fp>
+ class _UInt, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
+ _UInt _Ap, size_t _Up, _UInt _Dp, size_t _Sp,
+ _UInt _Bp, size_t _Tp, _UInt _Cp, size_t _Lp, _UInt _Fp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- mersenne_twister_engine<_UI, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
+ mersenne_twister_engine<_UInt, _Wp, _Np, _Mp, _Rp, _Ap, _Up, _Dp, _Sp,
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
{
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
- _UI __t[_Np];
+ _UInt __t[_Np];
for (size_t __i = 0; __i < _Np; ++__i)
__is >> __t[__i];
if (!__is.fail())
@@ -2501,30 +2503,30 @@ typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine;
-template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
bool
operator==(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
-template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
_LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+ subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TEMPLATE_VIS subtract_with_carry_engine
@@ -2586,33 +2588,33 @@ public:
_LIBCPP_INLINE_VISIBILITY
void discard(unsigned long long __z) {for (; __z; --__z) operator()();}
- template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
friend
bool
operator==(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
- template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
friend
bool
operator!=(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
+ subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x);
private:
@@ -2711,11 +2713,11 @@ subtract_with_carry_engine<_UIntType, __w, __s, __r>::operator()()
return __xr;
}
-template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
bool
operator==(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
{
if (__x.__c_ != __y.__c_)
return false;
@@ -2754,21 +2756,21 @@ operator==(
__x.__x_ + (_Rp - (__y.__i_ + __j)));
}
-template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+template<class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __y)
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x,
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
+ const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> __lx(__os);
__os.flags(ios_base::dec | ios_base::left);
@@ -2784,14 +2786,14 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits,
- class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
+ class _UInt, size_t _Wp, size_t _Sp, size_t _Rp>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x)
+ subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
{
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
- _UI __t[_Rp+1];
+ _UInt __t[_Rp+1];
for (size_t __i = 0; __i < _Rp+1; ++__i)
__is >> __t[__i];
if (!__is.fail())
@@ -2826,7 +2828,7 @@ public:
static _LIBCPP_CONSTEXPR const size_t block_size = __p;
static _LIBCPP_CONSTEXPR const size_t used_block = __r;
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
static const result_type _Min = _Engine::_Min;
static const result_type _Max = _Engine::_Max;
#else
@@ -2845,11 +2847,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit discard_block_engine(const _Engine& __e)
: __e_(__e), __n_(0) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit discard_block_engine(_Engine&& __e)
: __e_(_VSTD::move(__e)), __n_(0) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {}
template<class _Sseq>
@@ -2986,13 +2988,13 @@ typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
template<class _Engine, size_t __w, class _UIntType>
class _LIBCPP_TEMPLATE_VIS independent_bits_engine
{
- template <class _UI, _UI _R0, size_t _Wp, size_t _Mp>
+ template <class _UInt, _UInt _R0, size_t _Wp, size_t _Mp>
class __get_n
{
- static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UI>::digits;
+ static _LIBCPP_CONSTEXPR const size_t _Dt = numeric_limits<_UInt>::digits;
static _LIBCPP_CONSTEXPR const size_t _Np = _Wp / _Mp + (_Wp % _Mp != 0);
static _LIBCPP_CONSTEXPR const size_t _W0 = _Wp / _Np;
- static _LIBCPP_CONSTEXPR const _UI _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
+ static _LIBCPP_CONSTEXPR const _UInt _Y0 = _W0 >= _Dt ? 0 : (_R0 >> _W0) << _W0;
public:
static _LIBCPP_CONSTEXPR const size_t value = _R0 - _Y0 > _Y0 / _Np ? _Np + 1 : _Np;
};
@@ -3014,7 +3016,7 @@ private:
result_type,
_Engine_result_type
>::type _Working_result_type;
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1);
#else
@@ -3055,11 +3057,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(const _Engine& __e)
: __e_(__e) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(_Engine&& __e)
: __e_(_VSTD::move(__e)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit independent_bits_engine(result_type __sd) : __e_(__sd) {}
template<class _Sseq>
@@ -3091,33 +3093,33 @@ public:
_LIBCPP_INLINE_VISIBILITY
const _Engine& base() const _NOEXCEPT {return __e_;}
- template<class _Eng, size_t _Wp, class _UI>
+ template<class _Eng, size_t _Wp, class _UInt>
friend
bool
operator==(
- const independent_bits_engine<_Eng, _Wp, _UI>& __x,
- const independent_bits_engine<_Eng, _Wp, _UI>& __y);
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
- template<class _Eng, size_t _Wp, class _UI>
+ template<class _Eng, size_t _Wp, class _UInt>
friend
bool
operator!=(
- const independent_bits_engine<_Eng, _Wp, _UI>& __x,
- const independent_bits_engine<_Eng, _Wp, _UI>& __y);
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y);
template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UI>
+ class _Eng, size_t _Wp, class _UInt>
friend
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UI>& __x);
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x);
template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UI>
+ class _Eng, size_t _Wp, class _UInt>
friend
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UI>& __x);
+ independent_bits_engine<_Eng, _Wp, _UInt>& __x);
private:
_LIBCPP_INLINE_VISIBILITY
@@ -3179,40 +3181,40 @@ independent_bits_engine<_Engine, __w, _UIntType>::__eval(true_type)
return _Sp;
}
-template<class _Eng, size_t _Wp, class _UI>
+template<class _Eng, size_t _Wp, class _UInt>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(
- const independent_bits_engine<_Eng, _Wp, _UI>& __x,
- const independent_bits_engine<_Eng, _Wp, _UI>& __y)
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
{
return __x.base() == __y.base();
}
-template<class _Eng, size_t _Wp, class _UI>
+template<class _Eng, size_t _Wp, class _UInt>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(
- const independent_bits_engine<_Eng, _Wp, _UI>& __x,
- const independent_bits_engine<_Eng, _Wp, _UI>& __y)
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x,
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __y)
{
return !(__x == __y);
}
template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UI>
+ class _Eng, size_t _Wp, class _UInt>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os,
- const independent_bits_engine<_Eng, _Wp, _UI>& __x)
+ const independent_bits_engine<_Eng, _Wp, _UInt>& __x)
{
return __os << __x.base();
}
template <class _CharT, class _Traits,
- class _Eng, size_t _Wp, class _UI>
+ class _Eng, size_t _Wp, class _UInt>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
- independent_bits_engine<_Eng, _Wp, _UI>& __x)
+ independent_bits_engine<_Eng, _Wp, _UInt>& __x)
{
_Eng __e;
__is >> __e;
@@ -3264,7 +3266,7 @@ public:
// engine characteristics
static _LIBCPP_CONSTEXPR const size_t table_size = __k;
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
static const result_type _Min = _Engine::_Min;
static const result_type _Max = _Engine::_Max;
#else
@@ -3285,11 +3287,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(const _Engine& __e)
: __e_(__e) {__init();}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(_Engine&& __e)
: __e_(_VSTD::move(__e)) {__init();}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();}
template<class _Sseq>
@@ -3526,11 +3528,11 @@ public:
// constructors
_LIBCPP_INLINE_VISIBILITY
seed_seq() _NOEXCEPT {}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY
seed_seq(initializer_list<_Tp> __il) {init(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
@@ -3637,7 +3639,7 @@ generate_canonical(_URNG& __g)
{
const size_t _Dt = numeric_limits<_RealType>::digits;
const size_t __b = _Dt < __bits ? _Dt : __bits;
-#ifdef _LIBCPP_HAS_NO_CONSTEXPR
+#ifdef _LIBCPP_CXX03_LANG
const size_t __logR = __log2<uint64_t, _URNG::_Max - _URNG::_Min + uint64_t(1)>::value;
#else
const size_t __logR = __log2<uint64_t, _URNG::max() - _URNG::min() + uint64_t(1)>::value;
@@ -3997,16 +3999,30 @@ public:
{return !(__x == __y);}
};
+#ifndef _LIBCPP_MSVCRT
+extern "C" double lgamma_r(double, int *);
+#endif
+
+inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) {
+#if defined(_LIBCPP_MSVCRT)
+ return lgamma(__d);
+#else
+ int __sign;
+ return lgamma_r(__d, &__sign);
+#endif
+}
+
template<class _IntType>
-binomial_distribution<_IntType>::param_type::param_type(result_type __t, double __p)
+binomial_distribution<_IntType>::param_type::param_type(const result_type __t, const double __p)
: __t_(__t), __p_(__p)
{
if (0 < __p_ && __p_ < 1)
{
__r0_ = static_cast<result_type>((__t_ + 1) * __p_);
- __pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) -
- _VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
- (__t_ - __r0_) * _VSTD::log(1 - __p_));
+ __pr_ = _VSTD::exp(__libcpp_lgamma(__t_ + 1.) -
+ __libcpp_lgamma(__r0_ + 1.) -
+ __libcpp_lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) +
+ (__t_ - __r0_) * _VSTD::log(1 - __p_));
__odds_ratio_ = __p_ / (1 - __p_);
}
}
@@ -5851,11 +5867,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
param_type(_InputIterator __f, _InputIterator __l)
: __p_(__f, __l) {__init();}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
param_type(initializer_list<double> __wl)
: __p_(__wl.begin(), __wl.end()) {__init();}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
param_type(size_t __nw, double __xmin, double __xmax,
_UnaryOperation __fw);
@@ -5898,11 +5914,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(_InputIterator __f, _InputIterator __l)
: __p_(__f, __l) {}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(initializer_list<double> __wl)
: __p_(__wl) {}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
discrete_distribution(size_t __nw, double __xmin, double __xmax,
@@ -6079,10 +6095,10 @@ public:
template<class _InputIteratorB, class _InputIteratorW>
param_type(_InputIteratorB __fB, _InputIteratorB __lB,
_InputIteratorW __fW);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
param_type(size_t __nw, result_type __xmin, result_type __xmax,
_UnaryOperation __fw);
@@ -6132,13 +6148,13 @@ public:
_InputIteratorW __fW)
: __p_(__fB, __lB, __fW) {}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
piecewise_constant_distribution(initializer_list<result_type> __bl,
_UnaryOperation __fw)
: __p_(__bl, __fw) {}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
@@ -6268,7 +6284,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type(
}
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _RealType>
template<class _UnaryOperation>
@@ -6293,7 +6309,7 @@ piecewise_constant_distribution<_RealType>::param_type::param_type(
}
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _RealType>
template<class _UnaryOperation>
@@ -6402,10 +6418,10 @@ public:
template<class _InputIteratorB, class _InputIteratorW>
param_type(_InputIteratorB __fB, _InputIteratorB __lB,
_InputIteratorW __fW);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
param_type(initializer_list<result_type> __bl, _UnaryOperation __fw);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
param_type(size_t __nw, result_type __xmin, result_type __xmax,
_UnaryOperation __fw);
@@ -6455,13 +6471,13 @@ public:
_InputIteratorW __fW)
: __p_(__fB, __lB, __fW) {}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
piecewise_linear_distribution(initializer_list<result_type> __bl,
_UnaryOperation __fw)
: __p_(__bl, __fw) {}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _UnaryOperation>
_LIBCPP_INLINE_VISIBILITY
@@ -6595,7 +6611,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type(
}
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template<class _RealType>
template<class _UnaryOperation>
@@ -6620,7 +6636,7 @@ piecewise_linear_distribution<_RealType>::param_type::param_type(
}
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template<class _RealType>
template<class _UnaryOperation>
@@ -6722,4 +6738,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_RANDOM
diff --git a/contrib/libc++/include/ratio b/contrib/libc++/include/ratio
index fa89363..27aa0de 100644
--- a/contrib/libc++/include/ratio
+++ b/contrib/libc++/include/ratio
@@ -83,12 +83,14 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits>
#include <type_traits>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// __static_gcd
@@ -520,4 +522,6 @@ template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_RATIO
diff --git a/contrib/libc++/include/regex b/contrib/libc++/include/regex
index 42e55e8..77ca648 100644
--- a/contrib/libc++/include/regex
+++ b/contrib/libc++/include/regex
@@ -765,12 +765,14 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <vector>
#include <deque>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
namespace regex_constants
@@ -2539,14 +2541,14 @@ public:
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__first, __last);}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_regex(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
__end_(0)
{__parse(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// ~basic_regex() = default;
@@ -2555,11 +2557,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const value_type* __p)
{return assign(__p);}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(initializer_list<value_type> __il)
{return assign(__il);}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _ST, class _SA>
_LIBCPP_INLINE_VISIBILITY
basic_regex& operator=(const basic_string<value_type, _ST, _SA>& __p)
@@ -2569,7 +2571,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const basic_regex& __that)
{return *this = __that;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(basic_regex&& __that) _NOEXCEPT
{return *this = _VSTD::move(__that);}
@@ -2626,14 +2628,14 @@ public:
return assign(basic_regex(__first, __last, __f));
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(initializer_list<value_type> __il,
flag_type __f = regex_constants::ECMAScript)
{return assign(__il.begin(), __il.end(), __f);}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// const operations:
_LIBCPP_INLINE_VISIBILITY
@@ -3957,7 +3959,6 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
if (__temp == __last)
__throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [= ... =]
- typedef typename _Traits::string_type string_type;
string_type __collate_name =
__traits_.lookup_collatename(__first, __temp);
if (__collate_name.empty())
@@ -6141,7 +6142,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
{
__flags_ |= regex_constants::__no_update_pos;
_BidirectionalIterator __start = __match_[0].second;
- if (__match_.empty())
+ if (__match_[0].first == __match_[0].second)
{
if (__start == __end_)
{
@@ -6214,7 +6215,7 @@ public:
regex_constants::match_default) = delete;
#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re,
initializer_list<int> __submatches,
@@ -6228,7 +6229,7 @@ public:
regex_constants::match_flag_type __m =
regex_constants::match_default) = delete;
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <size_t _Np>
regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b,
@@ -6328,7 +6329,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
@@ -6343,7 +6344,7 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
__init(__a, __b);
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _Np>
@@ -6563,4 +6564,6 @@ regex_replace(const _CharT* __s,
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_REGEX
diff --git a/contrib/libc++/include/set b/contrib/libc++/include/set
index be5c952..30f2fa8 100644
--- a/contrib/libc++/include/set
+++ b/contrib/libc++/include/set
@@ -486,12 +486,12 @@ public:
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
set(set&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit set(const allocator_type& __a)
@@ -504,11 +504,9 @@ public:
insert(__s.begin(), __s.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
set(set&& __s, const allocator_type& __a);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -536,9 +534,7 @@ public:
__tree_.__assign_unique(__il.begin(), __il.end());
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
@@ -546,7 +542,7 @@ public:
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();}
@@ -587,7 +583,7 @@ public:
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers:
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
@@ -596,23 +592,15 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);}
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#endif // _LIBCPP_CXX03_LANG
+
_LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v)
{return __tree_.__insert_unique(__v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator,bool> insert(value_type&& __v)
- {return __tree_.__insert_unique(_VSTD::move(__v));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_unique(__p, __v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
@@ -621,11 +609,19 @@ public:
__tree_.__insert_unique(__e, *__f);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator,bool> insert(value_type&& __v)
+ {return __tree_.__insert_unique(_VSTD::move(__v));}
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator __p, value_type&& __v)
+ {return __tree_.__insert_unique(__p, _VSTD::move(__v));}
+
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -727,7 +723,7 @@ public:
#endif
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
@@ -741,7 +737,7 @@ set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -901,12 +897,14 @@ public:
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __tree_(_VSTD::move(__s.__tree_)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+ multiset(multiset&& __s, const allocator_type& __a);
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a)
: __tree_(__a) {}
@@ -916,11 +914,8 @@ public:
{
insert(__s.begin(), __s.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- multiset(multiset&& __s, const allocator_type& __a);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp)
@@ -948,9 +943,7 @@ public:
__tree_.__assign_multi(__il.begin(), __il.end());
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
@@ -958,7 +951,7 @@ public:
__tree_ = _VSTD::move(__s.__tree_);
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();}
@@ -999,7 +992,7 @@ public:
size_type max_size() const _NOEXCEPT {return __tree_.max_size();}
// modifiers:
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
@@ -1008,23 +1001,15 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#endif // _LIBCPP_CXX03_LANG
+
_LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v)
{return __tree_.__insert_multi(__v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(value_type&& __v)
- {return __tree_.__insert_multi(_VSTD::move(__v));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v)
{return __tree_.__insert_multi(__p, __v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, value_type&& __v)
- {return __tree_.__insert_multi(__p, _VSTD::move(__v));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __f, _InputIterator __l)
@@ -1033,11 +1018,19 @@ public:
__tree_.__insert_multi(__e, *__f);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(value_type&& __v)
+ {return __tree_.__insert_multi(_VSTD::move(__v));}
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator __p, value_type&& __v)
+ {return __tree_.__insert_multi(__p, _VSTD::move(__v));}
+
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -1140,7 +1133,7 @@ public:
#endif
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
@@ -1154,7 +1147,7 @@ multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_t
}
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
diff --git a/contrib/libc++/include/shared_mutex b/contrib/libc++/include/shared_mutex
index 923fe07..9cb8152 100644
--- a/contrib/libc++/include/shared_mutex
+++ b/contrib/libc++/include/shared_mutex
@@ -125,12 +125,14 @@ template <class Mutex>
#include <__config>
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX)
#include <__mutex_base>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -141,7 +143,7 @@ template <class Mutex>
_LIBCPP_BEGIN_NAMESPACE_STD
-struct _LIBCPP_TYPE_VIS __shared_mutex_base
+struct _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX __shared_mutex_base
{
mutex __mut_;
condition_variable __gate1_;
@@ -173,11 +175,11 @@ struct _LIBCPP_TYPE_VIS __shared_mutex_base
#if _LIBCPP_STD_VER > 14
-class _LIBCPP_TYPE_VIS shared_mutex
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_mutex
{
- __shared_mutex_base __base;
+ __shared_mutex_base __base;
public:
- shared_mutex() : __base() {}
+ _LIBCPP_INLINE_VISIBILITY shared_mutex() : __base() {}
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
shared_mutex(const shared_mutex&) = delete;
@@ -199,9 +201,9 @@ public:
#endif
-class _LIBCPP_TYPE_VIS shared_timed_mutex
+class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_SHARED_MUTEX shared_timed_mutex
{
- __shared_mutex_base __base;
+ __shared_mutex_base __base;
public:
shared_timed_mutex();
_LIBCPP_INLINE_VISIBILITY ~shared_timed_mutex() = default;
@@ -220,6 +222,7 @@ public:
return try_lock_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock();
@@ -235,6 +238,7 @@ public:
return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Clock, class _Duration>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
bool
try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock_shared();
@@ -498,4 +502,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SHARED_MUTEX
diff --git a/contrib/libc++/include/sstream b/contrib/libc++/include/sstream
index 40b9785..fe65fd7 100644
--- a/contrib/libc++/include/sstream
+++ b/contrib/libc++/include/sstream
@@ -175,12 +175,14 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream>
#include <string>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
@@ -212,12 +214,10 @@ public:
inline _LIBCPP_INLINE_VISIBILITY
explicit basic_stringbuf(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
basic_stringbuf(basic_stringbuf&& __rhs);
-#endif
// 27.8.1.2 Assign and swap:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
#endif
void swap(basic_stringbuf& __rhs);
@@ -249,13 +249,14 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
ios_base::openmode __wch)
- : __hm_(0),
+ : __str_(__s.get_allocator()),
+ __hm_(0),
__mode_(__wch)
{
str(__s);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
@@ -346,7 +347,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
void
@@ -641,13 +642,13 @@ public:
inline _LIBCPP_INLINE_VISIBILITY
explicit basic_istringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_istringstream(basic_istringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_istringstream& operator=(basic_istringstream&& __rhs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
void swap(basic_istringstream& __rhs);
@@ -675,7 +676,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
{
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
@@ -694,7 +695,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs)
@@ -758,13 +759,13 @@ public:
inline _LIBCPP_INLINE_VISIBILITY
explicit basic_ostringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::out);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_ostringstream(basic_ostringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
void swap(basic_ostringstream& __rhs);
@@ -792,7 +793,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
{
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
@@ -811,7 +812,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
void
@@ -877,13 +878,13 @@ public:
inline _LIBCPP_INLINE_VISIBILITY
explicit basic_stringstream(const string_type& __s,
ios_base::openmode __wch = ios_base::in | ios_base::out);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
basic_stringstream(basic_stringstream&& __rhs);
// 27.8.2.2 Assign and swap:
basic_stringstream& operator=(basic_stringstream&& __rhs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
void swap(basic_stringstream& __rhs);
@@ -911,7 +912,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
{
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
@@ -930,7 +931,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&&
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
void
@@ -972,4 +973,6 @@ basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_SSTREAM
diff --git a/contrib/libc++/include/stack b/contrib/libc++/include/stack
index c797ea5..b2d4e23 100644
--- a/contrib/libc++/include/stack
+++ b/contrib/libc++/include/stack
@@ -126,29 +126,28 @@ public:
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __q) : c(__q.c) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ stack& operator=(const stack& __q) {c = __q.c; return *this;}
+
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- stack& operator=(const stack& __q) {c = __q.c; return *this;}
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- explicit stack(const container_type& __c) : c(__c) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_INLINE_VISIBILITY
+ explicit stack(const container_type& __c) : c(__c) {}
+
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit stack(const _Alloc& __a,
@@ -167,7 +166,7 @@ public:
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(__s.c, __a) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
stack(container_type&& __c, const _Alloc& __a,
@@ -180,7 +179,7 @@ public:
typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0)
: c(_VSTD::move(__s.c), __a) {}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
bool empty() const {return c.empty();}
@@ -193,10 +192,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
void push(const value_type& __v) {c.push_back(__v);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_STD_VER > 14
@@ -206,8 +205,8 @@ public:
void emplace(_Args&&... __args)
{ c.emplace_back(_VSTD::forward<_Args>(__args)...);}
#endif
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
+
_LIBCPP_INLINE_VISIBILITY
void pop() {c.pop_back();}
diff --git a/contrib/libc++/include/stddef.h b/contrib/libc++/include/stddef.h
index 8841bbe..faf8552 100644
--- a/contrib/libc++/include/stddef.h
+++ b/contrib/libc++/include/stddef.h
@@ -53,7 +53,8 @@ using std::nullptr_t;
}
// Re-use the compiler's <stddef.h> max_align_t where possible.
-#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T)
+#if !defined(__CLANG_MAX_ALIGN_T_DEFINED) && !defined(_GCC_MAX_ALIGN_T) && \
+ !defined(__DEFINED_max_align_t)
typedef long double max_align_t;
#endif
diff --git a/contrib/libc++/include/stdexcept b/contrib/libc++/include/stdexcept
index d501d09..95a96cc 100644
--- a/contrib/libc++/include/stdexcept
+++ b/contrib/libc++/include/stdexcept
@@ -61,9 +61,9 @@ class _LIBCPP_HIDDEN __libcpp_refstring
bool __uses_refcount() const;
public:
- explicit __libcpp_refstring(const char* msg);
- __libcpp_refstring(const __libcpp_refstring& s) _NOEXCEPT;
- __libcpp_refstring& operator=(const __libcpp_refstring& s) _NOEXCEPT;
+ explicit __libcpp_refstring(const char* __msg);
+ __libcpp_refstring(const __libcpp_refstring& __s) _NOEXCEPT;
+ __libcpp_refstring& operator=(const __libcpp_refstring& __s) _NOEXCEPT;
~__libcpp_refstring();
const char* c_str() const _NOEXCEPT {return __imp_;}
diff --git a/contrib/libc++/include/stdio.h b/contrib/libc++/include/stdio.h
index 56fb2d8..f124176 100644
--- a/contrib/libc++/include/stdio.h
+++ b/contrib/libc++/include/stdio.h
@@ -110,9 +110,9 @@ void perror(const char* s);
#ifdef __cplusplus
// snprintf
-#if defined(_LIBCPP_MSVCRT)
-extern "C++" {
-#include "support/win32/support.h"
+#if defined(_LIBCPP_MSVCRT_LIKE)
+extern "C" {
+int vasprintf(char **sptr, const char *__restrict fmt, va_list ap);
}
#endif
diff --git a/contrib/libc++/include/stdlib.h b/contrib/libc++/include/stdlib.h
index 12fd676..f11c5e7 100644
--- a/contrib/libc++/include/stdlib.h
+++ b/contrib/libc++/include/stdlib.h
@@ -97,10 +97,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
extern "C++" {
-#ifdef _LIBCPP_MSVCRT
-#include "support/win32/locale_win32.h"
-#endif // _LIBCPP_MSVCRT
-
#undef abs
#undef div
#undef labs
diff --git a/contrib/libc++/include/streambuf b/contrib/libc++/include/streambuf
index 8607065..a10ce1b 100644
--- a/contrib/libc++/include/streambuf
+++ b/contrib/libc++/include/streambuf
@@ -116,6 +116,9 @@ protected:
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
@@ -476,12 +479,16 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
return traits_type::eof();
}
+#ifndef _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>)
+#endif
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STEAMBUF
diff --git a/contrib/libc++/include/string b/contrib/libc++/include/string
index ba311ef..610f19e 100644
--- a/contrib/libc++/include/string
+++ b/contrib/libc++/include/string
@@ -484,14 +484,16 @@ basic_string<char32_t> operator "" s( const char32_t *str, size_t len ); // C++1
#include <cstdint>
#endif
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
// fpos
@@ -554,6 +556,8 @@ template<class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>
operator+(const basic_string<_CharT, _Traits, _Allocator>& __x, _CharT __y);
+_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
+
template <bool>
class _LIBCPP_TEMPLATE_VIS __basic_string_common
{
@@ -576,14 +580,7 @@ __basic_string_common<__b>::__throw_out_of_range() const
_VSTD::__throw_out_of_range("basic_string");
}
-#ifdef _LIBCPP_MSVC
-#pragma warning( push )
-#pragma warning( disable: 4231 )
-#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __basic_string_common<true>)
-#ifdef _LIBCPP_MSVC
-#pragma warning( pop )
-#endif // _LIBCPP_MSVC
#ifdef _LIBCPP_NO_EXCEPTIONS
template <class _Iter>
@@ -637,7 +634,7 @@ public:
typedef basic_string __self;
typedef basic_string_view<_CharT, _Traits> __self_view;
typedef _Traits traits_type;
- typedef typename traits_type::char_type value_type;
+ typedef _CharT value_type;
typedef _Allocator allocator_type;
typedef allocator_traits<allocator_type> __alloc_traits;
typedef typename __alloc_traits::size_type size_type;
@@ -648,7 +645,7 @@ public:
typedef typename __alloc_traits::const_pointer const_pointer;
static_assert(is_pod<value_type>::value, "Character type of basic_string must be a POD");
- static_assert((is_same<_CharT, value_type>::value),
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
"traits_type::char_type must be the same type as CharT");
static_assert((is_same<typename allocator_type::value_type, value_type>::value),
"Allocator::value_type must be same type as value_type");
@@ -674,11 +671,11 @@ private:
};
#if _LIBCPP_BIG_ENDIAN
- enum {__short_mask = 0x01};
- enum {__long_mask = 0x1ul};
+ static const size_type __short_mask = 0x01;
+ static const size_type __long_mask = 0x1ul;
#else // _LIBCPP_BIG_ENDIAN
- enum {__short_mask = 0x80};
- enum {__long_mask = ~(size_type(~0) >> 1)};
+ static const size_type __short_mask = 0x80;
+ static const size_type __long_mask = ~(size_type(~0) >> 1);
#endif // _LIBCPP_BIG_ENDIAN
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
@@ -704,11 +701,11 @@ private:
};
#if _LIBCPP_BIG_ENDIAN
- enum {__short_mask = 0x80};
- enum {__long_mask = ~(size_type(~0) >> 1)};
+ static const size_type __short_mask = 0x80;
+ static const size_type __long_mask = ~(size_type(~0) >> 1);
#else // _LIBCPP_BIG_ENDIAN
- enum {__short_mask = 0x01};
- enum {__long_mask = 0x1ul};
+ static const size_type __short_mask = 0x01;
+ static const size_type __long_mask = 0x1ul;
#endif // _LIBCPP_BIG_ENDIAN
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
@@ -763,7 +760,7 @@ public:
basic_string(const basic_string& __str);
basic_string(const basic_string& __str, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str)
#if _LIBCPP_STD_VER <= 14
@@ -774,43 +771,44 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string(basic_string&& __str, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- _LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
+#endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s);
_LIBCPP_INLINE_VISIBILITY
- basic_string(const value_type* __s, const allocator_type& __a);
+ basic_string(const _CharT* __s, const _Allocator& __a);
_LIBCPP_INLINE_VISIBILITY
- basic_string(const value_type* __s, size_type __n);
+ basic_string(const _CharT* __s, size_type __n);
_LIBCPP_INLINE_VISIBILITY
- basic_string(const value_type* __s, size_type __n, const allocator_type& __a);
+ basic_string(const _CharT* __s, size_type __n, const _Allocator& __a);
_LIBCPP_INLINE_VISIBILITY
- basic_string(size_type __n, value_type __c);
+ basic_string(size_type __n, _CharT __c);
_LIBCPP_INLINE_VISIBILITY
- basic_string(size_type __n, value_type __c, const allocator_type& __a);
+ basic_string(size_type __n, _CharT __c, const _Allocator& __a);
basic_string(const basic_string& __str, size_type __pos, size_type __n,
- const allocator_type& __a = allocator_type());
+ const _Allocator& __a = _Allocator());
_LIBCPP_INLINE_VISIBILITY
basic_string(const basic_string& __str, size_type __pos,
- const allocator_type& __a = allocator_type());
+ const _Allocator& __a = _Allocator());
template<class _Tp>
- basic_string(const _Tp& __t, size_type __pos, size_type __n,
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ basic_string(const _Tp& __t, size_type __pos, size_type __n,
const allocator_type& __a = allocator_type(),
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);
_LIBCPP_INLINE_VISIBILITY explicit
basic_string(__self_view __sv);
_LIBCPP_INLINE_VISIBILITY
- basic_string(__self_view __sv, const allocator_type& __a);
+ basic_string(__self_view __sv, const _Allocator& __a);
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last);
template<class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
basic_string(_InputIterator __first, _InputIterator __last, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
- basic_string(initializer_list<value_type> __il);
+ basic_string(initializer_list<_CharT> __il);
_LIBCPP_INLINE_VISIBILITY
- basic_string(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+ basic_string(initializer_list<_CharT> __il, const _Allocator& __a);
+#endif // _LIBCPP_CXX03_LANG
inline ~basic_string();
@@ -824,17 +822,15 @@ public:
#endif
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(__self_view __sv) {return assign(__sv);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
+ _LIBCPP_INLINE_VISIBILITY
+ basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
basic_string& operator=(value_type __c);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- basic_string& operator=(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
@@ -900,7 +896,7 @@ public:
void resize(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
- void reserve(size_type res_arg = 0);
+ void reserve(size_type __res_arg = 0);
_LIBCPP_INLINE_VISIBILITY
void shrink_to_fit() _NOEXCEPT {reserve();}
_LIBCPP_INLINE_VISIBILITY
@@ -917,9 +913,9 @@ public:
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(__self_view __sv) {return append(__sv);}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(const value_type* __s) {return append(__s);}
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(value_type __c) {push_back(__c); return *this;}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY basic_string& operator+=(initializer_list<value_type> __il) {return append(__il);}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& append(const basic_string& __str);
@@ -927,7 +923,8 @@ public:
basic_string& append(__self_view __sv) { return append(__sv.data(), __sv.size()); }
basic_string& append(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
@@ -937,9 +934,11 @@ public:
basic_string& append(const value_type* __s);
basic_string& append(size_type __n, value_type __c);
template <class _ForwardIterator>
- inline basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ basic_string& __append_forward_unsafe(_ForwardIterator, _ForwardIterator);
template<class _InputIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
@@ -952,7 +951,8 @@ public:
return *this;
}
template<class _ForwardIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
@@ -963,10 +963,10 @@ public:
return __append_forward_unsafe(__first, __last);
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& append(initializer_list<value_type> __il) {return append(__il.begin(), __il.size());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
void push_back(value_type __c);
_LIBCPP_INLINE_VISIBILITY
@@ -980,25 +980,27 @@ public:
basic_string& assign(__self_view __sv) { return assign(__sv.data(), __sv.size()); }
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(const basic_string& __str) { return *this = __str; }
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
- basic_string& assign(basic_string&& str)
+ basic_string& assign(basic_string&& __str)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
- {*this = _VSTD::move(str); return *this;}
+ {*this = _VSTD::move(__str); return *this;}
#endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
template <class _Tp>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
>::type
- assign(const _Tp & __t, size_type pos, size_type n=npos);
+ assign(const _Tp & __t, size_type __pos, size_type __n=npos);
basic_string& assign(const value_type* __s, size_type __n);
basic_string& assign(const value_type* __s);
basic_string& assign(size_type __n, value_type __c);
template<class _InputIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
@@ -1006,24 +1008,26 @@ public:
>::type
assign(_InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
basic_string&
>::type
assign(_ForwardIterator __first, _ForwardIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(initializer_list<value_type> __il) {return assign(__il.begin(), __il.size());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, const basic_string& __str);
_LIBCPP_INLINE_VISIBILITY
basic_string& insert(size_type __pos1, __self_view __sv) { return insert(__pos1, __sv.data(), __sv.size()); }
template <class _Tp>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
@@ -1037,7 +1041,8 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, size_type __n, value_type __c);
template<class _InputIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_exactly_input_iterator<_InputIterator>::value
|| !__libcpp_string_gets_noexcept_iterator<_InputIterator>::value,
@@ -1045,18 +1050,19 @@ public:
>::type
insert(const_iterator __pos, _InputIterator __first, _InputIterator __last);
template<class _ForwardIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value
&& __libcpp_string_gets_noexcept_iterator<_ForwardIterator>::value,
iterator
>::type
insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, initializer_list<value_type> __il)
{return insert(__pos, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
basic_string& erase(size_type __pos = 0, size_type __n = npos);
_LIBCPP_INLINE_VISIBILITY
@@ -1070,7 +1076,8 @@ public:
basic_string& replace(size_type __pos1, size_type __n1, __self_view __sv) { return replace(__pos1, __n1, __sv.data(), __sv.size()); }
basic_string& replace(size_type __pos1, size_type __n1, const basic_string& __str, size_type __pos2, size_type __n2=npos);
template <class _Tp>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value,
basic_string&
@@ -1090,17 +1097,18 @@ public:
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, size_type __n, value_type __c);
template<class _InputIterator>
- typename enable_if
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ typename enable_if
<
__is_input_iterator<_InputIterator>::value,
basic_string&
>::type
replace(const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
basic_string& replace(const_iterator __i1, const_iterator __i2, initializer_list<value_type> __il)
{return replace(__i1, __i2, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
size_type copy(value_type* __s, size_type __n, size_type __pos = 0) const;
_LIBCPP_INLINE_VISIBILITY
@@ -1325,15 +1333,15 @@ private:
__align_it<sizeof(value_type) < __alignment ?
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
- inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ inline
void __init(const value_type* __s, size_type __sz, size_type __reserve);
- inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ inline
void __init(const value_type* __s, size_type __sz);
- inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ inline
void __init(size_type __n, value_type __c);
template <class _InputIterator>
- inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ inline
typename enable_if
<
__is_exactly_input_iterator<_InputIterator>::value,
@@ -1342,7 +1350,7 @@ private:
__init(_InputIterator __first, _InputIterator __last);
template <class _ForwardIterator>
- inline _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY
+ inline
typename enable_if
<
__is_forward_iterator<_ForwardIterator>::value,
@@ -1367,19 +1375,35 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string& __str, true_type)
{
- if (__alloc() != __str.__alloc())
+ if (__alloc() == __str.__alloc())
+ __alloc() = __str.__alloc();
+ else
{
- clear();
- shrink_to_fit();
+ if (!__str.__is_long())
+ {
+ clear();
+ shrink_to_fit();
+ __alloc() = __str.__alloc();
+ }
+ else
+ {
+ allocator_type __a = __str.__alloc();
+ pointer __p = __alloc_traits::allocate(__a, __str.__get_long_cap());
+ clear();
+ shrink_to_fit();
+ __alloc() = _VSTD::move(__a);
+ __set_long_pointer(__p);
+ __set_long_cap(__str.__get_long_cap());
+ __set_long_size(__str.size());
+ }
}
- __alloc() = __str.__alloc();
}
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, false_type)
_NOEXCEPT_(__alloc_traits::is_always_equal::value);
@@ -1482,7 +1506,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
#else
_NOEXCEPT
#endif
-: __r_(__a)
+: __r_(__second_tag(), __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1541,7 +1565,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s)
{
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
__init(__s, traits_type::length(__s));
@@ -1552,8 +1576,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s)
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
__init(__s, traits_type::length(__s));
@@ -1564,7 +1588,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, c
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
__init(__s, __n);
@@ -1575,8 +1599,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, s
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, size_type __n, const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_type __n, const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
__init(__s, __n);
@@ -1587,7 +1611,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const value_type* __s, s
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str)
- : __r_(__alloc_traits::select_on_container_copy_construction(__str.__alloc()))
+ : __r_(__second_tag(), __alloc_traits::select_on_container_copy_construction(__str.__alloc()))
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1599,8 +1623,9 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
}
template <class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(
+ const basic_string& __str, const allocator_type& __a)
+ : __r_(__second_tag(), __a)
{
if (!__str.__is_long())
__r_.first().__r = __str.__r_.first().__r;
@@ -1611,7 +1636,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
#endif
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1634,7 +1659,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, const allocator_type& __a)
- : __r_(__a)
+ : __r_(__second_tag(), __a)
{
if (__str.__is_long() && __a != __str.__alloc()) // copy, not move
__init(_VSTD::__to_raw_pointer(__str.__get_long_pointer()), __str.__get_long_size());
@@ -1650,7 +1675,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
void
@@ -1678,7 +1703,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(size_type __n, value_type __c)
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c)
{
__init(__n, __c);
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1688,8 +1713,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_type __c, const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __c, const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
__init(__n, __c);
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1698,9 +1723,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, value_typ
}
template <class _CharT, class _Traits, class _Allocator>
-basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos, size_type __n,
- const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str,
+ size_type __pos, size_type __n,
+ const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
@@ -1714,8 +1740,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __str, size_type __pos,
- const allocator_type& __a)
- : __r_(__a)
+ const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
size_type __str_sz = __str.size();
if (__pos > __str_sz)
@@ -1731,13 +1757,13 @@ template <class _Tp>
basic_string<_CharT, _Traits, _Allocator>::basic_string(
const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a,
typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *)
- : __r_(__a)
+ : __r_(__second_tag(), __a)
{
__self_view __sv = __self_view(__t).substr(__pos, __n);
__init(__sv.data(), __sv.size());
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
-#endif
+#endif
}
template <class _CharT, class _Traits, class _Allocator>
@@ -1752,8 +1778,8 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv)
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const allocator_type& __a)
- : __r_(__a)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(__self_view __sv, const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
__init(__sv.data(), __sv.size());
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1835,7 +1861,7 @@ template<class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first, _InputIterator __last,
const allocator_type& __a)
- : __r_(__a)
+ : __r_(__second_tag(), __a)
{
__init(__first, __last);
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1843,11 +1869,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
#endif
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il)
+basic_string<_CharT, _Traits, _Allocator>::basic_string(
+ initializer_list<_CharT> __il)
{
__init(__il.begin(), __il.end());
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1857,8 +1884,10 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
-basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_type> __il, const allocator_type& __a)
- : __r_(__a)
+
+basic_string<_CharT, _Traits, _Allocator>::basic_string(
+ initializer_list<_CharT> __il, const _Allocator& __a)
+ : __r_(__second_tag(), __a)
{
__init(__il.begin(), __il.end());
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1866,7 +1895,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(initializer_list<value_t
#endif
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
@@ -2015,7 +2044,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2242,7 +2271,9 @@ basic_string<_CharT, _Traits, _Allocator>::__append_forward_unsafe(
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__n)
{
- if ( __ptr_in_range(&*__first, data(), data() + size()))
+ typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
+ _CharRef __tmp_ref = *__first;
+ if (__ptr_in_range(_VSTD::addressof(__tmp_ref), data(), data() + size()))
{
const basic_string __temp (__first, __last, __alloc());
append(__temp.data(), __temp.size());
@@ -2406,7 +2437,9 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _Forward
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
if (__n)
{
- if ( __ptr_in_range(&*__first, data(), data() + size()))
+ typedef typename iterator_traits<_ForwardIterator>::reference _CharRef;
+ _CharRef __tmp_char = *__first;
+ if (__ptr_in_range(_VSTD::addressof(__tmp_char), data(), data() + size()))
{
const basic_string __temp(__first, __last, __alloc());
return insert(__pos, __temp.data(), __temp.data() + __temp.size());
@@ -2526,6 +2559,7 @@ basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_typ
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, const value_type* __s, size_type __n2)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
_LIBCPP_ASSERT(__n2 == 0 || __s != nullptr, "string::replace received nullptr");
size_type __sz = size();
@@ -2565,6 +2599,8 @@ basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __
}
traits_type::move(__p + __pos, __s, __n2);
__finish:
+// __sz += __n2 - __n1; in this and the below function below can cause unsigned integer overflow,
+// but this is a safe operation, so we disable the check.
__sz += __n2 - __n1;
__set_size(__sz);
__invalidate_iterators_past(__sz);
@@ -2578,6 +2614,7 @@ __finish:
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::replace(size_type __pos, size_type __n1, size_type __n2, value_type __c)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
{
size_type __sz = size();
if (__pos > __sz)
@@ -3748,7 +3785,7 @@ operator+(const basic_string<_CharT, _Traits, _Allocator>& __lhs, _CharT __rhs)
return __r;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -3808,7 +3845,7 @@ operator+(basic_string<_CharT, _Traits, _Allocator>&& __lhs, _CharT __rhs)
return _VSTD::move(__lhs);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
// swap
@@ -3910,7 +3947,7 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template<class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -3924,7 +3961,7 @@ basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -3962,6 +3999,9 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
#endif // _LIBCPP_DEBUG_LEVEL >= 2
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
+_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
+
#if _LIBCPP_STD_VER > 11
// Literal suffixes for basic_string [basic.string.literals]
inline namespace literals
@@ -3995,10 +4035,8 @@ inline namespace literals
}
#endif
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<char>)
-_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_string<wchar_t>)
-_LIBCPP_EXTERN_TEMPLATE(string operator+<char, char_traits<char>, allocator<char> >(char const*, string const&))
-
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STRING
diff --git a/contrib/libc++/include/string_view b/contrib/libc++/include/string_view
index 20a4e06..4c759ab 100644
--- a/contrib/libc++/include/string_view
+++ b/contrib/libc++/include/string_view
@@ -103,7 +103,6 @@ namespace std {
constexpr const_pointer data() const noexcept;
// 7.7, basic_string_view modifiers
- constexpr void clear() noexcept;
constexpr void remove_prefix(size_type n);
constexpr void remove_suffix(size_type n);
constexpr void swap(basic_string_view& s) noexcept;
@@ -167,7 +166,6 @@ namespace std {
*/
#include <__config>
-
#include <__string>
#include <algorithm>
#include <iterator>
@@ -179,6 +177,10 @@ namespace std {
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _CharT, class _Traits = char_traits<_CharT> >
@@ -199,6 +201,10 @@ public:
typedef ptrdiff_t difference_type;
static _LIBCPP_CONSTEXPR const size_type npos = -1; // size_type(-1);
+ static_assert(is_pod<value_type>::value, "Character type of basic_string_view must be a POD");
+ static_assert((is_same<_CharT, typename traits_type::char_type>::value),
+ "traits_type::char_type must be the same type as CharT");
+
// [string.view.cons], construct/copy
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
basic_string_view() _NOEXCEPT : __data (nullptr), __size(0) {}
@@ -206,7 +212,7 @@ public:
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
basic_string_view(const basic_string_view&) _NOEXCEPT = default;
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
basic_string_view& operator=(const basic_string_view&) _NOEXCEPT = default;
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
@@ -235,16 +241,16 @@ public:
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT { return __data + __size; }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT { return const_reverse_iterator(cend()); }
- _LIBCPP_INLINE_VISIBILITY
+ _LIBCPP_CONSTEXPR_AFTER_CXX14 _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT { return const_reverse_iterator(cbegin()); }
// [string.view.capacity], capacity
@@ -289,13 +295,6 @@ public:
// [string.view.modifiers], modifiers:
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
- void clear() _NOEXCEPT
- {
- __data = nullptr;
- __size = 0;
- }
-
- _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
void remove_prefix(size_type __n) _NOEXCEPT
{
_LIBCPP_ASSERT(__n <= size(), "remove_prefix() can't remove more than size()");
@@ -357,9 +356,9 @@ public:
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
int compare( size_type __pos1, size_type __n1,
- basic_string_view _sv, size_type __pos2, size_type __n2) const
+ basic_string_view __sv, size_type __pos2, size_type __n2) const
{
- return substr(__pos1, __n1).compare(_sv.substr(__pos2, __n2));
+ return substr(__pos1, __n1).compare(__sv.substr(__pos2, __n2));
}
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
@@ -788,4 +787,6 @@ inline namespace literals
#endif
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_STRING_VIEW
diff --git a/contrib/libc++/include/strstream b/contrib/libc++/include/strstream
index 81eef2a..b00b9d8 100644
--- a/contrib/libc++/include/strstream
+++ b/contrib/libc++/include/strstream
@@ -151,12 +151,12 @@ public:
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
strstreambuf(const unsigned char* __gnext, streamsize __n);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
strstreambuf(strstreambuf&& __rhs);
_LIBCPP_INLINE_VISIBILITY
strstreambuf& operator=(strstreambuf&& __rhs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
virtual ~strstreambuf();
@@ -191,7 +191,7 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg);
};
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf::strstreambuf(strstreambuf&& __rhs)
@@ -226,7 +226,7 @@ strstreambuf::operator=(strstreambuf&& __rhs)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
class _LIBCPP_TYPE_VIS istrstream
: public istream
@@ -245,7 +245,7 @@ public:
istrstream(char* __s, streamsize __n)
: istream(&__sb_), __sb_(__s, __n) {}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs)
: istream(_VSTD::move(__rhs)),
@@ -261,7 +261,7 @@ public:
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
virtual ~istrstream();
@@ -294,7 +294,7 @@ public:
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs)
: ostream(_VSTD::move(__rhs)),
@@ -310,7 +310,7 @@ public:
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
virtual ~ostrstream();
@@ -354,7 +354,7 @@ public:
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs)
: iostream(_VSTD::move(__rhs)),
@@ -370,7 +370,7 @@ public:
__sb_ = _VSTD::move(__rhs.__sb_);
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
virtual ~strstream();
diff --git a/contrib/libc++/include/system_error b/contrib/libc++/include/system_error
index 3257ef9..a29807d 100644
--- a/contrib/libc++/include/system_error
+++ b/contrib/libc++/include/system_error
@@ -385,7 +385,7 @@ public:
virtual ~error_category() _NOEXCEPT;
#if defined(_LIBCPP_BUILDING_SYSTEM_ERROR) && \
- defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
+ defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
error_category() _NOEXCEPT;
#else
_LIBCPP_ALWAYS_INLINE
diff --git a/contrib/libc++/include/thread b/contrib/libc++/include/thread
index 479e3c0..1b8dca3 100644
--- a/contrib/libc++/include/thread
+++ b/contrib/libc++/include/thread
@@ -95,7 +95,7 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error>
#include <chrono>
#include <__mutex_base>
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
#include <tuple>
#endif
#include <__threading_support>
@@ -105,6 +105,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
#define __STDCPP_THREADS__ __cplusplus
#ifdef _LIBCPP_HAS_NO_THREADS
@@ -261,7 +264,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
- size_t operator()(__thread_id __v) const
+ size_t operator()(__thread_id __v) const _NOEXCEPT
{
return hash<__libcpp_thread_id>()(__v.__id_);
}
@@ -290,32 +293,35 @@ public:
typedef __libcpp_thread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY
- thread() _NOEXCEPT : __t_(0) {}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+ thread() _NOEXCEPT : __t_(_LIBCPP_NULL_THREAD) {}
+#ifndef _LIBCPP_CXX03_LANG
template <class _Fp, class ..._Args,
class = typename enable_if
<
!is_same<typename decay<_Fp>::type, thread>::value
>::type
>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
explicit thread(_Fp&& __f, _Args&&... __args);
-#else // _LIBCPP_HAS_NO_VARIADICS
- template <class _Fp> explicit thread(_Fp __f);
+#else // _LIBCPP_CXX03_LANG
+ template <class _Fp>
+ _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
+ explicit thread(_Fp __f);
#endif
~thread();
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
- thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+ thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = _LIBCPP_NULL_THREAD;}
_LIBCPP_INLINE_VISIBILITY
thread& operator=(thread&& __t) _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY
- bool joinable() const _NOEXCEPT {return __t_ != 0;}
+ bool joinable() const _NOEXCEPT {return !__libcpp_thread_isnull(&__t_);}
void join();
void detach();
_LIBCPP_INLINE_VISIBILITY
@@ -326,7 +332,7 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
template <class _TSp, class _Fp, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
@@ -366,7 +372,18 @@ thread::thread(_Fp&& __f, _Args&&... __args)
__throw_system_error(__ec, "thread constructor failed");
}
-#else // _LIBCPP_HAS_NO_VARIADICS
+inline
+thread&
+thread::operator=(thread&& __t) _NOEXCEPT
+{
+ if (!__libcpp_thread_isnull(&__t_))
+ terminate();
+ __t_ = __t.__t_;
+ __t.__t_ = _LIBCPP_NULL_THREAD;
+ return *this;
+}
+
+#else // _LIBCPP_CXX03_LANG
template <class _Fp>
struct __thread_invoke_pair {
@@ -401,22 +418,7 @@ thread::thread(_Fp __f)
__throw_system_error(__ec, "thread constructor failed");
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-inline
-thread&
-thread::operator=(thread&& __t) _NOEXCEPT
-{
- if (__t_ != 0)
- terminate();
- __t_ = __t.__t_;
- __t.__t_ = 0;
- return *this;
-}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
inline _LIBCPP_INLINE_VISIBILITY
void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
@@ -424,7 +426,7 @@ void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
namespace this_thread
{
-_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
+_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& __ns);
template <class _Rep, class _Period>
void
@@ -477,4 +479,6 @@ _LIBCPP_END_NAMESPACE_STD
#endif // !_LIBCPP_HAS_NO_THREADS
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_THREAD
diff --git a/contrib/libc++/include/tuple b/contrib/libc++/include/tuple
index cddb709..a52b934 100644
--- a/contrib/libc++/include/tuple
+++ b/contrib/libc++/include/tuple
@@ -148,7 +148,7 @@ template <class... Types>
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+#ifndef _LIBCPP_CXX03_LANG
// __tuple_leaf
@@ -169,7 +169,7 @@ void swap(__tuple_leaf<_Ip, _Hp, _Ep>& __x, __tuple_leaf<_Ip, _Hp, _Ep>& __y)
template <size_t _Ip, class _Hp, bool>
class __tuple_leaf
{
- _Hp value;
+ _Hp __value_;
template <class _Tp>
static constexpr bool __can_bind_reference() {
@@ -188,28 +188,28 @@ class __tuple_leaf
__tuple_leaf& operator=(const __tuple_leaf&);
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR __tuple_leaf()
- _NOEXCEPT_(is_nothrow_default_constructible<_Hp>::value) : value()
+ _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 <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf(integral_constant<int, 0>, const _Alloc&)
- : value()
+ : __value_()
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf(integral_constant<int, 1>, const _Alloc& __a)
- : value(allocator_arg_t(), __a)
+ : __value_(allocator_arg_t(), __a)
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf(integral_constant<int, 2>, const _Alloc& __a)
- : value(__a)
+ : __value_(__a)
{static_assert(!is_reference<_Hp>::value,
"Attempted to default construct a reference element in a tuple");}
@@ -223,28 +223,28 @@ public:
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
- : value(_VSTD::forward<_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 <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 0>, const _Alloc&, _Tp&& __t)
- : value(_VSTD::forward<_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 <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 1>, const _Alloc& __a, _Tp&& __t)
- : value(allocator_arg_t(), __a, _VSTD::forward<_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 <class _Tp, class _Alloc>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
- : value(_VSTD::forward<_Tp>(__t), __a)
+ : __value_(_VSTD::forward<_Tp>(__t), __a)
{static_assert(!is_reference<_Hp>::value,
"Attempted to uses-allocator construct a reference element in a tuple");}
@@ -256,7 +256,7 @@ public:
__tuple_leaf&
operator=(_Tp&& __t) _NOEXCEPT_((is_nothrow_assignable<_Hp&, _Tp>::value))
{
- value = _VSTD::forward<_Tp>(__t);
+ __value_ = _VSTD::forward<_Tp>(__t);
return *this;
}
@@ -267,8 +267,8 @@ public:
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;}
+ _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 <size_t _Ip, class _Hp>
@@ -366,7 +366,7 @@ struct __all_default_constructible<__tuple_types<_Tp...>>
template<class _Indx, class ..._Tp> struct __tuple_impl;
template<size_t ..._Indx, class ..._Tp>
-struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
+struct _LIBCPP_DECLSPEC_EMPTY_BASES __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
: public __tuple_leaf<_Indx, _Tp>...
{
_LIBCPP_INLINE_VISIBILITY
@@ -473,9 +473,9 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <class ..._Tp>
class _LIBCPP_TEMPLATE_VIS tuple
{
- typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
+ typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> _BaseT;
- base base_;
+ _BaseT __base_;
#if defined(_LIBCPP_ENABLE_TUPLE_IMPLICIT_REDUCED_ARITY_EXTENSION)
static constexpr bool _EnableImplicitReducedArityExtension = true;
@@ -628,7 +628,7 @@ public:
>::type>
_LIBCPP_INLINE_VISIBILITY
tuple(_AllocArgT, _Alloc const& __a)
- : base_(allocator_arg_t(), __a,
+ : __base_(allocator_arg_t(), __a,
__tuple_indices<>(), __tuple_types<>(),
typename __make_tuple_indices<sizeof...(_Tp), 0>::type(),
__tuple_types<_Tp...>()) {}
@@ -644,7 +644,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
- : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
@@ -662,7 +662,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
- : base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
+ : __base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
typename __make_tuple_types<tuple, 0>::type(),
@@ -680,7 +680,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
- : base_(allocator_arg_t(), __a,
+ : __base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -700,7 +700,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(allocator_arg_t, const _Alloc& __a, const _Tp& ... __t)
- : base_(allocator_arg_t(), __a,
+ : __base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
typename __make_tuple_indices<0>::type(),
@@ -727,7 +727,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
tuple(_Up&&... __u)
_NOEXCEPT_((
- is_nothrow_constructible<base,
+ is_nothrow_constructible<_BaseT,
typename __make_tuple_indices<sizeof...(_Up)>::type,
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
@@ -735,7 +735,7 @@ public:
_Up...
>::value
))
- : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -751,7 +751,7 @@ public:
_CheckArgsConstructor<
!_EnableImplicitReducedArityExtension
&& sizeof...(_Up) < sizeof...(_Tp)
- && !_PackExpandsToThisTuple<_Up...>()
+ && !_PackExpandsToThisTuple<_Up...>::value
>::template __enable_implicit<_Up...>(),
bool
>::type = false
@@ -760,7 +760,7 @@ public:
explicit
tuple(_Up&&... __u)
_NOEXCEPT_((
- is_nothrow_constructible<base,
+ is_nothrow_constructible<_BaseT,
typename __make_tuple_indices<sizeof...(_Up)>::type,
typename __make_tuple_types<tuple, sizeof...(_Up)>::type,
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type,
@@ -768,7 +768,7 @@ public:
_Up...
>::value
))
- : base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
+ : __base_(typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -786,7 +786,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
- : base_(allocator_arg_t(), __a,
+ : __base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -806,7 +806,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(allocator_arg_t, const _Alloc& __a, _Up&&... __u)
- : base_(allocator_arg_t(), __a,
+ : __base_(allocator_arg_t(), __a,
typename __make_tuple_indices<sizeof...(_Up)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Up)>::type(),
typename __make_tuple_indices<sizeof...(_Tp), sizeof...(_Up)>::type(),
@@ -824,8 +824,8 @@ public:
>::type = false
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
- tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
- : base_(_VSTD::forward<_Tuple>(__t)) {}
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
+ : __base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Tuple,
typename enable_if
@@ -839,8 +839,8 @@ public:
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
explicit
- tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
- : base_(_VSTD::forward<_Tuple>(__t)) {}
+ tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<_BaseT, _Tuple>::value))
+ : __base_(_VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
typename enable_if
@@ -853,7 +853,7 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
- : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
+ : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
template <class _Alloc, class _Tuple,
typename enable_if
@@ -867,7 +867,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(allocator_arg_t, const _Alloc& __a, _Tuple&& __t)
- : base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
+ : __base_(allocator_arg_t(), __a, _VSTD::forward<_Tuple>(__t)) {}
using _CanCopyAssign = __all<is_copy_assignable<_Tp>::value...>;
using _CanMoveAssign = __all<is_move_assignable<_Tp>::value...>;
@@ -876,7 +876,7 @@ public:
tuple& operator=(typename conditional<_CanCopyAssign::value, tuple, __nat>::type const& __t)
_NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
{
- base_.operator=(__t.base_);
+ __base_.operator=(__t.__base_);
return *this;
}
@@ -884,7 +884,7 @@ public:
tuple& operator=(typename conditional<_CanMoveAssign::value, tuple, __nat>::type&& __t)
_NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value))
{
- base_.operator=(static_cast<base&&>(__t.base_));
+ __base_.operator=(static_cast<_BaseT&&>(__t.__base_));
return *this;
}
@@ -896,15 +896,15 @@ public:
>
_LIBCPP_INLINE_VISIBILITY
tuple&
- operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<base&, _Tuple>::value))
+ operator=(_Tuple&& __t) _NOEXCEPT_((is_nothrow_assignable<_BaseT&, _Tuple>::value))
{
- base_.operator=(_VSTD::forward<_Tuple>(__t));
+ __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_);}
+ {__base_.swap(__t.__base_);}
};
template <>
@@ -929,6 +929,16 @@ public:
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 <class _Alloc, class ..._Args>
+tuple(allocator_arg_t, const _Alloc&, tuple<_Args...> const&) -> tuple<_Args...>;
+template <class _Alloc, class ..._Args>
+tuple(allocator_arg_t, const _Alloc&, tuple<_Args...>&&) -> tuple<_Args...>;
+#endif
+
template <class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -948,7 +958,7 @@ 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();
+ return static_cast<__tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
template <size_t _Ip, class ..._Tp>
@@ -957,7 +967,7 @@ 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<const __tuple_leaf<_Ip, type>&>(__t.base_).get();
+ return static_cast<const __tuple_leaf<_Ip, type>&>(__t.__base_).get();
}
template <size_t _Ip, class ..._Tp>
@@ -967,7 +977,7 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<type&&>(
- static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
+ static_cast<__tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
template <size_t _Ip, class ..._Tp>
@@ -977,7 +987,7 @@ get(const tuple<_Tp...>&& __t) _NOEXCEPT
{
typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
return static_cast<const type&&>(
- static_cast<const __tuple_leaf<_Ip, type>&&>(__t.base_).get());
+ static_cast<const __tuple_leaf<_Ip, type>&&>(__t.__base_).get());
}
#if _LIBCPP_STD_VER > 11
@@ -1064,11 +1074,13 @@ template <class _Up>
struct __ignore_t
{
template <class _Tp>
- _LIBCPP_INLINE_VISIBILITY
- const __ignore_t& operator=(_Tp&&) const {return *this;}
+ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+ const __ignore_t& operator=(_Tp&&) const {return *this;}
};
-namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
+namespace {
+ constexpr __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>();
+}
template <class _Tp>
struct __make_tuple_return_impl
@@ -1343,9 +1355,6 @@ template <class ..._Tp, class _Alloc>
struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
: true_type {};
-#endif // _LIBCPP_HAS_NO_VARIADICS
-
-#ifndef _LIBCPP_CXX03_LANG
template <class _T1, class _T2>
template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1356,7 +1365,6 @@ pair<_T1, _T2>::pair(piecewise_construct_t,
second(_VSTD::forward<_Args2>(_VSTD::get<_I2>(__second_args))...)
{
}
-#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 14
template <class _Tp>
@@ -1402,6 +1410,8 @@ _LIBCPP_NOEXCEPT_RETURN(
#endif // _LIBCPP_STD_VER > 14
+#endif // !defined(_LIBCPP_CXX03_LANG)
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_TUPLE
diff --git a/contrib/libc++/include/type_traits b/contrib/libc++/include/type_traits
index 7862955..9db4d66 100644
--- a/contrib/libc++/include/type_traits
+++ b/contrib/libc++/include/type_traits
@@ -97,6 +97,7 @@ namespace std
template <class T> struct is_polymorphic;
template <class T> struct is_abstract;
template <class T> struct is_final; // C++14
+ template <class T> struct is_aggregate; // C++17
template <class T, class... Args> struct is_constructible;
template <class T> struct is_default_constructible;
@@ -286,6 +287,8 @@ namespace std
= is_abstract<T>::value; // C++17
template <class T> constexpr bool is_final_v
= is_final<T>::value; // C++17
+ template <class T> constexpr bool is_aggregate_v
+ = is_aggregate<T>::value; // C++17
template <class T> constexpr bool is_signed_v
= is_signed<T>::value; // C++17
template <class T> constexpr bool is_unsigned_v
@@ -1272,11 +1275,13 @@ template <class _Tp> using remove_all_extents_t = typename remove_all_extents<_T
// decay
-template <class _Tp>
-struct _LIBCPP_TEMPLATE_VIS decay
-{
-private:
- typedef typename remove_reference<_Tp>::type _Up;
+template <class _Up, bool>
+struct __decay {
+ typedef typename remove_cv<_Up>::type type;
+};
+
+template <class _Up>
+struct __decay<_Up, true> {
public:
typedef typename conditional
<
@@ -1291,24 +1296,23 @@ public:
>::type type;
};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS decay
+{
+private:
+ typedef typename remove_reference<_Tp>::type _Up;
+public:
+ typedef typename __decay<_Up, __is_referenceable<_Up>::value>::type type;
+};
+
#if _LIBCPP_STD_VER > 11
template <class _Tp> using decay_t = typename decay<_Tp>::type;
#endif
// is_abstract
-namespace __is_abstract_imp
-{
-template <class _Tp> char __test(_Tp (*)[1]);
-template <class _Tp> __two __test(...);
-}
-
-template <class _Tp, bool = is_class<_Tp>::value>
-struct __libcpp_abstract : public integral_constant<bool, sizeof(__is_abstract_imp::__test<_Tp>(0)) != 1> {};
-
-template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {};
-
-template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract : public __libcpp_abstract<_Tp> {};
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS is_abstract
+ : public integral_constant<bool, __is_abstract(_Tp)> {};
#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
@@ -1335,6 +1339,19 @@ template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
= is_final<_Tp>::value;
#endif
+// is_aggregate
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
+
+template <class _Tp> struct _LIBCPP_TEMPLATE_VIS
+is_aggregate : public integral_constant<bool, __is_aggregate(_Tp)> {};
+
+#if !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp>
+constexpr bool is_aggregate_v = is_aggregate<_Tp>::value;
+#endif
+
+#endif // _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_IS_AGGREGATE)
+
// is_base_of
#ifdef _LIBCPP_HAS_IS_BASE_OF
@@ -1964,11 +1981,18 @@ public:
typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp>::type type;
};
+template <>
+struct _LIBCPP_TEMPLATE_VIS common_type<void, void, void>
+{
+public:
+ typedef void type;
+};
+
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp, void, void>
{
public:
- typedef typename decay<_Tp>::type type;
+ typedef typename common_type<_Tp, _Tp>::type type;
};
template <class _Tp, class _Up>
@@ -1990,9 +2014,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type {};
template <class _Tp>
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
-{
- typedef typename decay<_Tp>::type type;
-};
+ : public common_type<_Tp, _Tp> {};
// bullet 3 - sizeof...(Tp) == 2
@@ -4717,4 +4739,35 @@ struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
_LIBCPP_END_NAMESPACE_STD
+#if _LIBCPP_STD_VER > 14
+// std::byte
+namespace std // purposefully not versioned
+{
+template <class _Integer>
+ constexpr typename enable_if<is_integral_v<_Integer>, byte>::type &
+ operator<<=(byte& __lhs, _Integer __shift) noexcept
+ { return __lhs = byte(static_cast<unsigned char>(__lhs) << __shift); }
+
+template <class _Integer>
+ constexpr typename enable_if<is_integral_v<_Integer>, byte>::type
+ operator<< (byte __lhs, _Integer __shift) noexcept
+ { return byte(static_cast<unsigned char>(__lhs) << __shift); }
+
+template <class _Integer>
+ constexpr typename enable_if<is_integral_v<_Integer>, byte>::type &
+ operator>>=(byte& __lhs, _Integer __shift) noexcept
+ { return __lhs = byte(static_cast<unsigned char>(__lhs) >> __shift); }
+
+template <class _Integer>
+ constexpr typename enable_if<is_integral_v<_Integer>, byte>::type
+ operator>> (byte __lhs, _Integer __shift) noexcept
+ { return byte(static_cast<unsigned char>(__lhs) >> __shift); }
+
+template <class _Integer>
+ constexpr typename enable_if<is_integral_v<_Integer>, _Integer>::type
+ to_integer(byte __b) noexcept { return _Integer(__b); }
+
+}
+#endif
+
#endif // _LIBCPP_TYPE_TRAITS
diff --git a/contrib/libc++/include/typeinfo b/contrib/libc++/include/typeinfo
index fdc25c8..8624b34 100644
--- a/contrib/libc++/include/typeinfo
+++ b/contrib/libc++/include/typeinfo
@@ -69,7 +69,9 @@ public:
#pragma GCC system_header
#endif
-#if defined(_LIBCPP_NONUNIQUE_RTTI_BIT)
+#if defined(_LIBCPP_ABI_MICROSOFT)
+#include <vcruntime_typeinfo.h>
+#elif defined(_LIBCPP_NONUNIQUE_RTTI_BIT)
#define _LIBCPP_HAS_NONUNIQUE_TYPEINFO
#else
#define _LIBCPP_HAS_UNIQUE_TYPEINFO
@@ -78,6 +80,7 @@ public:
namespace std // purposefully not using versioning namespace
{
+#if !defined(_LIBCPP_ABI_MICROSOFT)
class _LIBCPP_EXCEPTION_ABI type_info
{
type_info& operator=(const type_info&);
@@ -105,6 +108,7 @@ protected:
#endif
public:
+ _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
virtual ~type_info();
#if defined(_LIBCPP_HAS_NONUNIQUE_TYPEINFO)
@@ -187,6 +191,8 @@ public:
virtual const char* what() const _NOEXCEPT;
};
+#endif // !_LIBCPP_ABI_MICROSOFT
+
} // std
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/libc++/include/unordered_map b/contrib/libc++/include/unordered_map
index 7baf638..0546c0e 100644
--- a/contrib/libc++/include/unordered_map
+++ b/contrib/libc++/include/unordered_map
@@ -379,9 +379,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
_LIBCPP_BEGIN_NAMESPACE_STD
-template <class _Key, class _Cp, class _Hash,
- bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value
- >
+template <class _Key, class _Cp, class _Hash, bool _IsEmpty>
class __unordered_map_hasher
: private _Hash
{
@@ -406,7 +404,7 @@ public:
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
{
using _VSTD::swap;
- swap(static_cast<const _Hash&>(*this), static_cast<const _Hash&>(__y));
+ swap(static_cast<_Hash&>(*this), static_cast<_Hash&>(__y));
}
};
@@ -449,9 +447,7 @@ swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
__x.swap(__y);
}
-template <class _Key, class _Cp, class _Pred,
- bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
- >
+template <class _Key, class _Cp, class _Pred, bool _IsEmpty>
class __unordered_map_equal
: private _Pred
{
@@ -479,7 +475,7 @@ public:
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
{
using _VSTD::swap;
- swap(static_cast<const _Pred&>(*this), static_cast<const _Pred&>(__y));
+ swap(static_cast<_Pred&>(*this), static_cast<_Pred&>(__y));
}
};
@@ -551,7 +547,7 @@ public:
__second_constructed(false)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
_NOEXCEPT
@@ -561,7 +557,7 @@ public:
{
__x.__value_constructed = false;
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
: __na_(__x.__na_),
@@ -570,7 +566,7 @@ public:
{
const_cast<bool&>(__x.__value_constructed) = false;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) _NOEXCEPT
@@ -823,20 +819,18 @@ public:
explicit unordered_map(const allocator_type& __a);
unordered_map(const unordered_map& __u);
unordered_map(const unordered_map& __u, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_map(unordered_map&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_map(unordered_map&& __u, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_map(initializer_list<value_type> __il);
unordered_map(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(), const key_equal& __eql = key_equal());
unordered_map(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
unordered_map(size_type __n, const allocator_type& __a)
@@ -879,15 +873,13 @@ public:
#endif
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_map& operator=(unordered_map&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
unordered_map& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -932,13 +924,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __first, _InputIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(value_type&& __x)
{return __table_.__insert_unique(_VSTD::move(__x));}
@@ -1082,7 +1072,7 @@ public:
// FIXME: Add debug mode checking for the iterator input
return insert_or_assign(_VSTD::move(__k), _VSTD::forward<_Vp>(__v)).first;
}
-#endif
+#endif // _LIBCPP_STD_VER > 14
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p.__i_);}
@@ -1281,7 +1271,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
insert(__u.begin(), __u.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
@@ -1318,10 +1308,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
initializer_list<value_type> __il)
@@ -1358,10 +1344,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
insert(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -1372,10 +1354,6 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_map&& __u)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -1386,22 +1364,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifdef _LIBCPP_CXX03_LANG
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
-{
- __node_allocator& __na = __table_.__node_alloc();
- __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
- __h.get_deleter().__first_constructed = true;
- __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
- __h.get_deleter().__second_constructed = true;
- return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
-}
-#endif
+#endif // _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
@@ -1414,20 +1377,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator __first,
__table_.__insert_unique(*__first);
}
-#ifdef _LIBCPP_CXX03_LANG
-template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
-_Tp&
-unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
-{
- iterator __i = find(__k);
- if (__i != end())
- return __i->second;
- __node_holder __h = __construct_node_with_key(__k);
- pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
- __h.release();
- return __r.first->second;
-}
-#else
+#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_Tp&
@@ -1446,8 +1396,35 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
std::piecewise_construct, std::forward_as_tuple(std::move(__k)),
std::forward_as_tuple()).first->__cc.second;
}
+#else // _LIBCPP_CXX03_LANG
-#endif // !_LIBCPP_CXX03_MODE
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+typename unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const key_type& __k)
+{
+ __node_allocator& __na = __table_.__node_alloc();
+ __node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.first), __k);
+ __h.get_deleter().__first_constructed = true;
+ __node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
+ __h.get_deleter().__second_constructed = true;
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
+}
+
+template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
+_Tp&
+unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
+{
+ iterator __i = find(__k);
+ if (__i != end())
+ return __i->second;
+ __node_holder __h = __construct_node_with_key(__k);
+ pair<iterator, bool> __r = __table_.__node_insert_unique(__h.get());
+ __h.release();
+ return __r.first->second;
+}
+
+#endif // _LIBCPP_CXX03_MODE
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
_Tp&
@@ -1590,13 +1567,11 @@ public:
explicit unordered_multimap(const allocator_type& __a);
unordered_multimap(const unordered_multimap& __u);
unordered_multimap(const unordered_multimap& __u, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_multimap(unordered_multimap&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_multimap(unordered_multimap&& __u, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multimap(initializer_list<value_type> __il);
unordered_multimap(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -1604,7 +1579,7 @@ public:
unordered_multimap(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
unordered_multimap(size_type __n, const allocator_type& __a)
@@ -1647,15 +1622,13 @@ public:
#endif
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_multimap& operator=(unordered_multimap&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
unordered_multimap& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -1692,13 +1665,10 @@ public:
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __first, _InputIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
@@ -1916,7 +1886,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__u.begin(), __u.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
@@ -1955,10 +1925,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
initializer_list<value_type> __il)
@@ -1995,10 +1961,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
insert(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -2009,10 +1971,6 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(unordered_multima
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
inline
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>&
@@ -2023,7 +1981,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
diff --git a/contrib/libc++/include/unordered_set b/contrib/libc++/include/unordered_set
index fc53c82..a14fb00 100644
--- a/contrib/libc++/include/unordered_set
+++ b/contrib/libc++/include/unordered_set
@@ -408,13 +408,11 @@ public:
explicit unordered_set(const allocator_type& __a);
unordered_set(const unordered_set& __u);
unordered_set(const unordered_set& __u, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_set(unordered_set&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_set(unordered_set&& __u, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_set(initializer_list<value_type> __il);
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -432,7 +430,7 @@ public:
const hasher& __hf, const allocator_type& __a)
: unordered_set(__il, __n, __hf, key_equal(), __a) {}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// ~unordered_set() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_set& operator=(const unordered_set& __u)
@@ -440,15 +438,13 @@ public:
__table_ = __u.__table_;
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_set& operator=(unordered_set&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
unordered_set& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -474,7 +470,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return __table_.end();}
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args)
@@ -493,51 +489,47 @@ public:
iterator emplace_hint(const_iterator, _Args&&... __args)
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
#endif
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
- _LIBCPP_INLINE_VISIBILITY
- pair<iterator, bool> insert(const value_type& __x)
- {return __table_.__insert_unique(__x);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(value_type&& __x)
{return __table_.__insert_unique(_VSTD::move(__x));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_DEBUG_LEVEL >= 2
- iterator insert(const_iterator __p, const value_type& __x)
+ iterator insert(const_iterator __p, value_type&& __x)
{
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
- "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
+ "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
" referring to this unordered_set");
- return insert(__x).first;
+ return insert(_VSTD::move(__x)).first;
}
#else
- iterator insert(const_iterator, const value_type& __x)
- {return insert(__x).first;}
+ iterator insert(const_iterator, value_type&& __x)
+ {return insert(_VSTD::move(__x)).first;}
#endif
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(initializer_list<value_type> __il)
+ {insert(__il.begin(), __il.end());}
+#endif // _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY
+ pair<iterator, bool> insert(const value_type& __x)
+ {return __table_.__insert_unique(__x);}
+
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_DEBUG_LEVEL >= 2
- iterator insert(const_iterator __p, value_type&& __x)
+ iterator insert(const_iterator __p, const value_type& __x)
{
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
- "unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
+ "unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
" referring to this unordered_set");
- return insert(_VSTD::move(__x)).first;
+ return insert(__x).first;
}
#else
- iterator insert(const_iterator, value_type&& __x)
- {return insert(_VSTD::move(__x)).first;}
+ iterator insert(const_iterator, const value_type& __x)
+ {return insert(__x).first;}
#endif
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
void insert(_InputIterator __first, _InputIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- void insert(initializer_list<value_type> __il)
- {insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
@@ -717,7 +709,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
insert(__u.begin(), __u.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
@@ -752,10 +744,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
initializer_list<value_type> __il)
@@ -792,10 +780,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
insert(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>&
@@ -806,10 +790,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(unordered_set&& __u)
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
unordered_set<_Value, _Hash, _Pred, _Alloc>&
@@ -820,7 +800,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
@@ -949,13 +929,11 @@ public:
explicit unordered_multiset(const allocator_type& __a);
unordered_multiset(const unordered_multiset& __u);
unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_multiset(unordered_multiset&& __u)
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value);
unordered_multiset(unordered_multiset&& __u, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multiset(initializer_list<value_type> __il);
unordered_multiset(initializer_list<value_type> __il, size_type __n,
const hasher& __hf = hasher(),
@@ -971,7 +949,7 @@ public:
unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
#endif
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
// ~unordered_multiset() = default;
_LIBCPP_INLINE_VISIBILITY
unordered_multiset& operator=(const unordered_multiset& __u)
@@ -979,14 +957,12 @@ public:
__table_ = __u.__table_;
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
unordered_multiset& operator=(unordered_multiset&& __u)
_NOEXCEPT_(is_nothrow_move_assignable<__table>::value);
-#endif
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
unordered_multiset& operator=(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -1012,7 +988,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return __table_.end();}
-#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+#ifndef _LIBCPP_CXX03_LANG
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args)
@@ -1021,29 +997,27 @@ public:
_LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __table_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);}
-#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
_LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __x) {return __table_.__insert_multi(_VSTD::move(__x));}
-#endif
- _LIBCPP_INLINE_VISIBILITY
- iterator insert(const_iterator __p, const value_type& __x)
- {return __table_.__insert_multi(__p, __x);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __x)
{return __table_.__insert_multi(__p, _VSTD::move(__x));}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- template <class _InputIterator>
- _LIBCPP_INLINE_VISIBILITY
- void insert(_InputIterator __first, _InputIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
+
+ _LIBCPP_INLINE_VISIBILITY
+ iterator insert(const_iterator __p, const value_type& __x)
+ {return __table_.__insert_multi(__p, __x);}
+
+ template <class _InputIterator>
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(_InputIterator __first, _InputIterator __last);
_LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __table_.erase(__p);}
@@ -1224,7 +1198,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
insert(__u.begin(), __u.end());
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
@@ -1259,10 +1233,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
initializer_list<value_type> __il)
@@ -1299,10 +1269,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
insert(__il.begin(), __il.end());
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
@@ -1314,10 +1280,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Value, class _Hash, class _Pred, class _Alloc>
inline
unordered_multiset<_Value, _Hash, _Pred, _Alloc>&
@@ -1328,7 +1290,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::operator=(
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Value, class _Hash, class _Pred, class _Alloc>
template <class _InputIterator>
diff --git a/contrib/libc++/include/utility b/contrib/libc++/include/utility
index cc0646c..00e3cd2 100644
--- a/contrib/libc++/include/utility
+++ b/contrib/libc++/include/utility
@@ -198,6 +198,9 @@ template <size_t I>
#include <__tuple>
#include <type_traits>
#include <initializer_list>
+#include <cstddef>
+#include <cstring>
+#include <cstdint>
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -269,14 +272,14 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
typename conditional
<
!is_nothrow_move_constructible<_Tp>::value && is_copy_constructible<_Tp>::value,
const _Tp&,
_Tp&&
>::type
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else // _LIBCPP_CXX03_LANG
const _Tp&
#endif
move_if_noexcept(_Tp& __x) _NOEXCEPT
@@ -290,7 +293,7 @@ template <class _Tp> void as_const(const _Tp&&) = delete;
#endif
struct _LIBCPP_TEMPLATE_VIS piecewise_construct_t { };
-#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
+#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_UTILITY)
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
#else
constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
@@ -605,8 +608,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
__x.swap(__y);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
struct __make_pair_return_impl
@@ -635,7 +637,7 @@ make_pair(_T1&& __t1, _T2&& __t2)
(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
}
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#else // _LIBCPP_CXX03_LANG
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
@@ -645,12 +647,18 @@ make_pair(_T1 __x, _T2 __y)
return pair<_T1, _T2>(__x, __y);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _T1, class _T2>
class _LIBCPP_TEMPLATE_VIS tuple_size<pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
+template <size_t _Ip, class _T1, class _T2>
+class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, pair<_T1, _T2> >
+{
+ static_assert(_Ip < 2, "Index out of bounds in std::tuple_element<std::pair<T1, T2>>");
+};
+
template <class _T1, class _T2>
class _LIBCPP_TEMPLATE_VIS tuple_element<0, pair<_T1, _T2> >
{
@@ -682,8 +690,7 @@ struct __get_pair<0>
const _T1&
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -695,8 +702,7 @@ struct __get_pair<0>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T1&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T1>(__p.first);}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
};
template <>
@@ -714,8 +720,7 @@ struct __get_pair<1>
const _T2&
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -727,8 +732,7 @@ struct __get_pair<1>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
const _T2&&
get(const pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<const _T2>(__p.second);}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
};
template <size_t _Ip, class _T1, class _T2>
@@ -747,8 +751,7 @@ get(const pair<_T1, _T2>& __p) _NOEXCEPT
return __get_pair<_Ip>::get(__p);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
+#ifndef _LIBCPP_CXX03_LANG
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
@@ -764,8 +767,7 @@ get(const pair<_T1, _T2>&& __p) _NOEXCEPT
{
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
-
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
#if _LIBCPP_STD_VER > 11
template <class _T1, class _T2>
@@ -903,7 +905,7 @@ inline
constexpr in_place_t in_place{};
template <class _Tp>
-struct _LIBCPP_TYPE_VIS in_place_type_t {
+struct _LIBCPP_TEMPLATE_VIS in_place_type_t {
explicit in_place_type_t() = default;
};
template <class _Tp>
@@ -928,8 +930,669 @@ template <class _Tp> struct __is_inplace_type_imp<in_place_type_t<_Tp>> : true_t
template <class _Tp>
using __is_inplace_type = __is_inplace_type_imp<__uncvref_t<_Tp>>;
+template <class _Tp> struct __is_inplace_index_imp : false_type {};
+template <size_t _Idx> struct __is_inplace_index_imp<in_place_index_t<_Idx>> : true_type {};
+
+template <class _Tp>
+using __is_inplace_index = __is_inplace_index_imp<__uncvref_t<_Tp>>;
+
#endif // _LIBCPP_STD_VER > 14
+template <class _Arg, class _Result>
+struct _LIBCPP_TEMPLATE_VIS unary_function
+{
+ typedef _Arg argument_type;
+ typedef _Result result_type;
+};
+
+template <class _Size>
+inline _LIBCPP_INLINE_VISIBILITY
+_Size
+__loadword(const void* __p)
+{
+ _Size __r;
+ std::memcpy(&__r, __p, sizeof(__r));
+ return __r;
+}
+
+// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
+// is 64 bits. This is because cityhash64 uses 64bit x 64bit
+// multiplication, which can be very slow on 32-bit systems.
+template <class _Size, size_t = sizeof(_Size)*__CHAR_BIT__>
+struct __murmur2_or_cityhash;
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 32>
+{
+ inline _Size operator()(const void* __key, _Size __len)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
+};
+
+// murmur2
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
+{
+ const _Size __m = 0x5bd1e995;
+ const _Size __r = 24;
+ _Size __h = __len;
+ const unsigned char* __data = static_cast<const unsigned char*>(__key);
+ for (; __len >= 4; __data += 4, __len -= 4)
+ {
+ _Size __k = __loadword<_Size>(__data);
+ __k *= __m;
+ __k ^= __k >> __r;
+ __k *= __m;
+ __h *= __m;
+ __h ^= __k;
+ }
+ switch (__len)
+ {
+ case 3:
+ __h ^= __data[2] << 16;
+ case 2:
+ __h ^= __data[1] << 8;
+ case 1:
+ __h ^= __data[0];
+ __h *= __m;
+ }
+ __h ^= __h >> 13;
+ __h *= __m;
+ __h ^= __h >> 15;
+ return __h;
+}
+
+template <class _Size>
+struct __murmur2_or_cityhash<_Size, 64>
+{
+ inline _Size operator()(const void* __key, _Size __len) _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK;
+
+ private:
+ // Some primes between 2^63 and 2^64.
+ static const _Size __k0 = 0xc3a5c85c97cb3127ULL;
+ static const _Size __k1 = 0xb492b66fbe98f273ULL;
+ static const _Size __k2 = 0x9ae16a3b2f90404fULL;
+ static const _Size __k3 = 0xc949d7c7509e6557ULL;
+
+ static _Size __rotate(_Size __val, int __shift) {
+ return __shift == 0 ? __val : ((__val >> __shift) | (__val << (64 - __shift)));
+ }
+
+ static _Size __rotate_by_at_least_1(_Size __val, int __shift) {
+ return (__val >> __shift) | (__val << (64 - __shift));
+ }
+
+ static _Size __shift_mix(_Size __val) {
+ return __val ^ (__val >> 47);
+ }
+
+ static _Size __hash_len_16(_Size __u, _Size __v)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ const _Size __mul = 0x9ddfea08eb382d69ULL;
+ _Size __a = (__u ^ __v) * __mul;
+ __a ^= (__a >> 47);
+ _Size __b = (__v ^ __a) * __mul;
+ __b ^= (__b >> 47);
+ __b *= __mul;
+ return __b;
+ }
+
+ static _Size __hash_len_0_to_16(const char* __s, _Size __len)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ if (__len > 8) {
+ const _Size __a = __loadword<_Size>(__s);
+ const _Size __b = __loadword<_Size>(__s + __len - 8);
+ return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
+ }
+ if (__len >= 4) {
+ const uint32_t __a = __loadword<uint32_t>(__s);
+ const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
+ return __hash_len_16(__len + (__a << 3), __b);
+ }
+ if (__len > 0) {
+ const unsigned char __a = __s[0];
+ const unsigned char __b = __s[__len >> 1];
+ const unsigned char __c = __s[__len - 1];
+ const uint32_t __y = static_cast<uint32_t>(__a) +
+ (static_cast<uint32_t>(__b) << 8);
+ const uint32_t __z = __len + (static_cast<uint32_t>(__c) << 2);
+ return __shift_mix(__y * __k2 ^ __z * __k3) * __k2;
+ }
+ return __k2;
+ }
+
+ static _Size __hash_len_17_to_32(const char *__s, _Size __len)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ const _Size __a = __loadword<_Size>(__s) * __k1;
+ const _Size __b = __loadword<_Size>(__s + 8);
+ const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
+ const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
+ return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
+ __a + __rotate(__b ^ __k3, 20) - __c + __len);
+ }
+
+ // Return a 16-byte hash for 48 bytes. Quick and dirty.
+ // Callers do best to use "random-looking" values for a and b.
+ static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+ _Size __w, _Size __x, _Size __y, _Size __z, _Size __a, _Size __b)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ __a += __w;
+ __b = __rotate(__b + __a + __z, 21);
+ const _Size __c = __a;
+ __a += __x;
+ __a += __y;
+ __b += __rotate(__a, 44);
+ return pair<_Size, _Size>(__a + __z, __b + __c);
+ }
+
+ // Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
+ static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
+ const char* __s, _Size __a, _Size __b)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
+ __loadword<_Size>(__s + 8),
+ __loadword<_Size>(__s + 16),
+ __loadword<_Size>(__s + 24),
+ __a,
+ __b);
+ }
+
+ // Return an 8-byte hash for 33 to 64 bytes.
+ static _Size __hash_len_33_to_64(const char *__s, size_t __len)
+ _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
+ {
+ _Size __z = __loadword<_Size>(__s + 24);
+ _Size __a = __loadword<_Size>(__s) +
+ (__len + __loadword<_Size>(__s + __len - 16)) * __k0;
+ _Size __b = __rotate(__a + __z, 52);
+ _Size __c = __rotate(__a, 37);
+ __a += __loadword<_Size>(__s + 8);
+ __c += __rotate(__a, 7);
+ __a += __loadword<_Size>(__s + 16);
+ _Size __vf = __a + __z;
+ _Size __vs = __b + __rotate(__a, 31) + __c;
+ __a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
+ __z += __loadword<_Size>(__s + __len - 8);
+ __b = __rotate(__a + __z, 52);
+ __c = __rotate(__a, 37);
+ __a += __loadword<_Size>(__s + __len - 24);
+ __c += __rotate(__a, 7);
+ __a += __loadword<_Size>(__s + __len - 16);
+ _Size __wf = __a + __z;
+ _Size __ws = __b + __rotate(__a, 31) + __c;
+ _Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
+ return __shift_mix(__r * __k0 + __vs) * __k2;
+ }
+};
+
+// cityhash64
+template <class _Size>
+_Size
+__murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
+{
+ const char* __s = static_cast<const char*>(__key);
+ if (__len <= 32) {
+ if (__len <= 16) {
+ return __hash_len_0_to_16(__s, __len);
+ } else {
+ return __hash_len_17_to_32(__s, __len);
+ }
+ } else if (__len <= 64) {
+ return __hash_len_33_to_64(__s, __len);
+ }
+
+ // For strings over 64 bytes we hash the end first, and then as we
+ // loop we keep 56 bytes of state: v, w, x, y, and z.
+ _Size __x = __loadword<_Size>(__s + __len - 40);
+ _Size __y = __loadword<_Size>(__s + __len - 16) +
+ __loadword<_Size>(__s + __len - 56);
+ _Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
+ __loadword<_Size>(__s + __len - 24));
+ pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
+ pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
+ __x = __x * __k1 + __loadword<_Size>(__s);
+
+ // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
+ __len = (__len - 1) & ~static_cast<_Size>(63);
+ do {
+ __x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
+ __y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
+ __x ^= __w.second;
+ __y += __v.first + __loadword<_Size>(__s + 40);
+ __z = __rotate(__z + __w.first, 33) * __k1;
+ __v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
+ __w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
+ __y + __loadword<_Size>(__s + 16));
+ std::swap(__z, __x);
+ __s += 64;
+ __len -= 64;
+ } while (__len != 0);
+ return __hash_len_16(
+ __hash_len_16(__v.first, __w.first) + __shift_mix(__y) * __k1 + __z,
+ __hash_len_16(__v.second, __w.second) + __x);
+}
+
+template <class _Tp, size_t = sizeof(_Tp) / sizeof(size_t)>
+struct __scalar_hash;
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 0>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__a = 0;
+ __u.__t = __v;
+ return __u.__a;
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 1>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __u.__a;
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 2>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 3>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+template <class _Tp>
+struct __scalar_hash<_Tp, 4>
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+struct _PairT {
+ size_t first;
+ size_t second;
+};
+
+_LIBCPP_INLINE_VISIBILITY
+inline size_t __hash_combine(size_t __lhs, size_t __rhs) _NOEXCEPT {
+ typedef __scalar_hash<_PairT> _HashT;
+ const _PairT __p = {__lhs, __rhs};
+ return _HashT()(__p);
+}
+
+template<class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash<_Tp*>
+ : public unary_function<_Tp*, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp* __v) const _NOEXCEPT
+ {
+ union
+ {
+ _Tp* __t;
+ size_t __a;
+ } __u;
+ __u.__t = __v;
+ return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
+ }
+};
+
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<bool>
+ : public unary_function<bool, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char>
+ : public unary_function<char, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<signed char>
+ : public unary_function<signed char, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
+ : public unary_function<unsigned char, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
+ : public unary_function<char16_t, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
+ : public unary_function<char32_t, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
+ : public unary_function<wchar_t, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<short>
+ : public unary_function<short, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
+ : public unary_function<unsigned short, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<int>
+ : public unary_function<int, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
+ : public unary_function<unsigned int, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<long>
+ : public unary_function<long, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
+ : public unary_function<unsigned long, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<long long>
+ : public __scalar_hash<long long>
+{
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
+ : public __scalar_hash<unsigned long long>
+{
+};
+
+#ifndef _LIBCPP_HAS_NO_INT128
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
+ : public __scalar_hash<__int128_t>
+{
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
+ : public __scalar_hash<__uint128_t>
+{
+};
+
+#endif
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<float>
+ : public __scalar_hash<float>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(float __v) const _NOEXCEPT
+ {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0)
+ return 0;
+ return __scalar_hash<float>::operator()(__v);
+ }
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<double>
+ : public __scalar_hash<double>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(double __v) const _NOEXCEPT
+ {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0)
+ return 0;
+ return __scalar_hash<double>::operator()(__v);
+ }
+};
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<long double>
+ : public __scalar_hash<long double>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(long double __v) const _NOEXCEPT
+ {
+ // -0.0 and 0.0 should return same hash
+ if (__v == 0)
+ return 0;
+#if defined(__i386__)
+ // Zero out padding bits
+ union
+ {
+ long double __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ size_t __c;
+ size_t __d;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__s.__c = 0;
+ __u.__s.__d = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
+#elif defined(__x86_64__)
+ // Zero out padding bits
+ union
+ {
+ long double __t;
+ struct
+ {
+ size_t __a;
+ size_t __b;
+ } __s;
+ } __u;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__t = __v;
+ return __u.__s.__a ^ __u.__s.__b;
+#else
+ return __scalar_hash<long double>::operator()(__v);
+#endif
+ }
+};
+
+#if _LIBCPP_STD_VER > 11
+
+template <class _Tp, bool = is_enum<_Tp>::value>
+struct _LIBCPP_TEMPLATE_VIS __enum_hash
+ : public unary_function<_Tp, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(_Tp __v) const _NOEXCEPT
+ {
+ typedef typename underlying_type<_Tp>::type type;
+ return hash<type>{}(static_cast<type>(__v));
+ }
+};
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
+ __enum_hash() = delete;
+ __enum_hash(__enum_hash const&) = delete;
+ __enum_hash& operator=(__enum_hash const&) = delete;
+};
+
+template <class _Tp>
+struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
+{
+};
+#endif
+
+#if _LIBCPP_STD_VER > 14
+
+template <>
+struct _LIBCPP_TEMPLATE_VIS hash<nullptr_t>
+ : public unary_function<nullptr_t, size_t>
+{
+ _LIBCPP_INLINE_VISIBILITY
+ size_t operator()(nullptr_t) const _NOEXCEPT {
+ return 662607004ull;
+ }
+};
+#endif
+
+#ifndef _LIBCPP_CXX03_LANG
+template <class _Key, class _Hash>
+using __check_hash_requirements = integral_constant<bool,
+ is_copy_constructible<_Hash>::value &&
+ is_move_constructible<_Hash>::value &&
+ __invokable_r<size_t, _Hash, _Key const&>::value
+>;
+
+template <class _Key, class _Hash = std::hash<_Key> >
+using __has_enabled_hash = integral_constant<bool,
+ __check_hash_requirements<_Key, _Hash>::value &&
+ is_default_constructible<_Hash>::value
+>;
+
+#if _LIBCPP_STD_VER > 14
+template <class _Type, class>
+using __enable_hash_helper_imp = _Type;
+
+template <class _Type, class ..._Keys>
+using __enable_hash_helper = __enable_hash_helper_imp<_Type,
+ typename enable_if<__all<__has_enabled_hash<_Keys>::value...>::value>::type
+>;
+#else
+template <class _Type, class ...>
+using __enable_hash_helper = _Type;
+#endif
+
+#endif // !_LIBCPP_CXX03_LANG
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_UTILITY
diff --git a/contrib/libc++/include/valarray b/contrib/libc++/include/valarray
index f0f1f62..ee61238 100644
--- a/contrib/libc++/include/valarray
+++ b/contrib/libc++/include/valarray
@@ -347,12 +347,14 @@ template <class T> unspecified2 end(const valarray<T>& v);
#include <functional>
#include <new>
-#include <__undef_min_max>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TEMPLATE_VIS valarray;
@@ -807,13 +809,11 @@ public:
valarray(const value_type& __x, size_t __n);
valarray(const value_type* __p, size_t __n);
valarray(const valarray& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
valarray(valarray&& __v) _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
valarray(initializer_list<value_type> __il);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
valarray(const slice_array<value_type>& __sa);
valarray(const gslice_array<value_type>& __ga);
valarray(const mask_array<value_type>& __ma);
@@ -823,14 +823,12 @@ public:
// assignment:
valarray& operator=(const valarray& __v);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
valarray& operator=(valarray&& __v) _NOEXCEPT;
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
valarray& operator=(initializer_list<value_type>);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
valarray& operator=(const value_type& __x);
_LIBCPP_INLINE_VISIBILITY
@@ -861,32 +859,32 @@ public:
__val_expr<__indirect_expr<const valarray&> > operator[](const gslice& __gs) const;
_LIBCPP_INLINE_VISIBILITY
gslice_array<value_type> operator[](const gslice& __gs);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__val_expr<__indirect_expr<const valarray&> > operator[](gslice&& __gs) const;
_LIBCPP_INLINE_VISIBILITY
gslice_array<value_type> operator[](gslice&& __gs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__val_expr<__mask_expr<const valarray&> > operator[](const valarray<bool>& __vb) const;
_LIBCPP_INLINE_VISIBILITY
mask_array<value_type> operator[](const valarray<bool>& __vb);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__val_expr<__mask_expr<const valarray&> > operator[](valarray<bool>&& __vb) const;
_LIBCPP_INLINE_VISIBILITY
mask_array<value_type> operator[](valarray<bool>&& __vb);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__val_expr<__indirect_expr<const valarray&> > operator[](const valarray<size_t>& __vs) const;
_LIBCPP_INLINE_VISIBILITY
indirect_array<value_type> operator[](const valarray<size_t>& __vs);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__val_expr<__indirect_expr<const valarray&> > operator[](valarray<size_t>&& __vs) const;
_LIBCPP_INLINE_VISIBILITY
indirect_array<value_type> operator[](valarray<size_t>&& __vs);
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
// unary operators:
valarray operator+() const;
@@ -1480,7 +1478,7 @@ public:
__stride_(__stride)
{__init(__start);}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
gslice(size_t __start, const valarray<size_t>& __size,
@@ -1503,7 +1501,7 @@ public:
__stride_(move(__stride))
{__init(__start);}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
// gslice(const gslice&) = default;
// gslice(gslice&&) = default;
@@ -1656,12 +1654,12 @@ private:
__1d_(__gs.__1d_)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
gslice_array(gslice&& __gs, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)),
__1d_(move(__gs.__1d_))
{}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class> friend class valarray;
};
@@ -2353,7 +2351,7 @@ private:
__1d_(__ia)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
indirect_array(valarray<size_t>&& __ia, const valarray<value_type>& __v)
@@ -2361,7 +2359,7 @@ private:
__1d_(move(__ia))
{}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class> friend class valarray;
};
@@ -2572,7 +2570,7 @@ private:
__1d_(__ia)
{}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
__indirect_expr(valarray<size_t>&& __ia, const _RmExpr& __e)
@@ -2580,7 +2578,7 @@ private:
__1d_(move(__ia))
{}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
public:
_LIBCPP_INLINE_VISIBILITY
@@ -2814,7 +2812,7 @@ valarray<_Tp>::valarray(const valarray& __v)
}
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -2825,10 +2823,6 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
__v.__begin_ = __v.__end_ = nullptr;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp>
valarray<_Tp>::valarray(initializer_list<value_type> __il)
: __begin_(0),
@@ -2855,7 +2849,7 @@ valarray<_Tp>::valarray(initializer_list<value_type> __il)
}
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
@@ -2990,7 +2984,7 @@ valarray<_Tp>::operator=(const valarray& __v)
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3005,10 +2999,6 @@ valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
return *this;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp>
inline
valarray<_Tp>&
@@ -3020,7 +3010,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il)
return *this;
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3132,7 +3122,7 @@ valarray<_Tp>::operator[](const gslice& __gs)
return gslice_array<value_type>(__gs, *this);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3150,7 +3140,7 @@ valarray<_Tp>::operator[](gslice&& __gs)
return gslice_array<value_type>(move(__gs), *this);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3168,7 +3158,7 @@ valarray<_Tp>::operator[](const valarray<bool>& __vb)
return mask_array<value_type>(__vb, *this);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3186,7 +3176,7 @@ valarray<_Tp>::operator[](valarray<bool>&& __vb)
return mask_array<value_type>(move(__vb), *this);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3204,7 +3194,7 @@ valarray<_Tp>::operator[](const valarray<size_t>& __vs)
return indirect_array<value_type>(__vs, *this);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp>
inline
@@ -3222,7 +3212,7 @@ valarray<_Tp>::operator[](valarray<size_t>&& __vs)
return indirect_array<value_type>(move(__vs), *this);
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // _LIBCPP_CXX03_LANG
template <class _Tp>
valarray<_Tp>
@@ -4877,4 +4867,6 @@ end(const valarray<_Tp>& __v)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_VALARRAY
diff --git a/contrib/libc++/include/variant b/contrib/libc++/include/variant
index bbd4bf4..f8d3e28 100644
--- a/contrib/libc++/include/variant
+++ b/contrib/libc++/include/variant
@@ -53,16 +53,16 @@ namespace std {
// 20.7.2.4, modifiers
template <class T, class... Args>
- void emplace(Args&&...);
+ T& emplace(Args&&...);
template <class T, class U, class... Args>
- void emplace(initializer_list<U>, Args&&...);
+ T& emplace(initializer_list<U>, Args&&...);
template <size_t I, class... Args>
- void emplace(Args&&...);
+ variant_alternative_t<I, variant>& emplace(Args&&...);
template <size_t I, class U, class... Args>
- void emplace(initializer_list<U>, Args&&...);
+ variant_alternative_t<I, variant>& emplace(initializer_list<U>, Args&&...);
// 20.7.2.5, value status
constexpr bool valueless_by_exception() const noexcept;
@@ -278,7 +278,7 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, const volatile _Tp>
template <size_t _Ip, class... _Types>
struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
- static_assert(_Ip < sizeof...(_Types));
+ static_assert(_Ip < sizeof...(_Types), "Index out of bounds in std::variant_alternative<>");
using type = __type_pack_element<_Ip, _Types...>;
};
@@ -358,7 +358,6 @@ struct __traits {
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(
@@ -425,30 +424,21 @@ struct __base {
constexpr auto __fmatrix =
__make_fmatrix<_Visitor&&,
decltype(_VSTD::forward<_Vs>(__vs).__as_base())...>();
- const size_t __indices[] = {__vs.index()...};
- return __at(__fmatrix, __indices)(_VSTD::forward<_Visitor>(__visitor),
- _VSTD::forward<_Vs>(__vs).__as_base()...);
+ return __at(__fmatrix, __vs.index()...)(
+ _VSTD::forward<_Visitor>(__visitor),
+ _VSTD::forward<_Vs>(__vs).__as_base()...);
}
private:
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
- static constexpr const _Tp& __at_impl(const _Tp& __elem, const size_t*) {
- return __elem;
- }
-
- template <class _Tp, size_t _Np>
- inline _LIBCPP_INLINE_VISIBILITY
- static constexpr auto&& __at_impl(const array<_Tp, _Np>& __elems,
- const size_t* __index) {
- return __at_impl(__elems[*__index], __index + 1);
- }
+ static constexpr const _Tp& __at(const _Tp& __elem) { return __elem; }
- template <class _Tp, size_t _Np, size_t _Ip>
+ template <class _Tp, size_t _Np, typename... _Indices>
inline _LIBCPP_INLINE_VISIBILITY
static constexpr auto&& __at(const array<_Tp, _Np>& __elems,
- const size_t (&__indices)[_Ip]) {
- return __at_impl(__elems, begin(__indices));
+ size_t __index, _Indices... __indices) {
+ return __at(__elems[__index], __indices...);
}
template <class _Fp, class... _Fs>
@@ -466,17 +456,21 @@ private:
return __result{{_VSTD::forward<_Fs>(__fs)...}};
}
- template <class _Fp, class... _Vs, size_t... _Is>
- inline _LIBCPP_INLINE_VISIBILITY
- static constexpr auto __make_dispatch(index_sequence<_Is...>) {
- struct __dispatcher {
- static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
+ template <std::size_t... _Is>
+ struct __dispatcher {
+ template <class _Fp, class... _Vs>
+ 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))...);
- }
- };
- return _VSTD::addressof(__dispatcher::__dispatch);
+ }
+ };
+
+ template <class _Fp, class... _Vs, size_t... _Is>
+ inline _LIBCPP_INLINE_VISIBILITY
+ static constexpr auto __make_dispatch(index_sequence<_Is...>) {
+ return __dispatcher<_Is...>::template __dispatch<_Fp, _Vs...>;
}
template <size_t _Ip, class _Fp, class... _Vs>
@@ -760,9 +754,10 @@ public:
protected:
template <size_t _Ip, class _Tp, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
- static void __construct_alt(__alt<_Ip, _Tp>& __a, _Args&&... __args) {
- ::new (_VSTD::addressof(__a))
+ 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 <class _Rhs>
@@ -872,33 +867,33 @@ public:
template <size_t _Ip, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
- void __emplace(_Args&&... __args) {
+ auto& __emplace(_Args&&... __args) {
this->__destroy();
- this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
+ auto& __res = this->__construct_alt(__access::__base::__get_alt<_Ip>(*this),
_VSTD::forward<_Args>(__args)...);
this->__index = _Ip;
+ return __res;
}
protected:
- template <bool _CopyAssign, size_t _Ip, class _Tp, class _Arg>
+ template <size_t _Ip, class _Tp, class _Arg>
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_constructible_v<_Tp, _Arg> ||
+ !is_nothrow_move_constructible_v<_Tp>>{});
}
}
@@ -915,8 +910,7 @@ protected:
[this](auto& __this_alt, auto&& __that_alt) {
this->__assign_alt(
__this_alt,
- _VSTD::forward<decltype(__that_alt)>(__that_alt).__value,
- is_lvalue_reference<_That>{});
+ _VSTD::forward<decltype(__that_alt)>(__that_alt).__value);
},
*this, _VSTD::forward<_That>(__that));
}
@@ -1016,8 +1010,7 @@ public:
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
@@ -1091,7 +1084,6 @@ class _LIBCPP_TEMPLATE_VIS variant
__all<is_move_constructible_v<_Types>...>::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> {
@@ -1124,6 +1116,8 @@ public:
template <
class _Arg,
enable_if_t<!is_same_v<decay_t<_Arg>, variant>, int> = 0,
+ enable_if_t<!__is_inplace_type<decay_t<_Arg>>::value, int> = 0,
+ enable_if_t<!__is_inplace_index<decay_t<_Arg>>::value, int> = 0,
class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>,
size_t _Ip =
__find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
@@ -1134,7 +1128,7 @@ public:
: __impl(in_place_index<_Ip>, _VSTD::forward<_Arg>(__arg)) {}
template <size_t _Ip, class... _Args,
- enable_if_t<(_Ip < sizeof...(_Types)), int> = 0,
+ class = enable_if_t<(_Ip < sizeof...(_Types)), int>,
class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1214,8 +1208,8 @@ public:
class _Tp = variant_alternative_t<_Ip, variant<_Types...>>,
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
inline _LIBCPP_INLINE_VISIBILITY
- void emplace(_Args&&... __args) {
- __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
+ _Tp& emplace(_Args&&... __args) {
+ return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
}
template <
@@ -1227,8 +1221,8 @@ public:
enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
int> = 0>
inline _LIBCPP_INLINE_VISIBILITY
- void emplace(initializer_list<_Up> __il, _Args&&... __args) {
- __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
+ _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
}
template <
@@ -1238,8 +1232,8 @@ public:
__find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value,
enable_if_t<is_constructible_v<_Tp, _Args...>, int> = 0>
inline _LIBCPP_INLINE_VISIBILITY
- void emplace(_Args&&... __args) {
- __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
+ _Tp& emplace(_Args&&... __args) {
+ return __impl.template __emplace<_Ip>(_VSTD::forward<_Args>(__args)...);
}
template <
@@ -1251,8 +1245,8 @@ public:
enable_if_t<is_constructible_v<_Tp, initializer_list<_Up>&, _Args...>,
int> = 0>
inline _LIBCPP_INLINE_VISIBILITY
- void emplace(initializer_list<_Up> __il, _Args&&... __args) {
- __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
+ _Tp& emplace(initializer_list<_Up> __il, _Args&&... __args) {
+ return __impl.template __emplace<_Ip>(__il, _VSTD::forward<_Args>(__args)...);
}
inline _LIBCPP_INLINE_VISIBILITY
@@ -1529,7 +1523,8 @@ auto swap(variant<_Types...>& __lhs,
}
template <class... _Types>
-struct _LIBCPP_TEMPLATE_VIS hash<variant<_Types...>> {
+struct _LIBCPP_TEMPLATE_VIS hash<
+ __enable_hash_helper<variant<_Types...>, remove_const_t<_Types>...>> {
using argument_type = variant<_Types...>;
using result_type = size_t;
@@ -1542,7 +1537,8 @@ struct _LIBCPP_TEMPLATE_VIS hash<variant<_Types...>> {
: __variant::__visit_alt(
[](const auto& __alt) {
using __alt_type = decay_t<decltype(__alt)>;
- using __value_type = typename __alt_type::__value_type;
+ using __value_type = remove_const_t<
+ typename __alt_type::__value_type>;
return hash<__value_type>{}(__alt.__value);
},
__v);
@@ -1556,7 +1552,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<monostate> {
using result_type = size_t;
inline _LIBCPP_INLINE_VISIBILITY
- result_type operator()(const argument_type&) const {
+ result_type operator()(const argument_type&) const _NOEXCEPT {
return 66740831; // return a fundamentally attractive random value.
}
};
diff --git a/contrib/libc++/include/vector b/contrib/libc++/include/vector
index ded057b..6e9920a 100644
--- a/contrib/libc++/include/vector
+++ b/contrib/libc++/include/vector
@@ -275,14 +275,16 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <__split_buffer>
#include <__functional_base>
-#include <__undef_min_max>
-
#include <__debug>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+
_LIBCPP_BEGIN_NAMESPACE_STD
template <bool>
@@ -308,14 +310,7 @@ __vector_base_common<__b>::__throw_out_of_range() const
_VSTD::__throw_out_of_range("vector");
}
-#ifdef _LIBCPP_MSVC
-#pragma warning( push )
-#pragma warning( disable: 4231 )
-#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __vector_base_common<true>)
-#ifdef _LIBCPP_MSVC
-#pragma warning( pop )
-#endif // _LIBCPP_MSVC
template <class _Tp, class _Allocator>
class __vector_base
@@ -413,8 +408,10 @@ inline _LIBCPP_INLINE_VISIBILITY
void
__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
{
- while (__new_last != __end_)
- __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
+ pointer __soon_to_be_end = __end_;
+ while (__new_last != __soon_to_be_end)
+ __alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__soon_to_be_end));
+ __end_ = __new_last;
}
template <class _Tp, class _Allocator>
@@ -525,12 +522,7 @@ public:
is_constructible<
value_type,
typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
- _LIBCPP_INLINE_VISIBILITY
- vector(initializer_list<value_type> __il);
- _LIBCPP_INLINE_VISIBILITY
- vector(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY
~vector()
@@ -543,7 +535,14 @@ public:
vector(const vector& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(const vector& __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_CXX03_LANG
+ _LIBCPP_INLINE_VISIBILITY
+ vector(initializer_list<value_type> __il);
+
+ _LIBCPP_INLINE_VISIBILITY
+ vector(initializer_list<value_type> __il, const allocator_type& __a);
+
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x)
#if _LIBCPP_STD_VER > 14
@@ -551,17 +550,18 @@ public:
#else
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
#endif
+
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#endif // !_LIBCPP_CXX03_LANG
template <class _InputIterator>
typename enable_if
@@ -586,11 +586,12 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const_reference __u);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
_LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT
@@ -674,9 +675,10 @@ public:
{return _VSTD::__to_raw_pointer(this->__begin_);}
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
-#ifndef _LIBCPP_HAS_NO_VARIADICS
+
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_STD_VER > 14
@@ -684,19 +686,19 @@ public:
#else
void emplace_back(_Args&&... __args);
#endif
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
+
_LIBCPP_INLINE_VISIBILITY
void pop_back();
iterator insert(const_iterator __position, const_reference __x);
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+
+#ifndef _LIBCPP_CXX03_LANG
iterator insert(const_iterator __position, value_type&& __x);
-#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
iterator emplace(const_iterator __position, _Args&&... __args);
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
+
iterator insert(const_iterator __position, size_type __n, const_reference __x);
template <class _InputIterator>
typename enable_if
@@ -719,11 +721,12 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
@@ -796,18 +799,16 @@ private:
__base::__destruct_at_end(__new_last);
__annotate_shrink(__old_size);
}
- template <class _Up>
- void
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- __push_back_slow_path(_Up&& __x);
-#else
- __push_back_slow_path(_Up& __x);
-#endif
-#if !defined(_LIBCPP_HAS_NO_VARIADICS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
+
+#ifndef _LIBCPP_CXX03_LANG
+ template <class _Up> void __push_back_slow_path(_Up&& __x);
+
template <class... _Args>
- void
- __emplace_back_slow_path(_Args&&... __args);
+ void __emplace_back_slow_path(_Args&&... __args);
+#else
+ template <class _Up> void __push_back_slow_path(_Up& __x);
#endif
+
// The following functions are no-ops outside of AddressSanitizer mode.
// We call annotatations only for the default Allocator because other allocators
// may not meet the AddressSanitizer alignment constraints.
@@ -1217,7 +1218,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
}
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1264,8 +1265,6 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
}
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
@@ -1295,8 +1294,6 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
}
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
@@ -1338,7 +1335,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
#endif
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1560,7 +1557,7 @@ vector<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
template <class _Tp, class _Allocator>
template <class _Up>
void
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
vector<_Tp, _Allocator>::__push_back_slow_path(_Up&& __x)
#else
vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
@@ -1591,7 +1588,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
__push_back_slow_path(__x);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -1611,8 +1608,6 @@ vector<_Tp, _Allocator>::push_back(value_type&& __x)
__push_back_slow_path(_VSTD::move(__x));
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Allocator>
template <class... _Args>
void
@@ -1652,8 +1647,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
inline
@@ -1758,7 +1752,7 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
return __make_iter(__p);
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
@@ -1797,8 +1791,6 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
return __make_iter(__p);
}
-#ifndef _LIBCPP_HAS_NO_VARIADICS
-
template <class _Tp, class _Allocator>
template <class... _Args>
typename vector<_Tp, _Allocator>::iterator
@@ -1838,8 +1830,7 @@ vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
return __make_iter(__p);
}
-#endif // _LIBCPP_HAS_NO_VARIADICS
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
template <class _Tp, class _Allocator>
typename vector<_Tp, _Allocator>::iterator
@@ -2036,7 +2027,7 @@ vector<_Tp, _Allocator>::swap(vector& __x)
_VSTD::swap(this->__begin_, __x.__begin_);
_VSTD::swap(this->__end_, __x.__end_);
_VSTD::swap(this->__end_cap(), __x.__end_cap());
- __swap_allocator(this->__alloc(), __x.__alloc(),
+ __swap_allocator(this->__alloc(), __x.__alloc(),
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->swap(this, &__x);
@@ -2231,12 +2222,11 @@ public:
vector(const vector& __v);
vector(const vector& __v, const allocator_type& __a);
vector& operator=(const vector& __v);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
vector(initializer_list<value_type> __il);
vector(initializer_list<value_type> __il, const allocator_type& __a);
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
vector(vector&& __v)
#if _LIBCPP_STD_VER > 14
@@ -2248,12 +2238,12 @@ public:
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __v)
_NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
_LIBCPP_INLINE_VISIBILITY
vector& operator=(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end()); return *this;}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#endif // !_LIBCPP_CXX03_LANG
template <class _InputIterator>
typename enable_if
@@ -2272,11 +2262,12 @@ public:
assign(_ForwardIterator __first, _ForwardIterator __last);
void assign(size_type __n, const value_type& __x);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
void assign(initializer_list<value_type> __il)
{assign(__il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
_LIBCPP_INLINE_VISIBILITY allocator_type get_allocator() const _NOEXCEPT
{return allocator_type(this->__alloc());}
@@ -2385,11 +2376,12 @@ public:
iterator
>::type
insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last);
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+
+#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __position, initializer_list<value_type> __il)
{return insert(__position, __il.begin(), __il.end());}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif
_LIBCPP_INLINE_VISIBILITY iterator erase(const_iterator __position);
iterator erase(const_iterator __first, const_iterator __last);
@@ -2749,7 +2741,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
}
}
-#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#ifndef _LIBCPP_CXX03_LANG
template <class _Allocator>
vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
@@ -2779,7 +2771,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
}
}
-#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#endif // _LIBCPP_CXX03_LANG
template <class _Allocator>
vector<bool, _Allocator>::~vector()
@@ -2836,7 +2828,7 @@ vector<bool, _Allocator>::operator=(const vector& __v)
return *this;
}
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#ifndef _LIBCPP_CXX03_LANG
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2911,7 +2903,7 @@ vector<bool, _Allocator>::__move_assign(vector& __c, true_type)
__c.__cap() = __c.__size_ = 0;
}
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+#endif // !_LIBCPP_CXX03_LANG
template <class _Allocator>
void
@@ -3201,7 +3193,7 @@ vector<bool, _Allocator>::swap(vector& __x)
_VSTD::swap(this->__begin_, __x.__begin_);
_VSTD::swap(this->__size_, __x.__size_);
_VSTD::swap(this->__cap(), __x.__cap());
- __swap_allocator(this->__alloc(), __x.__alloc(),
+ __swap_allocator(this->__alloc(), __x.__alloc(),
integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
}
@@ -3360,4 +3352,6 @@ swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
_LIBCPP_END_NAMESPACE_STD
+_LIBCPP_POP_MACROS
+
#endif // _LIBCPP_VECTOR
diff --git a/contrib/libc++/include/wchar.h b/contrib/libc++/include/wchar.h
index c0c6ef7..a5666e1 100644
--- a/contrib/libc++/include/wchar.h
+++ b/contrib/libc++/include/wchar.h
@@ -166,9 +166,12 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD
}
#endif
-#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
-extern "C++" {
-#include <support/win32/support.h> // pull in *swprintf defines
+#if defined(__cplusplus) && defined(_LIBCPP_MSVCRT_LIKE)
+extern "C" {
+size_t mbsnrtowcs(wchar_t *__restrict dst, const char **__restrict src,
+ size_t nmc, size_t len, mbstate_t *__restrict ps);
+size_t wcsnrtombs(char *__restrict dst, const wchar_t **__restrict src,
+ size_t nwc, size_t len, mbstate_t *__restrict ps);
} // extern "C++"
#endif // __cplusplus && _LIBCPP_MSVCRT
diff --git a/contrib/libc++/src/chrono.cpp b/contrib/libc++/src/chrono.cpp
index 9b277a6..d0e184a 100644
--- a/contrib/libc++/src/chrono.cpp
+++ b/contrib/libc++/src/chrono.cpp
@@ -37,7 +37,7 @@
#if defined(_LIBCPP_WIN32API)
#define WIN32_LEAN_AND_MEAN
#define VC_EXTRA_LEAN
-#include <Windows.h>
+#include <windows.h>
#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
#include <winapifamily.h>
#endif
diff --git a/contrib/libc++/src/condition_variable.cpp b/contrib/libc++/src/condition_variable.cpp
index 25e6603..2200aef 100644
--- a/contrib/libc++/src/condition_variable.cpp
+++ b/contrib/libc++/src/condition_variable.cpp
@@ -14,7 +14,7 @@
#include "condition_variable"
#include "thread"
#include "system_error"
-#include "cassert"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/libc++/src/exception.cpp b/contrib/libc++/src/exception.cpp
index f25041d..4359d12 100644
--- a/contrib/libc++/src/exception.cpp
+++ b/contrib/libc++/src/exception.cpp
@@ -6,328 +6,31 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include <stdlib.h>
-#include <stdio.h>
#include "exception"
#include "new"
+#include "typeinfo"
-#if defined(_LIBCPP_ABI_MICROSOFT)
-#include <eh.h>
-#include <corecrt_terminate.h>
-#elif defined(__APPLE__) && !defined(LIBCXXRT) && \
- !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
+#if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI) || \
+ (defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY))
#include <cxxabi.h>
-
using namespace __cxxabiv1;
#define HAVE_DEPENDENT_EH_ABI 1
- #ifndef _LIBCPPABI_VERSION
- using namespace __cxxabiapple;
- // On Darwin, there are two STL shared libraries and a lower level ABI
- // shared library. The globals holding the current terminate handler and
- // current unexpected handler are in the ABI library.
- #define __terminate_handler __cxxabiapple::__cxa_terminate_handler
- #define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
- #endif // _LIBCPPABI_VERSION
-#elif defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
- #include <cxxabi.h>
- using namespace __cxxabiv1;
- #if defined(LIBCXXRT) || defined(_LIBCPPABI_VERSION)
- #define HAVE_DEPENDENT_EH_ABI 1
- #endif
-#elif !defined(__GLIBCXX__) // defined(LIBCXX_BUILDING_LIBCXXABI)
- _LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
- _LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
-#endif // defined(LIBCXX_BUILDING_LIBCXXABI)
-
-namespace std
-{
-
-#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
-
-// libcxxrt provides implementations of these functions itself.
-unexpected_handler
-set_unexpected(unexpected_handler func) _NOEXCEPT
-{
-#if defined(_LIBCPP_ABI_MICROSOFT)
- return ::set_unexpected(func);
-#else
- return __sync_lock_test_and_set(&__unexpected_handler, func);
-#endif
-}
-
-unexpected_handler
-get_unexpected() _NOEXCEPT
-{
-#if defined(_LIBCPP_ABI_MICROSOFT)
- return ::_get_unexpected();
-#else
- return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
-#endif
-}
-
-_LIBCPP_NORETURN
-void
-unexpected()
-{
- (*get_unexpected())();
- // unexpected handler should not return
- terminate();
-}
-
-terminate_handler
-set_terminate(terminate_handler func) _NOEXCEPT
-{
-#if defined(_LIBCPP_ABI_MICROSOFT)
- return ::set_terminate(func);
-#else
- return __sync_lock_test_and_set(&__terminate_handler, func);
#endif
-}
-terminate_handler
-get_terminate() _NOEXCEPT
-{
#if defined(_LIBCPP_ABI_MICROSOFT)
- return ::_get_terminate();
-#else
- return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
-#endif
-}
-
-#ifndef __EMSCRIPTEN__ // We provide this in JS
-_LIBCPP_NORETURN
-void
-terminate() _NOEXCEPT
-{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- try
- {
-#endif // _LIBCPP_NO_EXCEPTIONS
- (*get_terminate())();
- // handler should not return
- fprintf(stderr, "terminate_handler unexpectedly returned\n");
- ::abort();
-#ifndef _LIBCPP_NO_EXCEPTIONS
- }
- catch (...)
- {
- // handler should not throw exception
- fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
- ::abort();
- }
-#endif // _LIBCPP_NO_EXCEPTIONS
-}
-#endif // !__EMSCRIPTEN__
-#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
-
-#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
-
-bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
-
-int uncaught_exceptions() _NOEXCEPT
-{
-#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
- (defined(__APPLE__) || defined(_LIBCPPABI_VERSION))
- // on Darwin, there is a helper function so __cxa_get_globals is private
-# if _LIBCPPABI_VERSION > 1101
- return __cxa_uncaught_exceptions();
-# else
- return __cxa_uncaught_exception() ? 1 : 0;
-# endif
-#elif defined(_LIBCPP_ABI_MICROSOFT)
- return __uncaught_exceptions();
-#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("uncaught_exceptions not yet implemented")
-# else
-# warning uncaught_exception not yet implemented
-# endif
- fprintf(stderr, "uncaught_exceptions not yet implemented\n");
- ::abort();
-#endif // __APPLE__
-}
-
-
-#ifndef _LIBCPPABI_VERSION
-
-exception::~exception() _NOEXCEPT
-{
-}
-
-const char* exception::what() const _NOEXCEPT
-{
- return "std::exception";
-}
-
-#endif // _LIBCPPABI_VERSION
-#endif //LIBCXXRT
-#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
-
-bad_exception::~bad_exception() _NOEXCEPT
-{
-}
-
-const char* bad_exception::what() const _NOEXCEPT
-{
- return "std::bad_exception";
-}
-
-#endif
-
-#if defined(__GLIBCXX__)
-
-// libsupc++ does not implement the dependent EH ABI and the functionality
-// it uses to implement std::exception_ptr (which it declares as an alias of
-// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
-// we have little choice but to hijack std::__exception_ptr::exception_ptr's
-// (which fortunately has the same layout as our std::exception_ptr) copy
-// constructor, assignment operator and destructor (which are part of its
-// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
-// function.
-
-namespace __exception_ptr
-{
-
-struct exception_ptr
-{
- void* __ptr_;
-
- exception_ptr(const exception_ptr&) _NOEXCEPT;
- exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
- ~exception_ptr() _NOEXCEPT;
-};
-
-}
-
-_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
-
-#endif
-
-exception_ptr::~exception_ptr() _NOEXCEPT
-{
-#if HAVE_DEPENDENT_EH_ABI
- __cxa_decrement_exception_refcount(__ptr_);
-#elif defined(__GLIBCXX__)
- reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
-#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("exception_ptr not yet implemented")
-# else
-# warning exception_ptr not yet implemented
-# endif
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
-#endif
-}
-
-exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
- : __ptr_(other.__ptr_)
-{
-#if HAVE_DEPENDENT_EH_ABI
- __cxa_increment_exception_refcount(__ptr_);
-#elif defined(__GLIBCXX__)
- new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
- reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
-#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("exception_ptr not yet implemented")
-# else
-# warning exception_ptr not yet implemented
-# endif
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
-#endif
-}
-
-exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
-{
-#if HAVE_DEPENDENT_EH_ABI
- if (__ptr_ != other.__ptr_)
- {
- __cxa_increment_exception_refcount(other.__ptr_);
- __cxa_decrement_exception_refcount(__ptr_);
- __ptr_ = other.__ptr_;
- }
- return *this;
-#elif defined(__GLIBCXX__)
- *reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
- reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
- return *this;
-#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("exception_ptr not yet implemented")
-# else
-# warning exception_ptr not yet implemented
-# endif
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
-#endif
-}
-
-nested_exception::nested_exception() _NOEXCEPT
- : __ptr_(current_exception())
-{
-}
-
-#if !defined(__GLIBCXX__)
-
-nested_exception::~nested_exception() _NOEXCEPT
-{
-}
-
-#endif
-
-_LIBCPP_NORETURN
-void
-nested_exception::rethrow_nested() const
-{
- if (__ptr_ == nullptr)
- terminate();
- rethrow_exception(__ptr_);
-}
-
-#if !defined(__GLIBCXX__)
-
-exception_ptr current_exception() _NOEXCEPT
-{
-#if HAVE_DEPENDENT_EH_ABI
- // be nicer if there was a constructor that took a ptr, then
- // this whole function would be just:
- // return exception_ptr(__cxa_current_primary_exception());
- exception_ptr ptr;
- ptr.__ptr_ = __cxa_current_primary_exception();
- return ptr;
-#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING( "exception_ptr not yet implemented" )
-# else
-# warning exception_ptr not yet implemented
-# endif
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
-#endif
-}
-
-#endif // !__GLIBCXX__
-
-_LIBCPP_NORETURN
-void rethrow_exception(exception_ptr p)
-{
-#if HAVE_DEPENDENT_EH_ABI
- __cxa_rethrow_primary_exception(p.__ptr_);
- // if p.__ptr_ is NULL, above returns so we terminate
- terminate();
+#include "support/runtime/exception_msvc.ipp"
+#include "support/runtime/exception_pointer_msvc.ipp"
+#elif defined(_LIBCPPABI_VERSION)
+#include "support/runtime/exception_libcxxabi.ipp"
+#include "support/runtime/exception_pointer_cxxabi.ipp"
+#elif defined(LIBCXXRT)
+#include "support/runtime/exception_libcxxrt.ipp"
+#include "support/runtime/exception_pointer_cxxabi.ipp"
#elif defined(__GLIBCXX__)
- rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
+#include "support/runtime/exception_glibcxx.ipp"
+#include "support/runtime/exception_pointer_glibcxx.ipp"
#else
-# if defined(_MSC_VER) && ! defined(__clang__)
- _LIBCPP_WARNING("exception_ptr not yet implemented")
-# else
-# warning exception_ptr not yet implemented
-# endif
- fprintf(stderr, "exception_ptr not yet implemented\n");
- ::abort();
+#include "support/runtime/exception_fallback.ipp"
+#include "support/runtime/exception_pointer_unimplemented.ipp"
#endif
-}
-} // std
diff --git a/contrib/libc++/src/experimental/filesystem/directory_iterator.cpp b/contrib/libc++/src/experimental/filesystem/directory_iterator.cpp
index a888dcf..2513585 100644
--- a/contrib/libc++/src/experimental/filesystem/directory_iterator.cpp
+++ b/contrib/libc++/src/experimental/filesystem/directory_iterator.cpp
@@ -1,28 +1,32 @@
+//===------------------ directory_iterator.cpp ----------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
#include "experimental/filesystem"
+#include "__config"
+#if defined(_LIBCPP_WIN32API)
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#else
#include <dirent.h>
+#endif
#include <errno.h>
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
namespace { namespace detail {
+#if !defined(_LIBCPP_WIN32API)
inline error_code capture_errno() {
_LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
return error_code{errno, std::generic_category()};
}
-
-template <class ...Args>
-inline bool capture_error_or_throw(std::error_code* user_ec,
- const char* msg, Args&&... args)
-{
- std::error_code my_ec = capture_errno();
- if (user_ec) {
- *user_ec = my_ec;
- return true;
- }
- __throw_filesystem_error(msg, std::forward<Args>(args)..., my_ec);
- return false;
-}
+#endif
template <class ...Args>
inline bool set_or_throw(std::error_code& my_ec,
@@ -37,25 +41,87 @@ inline bool set_or_throw(std::error_code& my_ec,
return false;
}
-typedef path::string_type string_type;
-
-
-inline string_type posix_readdir(DIR *dir_stream, error_code& ec) {
+#if !defined(_LIBCPP_WIN32API)
+inline path::string_type posix_readdir(DIR *dir_stream, error_code& ec) {
struct dirent* dir_entry_ptr = nullptr;
errno = 0; // zero errno in order to detect errors
+ ec.clear();
if ((dir_entry_ptr = ::readdir(dir_stream)) == nullptr) {
- ec = capture_errno();
+ if (errno)
+ ec = capture_errno();
return {};
} else {
- ec.clear();
return dir_entry_ptr->d_name;
}
}
+#endif
}} // namespace detail
using detail::set_or_throw;
+#if defined(_LIBCPP_WIN32API)
+class __dir_stream {
+public:
+ __dir_stream() = delete;
+ __dir_stream& operator=(const __dir_stream&) = delete;
+
+ __dir_stream(__dir_stream&& __ds) noexcept
+ : __stream_(__ds.__stream_), __root_(std::move(__ds.__root_)),
+ __entry_(std::move(__ds.__entry_)) {
+ __ds.__stream_ = INVALID_HANDLE_VALUE;
+ }
+
+ __dir_stream(const path& root, directory_options opts, error_code& ec)
+ : __stream_(INVALID_HANDLE_VALUE), __root_(root) {
+ __stream_ = ::FindFirstFile(root.c_str(), &__data_);
+ if (__stream_ == INVALID_HANDLE_VALUE) {
+ ec = error_code(::GetLastError(), std::generic_category());
+ const bool ignore_permission_denied =
+ bool(opts & directory_options::skip_permission_denied);
+ if (ignore_permission_denied && ec.value() == ERROR_ACCESS_DENIED)
+ ec.clear();
+ return;
+ }
+ }
+
+ ~__dir_stream() noexcept {
+ if (__stream_ == INVALID_HANDLE_VALUE)
+ return;
+ close();
+ }
+
+ bool good() const noexcept { return __stream_ != INVALID_HANDLE_VALUE; }
+
+ bool advance(error_code& ec) {
+ while (::FindNextFile(__stream_, &__data_)) {
+ if (!strcmp(__data_.cFileName, ".") || strcmp(__data_.cFileName, ".."))
+ continue;
+ __entry_.assign(__root_ / __data_.cFileName);
+ return true;
+ }
+ ec = error_code(::GetLastError(), std::generic_category());
+ close();
+ return false;
+ }
+
+private:
+ std::error_code close() noexcept {
+ std::error_code ec;
+ if (!::FindClose(__stream_))
+ ec = error_code(::GetLastError(), std::generic_category());
+ __stream_ = INVALID_HANDLE_VALUE;
+ return ec;
+ }
+
+ HANDLE __stream_{INVALID_HANDLE_VALUE};
+ WIN32_FIND_DATA __data_;
+
+public:
+ path __root_;
+ directory_entry __entry_;
+};
+#else
class __dir_stream {
public:
__dir_stream() = delete;
@@ -117,6 +183,7 @@ public:
path __root_;
directory_entry __entry_;
};
+#endif
// directory_iterator
@@ -149,7 +216,7 @@ directory_iterator& directory_iterator::__increment(error_code *ec)
}
-directory_entry const& directory_iterator::__deref() const {
+directory_entry const& directory_iterator::__dereference() const {
_LIBCPP_ASSERT(__imp_, "Attempting to dereference an invalid iterator");
return __imp_->__entry_;
}
@@ -195,7 +262,7 @@ int recursive_directory_iterator::depth() const {
return __imp_->__stack_.size() - 1;
}
-const directory_entry& recursive_directory_iterator::__deref() const {
+const directory_entry& recursive_directory_iterator::__dereference() const {
return __imp_->__stack_.top().__entry_;
}
diff --git a/contrib/libc++/src/experimental/filesystem/filesystem_time_helper.h b/contrib/libc++/src/experimental/filesystem/filesystem_time_helper.h
new file mode 100644
index 0000000..a60fdef
--- /dev/null
+++ b/contrib/libc++/src/experimental/filesystem/filesystem_time_helper.h
@@ -0,0 +1,173 @@
+//===----------------------------------------------------------------------===////
+//
+// 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 FILESYSTEM_TIME_HELPER_H
+#define FILESYSTEM_TIME_HELPER_H
+
+#include "experimental/__config"
+#include "chrono"
+#include "cstdlib"
+#include "climits"
+
+#include <unistd.h>
+#include <sys/stat.h>
+#if !defined(UTIME_OMIT)
+#include <sys/time.h> // for ::utimes as used in __last_write_time
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_FILESYSTEM
+
+namespace time_detail { namespace {
+
+using namespace chrono;
+
+template <class FileTimeT,
+ bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
+struct fs_time_util_base {
+ static constexpr auto max_seconds =
+ duration_cast<seconds>(FileTimeT::duration::max()).count();
+
+ static constexpr auto max_nsec =
+ duration_cast<nanoseconds>(FileTimeT::duration::max() -
+ seconds(max_seconds))
+ .count();
+
+ static constexpr auto min_seconds =
+ duration_cast<seconds>(FileTimeT::duration::min()).count();
+
+ static constexpr auto min_nsec_timespec =
+ duration_cast<nanoseconds>(
+ (FileTimeT::duration::min() - seconds(min_seconds)) + seconds(1))
+ .count();
+
+ // Static assert that these values properly round trip.
+ static_assert((seconds(min_seconds) +
+ duration_cast<microseconds>(nanoseconds(min_nsec_timespec))) -
+ duration_cast<microseconds>(seconds(1)) ==
+ FileTimeT::duration::min(),
+ "");
+};
+
+template <class FileTimeT>
+struct fs_time_util_base<FileTimeT, true> {
+ static const long long max_seconds;
+ static const long long max_nsec;
+ static const long long min_seconds;
+ static const long long min_nsec_timespec;
+};
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::max_seconds =
+ duration_cast<seconds>(FileTimeT::duration::max()).count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::max_nsec =
+ duration_cast<nanoseconds>(FileTimeT::duration::max() -
+ seconds(max_seconds))
+ .count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::min_seconds =
+ duration_cast<seconds>(FileTimeT::duration::min()).count();
+
+template <class FileTimeT>
+const long long fs_time_util_base<FileTimeT, true>::min_nsec_timespec =
+ duration_cast<nanoseconds>((FileTimeT::duration::min() -
+ seconds(min_seconds)) +
+ seconds(1))
+ .count();
+
+template <class FileTimeT, class TimeT, class TimeSpecT>
+struct fs_time_util : fs_time_util_base<FileTimeT> {
+ using Base = fs_time_util_base<FileTimeT>;
+ using Base::max_nsec;
+ using Base::max_seconds;
+ using Base::min_nsec_timespec;
+ using Base::min_seconds;
+
+public:
+ template <class CType, class ChronoType>
+ static bool checked_set(CType* out, ChronoType time) {
+ using Lim = numeric_limits<CType>;
+ if (time > Lim::max() || time < Lim::min())
+ return false;
+ *out = static_cast<CType>(time);
+ return true;
+ }
+
+ static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(TimeSpecT tm) {
+ if (tm.tv_sec >= 0) {
+ return (tm.tv_sec < max_seconds) ||
+ (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
+ } else if (tm.tv_sec == (min_seconds - 1)) {
+ return tm.tv_nsec >= min_nsec_timespec;
+ } else {
+ return (tm.tv_sec >= min_seconds);
+ }
+ }
+
+ static _LIBCPP_CONSTEXPR_AFTER_CXX11 bool is_representable(FileTimeT tm) {
+ auto secs = duration_cast<seconds>(tm.time_since_epoch());
+ auto nsecs = duration_cast<nanoseconds>(tm.time_since_epoch() - secs);
+ if (nsecs.count() < 0) {
+ secs = secs + seconds(1);
+ nsecs = nsecs + seconds(1);
+ }
+ using TLim = numeric_limits<TimeT>;
+ if (secs.count() >= 0)
+ return secs.count() <= TLim::max();
+ return secs.count() >= TLim::min();
+ }
+
+ static _LIBCPP_CONSTEXPR_AFTER_CXX11 FileTimeT
+ convert_timespec(TimeSpecT tm) {
+ auto adj_msec = duration_cast<microseconds>(nanoseconds(tm.tv_nsec));
+ if (tm.tv_sec >= 0) {
+ auto Dur = seconds(tm.tv_sec) + microseconds(adj_msec);
+ return FileTimeT(Dur);
+ } else if (duration_cast<microseconds>(nanoseconds(tm.tv_nsec)).count() ==
+ 0) {
+ return FileTimeT(seconds(tm.tv_sec));
+ } else { // tm.tv_sec < 0
+ auto adj_subsec =
+ duration_cast<microseconds>(seconds(1) - nanoseconds(tm.tv_nsec));
+ auto Dur = seconds(tm.tv_sec + 1) - adj_subsec;
+ return FileTimeT(Dur);
+ }
+ }
+
+ template <class SubSecDurT, class SubSecT>
+ static bool set_times_checked(TimeT* sec_out, SubSecT* subsec_out,
+ FileTimeT tp) {
+ using namespace chrono;
+ auto dur = tp.time_since_epoch();
+ auto sec_dur = duration_cast<seconds>(dur);
+ auto subsec_dur = duration_cast<SubSecDurT>(dur - sec_dur);
+ // The tv_nsec and tv_usec fields must not be negative so adjust accordingly
+ if (subsec_dur.count() < 0) {
+ if (sec_dur.count() > min_seconds) {
+ sec_dur -= seconds(1);
+ subsec_dur += seconds(1);
+ } else {
+ subsec_dur = SubSecDurT::zero();
+ }
+ }
+ return checked_set(sec_out, sec_dur.count()) &&
+ checked_set(subsec_out, subsec_dur.count());
+ }
+};
+
+} // end namespace
+} // end namespace time_detail
+
+using time_detail::fs_time_util;
+
+_LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM
+
+#endif // FILESYSTEM_TIME_HELPER_H
diff --git a/contrib/libc++/src/experimental/filesystem/operations.cpp b/contrib/libc++/src/experimental/filesystem/operations.cpp
index 6c7e4cf..641a3c5 100644
--- a/contrib/libc++/src/experimental/filesystem/operations.cpp
+++ b/contrib/libc++/src/experimental/filesystem/operations.cpp
@@ -15,6 +15,8 @@
#include "cstdlib"
#include "climits"
+#include "filesystem_time_helper.h"
+
#include <unistd.h>
#include <sys/stat.h>
#include <sys/statvfs.h>
@@ -35,12 +37,9 @@ namespace detail { namespace {
using value_type = path::value_type;
using string_type = path::string_type;
-
-
inline std::error_code capture_errno() {
- _LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
- std::error_code m_ec(errno, std::generic_category());
- return m_ec;
+ _LIBCPP_ASSERT(errno, "Expected errno to be non-zero");
+ return std::error_code(errno, std::generic_category());
}
void set_or_throw(std::error_code const& m_ec, std::error_code* ec,
@@ -429,17 +428,20 @@ void __current_path(const path& p, std::error_code *ec) {
bool __equivalent(const path& p1, const path& p2, std::error_code *ec)
{
+ auto make_unsupported_error = [&]() {
+ set_or_throw(make_error_code(errc::not_supported), ec,
+ "equivalent", p1, p2);
+ return false;
+ };
std::error_code ec1, ec2;
struct ::stat st1 = {};
struct ::stat st2 = {};
auto s1 = detail::posix_stat(p1.native(), st1, &ec1);
+ if (!exists(s1))
+ return make_unsupported_error();
auto s2 = detail::posix_stat(p2.native(), st2, &ec2);
-
- if ((!exists(s1) && !exists(s2)) || (is_other(s1) && is_other(s2))) {
- set_or_throw(make_error_code(errc::not_supported), ec,
- "equivalent", p1, p2);
- return false;
- }
+ if (!exists(s2))
+ return make_unsupported_error();
if (ec) ec->clear();
return (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino);
}
@@ -505,19 +507,8 @@ bool __fs_is_empty(const path& p, std::error_code *ec)
namespace detail { namespace {
-using namespace std::chrono;
-
-template <class CType, class ChronoType>
-bool checked_set(CType* out, ChronoType time) {
- using Lim = numeric_limits<CType>;
- if (time > Lim::max() || time < Lim::min())
- return false;
- *out = static_cast<CType>(time);
- return true;
-}
-
-using TimeSpec = struct ::timespec;
-using StatT = struct ::stat;
+using TimeSpec = struct timespec;
+using StatT = struct stat;
#if defined(__APPLE__)
TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
@@ -528,137 +519,10 @@ __attribute__((unused)) // Suppress warning
TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
#endif
-constexpr auto max_seconds = duration_cast<seconds>(
- file_time_type::duration::max()).count();
-
-constexpr auto max_nsec = duration_cast<nanoseconds>(
- file_time_type::duration::max() - seconds(max_seconds)).count();
-
-constexpr auto min_seconds = duration_cast<seconds>(
- file_time_type::duration::min()).count();
-
-constexpr auto min_nsec_timespec = duration_cast<nanoseconds>(
- (file_time_type::duration::min() - seconds(min_seconds)) + seconds(1)).count();
-
-// Static assert that these values properly round trip.
-static_assert((seconds(min_seconds) + duration_cast<microseconds>(nanoseconds(min_nsec_timespec)))
- - duration_cast<microseconds>(seconds(1))
- == file_time_type::duration::min(), "");
-
-constexpr auto max_time_t = numeric_limits<time_t>::max();
-constexpr auto min_time_t = numeric_limits<time_t>::min();
-
-#if !defined(__LP64__) && defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wtautological-constant-out-of-range-compare"
-#endif
-
-_LIBCPP_CONSTEXPR_AFTER_CXX11
-bool is_representable(TimeSpec const& tm) {
- if (tm.tv_sec >= 0) {
- return (tm.tv_sec < max_seconds) ||
- (tm.tv_sec == max_seconds && tm.tv_nsec <= max_nsec);
- } else if (tm.tv_sec == (min_seconds - 1)) {
- return tm.tv_nsec >= min_nsec_timespec;
- } else {
- return (tm.tv_sec >= min_seconds);
- }
-}
-#ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#if defined(__LP64__)
-static_assert(is_representable({max_seconds, max_nsec}), "");
-static_assert(!is_representable({max_seconds + 1, 0}), "");
-static_assert(!is_representable({max_seconds, max_nsec + 1}), "");
-static_assert(!is_representable({max_time_t, 0}), "");
-static_assert(is_representable({min_seconds, 0}), "");
-static_assert(is_representable({min_seconds - 1, min_nsec_timespec}), "");
-static_assert(is_representable({min_seconds - 1, min_nsec_timespec + 1}), "");
-static_assert(!is_representable({min_seconds - 1, min_nsec_timespec - 1}), "");
-static_assert(!is_representable({min_time_t, 999999999}), "");
-#else
-static_assert(is_representable({max_time_t, 999999999}), "");
-static_assert(is_representable({max_time_t, 1000000000}), "");
-static_assert(is_representable({min_time_t, 0}), "");
-#endif
-#endif
-
-_LIBCPP_CONSTEXPR_AFTER_CXX11
-bool is_representable(file_time_type const& tm) {
- auto secs = duration_cast<seconds>(tm.time_since_epoch());
- auto nsecs = duration_cast<nanoseconds>(tm.time_since_epoch() - secs);
- if (nsecs.count() < 0) {
- secs = secs + seconds(1);
- nsecs = nsecs + seconds(1);
- }
- using TLim = numeric_limits<time_t>;
- if (secs.count() >= 0)
- return secs.count() <= TLim::max();
- return secs.count() >= TLim::min();
-}
-#ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#if defined(__LP64__)
-static_assert(is_representable(file_time_type::max()), "");
-static_assert(is_representable(file_time_type::min()), "");
-#else
-static_assert(!is_representable(file_time_type::max()), "");
-static_assert(!is_representable(file_time_type::min()), "");
-static_assert(is_representable(file_time_type(seconds(max_time_t))), "");
-static_assert(is_representable(file_time_type(seconds(min_time_t))), "");
-#endif
-#endif
-
-_LIBCPP_CONSTEXPR_AFTER_CXX11
-file_time_type convert_timespec(TimeSpec const& tm) {
- auto adj_msec = duration_cast<microseconds>(nanoseconds(tm.tv_nsec));
- if (tm.tv_sec >= 0) {
- auto Dur = seconds(tm.tv_sec) + microseconds(adj_msec);
- return file_time_type(Dur);
- } else if (duration_cast<microseconds>(nanoseconds(tm.tv_nsec)).count() == 0) {
- return file_time_type(seconds(tm.tv_sec));
- } else { // tm.tv_sec < 0
- auto adj_subsec = duration_cast<microseconds>(seconds(1) - nanoseconds(tm.tv_nsec));
- auto Dur = seconds(tm.tv_sec + 1) - adj_subsec;
- return file_time_type(Dur);
- }
-}
-#ifndef _LIBCPP_HAS_NO_CXX14_CONSTEXPR
-#if defined(__LP64__)
-static_assert(convert_timespec({max_seconds, max_nsec}) == file_time_type::max(), "");
-static_assert(convert_timespec({max_seconds, max_nsec - 1}) < file_time_type::max(), "");
-static_assert(convert_timespec({max_seconds - 1, 999999999}) < file_time_type::max(), "");
-static_assert(convert_timespec({min_seconds - 1, min_nsec_timespec}) == file_time_type::min(), "");
-static_assert(convert_timespec({min_seconds - 1, min_nsec_timespec + 1}) > file_time_type::min(), "");
-static_assert(convert_timespec({min_seconds , 0}) > file_time_type::min(), "");
-#else
-// FIXME add tests for 32 bit builds
-#endif
-#endif
-
-#if !defined(__LP64__) && defined(__clang__)
-#pragma clang diagnostic pop
-#endif
-
-template <class SubSecDurT, class SubSecT>
-bool set_times_checked(time_t* sec_out, SubSecT* subsec_out, file_time_type tp) {
- using namespace chrono;
- auto dur = tp.time_since_epoch();
- auto sec_dur = duration_cast<seconds>(dur);
- auto subsec_dur = duration_cast<SubSecDurT>(dur - sec_dur);
- // The tv_nsec and tv_usec fields must not be negative so adjust accordingly
- if (subsec_dur.count() < 0) {
- if (sec_dur.count() > min_seconds) {
- sec_dur -= seconds(1);
- subsec_dur += seconds(1);
- } else {
- subsec_dur = SubSecDurT::zero();
- }
- }
- return checked_set(sec_out, sec_dur.count())
- && checked_set(subsec_out, subsec_dur.count());
-}
-
}} // end namespace detail
+using FSTime = fs_time_util<file_time_type, time_t, struct timespec>;
+
file_time_type __last_write_time(const path& p, std::error_code *ec)
{
using namespace ::std::chrono;
@@ -671,12 +535,12 @@ file_time_type __last_write_time(const path& p, std::error_code *ec)
}
if (ec) ec->clear();
auto ts = detail::extract_mtime(st);
- if (!detail::is_representable(ts)) {
+ if (!FSTime::is_representable(ts)) {
set_or_throw(error_code(EOVERFLOW, generic_category()), ec,
"last_write_time", p);
return file_time_type::min();
}
- return detail::convert_timespec(ts);
+ return FSTime::convert_timespec(ts);
}
void __last_write_time(const path& p, file_time_type new_time,
@@ -701,7 +565,7 @@ void __last_write_time(const path& p, file_time_type new_time,
struct ::timeval tbuf[2];
tbuf[0].tv_sec = atime.tv_sec;
tbuf[0].tv_usec = duration_cast<microseconds>(nanoseconds(atime.tv_nsec)).count();
- const bool overflowed = !detail::set_times_checked<microseconds>(
+ const bool overflowed = !FSTime::set_times_checked<microseconds>(
&tbuf[1].tv_sec, &tbuf[1].tv_usec, new_time);
if (overflowed) {
@@ -717,7 +581,7 @@ void __last_write_time(const path& p, file_time_type new_time,
tbuf[0].tv_sec = 0;
tbuf[0].tv_nsec = UTIME_OMIT;
- const bool overflowed = !detail::set_times_checked<nanoseconds>(
+ const bool overflowed = !FSTime::set_times_checked<nanoseconds>(
&tbuf[1].tv_sec, &tbuf[1].tv_nsec, new_time);
if (overflowed) {
set_or_throw(make_error_code(errc::invalid_argument),
@@ -845,7 +709,7 @@ void __rename(const path& from, const path& to, std::error_code *ec) {
}
void __resize_file(const path& p, std::uintmax_t size, std::error_code *ec) {
- if (::truncate(p.c_str(), static_cast<long>(size)) == -1)
+ if (::truncate(p.c_str(), static_cast<::off_t>(size)) == -1)
set_or_throw(ec, "resize_file", p);
else if (ec)
ec->clear();
@@ -886,23 +750,28 @@ path __system_complete(const path& p, std::error_code *ec) {
return absolute(p, current_path());
}
-path __temp_directory_path(std::error_code *ec) {
- const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
- const char* ret = nullptr;
- for (auto & ep : env_paths) {
- if ((ret = std::getenv(ep)))
- break;
- }
- path p(ret ? ret : "/tmp");
- std::error_code m_ec;
- if (is_directory(p, m_ec)) {
- if (ec) ec->clear();
- return p;
- }
+path __temp_directory_path(std::error_code* ec) {
+ const char* env_paths[] = {"TMPDIR", "TMP", "TEMP", "TEMPDIR"};
+ const char* ret = nullptr;
+
+ for (auto& ep : env_paths)
+ if ((ret = std::getenv(ep)))
+ break;
+ if (ret == nullptr)
+ ret = "/tmp";
+
+ path p(ret);
+ std::error_code m_ec;
+ if (!exists(p, m_ec) || !is_directory(p, m_ec)) {
if (!m_ec || m_ec == make_error_code(errc::no_such_file_or_directory))
- m_ec = make_error_code(errc::not_a_directory);
+ m_ec = make_error_code(errc::not_a_directory);
set_or_throw(m_ec, ec, "temp_directory_path");
return {};
+ }
+
+ if (ec)
+ ec->clear();
+ return p;
}
// An absolute path is composed according to the table in [fs.op.absolute].
diff --git a/contrib/libc++/src/experimental/filesystem/path.cpp b/contrib/libc++/src/experimental/filesystem/path.cpp
index 96b81f7..dd4026c 100644
--- a/contrib/libc++/src/experimental/filesystem/path.cpp
+++ b/contrib/libc++/src/experimental/filesystem/path.cpp
@@ -6,11 +6,9 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#undef NDEBUG
#include "experimental/filesystem"
#include "string_view"
#include "utility"
-#include "cassert"
namespace { namespace parser
{
@@ -58,13 +56,13 @@ public:
}
PosPtr peek() const noexcept {
- auto End = &Path.back() + 1;
auto TkEnd = getNextTokenStartPos();
+ auto End = getAfterBack();
return TkEnd == End ? nullptr : TkEnd;
}
void increment() noexcept {
- const PosPtr End = &Path.back() + 1;
+ const PosPtr End = getAfterBack();
const PosPtr Start = getNextTokenStartPos();
if (Start == End)
return makeState(PS_AtEnd);
@@ -111,9 +109,8 @@ public:
}
void decrement() noexcept {
- const PosPtr REnd = &Path.front() - 1;
+ const PosPtr REnd = getBeforeFront();
const PosPtr RStart = getCurrentTokenStartPos() - 1;
- assert(RStart != REnd);
switch (State) {
case PS_AtEnd: {
@@ -198,19 +195,27 @@ private:
RawEntry = {};
}
+ PosPtr getAfterBack() const noexcept {
+ return Path.data() + Path.size();
+ }
+
+ PosPtr getBeforeFront() const noexcept {
+ return Path.data() - 1;
+ }
+
/// \brief Return a pointer to the first character after the currently
/// lexed element.
PosPtr getNextTokenStartPos() const noexcept {
switch (State) {
case PS_BeforeBegin:
- return &Path.front();
+ return Path.data();
case PS_InRootName:
case PS_InRootDir:
case PS_InFilenames:
return &RawEntry.back() + 1;
case PS_InTrailingSep:
case PS_AtEnd:
- return &Path.back() + 1;
+ return getAfterBack();
}
_LIBCPP_UNREACHABLE();
}
@@ -256,7 +261,8 @@ private:
string_view_pair separate_filename(string_view_t const & s) {
if (s == "." || s == ".." || s.empty()) return string_view_pair{s, ""};
auto pos = s.find_last_of('.');
- if (pos == string_view_t::npos) return string_view_pair{s, string_view{}};
+ if (pos == string_view_t::npos)
+ return string_view_pair{s, string_view_t{}};
return string_view_pair{s.substr(0, pos), s.substr(pos)};
}
@@ -322,7 +328,6 @@ string_view_t path::__root_path_raw() const
auto NextCh = PP.peek();
if (NextCh && *NextCh == '/') {
++PP;
- assert(PP.State == PathParser::PS_InRootDir);
return createView(__pn_.data(), &PP.RawEntry.back());
}
return PP.RawEntry;
@@ -392,7 +397,7 @@ int path::__compare(string_view_t __s) const {
size_t hash_value(const path& __p) noexcept {
auto PP = PathParser::CreateBegin(__p.native());
size_t hash_value = 0;
- std::hash<string_view> hasher;
+ std::hash<string_view_t> hasher;
while (PP) {
hash_value = __hash_combine(hash_value, hasher(*PP));
++PP;
diff --git a/contrib/libc++/src/functional.cpp b/contrib/libc++/src/functional.cpp
new file mode 100644
index 0000000..5c2646f
--- /dev/null
+++ b/contrib/libc++/src/functional.cpp
@@ -0,0 +1,26 @@
+//===----------------------- functional.cpp -------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include "functional"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
+bad_function_call::~bad_function_call() _NOEXCEPT
+{
+}
+
+const char*
+bad_function_call::what() const _NOEXCEPT
+{
+ return "std::bad_function_call";
+}
+#endif
+
+_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/src/include/atomic_support.h b/contrib/libc++/src/include/atomic_support.h
index af0f5f5..08847e6 100644
--- a/contrib/libc++/src/include/atomic_support.h
+++ b/contrib/libc++/src/include/atomic_support.h
@@ -29,7 +29,7 @@
#endif
#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_MSC_VER) && !defined(__clang__)
+# if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
# else
# warning Building libc++ without __atomic builtins is unsupported
diff --git a/contrib/libc++/include/__refstring b/contrib/libc++/src/include/refstring.h
index 7f417a0..f0d5b44 100644
--- a/contrib/libc++/include/__refstring
+++ b/contrib/libc++/src/include/refstring.h
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
-#ifndef _LIBCPP___REFSTRING
-#define _LIBCPP___REFSTRING
+#ifndef _LIBCPP_REFSTRING_H
+#define _LIBCPP_REFSTRING_H
#include <__config>
#include <stdexcept>
@@ -124,4 +124,4 @@ bool __libcpp_refstring::__uses_refcount() const {
_LIBCPP_END_NAMESPACE_STD
-#endif //_LIBCPP___REFSTRING
+#endif //_LIBCPP_REFSTRING_H
diff --git a/contrib/libc++/src/ios.cpp b/contrib/libc++/src/ios.cpp
index 7c76ca2..0f1d88e 100644
--- a/contrib/libc++/src/ios.cpp
+++ b/contrib/libc++/src/ios.cpp
@@ -22,6 +22,7 @@
#include "new"
#include "streambuf"
#include "string"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/libc++/src/iostream.cpp b/contrib/libc++/src/iostream.cpp
index a972be9..534b47a 100644
--- a/contrib/libc++/src/iostream.cpp
+++ b/contrib/libc++/src/iostream.cpp
@@ -15,14 +15,14 @@ _LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_STDIN
_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin[sizeof(istream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cin@__1@std@@3V?$basic_istream@DU?$char_traits@D@__1@std@@@12@A")
#endif
;
_ALIGNAS_TYPE (__stdinbuf<char> ) static char __cin[sizeof(__stdinbuf <char>)];
static mbstate_t mb_cin;
_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin[sizeof(wistream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcin@__1@std@@3V?$basic_istream@_WU?$char_traits@_W@__1@std@@@12@A")
#endif
;
@@ -32,14 +32,14 @@ static mbstate_t mb_wcin;
#ifndef _LIBCPP_HAS_NO_STDOUT
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cout@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
#endif
;
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cout[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cout;
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcout@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
#endif
;
@@ -48,14 +48,14 @@ static mbstate_t mb_wcout;
#endif
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?cerr@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
#endif
;
_ALIGNAS_TYPE (__stdoutbuf<char>) static char __cerr[sizeof(__stdoutbuf<char>)];
static mbstate_t mb_cerr;
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wcerr@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
#endif
;
@@ -63,12 +63,12 @@ _ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wcha
static mbstate_t mb_wcerr;
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?clog@__1@std@@3V?$basic_ostream@DU?$char_traits@D@__1@std@@@12@A")
#endif
;
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)]
-#if defined(_MSC_VER) && defined(__clang__)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(__clang__)
__asm__("?wclog@__1@std@@3V?$basic_ostream@_WU?$char_traits@_W@__1@std@@@12@A")
#endif
;
diff --git a/contrib/libc++/src/locale.cpp b/contrib/libc++/src/locale.cpp
index 338ffde..3b4c83a 100644
--- a/contrib/libc++/src/locale.cpp
+++ b/contrib/libc++/src/locale.cpp
@@ -36,6 +36,7 @@
#endif
#include <stdlib.h>
#include <stdio.h>
+#include "__undef_macros"
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
// lots of noise in the build log, but no bugs that I know of.
@@ -45,6 +46,24 @@
_LIBCPP_BEGIN_NAMESPACE_STD
+struct __libcpp_unique_locale {
+ __libcpp_unique_locale(const char* nm) : __loc_(newlocale(LC_ALL_MASK, nm, 0)) {}
+
+ ~__libcpp_unique_locale() {
+ if (__loc_)
+ freelocale(__loc_);
+ }
+
+ explicit operator bool() const { return __loc_; }
+
+ locale_t& get() { return __loc_; }
+
+ locale_t __loc_;
+private:
+ __libcpp_unique_locale(__libcpp_unique_locale const&);
+ __libcpp_unique_locale& operator=(__libcpp_unique_locale const&);
+};
+
#ifdef __cloc_defined
locale_t __cloc() {
// In theory this could create a race condition. In practice
@@ -68,8 +87,8 @@ T&
make(A0 a0)
{
static typename aligned_storage<sizeof(T)>::type buf;
- ::new (&buf) T(a0);
- return *reinterpret_cast<T*>(&buf);
+ auto *obj = ::new (&buf) T(a0);
+ return *obj;
}
template <class T, class A0, class A1>
@@ -88,8 +107,8 @@ T&
make(A0 a0, A1 a1, A2 a2)
{
static typename aligned_storage<sizeof(T)>::type buf;
- ::new (&buf) T(a0, a1, a2);
- return *reinterpret_cast<T*>(&buf);
+ auto *obj = ::new (&buf) T(a0, a1, a2);
+ return *obj;
}
template <typename T, size_t N>
@@ -480,8 +499,8 @@ locale::__imp::make_global()
{
// only one thread can get in here and it only gets in once
static aligned_storage<sizeof(locale)>::type buf;
- ::new (&buf) locale(locale::classic());
- return *reinterpret_cast<locale*>(&buf);
+ auto *obj = ::new (&buf) locale(locale::classic());
+ return *obj;
}
locale&
@@ -579,10 +598,8 @@ locale::global(const locale& loc)
locale& g = __global();
locale r = g;
g = loc;
-#ifndef __CloudABI__
if (g.name() != "*")
setlocale(LC_ALL, g.name().c_str());
-#endif
return r;
}
@@ -1111,13 +1128,7 @@ ctype<char>::classic_table() _NOEXCEPT
#elif __sun__
return __ctype_mask;
#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#if _VC_CRT_MAJOR_VERSION < 14
- // This is assumed to be safe, which is a nonsense assumption because we're
- // going to end up dereferencing it later...
- return _ctype+1; // internal ctype mask table defined in msvcrt.dll
-#else
return __pctype_func();
-#endif
#elif defined(__EMSCRIPTEN__)
return *__ctype_b_loc();
#elif defined(_NEWLIB_VERSION)
@@ -4193,7 +4204,7 @@ __widen_from_utf8<32>::~__widen_from_utf8()
static bool checked_string_to_wchar_convert(wchar_t& dest,
const char* ptr,
- __locale_struct* loc) {
+ locale_t loc) {
if (*ptr == '\0')
return false;
mbstate_t mb = {};
@@ -4208,7 +4219,7 @@ static bool checked_string_to_wchar_convert(wchar_t& dest,
static bool checked_string_to_char_convert(char& dest,
const char* ptr,
- __locale_struct* __loc) {
+ locale_t __loc) {
if (*ptr == '\0')
return false;
if (!ptr[1]) {
@@ -4303,8 +4314,8 @@ numpunct_byname<char>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("numpunct_byname<char>::numpunct_byname"
" failed to construct for " + string(nm));
@@ -4341,8 +4352,8 @@ numpunct_byname<wchar_t>::__init(const char* nm)
{
if (strcmp(nm, "C") != 0)
{
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("numpunct_byname<wchar_t>::numpunct_byname"
" failed to construct for " + string(nm));
@@ -5828,8 +5839,8 @@ void
moneypunct_byname<char, false>::init(const char* nm)
{
typedef moneypunct<char, false> base;
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
@@ -5872,8 +5883,8 @@ void
moneypunct_byname<char, true>::init(const char* nm)
{
typedef moneypunct<char, true> base;
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
@@ -5932,8 +5943,8 @@ void
moneypunct_byname<wchar_t, false>::init(const char* nm)
{
typedef moneypunct<wchar_t, false> base;
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
lconv* lc = __libcpp_localeconv_l(loc.get());
@@ -5997,8 +6008,8 @@ void
moneypunct_byname<wchar_t, true>::init(const char* nm)
{
typedef moneypunct<wchar_t, true> base;
- __locale_unique_ptr loc(newlocale(LC_ALL_MASK, nm, 0), freelocale);
- if (loc == nullptr)
+ __libcpp_unique_locale loc(nm);
+ if (!loc)
__throw_runtime_error("moneypunct_byname"
" failed to construct for " + string(nm));
@@ -6147,6 +6158,4 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t,
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>;
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>;
-template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common<true>;
-
_LIBCPP_END_NAMESPACE_STD
diff --git a/contrib/libc++/src/memory.cpp b/contrib/libc++/src/memory.cpp
index 8569faf..4e0d3af 100644
--- a/contrib/libc++/src/memory.cpp
+++ b/contrib/libc++/src/memory.cpp
@@ -17,28 +17,6 @@
_LIBCPP_BEGIN_NAMESPACE_STD
-namespace
-{
-
-// NOTE: Relaxed and acq/rel atomics (for increment and decrement respectively)
-// should be sufficient for thread safety.
-// See https://llvm.org/bugs/show_bug.cgi?id=22803
-template <class T>
-inline T
-increment(T& t) _NOEXCEPT
-{
- return __libcpp_atomic_add(&t, 1, _AO_Relaxed);
-}
-
-template <class T>
-inline T
-decrement(T& t) _NOEXCEPT
-{
- return __libcpp_atomic_add(&t, -1, _AO_Acq_Rel);
-}
-
-} // namespace
-
const allocator_arg_t allocator_arg = allocator_arg_t();
bad_weak_ptr::~bad_weak_ptr() _NOEXCEPT {}
@@ -53,16 +31,21 @@ __shared_count::~__shared_count()
{
}
+__shared_weak_count::~__shared_weak_count()
+{
+}
+
+#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
void
__shared_count::__add_shared() _NOEXCEPT
{
- increment(__shared_owners_);
+ __libcpp_atomic_refcount_increment(__shared_owners_);
}
bool
__shared_count::__release_shared() _NOEXCEPT
{
- if (decrement(__shared_owners_) == -1)
+ if (__libcpp_atomic_refcount_decrement(__shared_owners_) == -1)
{
__on_zero_shared();
return true;
@@ -70,10 +53,6 @@ __shared_count::__release_shared() _NOEXCEPT
return false;
}
-__shared_weak_count::~__shared_weak_count()
-{
-}
-
void
__shared_weak_count::__add_shared() _NOEXCEPT
{
@@ -83,7 +62,7 @@ __shared_weak_count::__add_shared() _NOEXCEPT
void
__shared_weak_count::__add_weak() _NOEXCEPT
{
- increment(__shared_weak_owners_);
+ __libcpp_atomic_refcount_increment(__shared_weak_owners_);
}
void
@@ -93,6 +72,8 @@ __shared_weak_count::__release_shared() _NOEXCEPT
__release_weak();
}
+#endif // _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
+
void
__shared_weak_count::__release_weak() _NOEXCEPT
{
@@ -124,7 +105,7 @@ __shared_weak_count::__release_weak() _NOEXCEPT
//__libcpp_atomic_store(&__shared_weak_owners_, -1, _AO_Release);
__on_zero_shared_weak();
}
- else if (decrement(__shared_weak_owners_) == -1)
+ else if (__libcpp_atomic_refcount_decrement(__shared_weak_owners_) == -1)
__on_zero_shared_weak();
}
@@ -139,7 +120,7 @@ __shared_weak_count::lock() _NOEXCEPT
object_owners+1))
return this;
}
- return 0;
+ return nullptr;
}
#if !defined(_LIBCPP_NO_RTTI) || !defined(_LIBCPP_BUILD_STATIC)
@@ -147,7 +128,7 @@ __shared_weak_count::lock() _NOEXCEPT
const void*
__shared_weak_count::__get_deleter(const type_info&) const _NOEXCEPT
{
- return 0;
+ return nullptr;
}
#endif // _LIBCPP_NO_RTTI
@@ -173,7 +154,7 @@ __sp_mut::lock() _NOEXCEPT
{
auto m = static_cast<__libcpp_mutex_t*>(__lx);
unsigned count = 0;
- while (__libcpp_mutex_trylock(m) != 0)
+ while (!__libcpp_mutex_trylock(m))
{
if (++count > 16)
{
diff --git a/contrib/libc++/src/mutex.cpp b/contrib/libc++/src/mutex.cpp
index 9397ae7..c36bd55 100644
--- a/contrib/libc++/src/mutex.cpp
+++ b/contrib/libc++/src/mutex.cpp
@@ -11,8 +11,8 @@
#include "mutex"
#include "limits"
#include "system_error"
-#include "cassert"
#include "include/atomic_support.h"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
@@ -37,7 +37,7 @@ mutex::lock()
bool
mutex::try_lock() _NOEXCEPT
{
- return __libcpp_mutex_trylock(&__m_) == 0;
+ return __libcpp_mutex_trylock(&__m_);
}
void
@@ -45,7 +45,7 @@ mutex::unlock() _NOEXCEPT
{
int ec = __libcpp_mutex_unlock(&__m_);
(void)ec;
- assert(ec == 0);
+ _LIBCPP_ASSERT(ec == 0, "call to mutex::unlock failed");
}
// recursive_mutex
@@ -61,7 +61,7 @@ recursive_mutex::~recursive_mutex()
{
int e = __libcpp_recursive_mutex_destroy(&__m_);
(void)e;
- assert(e == 0);
+ _LIBCPP_ASSERT(e == 0, "call to ~recursive_mutex() failed");
}
void
@@ -77,13 +77,13 @@ recursive_mutex::unlock() _NOEXCEPT
{
int e = __libcpp_recursive_mutex_unlock(&__m_);
(void)e;
- assert(e == 0);
+ _LIBCPP_ASSERT(e == 0, "call to recursive_mutex::unlock() failed");
}
bool
recursive_mutex::try_lock() _NOEXCEPT
{
- return __libcpp_recursive_mutex_trylock(&__m_) == 0;
+ return __libcpp_recursive_mutex_trylock(&__m_);
}
// timed_mutex
diff --git a/contrib/libc++/src/new.cpp b/contrib/libc++/src/new.cpp
index b1e8ee3..2b2682f 100644
--- a/contrib/libc++/src/new.cpp
+++ b/contrib/libc++/src/new.cpp
@@ -13,27 +13,48 @@
#include "new"
-#if defined(__APPLE__) && !defined(LIBCXXRT) && \
- !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
- #include <cxxabi.h>
-
- #ifndef _LIBCPPABI_VERSION
- // On Darwin, there are two STL shared libraries and a lower level ABI
- // shared library. The global holding the current new handler is
- // in the ABI library and named __cxa_new_handler.
- #define __new_handler __cxxabiapple::__cxa_new_handler
- #endif
-#else // __APPLE__
- #if defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI)
- #include <cxxabi.h>
- #endif // defined(LIBCXX_BUILDING_LIBCXXABI)
- #if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) || \
- (!defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__))
- static std::new_handler __new_handler;
- #endif // _LIBCPPABI_VERSION
+#if defined(_LIBCPP_ABI_MICROSOFT)
+// nothing todo
+#elif defined(LIBCXX_BUILDING_LIBCXXABI)
+#include <cxxabi.h>
+#elif defined(LIBCXXRT)
+#include <cxxabi.h>
+#include "support/runtime/new_handler_fallback.ipp"
+#elif defined(__GLIBCXX__)
+// nothing todo
+#else
+# if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
+# include <cxxabi.h> // FIXME: remove this once buildit is gone.
+# else
+# include "support/runtime/new_handler_fallback.ipp"
+# endif
#endif
+namespace std
+{
+
#ifndef __GLIBCXX__
+const nothrow_t nothrow = {};
+#endif
+
+#ifndef LIBSTDCXX
+
+void
+__throw_bad_alloc()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw bad_alloc();
+#else
+ _VSTD::abort();
+#endif
+}
+
+#endif // !LIBSTDCXX
+
+} // std
+
+#if !defined(__GLIBCXX__) && !defined(_LIBCPP_ABI_MICROSOFT) && \
+ !defined(_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS)
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overridden by programs
@@ -162,7 +183,7 @@ operator new(std::size_t size, std::align_val_t alignment) _THROW_BAD_ALLOC
if (static_cast<size_t>(alignment) < sizeof(void*))
alignment = std::align_val_t(sizeof(void*));
void* p;
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
while ((p = _aligned_malloc(size, static_cast<size_t>(alignment))) == nullptr)
#else
while (::posix_memalign(&p, static_cast<size_t>(alignment), size) != 0)
@@ -235,7 +256,7 @@ void
operator delete(void* ptr, std::align_val_t) _NOEXCEPT
{
if (ptr)
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
::_aligned_free(ptr);
#else
::free(ptr);
@@ -277,107 +298,5 @@ operator delete[] (void* ptr, size_t, std::align_val_t alignment) _NOEXCEPT
::operator delete[](ptr, alignment);
}
-#endif // !defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
-
-#endif // !__GLIBCXX__
-
-namespace std
-{
-
-#ifndef __GLIBCXX__
-const nothrow_t nothrow = {};
-#endif
-
-#ifndef _LIBCPPABI_VERSION
-
-#ifndef __GLIBCXX__
-
-new_handler
-set_new_handler(new_handler handler) _NOEXCEPT
-{
- return __sync_lock_test_and_set(&__new_handler, handler);
-}
-
-new_handler
-get_new_handler() _NOEXCEPT
-{
- return __sync_fetch_and_add(&__new_handler, nullptr);
-}
-
-#endif // !__GLIBCXX__
-
-#ifndef LIBCXXRT
-
-bad_alloc::bad_alloc() _NOEXCEPT
-{
-}
-
-#ifndef __GLIBCXX__
-
-bad_alloc::~bad_alloc() _NOEXCEPT
-{
-}
-
-const char*
-bad_alloc::what() const _NOEXCEPT
-{
- return "std::bad_alloc";
-}
-
-#endif // !__GLIBCXX__
-
-bad_array_new_length::bad_array_new_length() _NOEXCEPT
-{
-}
-
-#ifndef __GLIBCXX__
-
-bad_array_new_length::~bad_array_new_length() _NOEXCEPT
-{
-}
-
-const char*
-bad_array_new_length::what() const _NOEXCEPT
-{
- return "bad_array_new_length";
-}
-
-#endif // !__GLIBCXX__
-
-#endif //LIBCXXRT
-
-bad_array_length::bad_array_length() _NOEXCEPT
-{
-}
-
-#ifndef __GLIBCXX__
-
-bad_array_length::~bad_array_length() _NOEXCEPT
-{
-}
-
-const char*
-bad_array_length::what() const _NOEXCEPT
-{
- return "bad_array_length";
-}
-
-#endif // !__GLIBCXX__
-
-#endif // _LIBCPPABI_VERSION
-
-#ifndef LIBSTDCXX
-
-void
-__throw_bad_alloc()
-{
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw bad_alloc();
-#else
- _VSTD::abort();
-#endif
-}
-
-#endif // !LIBSTDCXX
-
-} // std
+#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION
+#endif // !__GLIBCXX__ && !_LIBCPP_ABI_MICROSOFT && !_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
diff --git a/contrib/libc++/src/stdexcept.cpp b/contrib/libc++/src/stdexcept.cpp
index 3f33330..5e06e52 100644
--- a/contrib/libc++/src/stdexcept.cpp
+++ b/contrib/libc++/src/stdexcept.cpp
@@ -11,7 +11,7 @@
#include "new"
#include "string"
#include "system_error"
-#include "__refstring"
+#include "include/refstring.h"
/* For _LIBCPPABI_VERSION */
#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
diff --git a/contrib/libc++/src/string.cpp b/contrib/libc++/src/string.cpp
index cd64433..d7ebdd3 100644
--- a/contrib/libc++/src/string.cpp
+++ b/contrib/libc++/src/string.cpp
@@ -13,9 +13,6 @@
#include "cerrno"
#include "limits"
#include "stdexcept"
-#ifdef _LIBCPP_MSVCRT
-#include "support/win32/support.h"
-#endif // _LIBCPP_MSVCRT
#include <stdio.h>
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -430,7 +427,7 @@ get_swprintf()
#ifndef _LIBCPP_MSVCRT
return swprintf;
#else
- return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(swprintf);
+ return static_cast<int (__cdecl*)(wchar_t* __restrict, size_t, const wchar_t*__restrict, ...)>(_snwprintf);
#endif
}
diff --git a/contrib/libc++/src/strstream.cpp b/contrib/libc++/src/strstream.cpp
index be94f9c..01523cf 100644
--- a/contrib/libc++/src/strstream.cpp
+++ b/contrib/libc++/src/strstream.cpp
@@ -13,6 +13,7 @@
#include "cstring"
#include "cstdlib"
#include "__debug"
+#include "__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
diff --git a/contrib/libc++/src/support/runtime/exception_fallback.ipp b/contrib/libc++/src/support/runtime/exception_fallback.ipp
new file mode 100644
index 0000000..69c06a9
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_fallback.ipp
@@ -0,0 +1,182 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <cstdio>
+
+namespace std {
+
+_LIBCPP_SAFE_STATIC static std::terminate_handler __terminate_handler;
+_LIBCPP_SAFE_STATIC static std::unexpected_handler __unexpected_handler;
+
+
+// libcxxrt provides implementations of these functions itself.
+unexpected_handler
+set_unexpected(unexpected_handler func) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__unexpected_handler, func);
+}
+
+unexpected_handler
+get_unexpected() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
+
+}
+
+_LIBCPP_NORETURN
+void unexpected()
+{
+ (*get_unexpected())();
+ // unexpected handler should not return
+ terminate();
+}
+
+terminate_handler
+set_terminate(terminate_handler func) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__terminate_handler, func);
+}
+
+terminate_handler
+get_terminate() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
+
+}
+
+#ifndef __EMSCRIPTEN__ // We provide this in JS
+_LIBCPP_NORETURN
+void
+terminate() _NOEXCEPT
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ (*get_terminate())();
+ // handler should not return
+ fprintf(stderr, "terminate_handler unexpectedly returned\n");
+ ::abort();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ // handler should not throw exception
+ fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
+ ::abort();
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+#endif // !__EMSCRIPTEN__
+
+#if !defined(__EMSCRIPTEN__)
+bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
+
+int uncaught_exceptions() _NOEXCEPT
+{
+#warning uncaught_exception not yet implemented
+ fprintf(stderr, "uncaught_exceptions not yet implemented\n");
+ ::abort();
+}
+#endif // !__EMSCRIPTEN__
+
+
+exception::~exception() _NOEXCEPT
+{
+}
+
+const char* exception::what() const _NOEXCEPT
+{
+ return "std::exception";
+}
+
+bad_exception::~bad_exception() _NOEXCEPT
+{
+}
+
+const char* bad_exception::what() const _NOEXCEPT
+{
+ return "std::bad_exception";
+}
+
+
+bad_alloc::bad_alloc() _NOEXCEPT
+{
+}
+
+bad_alloc::~bad_alloc() _NOEXCEPT
+{
+}
+
+const char*
+bad_alloc::what() const _NOEXCEPT
+{
+ return "std::bad_alloc";
+}
+
+bad_array_new_length::bad_array_new_length() _NOEXCEPT
+{
+}
+
+bad_array_new_length::~bad_array_new_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_new_length::what() const _NOEXCEPT
+{
+ return "bad_array_new_length";
+}
+
+
+bad_array_length::bad_array_length() _NOEXCEPT
+{
+}
+
+bad_array_length::~bad_array_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_length::what() const _NOEXCEPT
+{
+ return "bad_array_length";
+}
+
+
+bad_cast::bad_cast() _NOEXCEPT
+{
+}
+
+bad_typeid::bad_typeid() _NOEXCEPT
+{
+}
+
+bad_cast::~bad_cast() _NOEXCEPT
+{
+}
+
+const char*
+bad_cast::what() const _NOEXCEPT
+{
+ return "std::bad_cast";
+}
+
+bad_typeid::~bad_typeid() _NOEXCEPT
+{
+}
+
+const char*
+bad_typeid::what() const _NOEXCEPT
+{
+ return "std::bad_typeid";
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_glibcxx.ipp b/contrib/libc++/src/support/runtime/exception_glibcxx.ipp
new file mode 100644
index 0000000..0f78932
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_glibcxx.ipp
@@ -0,0 +1,38 @@
+// -*- 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 __GLIBCXX__
+#error header can only be used when targeting libstdc++ or libsupc++
+#endif
+
+namespace std {
+
+bad_alloc::bad_alloc() _NOEXCEPT
+{
+}
+
+bad_array_new_length::bad_array_new_length() _NOEXCEPT
+{
+}
+
+bad_array_length::bad_array_length() _NOEXCEPT
+{
+}
+
+
+bad_cast::bad_cast() _NOEXCEPT
+{
+}
+
+bad_typeid::bad_typeid() _NOEXCEPT
+{
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_libcxxabi.ipp b/contrib/libc++/src/support/runtime/exception_libcxxabi.ipp
new file mode 100644
index 0000000..c3dcf1e
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_libcxxabi.ipp
@@ -0,0 +1,28 @@
+// -*- 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 _LIBCPPABI_VERSION
+#error this header can only be used with libc++abi
+#endif
+
+namespace std {
+
+bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
+
+int uncaught_exceptions() _NOEXCEPT
+{
+# if _LIBCPPABI_VERSION > 1101
+ return __cxa_uncaught_exceptions();
+# else
+ return __cxa_uncaught_exception() ? 1 : 0;
+# endif
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_libcxxrt.ipp b/contrib/libc++/src/support/runtime/exception_libcxxrt.ipp
new file mode 100644
index 0000000..6d9e0cf
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_libcxxrt.ipp
@@ -0,0 +1,41 @@
+// -*- 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 LIBCXXRT
+#error this header may only be used when targeting libcxxrt
+#endif
+
+namespace std {
+
+bad_exception::~bad_exception() _NOEXCEPT
+{
+}
+
+const char* bad_exception::what() const _NOEXCEPT
+{
+ return "std::bad_exception";
+}
+
+
+bad_array_length::bad_array_length() _NOEXCEPT
+{
+}
+
+bad_array_length::~bad_array_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_length::what() const _NOEXCEPT
+{
+ return "bad_array_length";
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_msvc.ipp b/contrib/libc++/src/support/runtime/exception_msvc.ipp
new file mode 100644
index 0000000..950ec0c
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_msvc.ipp
@@ -0,0 +1,89 @@
+// -*- 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_ABI_MICROSOFT
+#error this header can only be used when targeting the MSVC ABI
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <eh.h>
+#include <corecrt_terminate.h>
+
+namespace std {
+
+// libcxxrt provides implementations of these functions itself.
+unexpected_handler
+set_unexpected(unexpected_handler func) _NOEXCEPT {
+ return ::set_unexpected(func);
+}
+
+unexpected_handler get_unexpected() _NOEXCEPT {
+ return ::_get_unexpected();
+}
+
+_LIBCPP_NORETURN
+void unexpected() {
+ (*get_unexpected())();
+ // unexpected handler should not return
+ terminate();
+}
+
+terminate_handler set_terminate(terminate_handler func) _NOEXCEPT {
+ return ::set_terminate(func);
+}
+
+terminate_handler get_terminate() _NOEXCEPT {
+ return ::_get_terminate();
+}
+
+_LIBCPP_NORETURN
+void terminate() _NOEXCEPT
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ try
+ {
+#endif // _LIBCPP_NO_EXCEPTIONS
+ (*get_terminate())();
+ // handler should not return
+ fprintf(stderr, "terminate_handler unexpectedly returned\n");
+ ::abort();
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ }
+ catch (...)
+ {
+ // handler should not throw exception
+ fprintf(stderr, "terminate_handler unexpectedly threw an exception\n");
+ ::abort();
+ }
+#endif // _LIBCPP_NO_EXCEPTIONS
+}
+
+bool uncaught_exception() _NOEXCEPT { return uncaught_exceptions() > 0; }
+
+int uncaught_exceptions() _NOEXCEPT {
+ return __uncaught_exceptions();
+}
+
+bad_array_length::bad_array_length() _NOEXCEPT
+{
+}
+
+bad_array_length::~bad_array_length() _NOEXCEPT
+{
+}
+
+const char*
+bad_array_length::what() const _NOEXCEPT
+{
+ return "bad_array_length";
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_pointer_cxxabi.ipp b/contrib/libc++/src/support/runtime/exception_pointer_cxxabi.ipp
new file mode 100644
index 0000000..dfac864
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_pointer_cxxabi.ipp
@@ -0,0 +1,74 @@
+// -*- 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 HAVE_DEPENDENT_EH_ABI
+#error this header may only be used with libc++abi or libcxxrt
+#endif
+
+namespace std {
+
+exception_ptr::~exception_ptr() _NOEXCEPT {
+ __cxa_decrement_exception_refcount(__ptr_);
+}
+
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
+ : __ptr_(other.__ptr_)
+{
+ __cxa_increment_exception_refcount(__ptr_);
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
+{
+ if (__ptr_ != other.__ptr_)
+ {
+ __cxa_increment_exception_refcount(other.__ptr_);
+ __cxa_decrement_exception_refcount(__ptr_);
+ __ptr_ = other.__ptr_;
+ }
+ return *this;
+}
+
+nested_exception::nested_exception() _NOEXCEPT
+ : __ptr_(current_exception())
+{
+}
+
+nested_exception::~nested_exception() _NOEXCEPT
+{
+}
+
+_LIBCPP_NORETURN
+void
+nested_exception::rethrow_nested() const
+{
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
+}
+
+exception_ptr current_exception() _NOEXCEPT
+{
+ // be nicer if there was a constructor that took a ptr, then
+ // this whole function would be just:
+ // return exception_ptr(__cxa_current_primary_exception());
+ exception_ptr ptr;
+ ptr.__ptr_ = __cxa_current_primary_exception();
+ return ptr;
+}
+
+_LIBCPP_NORETURN
+void rethrow_exception(exception_ptr p)
+{
+ __cxa_rethrow_primary_exception(p.__ptr_);
+ // if p.__ptr_ is NULL, above returns so we terminate
+ terminate();
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_pointer_glibcxx.ipp b/contrib/libc++/src/support/runtime/exception_pointer_glibcxx.ipp
new file mode 100644
index 0000000..9d20dfe
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_pointer_glibcxx.ipp
@@ -0,0 +1,78 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// libsupc++ does not implement the dependent EH ABI and the functionality
+// it uses to implement std::exception_ptr (which it declares as an alias of
+// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
+// we have little choice but to hijack std::__exception_ptr::exception_ptr's
+// (which fortunately has the same layout as our std::exception_ptr) copy
+// constructor, assignment operator and destructor (which are part of its
+// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
+// function.
+
+namespace std {
+
+namespace __exception_ptr
+{
+
+struct exception_ptr
+{
+ void* __ptr_;
+
+ exception_ptr(const exception_ptr&) _NOEXCEPT;
+ exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
+ ~exception_ptr() _NOEXCEPT;
+};
+
+}
+
+_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
+
+exception_ptr::~exception_ptr() _NOEXCEPT
+{
+ reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
+}
+
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
+ : __ptr_(other.__ptr_)
+{
+ new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
+ reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
+{
+ *reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
+ reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
+ return *this;
+}
+
+nested_exception::nested_exception() _NOEXCEPT
+ : __ptr_(current_exception())
+{
+}
+
+
+_LIBCPP_NORETURN
+void
+nested_exception::rethrow_nested() const
+{
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
+}
+
+_LIBCPP_NORETURN
+void rethrow_exception(exception_ptr p)
+{
+ rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_pointer_msvc.ipp b/contrib/libc++/src/support/runtime/exception_pointer_msvc.ipp
new file mode 100644
index 0000000..eab5d30
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_pointer_msvc.ipp
@@ -0,0 +1,95 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <yvals.h> // for _CRTIMP2_PURE
+
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCreate(_Out_ void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrDestroy(_Inout_ void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrCopy(_Out_ void*,
+ _In_ const void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrAssign(_Inout_ void*, _In_ const void*);
+_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrCompare(_In_ const void*, _In_ const void*);
+_CRTIMP2_PURE bool __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrToBool(_In_ const void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL __ExceptionPtrSwap(_Inout_ void*,
+ _Inout_ void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrCurrentException(_Out_ void*);
+[[noreturn]] _CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrRethrow(_In_ const void*);
+_CRTIMP2_PURE void __CLRCALL_PURE_OR_CDECL
+__ExceptionPtrCopyException(_Inout_ void*, _In_ const void*, _In_ const void*);
+
+namespace std {
+
+exception_ptr::exception_ptr() _NOEXCEPT { __ExceptionPtrCreate(this); }
+exception_ptr::exception_ptr(nullptr_t) _NOEXCEPT { __ExceptionPtrCreate(this); }
+
+exception_ptr::exception_ptr(const exception_ptr& __other) _NOEXCEPT {
+ __ExceptionPtrCopy(this, &__other);
+}
+exception_ptr& exception_ptr::operator=(const exception_ptr& __other) _NOEXCEPT {
+ __ExceptionPtrAssign(this, &__other);
+ return *this;
+}
+
+exception_ptr& exception_ptr::operator=(nullptr_t) _NOEXCEPT {
+ exception_ptr dummy;
+ __ExceptionPtrAssign(this, &dummy);
+ return *this;
+}
+
+exception_ptr::~exception_ptr() _NOEXCEPT { __ExceptionPtrDestroy(this); }
+
+exception_ptr::operator bool() const _NOEXCEPT {
+ return __ExceptionPtrToBool(this);
+}
+
+bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT {
+ return __ExceptionPtrCompare(&__x, &__y);
+}
+
+
+void swap(exception_ptr& lhs, exception_ptr& rhs) _NOEXCEPT {
+ __ExceptionPtrSwap(&rhs, &lhs);
+}
+
+exception_ptr __copy_exception_ptr(void* __except, const void* __ptr) {
+ exception_ptr __ret = nullptr;
+ if (__ptr)
+ __ExceptionPtrCopyException(&__ret, __except, __ptr);
+ return __ret;
+}
+
+exception_ptr current_exception() _NOEXCEPT {
+ exception_ptr __ret;
+ __ExceptionPtrCurrentException(&__ret);
+ return __ret;
+}
+
+_LIBCPP_NORETURN
+void rethrow_exception(exception_ptr p) { __ExceptionPtrRethrow(&p); }
+
+nested_exception::nested_exception() _NOEXCEPT : __ptr_(current_exception()) {}
+
+nested_exception::~nested_exception() _NOEXCEPT {}
+
+_LIBCPP_NORETURN
+void nested_exception::rethrow_nested() const {
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/exception_pointer_unimplemented.ipp b/contrib/libc++/src/support/runtime/exception_pointer_unimplemented.ipp
new file mode 100644
index 0000000..21c182c
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/exception_pointer_unimplemented.ipp
@@ -0,0 +1,80 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include <stdio.h>
+#include <stdlib.h>
+
+namespace std {
+
+exception_ptr::~exception_ptr() _NOEXCEPT
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
+exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
+ : __ptr_(other.__ptr_)
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
+exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
+nested_exception::nested_exception() _NOEXCEPT
+ : __ptr_(current_exception())
+{
+}
+
+#if !defined(__GLIBCXX__)
+
+nested_exception::~nested_exception() _NOEXCEPT
+{
+}
+
+#endif
+
+_LIBCPP_NORETURN
+void
+nested_exception::rethrow_nested() const
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+#if 0
+ if (__ptr_ == nullptr)
+ terminate();
+ rethrow_exception(__ptr_);
+#endif // FIXME
+}
+
+exception_ptr current_exception() _NOEXCEPT
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
+_LIBCPP_NORETURN
+void rethrow_exception(exception_ptr p)
+{
+# warning exception_ptr not yet implemented
+ fprintf(stderr, "exception_ptr not yet implemented\n");
+ ::abort();
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/support/runtime/new_handler_fallback.ipp b/contrib/libc++/src/support/runtime/new_handler_fallback.ipp
new file mode 100644
index 0000000..b7092d5
--- /dev/null
+++ b/contrib/libc++/src/support/runtime/new_handler_fallback.ipp
@@ -0,0 +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.
+//
+//===----------------------------------------------------------------------===//
+
+namespace std {
+
+_LIBCPP_SAFE_STATIC static std::new_handler __new_handler;
+
+new_handler
+set_new_handler(new_handler handler) _NOEXCEPT
+{
+ return __sync_lock_test_and_set(&__new_handler, handler);
+}
+
+new_handler
+get_new_handler() _NOEXCEPT
+{
+ return __sync_fetch_and_add(&__new_handler, nullptr);
+}
+
+} // namespace std
diff --git a/contrib/libc++/src/system_error.cpp b/contrib/libc++/src/system_error.cpp
index c547124..17f2c9a 100644
--- a/contrib/libc++/src/system_error.cpp
+++ b/contrib/libc++/src/system_error.cpp
@@ -17,9 +17,9 @@
#include "cstring"
#include "cstdio"
#include "cstdlib"
-#include "cassert"
#include "string"
#include "string.h"
+#include "__debug"
#if defined(__ANDROID__)
#include <android/api-level.h>
@@ -29,7 +29,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// class error_category
-#if defined(_LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR)
+#if defined(_LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS)
error_category::error_category() _NOEXCEPT
{
}
@@ -65,7 +65,7 @@ constexpr size_t strerror_buff_size = 1024;
string do_strerror_r(int ev);
-#if defined(_LIBCPP_MSVCRT)
+#if defined(_LIBCPP_MSVCRT_LIKE)
string do_strerror_r(int ev) {
char buffer[strerror_buff_size];
if (::strerror_s(buffer, strerror_buff_size, ev) == 0)
@@ -96,7 +96,7 @@ string do_strerror_r(int ev) {
std::snprintf(buffer, strerror_buff_size, "Unknown error %d", ev);
return string(buffer);
} else {
- assert(new_errno == ERANGE);
+ _LIBCPP_ASSERT(new_errno == ERANGE, "unexpected error from ::strerr_r");
// FIXME maybe? 'strerror_buff_size' is likely to exceed the
// maximum error size so ERANGE shouldn't be returned.
std::abort();
diff --git a/contrib/libc++/src/thread.cpp b/contrib/libc++/src/thread.cpp
index 5ccf829..550da8e 100644
--- a/contrib/libc++/src/thread.cpp
+++ b/contrib/libc++/src/thread.cpp
@@ -24,9 +24,9 @@
# endif // defined(BSD)
#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__)
# include <unistd.h>
-#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__CloudABI__) || defined(__Fuchsia__)
#if defined(__NetBSD__)
#pragma weak pthread_create // Do not create libpthread dependency
@@ -34,13 +34,13 @@
#if defined(_LIBCPP_WIN32API)
#include <windows.h>
-#endif // defined(_LIBCPP_WIN32API)
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
thread::~thread()
{
- if (__t_ != 0)
+ if (!__libcpp_thread_isnull(&__t_))
terminate();
}
@@ -48,11 +48,11 @@ void
thread::join()
{
int ec = EINVAL;
- if (__t_ != 0)
+ if (!__libcpp_thread_isnull(&__t_))
{
ec = __libcpp_thread_join(&__t_);
if (ec == 0)
- __t_ = 0;
+ __t_ = _LIBCPP_NULL_THREAD;
}
if (ec)
@@ -63,11 +63,11 @@ void
thread::detach()
{
int ec = EINVAL;
- if (__t_ != 0)
+ if (!__libcpp_thread_isnull(&__t_))
{
ec = __libcpp_thread_detach(&__t_);
if (ec == 0)
- __t_ = 0;
+ __t_ = _LIBCPP_NULL_THREAD;
}
if (ec)
@@ -99,7 +99,7 @@ thread::hardware_concurrency() _NOEXCEPT
#else // defined(CTL_HW) && defined(HW_NCPU)
// TODO: grovel through /proc or check cpuid on x86 and similar
// instructions on other architectures.
-# if defined(_MSC_VER) && ! defined(__clang__)
+# if defined(_LIBCPP_WARNING)
_LIBCPP_WARNING("hardware_concurrency not yet implemented")
# else
# warning hardware_concurrency not yet implemented
@@ -114,33 +114,9 @@ namespace this_thread
void
sleep_for(const chrono::nanoseconds& ns)
{
- using namespace chrono;
- if (ns > nanoseconds::zero())
+ if (ns > chrono::nanoseconds::zero())
{
-#if defined(_LIBCPP_WIN32API)
- milliseconds ms = duration_cast<milliseconds>(ns);
- if (ms.count() == 0 || ns > duration_cast<nanoseconds>(ms))
- ++ms;
- Sleep(ms.count());
-#else
- seconds s = duration_cast<seconds>(ns);
- timespec ts;
- typedef decltype(ts.tv_sec) ts_sec;
- _LIBCPP_CONSTEXPR 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 = static_cast<decltype(ts.tv_nsec)>((ns-s).count());
- }
- else
- {
- ts.tv_sec = ts_sec_max;
- ts.tv_nsec = giga::num - 1;
- }
-
- while (nanosleep(&ts, &ts) == -1 && errno == EINTR)
- ;
-#endif
+ __libcpp_thread_sleep_for(ns);
}
}
diff --git a/contrib/libc++/src/typeinfo.cpp b/contrib/libc++/src/typeinfo.cpp
index d0a7dae..02778f3 100644
--- a/contrib/libc++/src/typeinfo.cpp
+++ b/contrib/libc++/src/typeinfo.cpp
@@ -6,73 +6,15 @@
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
-#include <stdlib.h>
-
-#if !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) && \
- (defined(__APPLE__) || defined(LIBCXXRT) || defined(LIBCXX_BUILDING_LIBCXXABI))
-#include <cxxabi.h>
-#endif
#include "typeinfo"
-#if defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
+// FIXME: Remove __APPLE__ default here once buildit is gone.
+#if (!defined(_LIBCPP_ABI_MICROSOFT) && !defined(LIBCXX_BUILDING_LIBCXXABI) && \
+ !defined(LIBCXXRT) && !defined(__GLIBCXX__) && \
+ !defined(__APPLE__)) || \
+ defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY) // FIXME: remove this configuration.
std::type_info::~type_info()
{
}
#endif
-
-#if !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
-
-std::bad_cast::bad_cast() _NOEXCEPT
-{
-}
-
-std::bad_typeid::bad_typeid() _NOEXCEPT
-{
-}
-
-#ifndef __GLIBCXX__
-
-std::bad_cast::~bad_cast() _NOEXCEPT
-{
-}
-
-const char*
-std::bad_cast::what() const _NOEXCEPT
-{
- return "std::bad_cast";
-}
-
-std::bad_typeid::~bad_typeid() _NOEXCEPT
-{
-}
-
-const char*
-std::bad_typeid::what() const _NOEXCEPT
-{
- return "std::bad_typeid";
-}
-
-#if defined(__APPLE__) && !defined(_LIBCPP_BUILDING_HAS_NO_ABI_LIBRARY)
- // On Darwin, the cxa_bad_* functions cannot be in the lower level library
- // because bad_cast and bad_typeid are defined in his higher level library
- void __cxxabiv1::__cxa_bad_typeid()
- {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_typeid();
-#else
- _VSTD::abort();
-#endif
- }
- void __cxxabiv1::__cxa_bad_cast()
- {
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw std::bad_cast();
-#else
- _VSTD::abort();
-#endif
- }
-#endif
-
-#endif // !__GLIBCXX__
-#endif // !LIBCXXRT && !_LIBCPPABI_VERSION
diff --git a/contrib/libc++/src/vector.cpp b/contrib/libc++/src/vector.cpp
new file mode 100644
index 0000000..300adae
--- /dev/null
+++ b/contrib/libc++/src/vector.cpp
@@ -0,0 +1,16 @@
+//===------------------------- vector.cpp ---------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+#include "vector"
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS __vector_base_common<true>;
+
+_LIBCPP_END_NAMESPACE_STD
OpenPOWER on IntegriCloud