aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-12-30 11:54:09 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-12-30 11:54:09 +0000
commitb4c64ad90b81d2a779786b7edb4c5c6dd28cc57d (patch)
tree13f237c02db4d1894ab06884d1b739344766bede /include
parent61b9a7258a7693d7f3674a5a1daf7b036ff1d382 (diff)
downloadsrc-b4c64ad90b81d2a779786b7edb4c5c6dd28cc57d.tar.gz
src-b4c64ad90b81d2a779786b7edb4c5c6dd28cc57d.zip
Vendor import of libc++ trunk r256633:vendor/libc++/r256633
Notes
Notes: svn path=/vendor/libc++/dist/; revision=292928 svn path=/vendor/libc++/r256633/; revision=292930; tag=vendor/libc++/r256633
Diffstat (limited to 'include')
-rw-r--r--include/CMakeLists.txt28
-rw-r--r--include/__config135
-rw-r--r--include/__config_site.in23
-rw-r--r--include/__functional_03571
-rw-r--r--include/__functional_base239
-rw-r--r--include/__functional_base_031104
-rw-r--r--include/__hash_table42
-rw-r--r--include/__locale6
-rw-r--r--include/__mutex_base5
-rw-r--r--include/__nullptr66
-rw-r--r--include/__split_buffer15
-rw-r--r--include/__std_stream1
-rw-r--r--include/__tree10
-rw-r--r--include/__tuple40
-rw-r--r--include/algorithm8
-rw-r--r--include/array20
-rw-r--r--include/atomic38
-rw-r--r--include/bitset124
-rw-r--r--include/cctype101
-rw-r--r--include/cerrno360
-rw-r--r--include/cfenv2
-rw-r--r--include/cfloat8
-rw-r--r--include/chrono131
-rw-r--r--include/cinttypes3
-rw-r--r--include/cmath1168
-rw-r--r--include/complex.h10
-rw-r--r--include/condition_variable21
-rw-r--r--include/csetjmp4
-rw-r--r--include/cstddef50
-rw-r--r--include/cstdio35
-rw-r--r--include/cstdlib22
-rw-r--r--include/ctype.h69
-rw-r--r--include/cwchar9
-rw-r--r--include/cwctype126
-rw-r--r--include/deque110
-rw-r--r--include/errno.h398
-rw-r--r--include/exception2
-rw-r--r--include/experimental/algorithm6
-rw-r--r--include/experimental/any590
-rw-r--r--include/experimental/dynarray2
-rw-r--r--include/experimental/functional454
-rw-r--r--include/ext/hash_map2
-rw-r--r--include/float.h83
-rw-r--r--include/forward_list3
-rw-r--r--include/functional213
-rw-r--r--include/future141
-rw-r--r--include/inttypes.h251
-rw-r--r--include/ios21
-rw-r--r--include/istream47
-rw-r--r--include/iterator10
-rw-r--r--include/list49
-rw-r--r--include/locale25
-rw-r--r--include/map8
-rw-r--r--include/math.h1419
-rw-r--r--include/memory177
-rw-r--r--include/module.modulemap6
-rw-r--r--include/mutex2
-rw-r--r--include/ostream32
-rw-r--r--include/random20
-rw-r--r--include/ratio33
-rw-r--r--include/regex246
-rw-r--r--include/scoped_allocator4
-rw-r--r--include/set6
-rw-r--r--include/setjmp.h45
-rw-r--r--include/sstream56
-rw-r--r--include/stddef.h62
-rw-r--r--include/stdio.h127
-rw-r--r--include/stdlib.h130
-rw-r--r--include/streambuf38
-rw-r--r--include/string113
-rw-r--r--include/support/musl/xlocale.h58
-rw-r--r--include/system_error2
-rw-r--r--include/thread56
-rw-r--r--include/tuple42
-rw-r--r--include/type_traits726
-rw-r--r--include/unordered_map2
-rw-r--r--include/utility98
-rw-r--r--include/valarray312
-rw-r--r--include/vector39
-rw-r--r--include/wchar.h136
-rw-r--r--include/wctype.h79
81 files changed, 6596 insertions, 4479 deletions
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index 95206bfeeaff..e16dc8b4de63 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -1,10 +1,12 @@
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
endif()
+
set(LIBCXX_HEADER_PATTERN
PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN ".svn" EXCLUDE
+ PATTERN "__config_site.in" EXCLUDE
${LIBCXX_SUPPORT_HEADER_PATTERN}
)
@@ -17,8 +19,34 @@ file(COPY .
if (LIBCXX_INSTALL_HEADERS)
install(DIRECTORY .
DESTINATION include/c++/v1
+ COMPONENT libcxx
FILES_MATCHING
${LIBCXX_HEADER_PATTERN}
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
+
+ if (LIBCXX_NEEDS_SITE_CONFIG)
+ set(UNIX_CAT cat)
+ if (WIN32)
+ set(UNIX_CAT type)
+ endif()
+ # Generate and install a custom __config header. The new header is created
+ # by prepending __config_site to the current __config header.
+ add_custom_command(OUTPUT ${LIBCXX_BINARY_DIR}/__generated_config
+ COMMAND ${CMAKE_COMMAND} -E copy ${LIBCXX_BINARY_DIR}/__config_site ${LIBCXX_BINARY_DIR}/__generated_config
+ COMMAND ${UNIX_CAT} ${LIBCXX_SOURCE_DIR}/include/__config >> ${LIBCXX_BINARY_DIR}/__generated_config
+ DEPENDS ${LIBCXX_SOURCE_DIR}/include/__config
+ ${LIBCXX_BINARY_DIR}/__config_site
+ )
+ # Add a target that executes the generation commands.
+ add_custom_target(generate_config_header ALL
+ DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config)
+ # Install the generated header as __config.
+ install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
+ DESTINATION include/c++/v1
+ PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
+ RENAME __config
+ COMPONENT libcxx)
+ endif()
+
endif()
diff --git a/include/__config b/include/__config
index 888f3c098cf4..f141f4f1b7f9 100644
--- a/include/__config
+++ b/include/__config
@@ -11,19 +11,35 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
-#if !defined(_MSC_VER) || defined(__clang__)
+#if defined(_MSC_VER) && !defined(__clang__)
+#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
+#endif
+
+#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#pragma GCC system_header
#endif
+#ifdef __cplusplus
+
#ifdef __GNUC__
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#else
#define _GNUC_VER 0
#endif
-#define _LIBCPP_VERSION 3700
+#define _LIBCPP_VERSION 3800
+#ifndef _LIBCPP_ABI_VERSION
#define _LIBCPP_ABI_VERSION 1
+#endif
+
+#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
+// Change short string represention so that string data starts at offset 0,
+// improving its alignment in some cases.
+#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
+// Fix deque iterator type in order to support incomplete types.
+#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+#endif
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
#define _LIBCPP_CONCAT(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y)
@@ -37,6 +53,9 @@
#ifndef __has_builtin
#define __has_builtin(__x) 0
#endif
+#ifndef __has_extension
+#define __has_extension(__x) 0
+#endif
#ifndef __has_feature
#define __has_feature(__x) 0
#endif
@@ -61,6 +80,16 @@
#endif // __BIG_ENDIAN__
#endif // __BIG_ENDIAN__
+#ifdef __BYTE_ORDER__
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define _LIBCPP_LITTLE_ENDIAN 1
+#define _LIBCPP_BIG_ENDIAN 0
+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#define _LIBCPP_LITTLE_ENDIAN 0
+#define _LIBCPP_BIG_ENDIAN 1
+#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+#endif // __BYTE_ORDER__
+
#ifdef __FreeBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
@@ -227,9 +256,12 @@
#if defined(__clang__)
-#if defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
- !defined(__arm__)
-#define _LIBCPP_ALTERNATE_STRING_LAYOUT
+// _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(_LIBCPP_ALTERNATE_STRING_LAYOUT)
+#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
#endif
#if __has_feature(cxx_alignas)
@@ -273,6 +305,10 @@ typedef __char32_t char32_t;
#define _LIBCPP_UNUSED __attribute__((__unused__))
+#if !(__has_feature(cxx_default_function_template_args))
+#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
+#endif
+
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
@@ -354,24 +390,23 @@ typedef __char32_t char32_t;
#elif defined(__ANDROID__)
#define _LIBCPP_HAS_QUICK_EXIT
#elif defined(__linux__)
-#include <features.h>
+#if !defined(_LIBCPP_HAS_MUSL_LIBC)
+# include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
+#else // defined(_LIBCPP_HAS_MUSL_LIBC)
+#define _LIBCPP_HAS_QUICK_EXIT
+#define _LIBCPP_HAS_C11_FEATURES
#endif
+#endif // __linux__
#endif
-#if (__has_feature(cxx_noexcept))
-# define _NOEXCEPT noexcept
-# define _NOEXCEPT_(x) noexcept(x)
-# define _NOEXCEPT_OR_FALSE(x) noexcept(x)
-#else
-# define _NOEXCEPT throw()
-# define _NOEXCEPT_(x)
-# define _NOEXCEPT_OR_FALSE(x) false
+#if !(__has_feature(cxx_noexcept))
+#define _LIBCPP_HAS_NO_NOEXCEPT
#endif
#if __has_feature(underlying_type)
@@ -429,19 +464,21 @@ namespace std {
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
-// No version of GCC supports relaxed constexpr rules
+// Determine if GCC supports relaxed constexpr
+#if !defined(__cpp_constexpr) || __cpp_constexpr < 201304L
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
+#endif
+
// GCC 5 will support variable templates
+#if !defined(__cpp_variable_templates) || __cpp_variable_templates < 201304L
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
-
-#define _NOEXCEPT throw()
-#define _NOEXCEPT_(x)
-#define _NOEXCEPT_OR_FALSE(x) false
+#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE
+#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_NULLPTR
@@ -449,31 +486,29 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_STRONG_ENUMS
+#define _LIBCPP_HAS_NO_NOEXCEPT
#else // __GXX_EXPERIMENTAL_CXX0X__
-#define _LIBCPP_HAS_NO_TRAILING_RETURN
-#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
-
#if _GNUC_VER < 403
+#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
-#endif
-
-#if _GNUC_VER < 403
#define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif
+
#if _GNUC_VER < 404
#define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
+#define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404
#if _GNUC_VER < 406
+#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#endif
@@ -501,22 +536,20 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#elif defined(_LIBCPP_MSVC)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
-#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_CXX14_CONSTEXPR
#define _LIBCPP_HAS_NO_VARIABLE_TEMPLATES
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+#define _LIBCPP_HAS_NO_NOEXCEPT
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _LIBCPP_UNUSED
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
-#define _NOEXCEPT throw ()
-#define _NOEXCEPT_(x)
-#define _NOEXCEPT_OR_FALSE(x) false
+
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
@@ -536,14 +569,11 @@ namespace std {
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _LIBCPP_UNUSED
-#define _NOEXCEPT throw()
-#define _NOEXCEPT_(x)
-#define _NOEXCEPT_OR_FALSE(x) false
-
+#define _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
-#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
+#define _LIBCPP_HAS_NO_NOEXCEPT
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_IS_BASE_OF
@@ -567,6 +597,14 @@ namespace std {
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
+#ifndef _LIBCPP_HAS_NO_NOEXCEPT
+# define _NOEXCEPT noexcept
+# define _NOEXCEPT_(x) noexcept(x)
+#else
+# define _NOEXCEPT throw()
+# define _NOEXCEPT_(x)
+#endif
+
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
typedef unsigned int char32_t;
@@ -578,9 +616,11 @@ typedef unsigned int char32_t;
#ifdef _LIBCPP_HAS_NO_STATIC_ASSERT
+extern "C++" {
template <bool> struct __static_assert_test;
template <> struct __static_assert_test<true> {};
template <unsigned> struct __static_assert_check {};
+}
#define static_assert(__b, __m) \
typedef __static_assert_check<sizeof(__static_assert_test<(__b)>)> \
_LIBCPP_CONCAT(__t, __LINE__)
@@ -716,6 +756,12 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#endif
+#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
+#else
+# define _LIBCPP_EXPLICIT_MOVE(x) (x)
+#endif
+
#ifndef _LIBCPP_HAS_NO_ASAN
extern "C" void __sanitizer_annotate_contiguous_container(
const void *, const void *, const void *, const void *);
@@ -725,7 +771,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
-# if defined(__GNUG__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
+# 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)
@@ -757,7 +803,7 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_STDOUT
#endif
-#if defined(__ANDROID__) || defined(__CloudABI__)
+#if defined(__ANDROID__) || defined(__CloudABI__) || defined(_LIBCPP_HAS_MUSL_LIBC)
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
#endif
@@ -767,4 +813,17 @@ extern "C" void __sanitizer_annotate_contiguous_container(
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
#endif
-#endif // _LIBCPP_CONFIG
+#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
+#define _LIBCPP_HAS_C_ATOMIC_IMP
+#elif _GNUC_VER > 407
+#define _LIBCPP_HAS_GCC_ATOMIC_IMP
+#endif
+
+#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
+ || defined(_LIBCPP_HAS_NO_THREADS)
+#define _LIBCPP_HAS_NO_ATOMIC_HEADER
+#endif
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_CONFIG
diff --git a/include/__config_site.in b/include/__config_site.in
new file mode 100644
index 000000000000..ec64485289fa
--- /dev/null
+++ b/include/__config_site.in
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// 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_CONFIG_SITE
+#define _LIBCPP_CONFIG_SITE
+
+#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
+#cmakedefine _LIBCPP_ABI_UNSTABLE
+#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
+#cmakedefine _LIBCPP_HAS_NO_STDIN
+#cmakedefine _LIBCPP_HAS_NO_STDOUT
+#cmakedefine _LIBCPP_HAS_NO_THREADS
+#cmakedefine _LIBCPP_HAS_NO_MONOTONIC_CLOCK
+#cmakedefine _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
+#cmakedefine _LIBCPP_HAS_MUSL_LIBC
+
+#endif // _LIBCPP_CONFIG_SITE
diff --git a/include/__functional_03 b/include/__functional_03
index 13c38d8548d9..4edbb0996ca0 100644
--- a/include/__functional_03
+++ b/include/__functional_03
@@ -17,218 +17,7 @@
#pragma GCC system_header
#endif
-template <class _Tp>
-class __mem_fn
- : public __weak_result_type<_Tp>
-{
-public:
- // types
- typedef _Tp type;
-private:
- type __f_;
-
-public:
- _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
-
- // invoke
-
- typename __invoke_return<type>::type
- operator() () const
- {
- return __invoke(__f_);
- }
-
- template <class _A0>
- typename __invoke_return0<type, _A0>::type
- operator() (_A0& __a0) const
- {
- return __invoke(__f_, __a0);
- }
-
- template <class _A0, class _A1>
- typename __invoke_return1<type, _A0, _A1>::type
- operator() (_A0& __a0, _A1& __a1) const
- {
- return __invoke(__f_, __a0, __a1);
- }
-
- template <class _A0, class _A1, class _A2>
- typename __invoke_return2<type, _A0, _A1, _A2>::type
- operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
- {
- return __invoke(__f_, __a0, __a1, __a2);
- }
-};
-
-template<class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp _Tp::*>
-mem_fn(_Rp _Tp::* __pm)
-{
- return __mem_fn<_Rp _Tp::*>(__pm);
-}
-
-template<class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)()>
-mem_fn(_Rp (_Tp::* __pm)())
-{
- return __mem_fn<_Rp (_Tp::*)()>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0)>
-mem_fn(_Rp (_Tp::* __pm)(_A0))
-{
- return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1))
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
-}
-
-template<class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)() const>
-mem_fn(_Rp (_Tp::* __pm)() const)
-{
- return __mem_fn<_Rp (_Tp::*)() const>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0) const>
-mem_fn(_Rp (_Tp::* __pm)(_A0) const)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1) const>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm);
-}
-
-template<class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)() volatile>
-mem_fn(_Rp (_Tp::* __pm)() volatile)
-{
- return __mem_fn<_Rp (_Tp::*)() volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0) volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm);
-}
-
-template<class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)() const volatile>
-mem_fn(_Rp (_Tp::* __pm)() const volatile)
-{
- return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0) const volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm);
-}
-
-template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>
-mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
-{
- return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm);
-}
-
-// bad_function_call
-
-class _LIBCPP_EXCEPTION_ABI bad_function_call
- : public exception
-{
-};
-
-template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
-
-namespace __function
-{
-
-template<class _Fp>
-struct __maybe_derive_from_unary_function
-{
-};
-
-template<class _Rp, class _A1>
-struct __maybe_derive_from_unary_function<_Rp(_A1)>
- : public unary_function<_A1, _Rp>
-{
-};
-
-template<class _Fp>
-struct __maybe_derive_from_binary_function
-{
-};
-
-template<class _Rp, class _A1, class _A2>
-struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
-{
-};
+namespace __function {
template<class _Fp> class __base;
@@ -662,15 +451,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _Fp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _Fp&) {return true;}
- template <class _R2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)()) {return __p;}
- template <class _R2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R2()>& __p) {return __p;}
public:
typedef _Rp result_type;
@@ -769,7 +549,7 @@ function<_Rp()>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -796,7 +576,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp()> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -947,27 +727,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _Fp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _Fp&) {return true;}
- template <class _R2, class _B0>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)(_B0)) {return __p;}
- template <class _R2, class _Cp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)()) {return __p;}
- template <class _R2, class _Cp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)() const) {return __p;}
- template <class _R2, class _Cp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)() volatile) {return __p;}
- template <class _R2, class _Cp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)() const volatile) {return __p;}
- template <class _R2, class _B0>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R2(_B0)>& __p) {return __p;}
public:
typedef _Rp result_type;
@@ -1066,7 +825,7 @@ function<_Rp(_A0)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1093,7 +852,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1244,27 +1003,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _Fp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _Fp&) {return true;}
- template <class _R2, class _B0, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)(_B0, _B1)) {return __p;}
- template <class _R2, class _Cp, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1)) {return __p;}
- template <class _R2, class _Cp, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1) const) {return __p;}
- template <class _R2, class _Cp, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1) volatile) {return __p;}
- template <class _R2, class _Cp, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1) const volatile) {return __p;}
- template <class _R2, class _B0, class _B1>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R2(_B0, _B1)>& __p) {return __p;}
public:
typedef _Rp result_type;
@@ -1363,7 +1101,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1390,7 +1128,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1540,27 +1278,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _Fp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _Fp&) {return true;}
- template <class _R2, class _B0, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)(_B0, _B1, _B2)) {return __p;}
- template <class _R2, class _Cp, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2)) {return __p;}
- template <class _R2, class _Cp, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const) {return __p;}
- template <class _R2, class _Cp, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) volatile) {return __p;}
- template <class _R2, class _Cp, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_B1, _B2) const volatile) {return __p;}
- template <class _R2, class _B0, class _B1, class _B2>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R2(_B0, _B1, _B2)>& __p) {return __p;}
public:
typedef _Rp result_type;
@@ -1660,7 +1377,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
typename enable_if<!is_integral<_Fp>::value>::type*)
: __f_(0)
{
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1687,7 +1404,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)> _FF;
if (sizeof(_FF) <= sizeof(__buf_))
@@ -1856,274 +1573,4 @@ void
swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
-template<class _Tp> struct __is_bind_expression : public false_type {};
-template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
- : public __is_bind_expression<typename remove_cv<_Tp>::type> {};
-
-template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
-template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder
- : public __is_placeholder<typename remove_cv<_Tp>::type> {};
-
-namespace placeholders
-{
-
-template <int _Np> struct __ph {};
-
-extern __ph<1> _1;
-extern __ph<2> _2;
-extern __ph<3> _3;
-extern __ph<4> _4;
-extern __ph<5> _5;
-extern __ph<6> _6;
-extern __ph<7> _7;
-extern __ph<8> _8;
-extern __ph<9> _9;
-extern __ph<10> _10;
-
-} // placeholders
-
-template<int _Np>
-struct __is_placeholder<placeholders::__ph<_Np> >
- : public integral_constant<int, _Np> {};
-
-template <class _Tp, class _Uj>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp&
-__mu(reference_wrapper<_Tp> __t, _Uj&)
-{
- return __t.get();
-}
-/*
-template <bool _IsBindExpr, class _Ti, class ..._Uj>
-struct __mu_return1 {};
-
-template <class _Ti, class ..._Uj>
-struct __mu_return1<true, _Ti, _Uj...>
-{
- typedef typename result_of<_Ti(_Uj...)>::type type;
-};
-
-template <class _Ti, class ..._Uj, size_t ..._Indx>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __mu_return1<true, _Ti, _Uj...>::type
-__mu_expand(_Ti& __ti, tuple<_Uj...>&& __uj, __tuple_indices<_Indx...>)
-{
- __ti(_VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj))...);
-}
-
-template <class _Ti, class ..._Uj>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_bind_expression<_Ti>::value,
- typename __mu_return1<is_bind_expression<_Ti>::value, _Ti, _Uj...>::type
->::type
-__mu(_Ti& __ti, tuple<_Uj...>& __uj)
-{
- typedef typename __make_tuple_indices<sizeof...(_Uj)>::type __indices;
- return __mu_expand(__ti, __uj, __indices());
-}
-
-template <bool IsPh, class _Ti, class _Uj>
-struct __mu_return2 {};
-
-template <class _Ti, class _Uj>
-struct __mu_return2<true, _Ti, _Uj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1, _Uj>::type type;
-};
-
-template <class _Ti, class _Uj>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- 0 < is_placeholder<_Ti>::value,
- typename __mu_return2<0 < is_placeholder<_Ti>::value, _Ti, _Uj>::type
->::type
-__mu(_Ti&, _Uj& __uj)
-{
- const size_t _Indx = is_placeholder<_Ti>::value - 1;
- // compiler bug workaround
- typename tuple_element<_Indx, _Uj>::type __t = _VSTD::get<_Indx>(__uj);
- return __t;
-// return _VSTD::forward<typename tuple_element<_Indx, _Uj>::type>(_VSTD::get<_Indx>(__uj));
-}
-
-template <class _Ti, class _Uj>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_bind_expression<_Ti>::value &&
- is_placeholder<_Ti>::value == 0 &&
- !__is_reference_wrapper<_Ti>::value,
- _Ti&
->::type
-__mu(_Ti& __ti, _Uj& __uj)
-{
- return __ti;
-}
-
-template <class _Ti, bool IsBindEx, bool IsPh, class _TupleUj>
-struct ____mu_return;
-
-template <class _Ti, class ..._Uj>
-struct ____mu_return<_Ti, true, false, tuple<_Uj...> >
-{
- typedef typename result_of<_Ti(_Uj...)>::type type;
-};
-
-template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, true, _TupleUj>
-{
- typedef typename tuple_element<is_placeholder<_Ti>::value - 1,
- _TupleUj>::type&& type;
-};
-
-template <class _Ti, class _TupleUj>
-struct ____mu_return<_Ti, false, false, _TupleUj>
-{
- typedef _Ti& type;
-};
-
-template <class _Ti, class _TupleUj>
-struct __mu_return
- : public ____mu_return<_Ti,
- is_bind_expression<_Ti>::value,
- 0 < is_placeholder<_Ti>::value,
- _TupleUj>
-{
-};
-
-template <class _Ti, class _TupleUj>
-struct __mu_return<reference_wrapper<_Ti>, _TupleUj>
-{
- typedef _Ti& type;
-};
-
-template <class _Fp, class _BoundArgs, class _TupleUj>
-struct __bind_return;
-
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, tuple<_BoundArgs...>, _TupleUj>
-{
- typedef typename __ref_return
- <
- _Fp&,
- typename __mu_return
- <
- _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
-};
-
-template <class _Fp, class ..._BoundArgs, class _TupleUj>
-struct __bind_return<_Fp, const tuple<_BoundArgs...>, _TupleUj>
-{
- typedef typename __ref_return
- <
- _Fp&,
- typename __mu_return
- <
- const _BoundArgs,
- _TupleUj
- >::type...
- >::type type;
-};
-
-template <class _Fp, class _BoundArgs, size_t ..._Indx, class _Args>
-inline _LIBCPP_INLINE_VISIBILITY
-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)...);
-}
-
-template<class _Fp, class ..._BoundArgs>
-class __bind
-{
- _Fp __f_;
- tuple<_BoundArgs...> __bound_args_;
-
- typedef typename __make_tuple_indices<sizeof...(_BoundArgs)>::type __indices;
-public:
- template <class _Gp, class ..._BA>
- explicit __bind(_Gp&& __f, _BA&& ...__bound_args)
- : __f_(_VSTD::forward<_Gp>(__f)),
- __bound_args_(_VSTD::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args>
- typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args)
- {
- // compiler bug workaround
- return __apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(__args...));
- }
-
- template <class ..._Args>
- typename __bind_return<_Fp, tuple<_BoundArgs...>, tuple<_Args&&...> >::type
- operator()(_Args&& ...__args) const
- {
- return __apply_functor(__f_, __bound_args_, __indices(),
- tuple<_Args&&...>(__args...));
- }
-};
-
-template<class _Fp, class ..._BoundArgs>
-struct __is_bind_expression<__bind<_Fp, _BoundArgs...> > : public true_type {};
-
-template<class _Rp, class _Fp, class ..._BoundArgs>
-class __bind_r
- : public __bind<_Fp, _BoundArgs...>
-{
- typedef __bind<_Fp, _BoundArgs...> base;
-public:
- typedef _Rp result_type;
-
- template <class _Gp, class ..._BA>
- explicit __bind_r(_Gp&& __f, _BA&& ...__bound_args)
- : base(_VSTD::forward<_Gp>(__f),
- _VSTD::forward<_BA>(__bound_args)...) {}
-
- template <class ..._Args>
- result_type
- operator()(_Args&& ...__args)
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base&>(*this), _VSTD::forward<_Args>(__args)...);
- }
-
- template <class ..._Args>
- result_type
- operator()(_Args&& ...__args) const
- {
- typedef __invoke_void_return_wrapper<_Rp> _Invoker;
- return _Invoker::__call(static_cast<base const&>(*this), _VSTD::forward<_Args>(__args)...);
- }
-};
-
-template<class _Rp, class _Fp, class ..._BoundArgs>
-struct __is_bind_expression<__bind_r<_Rp, _Fp, _BoundArgs...> > : public true_type {};
-
-template<class _Fp, class ..._BoundArgs>
-inline _LIBCPP_INLINE_VISIBILITY
-__bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind<typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
- return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
-}
-
-template<class _Rp, class _Fp, class ..._BoundArgs>
-inline _LIBCPP_INLINE_VISIBILITY
-__bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...>
-bind(_Fp&& __f, _BoundArgs&&... __bound_args)
-{
- typedef __bind_r<_Rp, typename decay<_Fp>::type, typename decay<_BoundArgs>::type...> type;
- return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
-}
-*/
-
#endif // _LIBCPP_FUNCTIONAL_03
diff --git a/include/__functional_base b/include/__functional_base
index 09424bc025a9..52c535aa3ea1 100644
--- a/include/__functional_base
+++ b/include/__functional_base
@@ -77,62 +77,6 @@ struct _LIBCPP_TYPE_VIS_ONLY less<void>
};
#endif
-// addressof
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-_Tp*
-addressof(_Tp& __x) _NOEXCEPT
-{
- return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
-}
-
-#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
-// Objective-C++ Automatic Reference Counting uses qualified pointers
-// that require special addressof() signatures. When
-// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
-// itself is providing these definitions. Otherwise, we provide them.
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__strong _Tp*
-addressof(__strong _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__weak _Tp*
-addressof(__weak _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__autoreleasing _Tp*
-addressof(__autoreleasing _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-__unsafe_unretained _Tp*
-addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
-{
- return &__x;
-}
-#endif
-
-#ifdef _LIBCPP_HAS_NO_VARIADICS
-
-#include <__functional_base_03>
-
-#else // _LIBCPP_HAS_NO_VARIADICS
-
// __weak_result_type
template <class _Tp>
@@ -314,6 +258,8 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
{
};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
// 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
@@ -358,8 +304,12 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
typedef _Rp result_type;
};
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
// __invoke
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args,
@@ -414,31 +364,79 @@ __invoke(_Fp&& __f, _Args&& ...__args)
{
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...);
}
-
template <class _Tp, class ..._Args>
struct __invoke_return
{
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
};
+#else // _LIBCPP_HAS_NO_VARIADICS
+
+#include <__functional_base_03>
+
+#endif // _LIBCPP_HAS_NO_VARIADICS
+
+
template <class _Ret>
struct __invoke_void_return_wrapper
{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
- static _Ret __call(_Args&&... __args)
- {
+ static _Ret __call(_Args&&... __args) {
return __invoke(_VSTD::forward<_Args>(__args)...);
}
+#else
+ template <class _Fn>
+ static _Ret __call(_Fn __f) {
+ return __invoke(__f);
+ }
+
+ template <class _Fn, class _A0>
+ static _Ret __call(_Fn __f, _A0& __a0) {
+ return __invoke(__f, __a0);
+ }
+
+ template <class _Fn, class _A0, class _A1>
+ static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
+ return __invoke(__f, __a0, __a1);
+ }
+
+ template <class _Fn, class _A0, class _A1, class _A2>
+ static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
+ return __invoke(__f, __a0, __a1, __a2);
+ }
+#endif
};
template <>
struct __invoke_void_return_wrapper<void>
{
+#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args>
- static void __call(_Args&&... __args)
- {
+ static void __call(_Args&&... __args) {
__invoke(_VSTD::forward<_Args>(__args)...);
}
+#else
+ template <class _Fn>
+ static void __call(_Fn __f) {
+ __invoke(__f);
+ }
+
+ template <class _Fn, class _A0>
+ static void __call(_Fn __f, _A0& __a0) {
+ __invoke(__f, __a0);
+ }
+
+ template <class _Fn, class _A0, class _A1>
+ static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
+ __invoke(__f, __a0, __a1);
+ }
+
+ template <class _Fn, class _A0, class _A1, class _A2>
+ static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
+ __invoke(__f, __a0, __a1, __a2);
+ }
+#endif
};
template <class _Tp>
@@ -463,14 +461,120 @@ public:
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_of<type&, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const
- {
- return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_of<type&, _ArgTypes...>::type
+ operator() (_ArgTypes&&... __args) const {
+ return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
+ }
+#else
+
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return<type>::type
+ operator() () const {
+ return __invoke(get());
+ }
+
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return0<type, _A0>::type
+ operator() (_A0& __a0) const {
+ return __invoke(get(), __a0);
+ }
+
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return0<type, _A0 const>::type
+ operator() (_A0 const& __a0) const {
+ return __invoke(get(), __a0);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0, _A1>::type
+ operator() (_A0& __a0, _A1& __a1) const {
+ return __invoke(get(), __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0 const, _A1>::type
+ operator() (_A0 const& __a0, _A1& __a1) const {
+ return __invoke(get(), __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0, _A1 const>::type
+ operator() (_A0& __a0, _A1 const& __a1) const {
+ return __invoke(get(), __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0 const, _A1 const>::type
+ operator() (_A0 const& __a0, _A1 const& __a1) const {
+ return __invoke(get(), __a0, __a1);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1, _A2>::type
+ operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1, _A2>::type
+ operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1 const, _A2>::type
+ operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1, _A2 const>::type
+ operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
+ operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
+ operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
+ operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
+ operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
+ return __invoke(get(), __a0, __a1, __a2);
+ }
+#endif // _LIBCPP_HAS_NO_VARIADICS
};
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
@@ -510,6 +614,7 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
return cref(__t.get());
}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
diff --git a/include/__functional_base_03 b/include/__functional_base_03
index 655027786665..8407dcfa39ca 100644
--- a/include/__functional_base_03
+++ b/include/__functional_base_03
@@ -13,943 +13,166 @@
// manual variadic expansion for <functional>
-// __weak_result_type
-
-template <class _Tp>
-struct __derives_from_unary_function
-{
-private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _Ap, class _Rp>
- static unary_function<_Ap, _Rp>
- __test(const volatile unary_function<_Ap, _Rp>*);
-public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
-};
-
-template <class _Tp>
-struct __derives_from_binary_function
-{
-private:
- struct __two {char __lx; char __lxx;};
- static __two __test(...);
- template <class _A1, class _A2, class _Rp>
- static binary_function<_A1, _A2, _Rp>
- __test(const volatile binary_function<_A1, _A2, _Rp>*);
-public:
- static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
- typedef decltype(__test((_Tp*)0)) type;
-};
-
-template <class _Tp, bool = __derives_from_unary_function<_Tp>::value>
-struct __maybe_derive_from_unary_function // bool is true
- : public __derives_from_unary_function<_Tp>::type
-{
-};
-
-template <class _Tp>
-struct __maybe_derive_from_unary_function<_Tp, false>
-{
-};
-
-template <class _Tp, bool = __derives_from_binary_function<_Tp>::value>
-struct __maybe_derive_from_binary_function // bool is true
- : public __derives_from_binary_function<_Tp>::type
-{
-};
-
-template <class _Tp>
-struct __maybe_derive_from_binary_function<_Tp, false>
-{
-};
-
-template <class _Tp, bool = __has_result_type<_Tp>::value>
-struct __weak_result_type_imp // bool is true
- : public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
- typedef typename _Tp::result_type result_type;
-};
-
-template <class _Tp>
-struct __weak_result_type_imp<_Tp, false>
- : public __maybe_derive_from_unary_function<_Tp>,
- public __maybe_derive_from_binary_function<_Tp>
-{
-};
-
-template <class _Tp>
-struct __weak_result_type
- : public __weak_result_type_imp<typename remove_reference<_Tp>::type>
-{
-};
-
-// 0 argument case
-
-template <class _Rp>
-struct __weak_result_type<_Rp ()>
-{
- typedef _Rp result_type;
-};
-
-template <class _Rp>
-struct __weak_result_type<_Rp (&)()>
-{
- typedef _Rp result_type;
-};
-
-template <class _Rp>
-struct __weak_result_type<_Rp (*)()>
-{
- typedef _Rp result_type;
-};
-
-// 1 argument case
-
-template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (_A1)>
- : public unary_function<_A1, _Rp>
-{
-};
-
-template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (&)(_A1)>
- : public unary_function<_A1, _Rp>
-{
-};
-
-template <class _Rp, class _A1>
-struct __weak_result_type<_Rp (*)(_A1)>
- : public unary_function<_A1, _Rp>
-{
-};
-
-template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)()>
- : public unary_function<_Cp*, _Rp>
-{
-};
-
-template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const>
- : public unary_function<const _Cp*, _Rp>
-{
-};
-
-template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() volatile>
- : public unary_function<volatile _Cp*, _Rp>
-{
-};
-
-template <class _Rp, class _Cp>
-struct __weak_result_type<_Rp (_Cp::*)() const volatile>
- : public unary_function<const volatile _Cp*, _Rp>
-{
-};
-
-// 2 argument case
-
-template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
-{
-};
-
-template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (*)(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
-{
-};
-
-template <class _Rp, class _A1, class _A2>
-struct __weak_result_type<_Rp (&)(_A1, _A2)>
- : public binary_function<_A1, _A2, _Rp>
-{
-};
-
-template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1)>
- : public binary_function<_Cp*, _A1, _Rp>
-{
-};
-
-template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const>
- : public binary_function<const _Cp*, _A1, _Rp>
-{
-};
-
-template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile>
- : public binary_function<volatile _Cp*, _A1, _Rp>
-{
-};
-
-template <class _Rp, class _Cp, class _A1>
-struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
- : public binary_function<const volatile _Cp*, _A1, _Rp>
-{
-};
+// __invoke
-// 3 or more arguments
+template <class _Ret, class _T1, bool _IsFunc, bool _IsBase>
+struct __enable_invoke_imp;
-template <class _Rp, class _A1, class _A2, class _A3>
-struct __weak_result_type<_Rp (_A1, _A2, _A3)>
-{
- typedef _Rp result_type;
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, true, true> {
+ typedef _Ret _Bullet1;
+ typedef _Bullet1 type;
};
-template <class _Rp, class _A1, class _A2, class _A3>
-struct __weak_result_type<_Rp (&)(_A1, _A2, _A3)>
-{
- typedef _Rp result_type;
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, true, false> {
+ typedef _Ret _Bullet2;
+ typedef _Bullet2 type;
};
-template <class _Rp, class _A1, class _A2, class _A3>
-struct __weak_result_type<_Rp (*)(_A1, _A2, _A3)>
-{
- typedef _Rp result_type;
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, false, true> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<_T1, _Ret>::type
+ >::type _Bullet3;
+ typedef _Bullet3 type;
};
-template <class _Rp, class _Cp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2)>
-{
- typedef _Rp result_type;
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1, false, false> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type
+ >::type _Bullet4;
+ typedef _Bullet4 type;
};
-template <class _Rp, class _Cp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) const>
-{
- typedef _Rp result_type;
+template <class _Ret, class _T1>
+struct __enable_invoke_imp<_Ret, _T1*, false, false> {
+ typedef typename add_lvalue_reference<
+ typename __apply_cv<_T1, _Ret>::type
+ >::type _Bullet4;
+ typedef _Bullet4 type;
};
-template <class _Rp, class _Cp, class _A1, class _A2>
-struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2) volatile>
+template <class _Fn, class _T1,
+ class _Traits = __member_pointer_traits<_Fn>,
+ class _Ret = typename _Traits::_ReturnType,
+ class _Class = typename _Traits::_ClassType>
+struct __enable_invoke : __enable_invoke_imp<
+ _Ret, _T1,
+ is_member_function_pointer<_Fn>::value,
+ is_base_of<_Class, typename remove_reference<_T1>::type>::value>
{
- typedef _Rp result_type;
};
-// __invoke
-
-// __ref_return0
-//
-// template <class _Tp, bool _HasResultType>
-// struct ________ref_return0 // _HasResultType is true
-// {
-// typedef typename _Tp::result_type type;
-// };
-//
-// template <class _Tp>
-// struct ________ref_return0<_Tp, false>
-// {
-// typedef void type;
-// };
-//
-// template <class _Tp, bool _IsClass>
-// struct ____ref_return0 // _IsClass is true
-// : public ________ref_return0<_Tp, __has_result_type<typename remove_cv<_Tp>::type>::value>
-// {
-// };
-//
-// template <class _Tp, bool _HasResultType>
-// struct ______ref_return0 // _HasResultType is true
-// {
-// typedef typename __callable_type<_Tp>::result_type type;
-// };
-//
-// template <class _Tp>
-// struct ______ref_return0<_Tp, false> // pointer to member data
-// {
-// typedef void type;
-// };
-//
-// template <class _Tp>
-// struct ____ref_return0<_Tp, false>
-// : public ______ref_return0<typename remove_cv<_Tp>::type,
-// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value>
-// {
-// };
-//
-// template <class _Tp>
-// struct __ref_return0
-// : public ____ref_return0<typename remove_reference<_Tp>::type,
-// is_class<typename remove_reference<_Tp>::type>::value>
-// {
-// };
-//
-// __ref_return1
-//
-// template <class _Tp, bool _IsClass, class _A0>
-// struct ____ref_return1 // _IsClass is true
-// {
-// typedef typename result_of<_Tp(_A0)>::type type;
-// };
-//
-// template <class _Tp, bool _HasResultType, class _A0>
-// struct ______ref_return1 // _HasResultType is true
-// {
-// typedef typename __callable_type<_Tp>::result_type type;
-// };
-//
-// template <class _Tp, class _A0, bool>
-// struct __ref_return1_member_data1;
-//
-// template <class _Rp, class _Cp, class _A0>
-// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, true>
-// {
-// typedef typename __apply_cv<_A0, _Rp>::type& type;
-// };
-//
-// template <class _Rp, class _Cp, class _A0>
-// struct __ref_return1_member_data1<_Rp _Cp::*, _A0, false>
-// {
-// static _A0 __a;
-// typedef typename __apply_cv<decltype(*__a), _Rp>::type& type;
-// };
-//
-// template <class _Tp, class _A0>
-// struct __ref_return1_member_data;
-//
-// template <class _Rp, class _Cp, class _A0>
-// struct __ref_return1_member_data<_Rp _Cp::*, _A0>
-// : public __ref_return1_member_data1<_Rp _Cp::*, _A0,
-// is_same<typename remove_cv<_Cp>::type,
-// typename remove_cv<typename remove_reference<_A0>::type>::type>::value>
-// {
-// };
-//
-// template <class _Tp, class _A0>
-// struct ______ref_return1<_Tp, false, _A0> // pointer to member data
-// : public __ref_return1_member_data<typename remove_cv<_Tp>::type, _A0>
-// {
-// };
-//
-// template <class _Tp, class _A0>
-// struct ____ref_return1<_Tp, false, _A0>
-// : public ______ref_return1<typename remove_cv<_Tp>::type,
-// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0>
-// {
-// };
-//
-// template <class _Tp, class _A0>
-// struct __ref_return1
-// : public ____ref_return1<typename remove_reference<_Tp>::type,
-// is_class<typename remove_reference<_Tp>::type>::value, _A0>
-// {
-// };
-//
-// __ref_return2
-//
-// template <class _Tp, bool _IsClass, class _A0, class _A1>
-// struct ____ref_return2 // _IsClass is true
-// {
-// typedef typename result_of<_Tp(_A0, _A1)>::type type;
-// };
-//
-// template <class _Tp, bool _HasResultType, class _A0, class _A1>
-// struct ______ref_return2 // _HasResultType is true
-// {
-// typedef typename __callable_type<_Tp>::result_type type;
-// };
-//
-// template <class _Tp>
-// struct ______ref_return2<_Tp, false, class _A0, class _A1> // pointer to member data
-// {
-// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
-// " to member data with too many arguments.");
-// };
-//
-// template <class _Tp, class _A0, class _A1>
-// struct ____ref_return2<_Tp, false, _A0, _A1>
-// : public ______ref_return2<typename remove_cv<_Tp>::type,
-// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1>
-// {
-// };
-//
-// template <class _Tp, class _A0, class _A1>
-// struct __ref_return2
-// : public ____ref_return2<typename remove_reference<_Tp>::type,
-// is_class<typename remove_reference<_Tp>::type>::value, _A0, _A1>
-// {
-// };
-//
-// __ref_return3
-//
-// template <class _Tp, bool _IsClass, class _A0, class _A1, class _A2>
-// struct ____ref_return3 // _IsClass is true
-// {
-// typedef typename result_of<_Tp(_A0, _A1, _A2)>::type type;
-// };
-//
-// template <class _Tp, bool _HasResultType, class _A0, class _A1, class _A2>
-// struct ______ref_return3 // _HasResultType is true
-// {
-// typedef typename __callable_type<_Tp>::result_type type;
-// };
-//
-// template <class _Tp>
-// struct ______ref_return3<_Tp, false, class _A0, class _A1, class _A2> // pointer to member data
-// {
-// static_assert(sizeof(_Tp) == 0, "An attempt has been made to `call` a pointer"
-// " to member data with too many arguments.");
-// };
-//
-// template <class _Tp, class _A0, class _A1, class _A2>
-// struct ____ref_return3<_Tp, false, _A0, _A1, _A2>
-// : public ______ref_return3<typename remove_cv<_Tp>::type,
-// __has_result_type<__callable_type<typename remove_cv<_Tp>::type> >::value, _A0, _A1, _A2>
-// {
-// };
-//
-// template <class _Tp, class _A0, class _A1, class _A2>
-// struct __ref_return3
-// : public ____ref_return3<typename remove_reference<_Tp>::type,
-// is_class<typename remove_reference<_Tp>::type>::value, _A0, _A1, _A2>
-// {
-// };
+__nat __invoke(__any, ...);
// first bullet
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(), _T1& __t1)
-{
- return (__t1.*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0), _T1& __t1, _A0& __a0)
-{
- return (__t1.*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1& __t1, _A0& __a0, _A1& __a1)
-{
- return (__t1.*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return (__t1.*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() const, _T1& __t1)
-{
- return (__t1.*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) const, _T1& __t1, _A0& __a0)
-{
- return (__t1.*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1& __t1, _A0& __a0, _A1& __a1)
-{
- return (__t1.*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return (__t1.*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() volatile, _T1& __t1)
-{
- return (__t1.*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1& __t1, _A0& __a0)
-{
- return (__t1.*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1& __t1, _A0& __a0, _A1& __a1)
-{
- return (__t1.*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return (__t1.*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
+template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() const volatile, _T1& __t1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1) {
return (__t1.*__f)();
}
-template <class _Rp, class _Tp, class _T1, class _A0>
+template <class _Fn, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1& __t1, _A0& __a0)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
return (__t1.*__f)(__a0);
}
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+template <class _Fn, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1& __t1, _A0& __a0, _A1& __a1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
return (__t1.*__f)(__a0, __a1);
}
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+template <class _Fn, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet1
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
return (__t1.*__f)(__a0, __a1, __a2);
}
-// second bullet
-
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(), _T1 __t1)
-{
- return ((*__t1).*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0), _T1 __t1, _A0& __a0)
-{
- return ((*__t1).*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1), _T1 __t1, _A0& __a0, _A1& __a1)
-{
- return ((*__t1).*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2), _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return ((*__t1).*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() const, _T1 __t1)
-{
- return ((*__t1).*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) const, _T1 __t1, _A0& __a0)
-{
- return ((*__t1).*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) const, _T1 __t1, _A0& __a0, _A1& __a1)
-{
- return ((*__t1).*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return ((*__t1).*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() volatile, _T1 __t1)
-{
- return ((*__t1).*__f)();
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) volatile, _T1 __t1, _A0& __a0)
-{
- return ((*__t1).*__f)(__a0);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) volatile, _T1 __t1, _A0& __a0, _A1& __a1)
-{
- return ((*__t1).*__f)(__a0, __a1);
-}
-
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
- return ((*__t1).*__f)(__a0, __a1, __a2);
-}
-
-template <class _Rp, class _Tp, class _T1>
+template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)() const volatile, _T1 __t1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1) {
return ((*__t1).*__f)();
}
-template <class _Rp, class _Tp, class _T1, class _A0>
+template <class _Fn, class _T1, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0) const volatile, _T1 __t1, _A0& __a0)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0) {
return ((*__t1).*__f)(__a0);
}
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1>
+template <class _Fn, class _T1, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1) const volatile, _T1 __t1, _A0& __a0, _A1& __a1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1) {
return ((*__t1).*__f)(__a0, __a1);
}
-template <class _Rp, class _Tp, class _T1, class _A0, class _A1, class _A2>
+template <class _Fn, class _T1, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- _Rp
->::type
-__invoke(_Rp (_Tp::*__f)(_A0, _A1, _A2) const volatile, _T1 __t1, _A0& __a0, _A1& __a1, _A2& __a2)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet2
+__invoke(_Fn __f, _T1& __t1, _A0& __a0, _A1& __a1, _A2& __a2) {
return ((*__t1).*__f)(__a0, __a1, __a2);
}
-// third bullet
-
-template <class _Rp, class _Tp, class _T1>
+template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename enable_if
-<
- is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
- typename __apply_cv<_T1, _Rp>::type&
->::type
-__invoke(_Rp _Tp::* __f, _T1& __t1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet3
+__invoke(_Fn __f, _T1& __t1) {
return __t1.*__f;
}
-template <class _Rp, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-void
-__invoke(_Rp _Tp::*)
-{
-}
-
-// template <class _Dp, class _Rp, class _Tp, class _T1>
-// inline _LIBCPP_INLINE_VISIBILITY
-// typename enable_if
-// <
-// is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_Rp _Tp::*, _T1>::type
-// >::type
-// __invoke(_Rp _Tp::* __f, _T1& __t1)
-// {
-// return __t1.*__f;
-// }
-
-// forth bullet
-
-template <class _T1, class _Rp, bool>
-struct __4th_helper
-{
-};
-
-template <class _T1, class _Rp>
-struct __4th_helper<_T1, _Rp, true>
-{
- typedef typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Rp>::type type;
-};
-
-template <class _Rp, class _Tp, class _T1>
+template <class _Fn, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
-typename __4th_helper<_T1, _Rp,
- !is_base_of<_Tp,
- typename remove_reference<_T1>::type
- >::value
- >::type&
-__invoke(_Rp _Tp::* __f, _T1& __t1)
-{
+typename __enable_invoke<_Fn, _T1>::_Bullet4
+__invoke(_Fn __f, _T1& __t1) {
return (*__t1).*__f;
}
-// template <class _Dp, class _Rp, class _Tp, class _T1>
-// inline _LIBCPP_INLINE_VISIBILITY
-// typename enable_if
-// <
-// !is_base_of<_Tp, typename remove_reference<_T1>::type>::value,
-// typename __ref_return1<_Rp _Tp::*, _T1>::type
-// >::type
-// __invoke(_Rp _Tp::* __f, _T1 __t1)
-// {
-// return (*__t1).*__f;
-// }
-
// fifth bullet
template <class _Fp>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp>()())
-__invoke(_Fp __f)
+decltype(_VSTD::declval<_Fp&>()())
+__invoke(_Fp& __f)
{
return __f();
}
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp>()(declval<_A0&>()))
-__invoke(_Fp __f, _A0& __a0)
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
+__invoke(_Fp& __f, _A0& __a0)
{
return __f(__a0);
}
template <class _Fp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>()))
-__invoke(_Fp __f, _A0& __a0, _A1& __a1)
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
{
return __f(__a0, __a1);
}
template <class _Fp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
-decltype(declval<_Fp>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
-__invoke(_Fp __f, _A0& __a0, _A1& __a1, _A2& __a2)
+decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
+__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
{
return __f(__a0, __a1, __a2);
}
-// template <class _Rp, class _Fp>
-// inline _LIBCPP_INLINE_VISIBILITY
-// _Rp
-// __invoke(_Fp& __f)
-// {
-// return __f();
-// }
-//
-// template <class _Rp, class _Fp, class _A0>
-// inline _LIBCPP_INLINE_VISIBILITY
-// typename enable_if
-// <
-// !is_member_pointer<_Fp>::value,
-// _Rp
-// >::type
-// __invoke(_Fp& __f, _A0& __a0)
-// {
-// return __f(__a0);
-// }
-//
-// template <class _Rp, class _Fp, class _A0, class _A1>
-// inline _LIBCPP_INLINE_VISIBILITY
-// _Rp
-// __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
-// {
-// return __f(__a0, __a1);
-// }
-//
-// template <class _Rp, class _Fp, class _A0, class _A1, class _A2>
-// inline _LIBCPP_INLINE_VISIBILITY
-// _Rp
-// __invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
-// {
-// return __f(__a0, __a1, __a2);
-// }
-
-template <class _Tp>
-struct __has_type
-{
-private:
- struct __two {char __lx; char __lxx;};
- template <class _Up> static __two __test(...);
- template <class _Up> static char __test(typename _Up::type* = 0);
-public:
- static const bool value = sizeof(__test<_Tp>(0)) == 1;
-};
-
template <class _Fp, bool = __has_result_type<__weak_result_type<_Fp> >::value>
struct __invoke_return
{
@@ -959,186 +182,43 @@ struct __invoke_return
template <class _Fp>
struct __invoke_return<_Fp, false>
{
- typedef decltype(__invoke(_VSTD::declval<_Fp>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
};
template <class _Tp, class _A0>
struct __invoke_return0
{
- typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
};
template <class _Rp, class _Tp, class _A0>
struct __invoke_return0<_Rp _Tp::*, _A0>
{
- typedef typename __apply_cv<_A0, _Rp>::type& type;
-};
-
-template <class _Rp, class _Tp, class _A0>
-struct __invoke_return0<_Rp _Tp::*, _A0*>
-{
- typedef typename __apply_cv<_A0, _Rp>::type& type;
+ typedef typename __enable_invoke<_Rp _Tp::*, _A0>::type type;
};
template <class _Tp, class _A0, class _A1>
struct __invoke_return1
{
- typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
- _VSTD::declval<_A1>())) type;
+ typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
+ _VSTD::declval<_A1&>())) type;
};
-template <class _Tp, class _A0, class _A1, class _A2>
-struct __invoke_return2
-{
- typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_A0>(),
- _VSTD::declval<_A1>(),
- _VSTD::declval<_A2>())) type;
+template <class _Rp, class _Class, class _A0, class _A1>
+struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
+ typedef typename __enable_invoke<_Rp _Class::*, _A0>::type type;
};
-template <class _Ret>
-struct __invoke_void_return_wrapper
+template <class _Tp, class _A0, class _A1, class _A2>
+struct __invoke_return2
{
- template <class _Fn>
- static _Ret __call(_Fn __f)
- {
- return __invoke(__f);
- }
-
- template <class _Fn, class _A0>
- static _Ret __call(_Fn __f, _A0& __a0)
- {
- return __invoke(__f, __a0);
- }
-
- template <class _Fn, class _A0, class _A1>
- static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1)
- {
- return __invoke(__f, __a0, __a1);
- }
-
- template <class _Fn, class _A0, class _A1, class _A2>
- static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2)
- {
- return __invoke(__f, __a0, __a1, __a2);
- }
+ typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
+ _VSTD::declval<_A1&>(),
+ _VSTD::declval<_A2&>())) type;
};
-
-template <>
-struct __invoke_void_return_wrapper<void>
-{
- template <class _Fn>
- static void __call(_Fn __f)
- {
- __invoke(__f);
- }
-
- template <class _Fn, class _A0>
- static void __call(_Fn __f, _A0& __a0)
- {
- __invoke(__f, __a0);
- }
-
- template <class _Fn, class _A0, class _A1>
- static void __call(_Fn __f, _A0& __a0, _A1& __a1)
- {
- __invoke(__f, __a0, __a1);
- }
-
- template <class _Fn, class _A0, class _A1, class _A2>
- static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2)
- {
- __invoke(__f, __a0, __a1, __a2);
- }
+template <class _Ret, class _Class, class _A0, class _A1, class _A2>
+struct __invoke_return2<_Ret _Class::*, _A0, _A1, _A2> {
+ typedef typename __enable_invoke<_Ret _Class::*, _A0>::type type;
};
-
-template <class _Tp>
-class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
- : public __weak_result_type<_Tp>
-{
-public:
- // types
- typedef _Tp type;
-private:
- type* __f_;
-
-public:
- // construct/copy/destroy
- _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
-
- // access
- _LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
- _LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
-
- // invoke
-
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return<type&>::type
- operator() () const
- {
- return __invoke(get());
- }
-
- template <class _A0>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return0<type&, _A0>::type
- operator() (_A0& __a0) const
- {
- return __invoke<type&, _A0>(get(), __a0);
- }
-
- template <class _A0, class _A1>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return1<type&, _A0, _A1>::type
- operator() (_A0& __a0, _A1& __a1) const
- {
- return __invoke<type&, _A0, _A1>(get(), __a0, __a1);
- }
-
- template <class _A0, class _A1, class _A2>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return2<type&, _A0, _A1, _A2>::type
- operator() (_A0& __a0, _A1& __a1, _A2& __a2) const
- {
- return __invoke<type&, _A0, _A1, _A2>(get(), __a0, __a1, __a2);
- }
-};
-
-template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
-template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
-template <class _Tp> struct __is_reference_wrapper
- : public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-reference_wrapper<_Tp>
-ref(_Tp& __t)
-{
- return reference_wrapper<_Tp>(__t);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-reference_wrapper<_Tp>
-ref(reference_wrapper<_Tp> __t)
-{
- return ref(__t.get());
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-reference_wrapper<const _Tp>
-cref(const _Tp& __t)
-{
- return reference_wrapper<const _Tp>(__t);
-}
-
-template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
-reference_wrapper<const _Tp>
-cref(reference_wrapper<_Tp> __t)
-{
- return cref(__t.get());
-}
-
#endif // _LIBCPP_FUNCTIONAL_BASE_03
diff --git a/include/__hash_table b/include/__hash_table
index f3a20309df71..cfa763ab217a 100644
--- a/include/__hash_table
+++ b/include/__hash_table
@@ -836,6 +836,7 @@ public:
typedef __hash_local_iterator<__node_pointer> local_iterator;
typedef __hash_const_local_iterator<__node_pointer> const_local_iterator;
+ _LIBCPP_INLINE_VISIBILITY
__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
@@ -843,6 +844,7 @@ public:
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value);
+ _LIBCPP_INLINE_VISIBILITY
__hash_table(const hasher& __hf, const key_equal& __eql);
__hash_table(const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
@@ -863,6 +865,7 @@ public:
__hash_table& operator=(const __hash_table& __u);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
__hash_table& operator=(__hash_table&& __u)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
@@ -934,9 +937,13 @@ public:
return __bucket_list_.get_deleter().size();
}
+ _LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT;
template <class _Key>
@@ -965,6 +972,7 @@ public:
__node_holder remove(const_iterator __p) _NOEXCEPT;
template <class _Key>
+ _LIBCPP_INLINE_VISIBILITY
size_type __count_unique(const _Key& __k) const;
template <class _Key>
size_type __count_multi(const _Key& __k) const;
@@ -984,15 +992,17 @@ public:
__equal_range_multi(const _Key& __k) const;
void swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
-#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
-#endif
);
+#else
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value);
+#endif
_LIBCPP_INLINE_VISIBILITY
size_type max_bucket_count() const _NOEXCEPT
@@ -1128,11 +1138,12 @@ private:
};
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
_NOEXCEPT_(
is_nothrow_default_constructible<__bucket_list>::value &&
is_nothrow_default_constructible<__first_node>::value &&
+ is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_default_constructible<hasher>::value &&
is_nothrow_default_constructible<key_equal>::value)
: __p2_(0),
@@ -1141,7 +1152,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table()
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
const key_equal& __eql)
: __bucket_list_(nullptr, __bucket_list_deleter()),
@@ -1201,6 +1212,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
_NOEXCEPT_(
is_nothrow_move_constructible<__bucket_list>::value &&
is_nothrow_move_constructible<__first_node>::value &&
+ is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<hasher>::value &&
is_nothrow_move_constructible<key_equal>::value)
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
@@ -1408,7 +1420,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__hash_table<_Tp, _Hash, _Equal, _Alloc>&
__hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
_NOEXCEPT_(
@@ -1493,7 +1505,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__assign_multi(_InputIterator __first,
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
{
@@ -1505,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
{
@@ -1517,7 +1529,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
{
@@ -1529,7 +1541,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
{
@@ -2106,7 +2118,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_);
__h->__next_ = nullptr;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -2122,7 +2134,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
__h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash;
__h->__next_ = nullptr;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -2254,7 +2266,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Key>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::size_type
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__count_unique(const _Key& __k) const
{
@@ -2351,15 +2363,17 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__equal_range_multi(
template <class _Tp, class _Hash, class _Equal, class _Alloc>
void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
+#if _LIBCPP_STD_VER <= 11
_NOEXCEPT_(
__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value
-#if _LIBCPP_STD_VER <= 11
&& (!allocator_traits<__pointer_allocator>::propagate_on_container_swap::value
|| __is_nothrow_swappable<__pointer_allocator>::value)
&& (!__node_traits::propagate_on_container_swap::value
|| __is_nothrow_swappable<__node_allocator>::value)
-#endif
)
+#else
+ _NOEXCEPT_(__is_nothrow_swappable<hasher>::value && __is_nothrow_swappable<key_equal>::value)
+#endif
{
{
__node_pointer_pointer __npp = __bucket_list_.release();
diff --git a/include/__locale b/include/__locale
index 19895582cac8..7bc701dda6e3 100644
--- a/include/__locale
+++ b/include/__locale
@@ -37,6 +37,8 @@
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
# include <xlocale.h>
+#elif defined(_LIBCPP_HAS_MUSL_LIBC)
+# include <support/musl/xlocale.h>
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -329,7 +331,7 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_TYPE_VIS ctype_base
{
public:
-#ifdef __GLIBC__
+#if defined(__GLIBC__)
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
@@ -359,7 +361,7 @@ public:
typedef __uint32_t mask;
# elif defined(__FreeBSD__)
typedef unsigned long mask;
-# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
+# elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
typedef unsigned short mask;
# endif
static const mask space = _CTYPE_S;
diff --git a/include/__mutex_base b/include/__mutex_base
index d5ece7c1454c..b019b4760d18 100644
--- a/include/__mutex_base
+++ b/include/__mutex_base
@@ -14,7 +14,9 @@
#include <__config>
#include <chrono>
#include <system_error>
+#ifndef _LIBCPP_HAS_NO_THREADS
#include <pthread.h>
+#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -306,6 +308,7 @@ public:
template <class _Rep, class _Period, class _Predicate>
bool
+ _LIBCPP_INLINE_VISIBILITY
wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
@@ -390,7 +393,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
}
template <class _Rep, class _Period, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d,
diff --git a/include/__nullptr b/include/__nullptr
new file mode 100644
index 000000000000..95415a6325a3
--- /dev/null
+++ b/include/__nullptr
@@ -0,0 +1,66 @@
+// -*- C++ -*-
+//===--------------------------- __nullptr --------------------------------===//
+//
+// 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_NULLPTR
+#define _LIBCPP_NULLPTR
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef _LIBCPP_HAS_NO_NULLPTR
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
+{
+ void* __lx;
+
+ struct __nat {int __for_bool_;};
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
+
+ template <class _Tp>
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
+ operator _Tp* () const {return 0;}
+
+ template <class _Tp, class _Up>
+ _LIBCPP_ALWAYS_INLINE
+ operator _Tp _Up::* () const {return 0;}
+
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
+ friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
+};
+
+inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
+
+#define nullptr _VSTD::__get_nullptr_t()
+
+_LIBCPP_END_NAMESPACE_STD
+
+#else // _LIBCPP_HAS_NO_NULLPTR
+
+namespace std
+{
+ typedef decltype(nullptr) nullptr_t;
+}
+
+#endif // _LIBCPP_HAS_NO_NULLPTR
+
+#endif // _LIBCPP_NULLPTR
diff --git a/include/__split_buffer b/include/__split_buffer
index 727b1b6b5674..79d1aa1d7c4a 100644
--- a/include/__split_buffer
+++ b/include/__split_buffer
@@ -56,9 +56,12 @@ public:
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();}
+ _LIBCPP_INLINE_VISIBILITY
__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+ _LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(__alloc_rr& __a);
+ _LIBCPP_INLINE_VISIBILITY
explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer();
@@ -128,7 +131,9 @@ public:
_LIBCPP_INLINE_VISIBILITY void __destruct_at_begin(pointer __new_begin)
{__destruct_at_begin(__new_begin, is_trivially_destructible<value_type>());}
+ _LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, false_type);
+ _LIBCPP_INLINE_VISIBILITY
void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY
@@ -266,7 +271,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
@@ -275,7 +280,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
@@ -309,7 +314,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
@@ -317,14 +322,14 @@ __split_buffer<_Tp, _Allocator>::__split_buffer()
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
{
diff --git a/include/__std_stream b/include/__std_stream
index 5403adabc343..f867cd23bdd5 100644
--- a/include/__std_stream
+++ b/include/__std_stream
@@ -276,7 +276,6 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
codecvt_base::result __r;
char_type* pbase = &__1buf;
char_type* pptr = pbase + 1;
- char_type* epptr = pptr;
do
{
const char_type* __e;
diff --git a/include/__tree b/include/__tree
index 574e74baf26b..6391609b3982 100644
--- a/include/__tree
+++ b/include/__tree
@@ -1118,8 +1118,8 @@ __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)
- : __pair1_(__node_allocator(__a)),
- __begin_node_(__node_pointer()),
+ : __begin_node_(__node_pointer()),
+ __pair1_(__node_allocator(__a)),
__pair3_(0)
{
__begin_node() = __end_node();
@@ -1128,8 +1128,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
const allocator_type& __a)
- : __pair1_(__node_allocator(__a)),
- __begin_node_(__node_pointer()),
+ : __begin_node_(__node_pointer()),
+ __pair1_(__node_allocator(__a)),
__pair3_(0, __comp)
{
__begin_node() = __end_node();
@@ -1843,7 +1843,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
diff --git a/include/__tuple b/include/__tuple
index 2837ce708f09..8c31759774de 100644
--- a/include/__tuple
+++ b/include/__tuple
@@ -86,6 +86,11 @@ template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
+
+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
// pair specializations
@@ -109,6 +114,11 @@ template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
+
+template <size_t _Ip, class _T1, class _T2>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&&) _NOEXCEPT;
#endif
// array specializations
@@ -132,35 +142,15 @@ template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
+
+template <size_t _Ip, class _Tp, size_t _Size>
+_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&&
+get(const array<_Tp, _Size>&&) _NOEXCEPT;
#endif
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
-// __lazy_and
-
-template <bool _Last, class ..._Preds>
-struct __lazy_and_impl;
-
-template <class ..._Preds>
-struct __lazy_and_impl<false, _Preds...> : false_type {};
-
-template <>
-struct __lazy_and_impl<true> : true_type {};
-
-template <class _Pred>
-struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
-
-template <class _Hp, class ..._Tp>
-struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
-
-template <class _P1, class ..._Pr>
-struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
-
-// __lazy_not
-
-template <class _Pred>
-struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
-
// __make_tuple_indices
template <size_t...> struct __tuple_indices {};
diff --git a/include/algorithm b/include/algorithm
index 7b0c53e05a5a..9c051198930d 100644
--- a/include/algorithm
+++ b/include/algorithm
@@ -851,7 +851,7 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
- return _VSTD::move(__f); // explicitly moved for (emulated) C++03
+ return _LIBCPP_EXPLICIT_MOVE(__f); // explicitly moved for (emulated) C++03
}
// find
@@ -2330,7 +2330,7 @@ __reverse(_BidirectionalIterator __first, _BidirectionalIterator __last, bidirec
{
if (__first == --__last)
break;
- swap(*__first, *__last);
+ _VSTD::iter_swap(__first, __last);
++__first;
}
}
@@ -2342,7 +2342,7 @@ __reverse(_RandomAccessIterator __first, _RandomAccessIterator __last, random_ac
{
if (__first != __last)
for (; __first < --__last; ++__first)
- swap(*__first, *__last);
+ _VSTD::iter_swap(__first, __last);
}
template <class _BidirectionalIterator>
@@ -3037,7 +3037,7 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
if (_Rp == 0)
return static_cast<result_type>(_Eng(__g, _Dt)());
size_t __w = _Dt - __clz(_Rp) - 1;
- if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0)
+ if ((_Rp & (std::numeric_limits<_UIntType>::max() >> (_Dt - __w))) != 0)
++__w;
_Eng __e(__g, __w);
_UIntType __u;
diff --git a/include/array b/include/array
index 2e02a43ed524..8866eaf6b463 100644
--- a/include/array
+++ b/include/array
@@ -89,12 +89,13 @@ template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y)));
template <class T> class tuple_size;
-template <int I, class T> class tuple_element;
+template <size_t I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
-template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
-template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
-template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
-template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
+template <size_t I, class T, size_t N> struct tuple_element<I, array<T, N>>;
+template <size_t I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
+template <size_t I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
+template <size_t I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
+template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexcept; // constexpr in C++14
} // std
@@ -324,6 +325,15 @@ get(array<_Tp, _Size>&& __a) _NOEXCEPT
return _VSTD::move(__a.__elems_[_Ip]);
}
+template <size_t _Ip, class _Tp, size_t _Size>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const _Tp&&
+get(const array<_Tp, _Size>&& __a) _NOEXCEPT
+{
+ static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array &&)");
+ return _VSTD::move(__a.__elems_[_Ip]);
+}
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/atomic b/include/atomic
index 97a998d33633..abec2a0b565a 100644
--- a/include/atomic
+++ b/include/atomic
@@ -535,25 +535,35 @@ void atomic_signal_fence(memory_order m) noexcept;
#ifdef _LIBCPP_HAS_NO_THREADS
#error <atomic> is not supported on this single threaded system
-#else // !_LIBCPP_HAS_NO_THREADS
+#endif
+#if !defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
+#error <atomic> is not implemented
+#endif
_LIBCPP_BEGIN_NAMESPACE_STD
-#if !__has_feature(cxx_atomic) && _GNUC_VER < 407
-#error <atomic> is not implemented
-#else
-
typedef enum memory_order
{
memory_order_relaxed, memory_order_consume, memory_order_acquire,
memory_order_release, memory_order_acq_rel, memory_order_seq_cst
} memory_order;
-#if _GNUC_VER >= 407
+#if defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)
namespace __gcc_atomic {
template <typename _Tp>
struct __gcc_atomic_t {
- __gcc_atomic_t() _NOEXCEPT {}
+
+#if _GNUC_VER >= 501
+ static_assert(is_trivially_copyable<_Tp>::value,
+ "std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
+#endif
+
+ _LIBCPP_INLINE_VISIBILITY
+#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
+ __gcc_atomic_t() _NOEXCEPT = default;
+#else
+ __gcc_atomic_t() _NOEXCEPT : __a_value() {}
+#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_CONSTEXPR explicit __gcc_atomic_t(_Tp value) _NOEXCEPT
: __a_value(value) {}
_Tp __a_value;
@@ -574,7 +584,7 @@ struct __can_assign {
sizeof(__test_atomic_assignable<_Tp, _Td>(1)) == sizeof(char);
};
-static inline constexpr int __to_gcc_order(memory_order __order) {
+static inline _LIBCPP_CONSTEXPR int __to_gcc_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -584,7 +594,7 @@ static inline constexpr int __to_gcc_order(memory_order __order) {
__ATOMIC_CONSUME))));
}
-static inline constexpr int __to_gcc_failure_order(memory_order __order) {
+static inline _LIBCPP_CONSTEXPR int __to_gcc_failure_order(memory_order __order) {
// Avoid switch statement to make this a constexpr.
return __order == memory_order_relaxed ? __ATOMIC_RELAXED:
(__order == memory_order_acquire ? __ATOMIC_ACQUIRE:
@@ -805,7 +815,7 @@ static inline _Tp __c11_atomic_fetch_xor(_Atomic(_Tp)* __a, _Tp __pattern,
return __atomic_fetch_xor(&__a->__a_value, __pattern,
__gcc_atomic::__to_gcc_order(__order));
}
-#endif // _GNUC_VER >= 407
+#endif // _LIBCPP_HAS_GCC_ATOMIC_IMP
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -825,7 +835,7 @@ struct __atomic_base // false
_LIBCPP_INLINE_VISIBILITY
bool is_lock_free() const volatile _NOEXCEPT
{
-#if __has_feature(cxx_atomic)
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP)
return __c11_atomic_is_lock_free(sizeof(_Tp));
#else
return __atomic_is_lock_free(sizeof(_Tp), 0);
@@ -1779,8 +1789,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_FLAG_INIT {false}
#define ATOMIC_VAR_INIT(__v) {__v}
-// lock-free property
-
#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
@@ -1792,10 +1800,6 @@ typedef atomic<uintmax_t> atomic_uintmax_t;
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
-#endif // !__has_feature(cxx_atomic)
-
_LIBCPP_END_NAMESPACE_STD
-#endif // !_LIBCPP_HAS_NO_THREADS
-
#endif // _LIBCPP_ATOMIC
diff --git a/include/bitset b/include/bitset
index 8c278cc724f1..87d7afca5a73 100644
--- a/include/bitset
+++ b/include/bitset
@@ -168,7 +168,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@@ -180,8 +182,11 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+ _LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
void flip() _NOEXCEPT;
@@ -192,22 +197,27 @@ protected:
bool all() const _NOEXCEPT;
bool any() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
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
unsigned long to_ulong(false_type) const;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type) const;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong(true_type, false_type) const;
unsigned long long to_ullong(true_type, true_type) const;
};
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@@ -245,7 +255,7 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
@@ -264,7 +274,7 @@ __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@@ -273,7 +283,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@@ -282,7 +292,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@@ -325,7 +335,7 @@ __bitset<_N_words, _Size>::to_ulong(false_type) const
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long
__bitset<_N_words, _Size>::to_ulong(true_type) const
{
@@ -348,7 +358,7 @@ __bitset<_N_words, _Size>::to_ullong(false_type) const
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type) const
{
@@ -356,7 +366,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type) const
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long long
__bitset<_N_words, _Size>::to_ullong(true_type, false_type) const
{
@@ -414,7 +424,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
}
template <size_t _N_words, size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT
{
@@ -450,7 +460,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
@@ -462,23 +474,32 @@ protected:
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
+ _LIBCPP_INLINE_VISIBILITY
void operator&=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void operator|=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void operator^=(const __bitset& __v) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void flip() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
+ _LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT;
};
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0)
@@ -486,7 +507,7 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v))
@@ -494,7 +515,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
{
@@ -502,7 +523,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
{
@@ -510,7 +531,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
{
@@ -518,7 +539,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
__bitset<1, _Size>::flip() _NOEXCEPT
{
@@ -528,7 +549,7 @@ __bitset<1, _Size>::flip() _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long
__bitset<1, _Size>::to_ulong() const
{
@@ -536,7 +557,7 @@ __bitset<1, _Size>::to_ulong() const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long long
__bitset<1, _Size>::to_ullong() const
{
@@ -544,7 +565,7 @@ __bitset<1, _Size>::to_ullong() const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
__bitset<1, _Size>::all() const _NOEXCEPT
{
@@ -553,7 +574,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
__bitset<1, _Size>::any() const _NOEXCEPT
{
@@ -562,7 +583,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
__bitset<1, _Size>::__hash_code() const _NOEXCEPT
{
@@ -593,7 +614,9 @@ protected:
typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator;
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
@@ -620,13 +643,13 @@ protected:
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;}
};
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT
{
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
@@ -663,16 +686,23 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations:
+ _LIBCPP_INLINE_VISIBILITY
bitset& operator&=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bitset& operator|=(const bitset& __rhs) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bitset& operator^=(const bitset& __rhs) _NOEXCEPT;
bitset& operator<<=(size_t __pos) _NOEXCEPT;
bitset& operator>>=(size_t __pos) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bitset& set() _NOEXCEPT;
bitset& set(size_t __pos, bool __val = true);
+ _LIBCPP_INLINE_VISIBILITY
bitset& reset() _NOEXCEPT;
bitset& reset(size_t __pos);
+ _LIBCPP_INLINE_VISIBILITY
bitset operator~() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bitset& flip() _NOEXCEPT;
bitset& flip(size_t __pos);
@@ -680,28 +710,40 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
+ _LIBCPP_INLINE_VISIBILITY
unsigned long to_ulong() const;
+ _LIBCPP_INLINE_VISIBILITY
unsigned long long to_ullong() const;
template <class _CharT, class _Traits, class _Allocator>
basic_string<_CharT, _Traits, _Allocator> to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT, class _Traits>
+ _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
template <class _CharT>
+ _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > to_string(_CharT __zero = _CharT('0'),
_CharT __one = _CharT('1')) const;
+ _LIBCPP_INLINE_VISIBILITY
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const;
+ _LIBCPP_INLINE_VISIBILITY
size_t count() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;}
+ _LIBCPP_INLINE_VISIBILITY
bool operator==(const bitset& __rhs) const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const;
+ _LIBCPP_INLINE_VISIBILITY
bool all() const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bool any() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();}
+ _LIBCPP_INLINE_VISIBILITY
bitset operator<<(size_t __pos) const _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
bitset operator>>(size_t __pos) const _NOEXCEPT;
private:
@@ -774,7 +816,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
{
@@ -783,7 +825,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
{
@@ -792,7 +834,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
{
@@ -821,7 +863,7 @@ bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::set() _NOEXCEPT
{
@@ -844,7 +886,7 @@ bitset<_Size>::set(size_t __pos, bool __val)
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::reset() _NOEXCEPT
{
@@ -867,7 +909,7 @@ bitset<_Size>::reset(size_t __pos)
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>
bitset<_Size>::operator~() const _NOEXCEPT
{
@@ -877,7 +919,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>&
bitset<_Size>::flip() _NOEXCEPT
{
@@ -901,7 +943,7 @@ bitset<_Size>::flip(size_t __pos)
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long
bitset<_Size>::to_ulong() const
{
@@ -909,7 +951,7 @@ bitset<_Size>::to_ulong() const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
unsigned long long
bitset<_Size>::to_ullong() const
{
@@ -932,7 +974,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<_CharT, _Traits, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@@ -941,7 +983,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
template <size_t _Size>
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> >
bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
{
@@ -949,7 +991,7 @@ bitset<_Size>::to_string(_CharT __zero, _CharT __one) const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<char, char_traits<char>, allocator<char> >
bitset<_Size>::to_string(char __zero, char __one) const
{
@@ -957,7 +999,7 @@ bitset<_Size>::to_string(char __zero, char __one) const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
bitset<_Size>::count() const _NOEXCEPT
{
@@ -965,7 +1007,7 @@ bitset<_Size>::count() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
{
@@ -973,7 +1015,7 @@ bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT
{
@@ -994,7 +1036,7 @@ bitset<_Size>::test(size_t __pos) const
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
bitset<_Size>::all() const _NOEXCEPT
{
@@ -1002,7 +1044,7 @@ bitset<_Size>::all() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
bitset<_Size>::any() const _NOEXCEPT
{
@@ -1010,7 +1052,7 @@ bitset<_Size>::any() const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
{
@@ -1020,7 +1062,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
}
template <size_t _Size>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
{
diff --git a/include/cctype b/include/cctype
index 26c740f7382d..a68c2a06604d 100644
--- a/include/cctype
+++ b/include/cctype
@@ -37,10 +37,6 @@ int toupper(int c);
#include <__config>
#include <ctype.h>
-#if defined(_LIBCPP_MSVCRT)
-#include "support/win32/support.h"
-#include "support/win32/locale_win32.h"
-#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -48,117 +44,20 @@ int toupper(int c);
_LIBCPP_BEGIN_NAMESPACE_STD
-#ifdef isalnum
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalnum(int __c) {return isalnum(__c);}
-#undef isalnum
-inline _LIBCPP_INLINE_VISIBILITY int isalnum(int __c) {return __libcpp_isalnum(__c);}
-#else // isalnum
using ::isalnum;
-#endif // isalnum
-
-#ifdef isalpha
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isalpha(int __c) {return isalpha(__c);}
-#undef isalpha
-inline _LIBCPP_INLINE_VISIBILITY int isalpha(int __c) {return __libcpp_isalpha(__c);}
-#else // isalpha
using ::isalpha;
-#endif // isalpha
-
-#ifdef isblank
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isblank(int __c) {return isblank(__c);}
-#undef isblank
-inline _LIBCPP_INLINE_VISIBILITY int isblank(int __c) {return __libcpp_isblank(__c);}
-#else // isblank
using ::isblank;
-#endif // isblank
-
-#ifdef iscntrl
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iscntrl(int __c) {return iscntrl(__c);}
-#undef iscntrl
-inline _LIBCPP_INLINE_VISIBILITY int iscntrl(int __c) {return __libcpp_iscntrl(__c);}
-#else // iscntrl
using ::iscntrl;
-#endif // iscntrl
-
-#ifdef isdigit
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isdigit(int __c) {return isdigit(__c);}
-#undef isdigit
-inline _LIBCPP_INLINE_VISIBILITY int isdigit(int __c) {return __libcpp_isdigit(__c);}
-#else // isdigit
using ::isdigit;
-#endif // isdigit
-
-#ifdef isgraph
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isgraph(int __c) {return isgraph(__c);}
-#undef isgraph
-inline _LIBCPP_INLINE_VISIBILITY int isgraph(int __c) {return __libcpp_isgraph(__c);}
-#else // isgraph
using ::isgraph;
-#endif // isgraph
-
-#ifdef islower
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_islower(int __c) {return islower(__c);}
-#undef islower
-inline _LIBCPP_INLINE_VISIBILITY int islower(int __c) {return __libcpp_islower(__c);}
-#else // islower
using ::islower;
-#endif // islower
-
-#ifdef isprint
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isprint(int __c) {return isprint(__c);}
-#undef isprint
-inline _LIBCPP_INLINE_VISIBILITY int isprint(int __c) {return __libcpp_isprint(__c);}
-#else // isprint
using ::isprint;
-#endif // isprint
-
-#ifdef ispunct
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ispunct(int __c) {return ispunct(__c);}
-#undef ispunct
-inline _LIBCPP_INLINE_VISIBILITY int ispunct(int __c) {return __libcpp_ispunct(__c);}
-#else // ispunct
using ::ispunct;
-#endif // ispunct
-
-#ifdef isspace
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isspace(int __c) {return isspace(__c);}
-#undef isspace
-inline _LIBCPP_INLINE_VISIBILITY int isspace(int __c) {return __libcpp_isspace(__c);}
-#else // isspace
using ::isspace;
-#endif // isspace
-
-#ifdef isupper
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isupper(int __c) {return isupper(__c);}
-#undef isupper
-inline _LIBCPP_INLINE_VISIBILITY int isupper(int __c) {return __libcpp_isupper(__c);}
-#else // isupper
using ::isupper;
-#endif // isupper
-
-#ifdef isxdigit
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_isxdigit(int __c) {return isxdigit(__c);}
-#undef isxdigit
-inline _LIBCPP_INLINE_VISIBILITY int isxdigit(int __c) {return __libcpp_isxdigit(__c);}
-#else // isxdigit
using ::isxdigit;
-#endif // isxdigit
-
-#ifdef tolower
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_tolower(int __c) {return tolower(__c);}
-#undef tolower
-inline _LIBCPP_INLINE_VISIBILITY int tolower(int __c) {return __libcpp_tolower(__c);}
-#else // tolower
using ::tolower;
-#endif // tolower
-
-#ifdef toupper
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_toupper(int __c) {return toupper(__c);}
-#undef toupper
-inline _LIBCPP_INLINE_VISIBILITY int toupper(int __c) {return __libcpp_toupper(__c);}
-#else // toupper
using ::toupper;
-#endif // toupper
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/cerrno b/include/cerrno
index 9804e4e3dcfe..bab13b8aa861 100644
--- a/include/cerrno
+++ b/include/cerrno
@@ -30,364 +30,4 @@ Macros:
#pragma GCC system_header
#endif
-#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-
-#ifdef ELAST
-
-const int __elast1 = ELAST+1;
-const int __elast2 = ELAST+2;
-
-#else
-
-const int __elast1 = 104;
-const int __elast2 = 105;
-
-#endif
-
-#ifdef ENOTRECOVERABLE
-
-#define EOWNERDEAD __elast1
-
-#ifdef ELAST
-#undef ELAST
-#define ELAST EOWNERDEAD
-#endif
-
-#elif defined(EOWNERDEAD)
-
-#define ENOTRECOVERABLE __elast1
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
-
-#else // defined(EOWNERDEAD)
-
-#define EOWNERDEAD __elast1
-#define ENOTRECOVERABLE __elast2
-#ifdef ELAST
-#undef ELAST
-#define ELAST ENOTRECOVERABLE
-#endif
-
-#endif // defined(EOWNERDEAD)
-
-#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
-
-// supply errno values likely to be missing, particularly on Windows
-
-#ifndef EAFNOSUPPORT
-#define EAFNOSUPPORT 9901
-#endif
-
-#ifndef EADDRINUSE
-#define EADDRINUSE 9902
-#endif
-
-#ifndef EADDRNOTAVAIL
-#define EADDRNOTAVAIL 9903
-#endif
-
-#ifndef EISCONN
-#define EISCONN 9904
-#endif
-
-#ifndef EBADMSG
-#define EBADMSG 9905
-#endif
-
-#ifndef ECONNABORTED
-#define ECONNABORTED 9906
-#endif
-
-#ifndef EALREADY
-#define EALREADY 9907
-#endif
-
-#ifndef ECONNREFUSED
-#define ECONNREFUSED 9908
-#endif
-
-#ifndef ECONNRESET
-#define ECONNRESET 9909
-#endif
-
-#ifndef EDESTADDRREQ
-#define EDESTADDRREQ 9910
-#endif
-
-#ifndef EHOSTUNREACH
-#define EHOSTUNREACH 9911
-#endif
-
-#ifndef EIDRM
-#define EIDRM 9912
-#endif
-
-#ifndef EMSGSIZE
-#define EMSGSIZE 9913
-#endif
-
-#ifndef ENETDOWN
-#define ENETDOWN 9914
-#endif
-
-#ifndef ENETRESET
-#define ENETRESET 9915
-#endif
-
-#ifndef ENETUNREACH
-#define ENETUNREACH 9916
-#endif
-
-#ifndef ENOBUFS
-#define ENOBUFS 9917
-#endif
-
-#ifndef ENOLINK
-#define ENOLINK 9918
-#endif
-
-#ifndef ENODATA
-#define ENODATA 9919
-#endif
-
-#ifndef ENOMSG
-#define ENOMSG 9920
-#endif
-
-#ifndef ENOPROTOOPT
-#define ENOPROTOOPT 9921
-#endif
-
-#ifndef ENOSR
-#define ENOSR 9922
-#endif
-
-#ifndef ENOTSOCK
-#define ENOTSOCK 9923
-#endif
-
-#ifndef ENOSTR
-#define ENOSTR 9924
-#endif
-
-#ifndef ENOTCONN
-#define ENOTCONN 9925
-#endif
-
-#ifndef ENOTSUP
-#define ENOTSUP 9926
-#endif
-
-#ifndef ECANCELED
-#define ECANCELED 9927
-#endif
-
-#ifndef EINPROGRESS
-#define EINPROGRESS 9928
-#endif
-
-#ifndef EOPNOTSUPP
-#define EOPNOTSUPP 9929
-#endif
-
-#ifndef EWOULDBLOCK
-#define EWOULDBLOCK 9930
-#endif
-
-#ifndef EOWNERDEAD
-#define EOWNERDEAD 9931
-#endif
-
-#ifndef EPROTO
-#define EPROTO 9932
-#endif
-
-#ifndef EPROTONOSUPPORT
-#define EPROTONOSUPPORT 9933
-#endif
-
-#ifndef ENOTRECOVERABLE
-#define ENOTRECOVERABLE 9934
-#endif
-
-#ifndef ETIME
-#define ETIME 9935
-#endif
-
-#ifndef ETXTBSY
-#define ETXTBSY 9936
-#endif
-
-#ifndef ETIMEDOUT
-#define ETIMEDOUT 9938
-#endif
-
-#ifndef ELOOP
-#define ELOOP 9939
-#endif
-
-#ifndef EOVERFLOW
-#define EOVERFLOW 9940
-#endif
-
-#ifndef EPROTOTYPE
-#define EPROTOTYPE 9941
-#endif
-
-#ifndef ENOSYS
-#define ENOSYS 9942
-#endif
-
-#ifndef EINVAL
-#define EINVAL 9943
-#endif
-
-#ifndef ERANGE
-#define ERANGE 9944
-#endif
-
-#ifndef EILSEQ
-#define EILSEQ 9945
-#endif
-
-// Windows Mobile doesn't appear to define these:
-
-#ifndef E2BIG
-#define E2BIG 9946
-#endif
-
-#ifndef EDOM
-#define EDOM 9947
-#endif
-
-#ifndef EFAULT
-#define EFAULT 9948
-#endif
-
-#ifndef EBADF
-#define EBADF 9949
-#endif
-
-#ifndef EPIPE
-#define EPIPE 9950
-#endif
-
-#ifndef EXDEV
-#define EXDEV 9951
-#endif
-
-#ifndef EBUSY
-#define EBUSY 9952
-#endif
-
-#ifndef ENOTEMPTY
-#define ENOTEMPTY 9953
-#endif
-
-#ifndef ENOEXEC
-#define ENOEXEC 9954
-#endif
-
-#ifndef EEXIST
-#define EEXIST 9955
-#endif
-
-#ifndef EFBIG
-#define EFBIG 9956
-#endif
-
-#ifndef ENAMETOOLONG
-#define ENAMETOOLONG 9957
-#endif
-
-#ifndef ENOTTY
-#define ENOTTY 9958
-#endif
-
-#ifndef EINTR
-#define EINTR 9959
-#endif
-
-#ifndef ESPIPE
-#define ESPIPE 9960
-#endif
-
-#ifndef EIO
-#define EIO 9961
-#endif
-
-#ifndef EISDIR
-#define EISDIR 9962
-#endif
-
-#ifndef ECHILD
-#define ECHILD 9963
-#endif
-
-#ifndef ENOLCK
-#define ENOLCK 9964
-#endif
-
-#ifndef ENOSPC
-#define ENOSPC 9965
-#endif
-
-#ifndef ENXIO
-#define ENXIO 9966
-#endif
-
-#ifndef ENODEV
-#define ENODEV 9967
-#endif
-
-#ifndef ENOENT
-#define ENOENT 9968
-#endif
-
-#ifndef ESRCH
-#define ESRCH 9969
-#endif
-
-#ifndef ENOTDIR
-#define ENOTDIR 9970
-#endif
-
-#ifndef ENOMEM
-#define ENOMEM 9971
-#endif
-
-#ifndef EPERM
-#define EPERM 9972
-#endif
-
-#ifndef EACCES
-#define EACCES 9973
-#endif
-
-#ifndef EROFS
-#define EROFS 9974
-#endif
-
-#ifndef EDEADLK
-#define EDEADLK 9975
-#endif
-
-#ifndef EAGAIN
-#define EAGAIN 9976
-#endif
-
-#ifndef ENFILE
-#define ENFILE 9977
-#endif
-
-#ifndef EMFILE
-#define EMFILE 9978
-#endif
-
-#ifndef EMLINK
-#define EMLINK 9979
-#endif
-
#endif // _LIBCPP_CERRNO
diff --git a/include/cfenv b/include/cfenv
index dd7db37f8e48..4fc630419bde 100644
--- a/include/cfenv
+++ b/include/cfenv
@@ -1,5 +1,5 @@
// -*- C++ -*-
-//===---------------------------- cctype ----------------------------------===//
+//===---------------------------- cfenv -----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
diff --git a/include/cfloat b/include/cfloat
index 5fa56550fa6a..176fa9de3cec 100644
--- a/include/cfloat
+++ b/include/cfloat
@@ -67,12 +67,4 @@ Macros:
#pragma GCC system_header
#endif
-#ifndef FLT_EVAL_METHOD
-#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
-#endif
-
-#ifndef DECIMAL_DIG
-#define DECIMAL_DIG __DECIMAL_DIG__
-#endif
-
#endif // _LIBCPP_CFLOAT
diff --git a/include/chrono b/include/chrono
index 9229234ce55a..68484e982432 100644
--- a/include/chrono
+++ b/include/chrono
@@ -26,6 +26,9 @@ duration_cast(const duration<Rep, Period>& fd);
template <class Rep> struct treat_as_floating_point : is_floating_point<Rep> {};
+template <class Rep> constexpr bool treat_as_floating_point_v
+ = treat_as_floating_point<Rep>::value; // C++17
+
template <class Rep>
struct duration_values
{
@@ -194,6 +197,13 @@ template <class Rep1, class Period1, class Rep2, class Period2>
template <class ToDuration, class Rep, class Period>
ToDuration duration_cast(const duration<Rep, Period>& d);
+template <class ToDuration, class Rep, class Period>
+ constexpr ToDuration floor(const duration<Rep, Period>& d); // C++17
+template <class ToDuration, class Rep, class Period>
+ constexpr ToDuration ceil(const duration<Rep, Period>& d); // C++17
+template <class ToDuration, class Rep, class Period>
+ constexpr ToDuration round(const duration<Rep, Period>& d); // C++17
+
// time_point arithmetic (all constexpr in C++14)
template <class Clock, class Duration1, class Rep2, class Period2>
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
@@ -227,6 +237,20 @@ template <class Clock, class Duration1, class Duration2>
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
+template <class ToDuration, class Clock, class Duration>
+ constexpr time_point<Clock, ToDuration>
+ floor(const time_point<Clock, Duration>& tp); // C++17
+
+template <class ToDuration, class Clock, class Duration>
+ constexpr time_point<Clock, ToDuration>
+ ceil(const time_point<Clock, Duration>& tp); // C++17
+
+template <class ToDuration, class Clock, class Duration>
+ constexpr time_point<Clock, ToDuration>
+ round(const time_point<Clock, Duration>& tp); // C++17
+
+template <class Rep, class Period>
+ constexpr duration<Rep, Period> abs(duration<Rep, Period> d); // C++17
// Clocks
class system_clock
@@ -392,6 +416,11 @@ duration_cast(const duration<_Rep, _Period>& __fd)
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Rep> _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
+ = treat_as_floating_point<_Rep>::value;
+#endif
+
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY duration_values
{
@@ -401,6 +430,58 @@ public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();}
};
+#if _LIBCPP_STD_VER > 14
+template <class _ToDuration, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ _ToDuration
+>::type
+floor(const duration<_Rep, _Period>& __d)
+{
+ _ToDuration __t = duration_cast<_ToDuration>(__d);
+ if (__t > __d)
+ __t = __t - _ToDuration{1};
+ return __t;
+}
+
+template <class _ToDuration, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ _ToDuration
+>::type
+ceil(const duration<_Rep, _Period>& __d)
+{
+ _ToDuration __t = duration_cast<_ToDuration>(__d);
+ if (__t < __d)
+ __t = __t + _ToDuration{1};
+ return __t;
+}
+
+template <class _ToDuration, class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ _ToDuration
+>::type
+round(const duration<_Rep, _Period>& __d)
+{
+ _ToDuration __lower = floor<_ToDuration>(__d);
+ _ToDuration __upper = __lower + _ToDuration{1};
+ auto __lowerDiff = __d - __lower;
+ auto __upperDiff = __upper - __d;
+ if (__lowerDiff < __upperDiff)
+ return __lower;
+ if (__lowerDiff > __upperDiff)
+ return __upper;
+ return __lower.count() & 1 ? __upper : __lower;
+}
+#endif
+
// duration
template <class _Rep, class _Period>
@@ -807,6 +888,56 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
}
+#if _LIBCPP_STD_VER > 14
+template <class _ToDuration, class _Clock, class _Duration>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ time_point<_Clock, _ToDuration>
+>::type
+floor(const time_point<_Clock, _Duration>& __t)
+{
+ return time_point<_Clock, _ToDuration>{floor<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _ToDuration, class _Clock, class _Duration>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ time_point<_Clock, _ToDuration>
+>::type
+ceil(const time_point<_Clock, _Duration>& __t)
+{
+ return time_point<_Clock, _ToDuration>{ceil<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _ToDuration, class _Clock, class _Duration>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ __is_duration<_ToDuration>::value,
+ time_point<_Clock, _ToDuration>
+>::type
+round(const time_point<_Clock, _Duration>& __t)
+{
+ return time_point<_Clock, _ToDuration>{round<_ToDuration>(__t.time_since_epoch())};
+}
+
+template <class _Rep, class _Period>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
+typename enable_if
+<
+ numeric_limits<_Rep>::is_signed,
+ duration<_Rep, _Period>
+>::type
+abs(duration<_Rep, _Period> __d)
+{
+ return __d >= __d.zero() ? __d : -__d;
+}
+#endif
+
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>
diff --git a/include/cinttypes b/include/cinttypes
index cfd763c98f4a..3f61b0634b17 100644
--- a/include/cinttypes
+++ b/include/cinttypes
@@ -246,10 +246,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
_LIBCPP_BEGIN_NAMESPACE_STD
using::imaxdiv_t;
-
-#undef imaxabs
using::imaxabs;
-#undef imaxdiv
using::imaxdiv;
using::strtoimax;
using::strtoumax;
diff --git a/include/cmath b/include/cmath
index 5f9aaedd5afa..ebbde18168ff 100644
--- a/include/cmath
+++ b/include/cmath
@@ -299,340 +299,11 @@ long double truncl(long double x);
#include <__config>
#include <math.h>
-#include <type_traits>
-
-#ifdef _LIBCPP_MSVCRT
-#include "support/win32/math_win32.h"
-#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
-// signbit
-
-#ifdef signbit
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
-{
- return signbit(__lcpp_x);
-}
-
-#undef signbit
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-signbit(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // signbit
-
-// fpclassify
-
-#ifdef fpclassify
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-int
-__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
-{
- return fpclassify(__lcpp_x);
-}
-
-#undef fpclassify
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
-fpclassify(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // fpclassify
-
-// isfinite
-
-#ifdef isfinite
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
- return isfinite(__lcpp_x);
-}
-
-#undef isfinite
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isfinite(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // isfinite
-
-// isinf
-
-#ifdef isinf
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
-{
- return isinf(__lcpp_x);
-}
-
-#undef isinf
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isinf(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // isinf
-
-// isnan
-
-#ifdef isnan
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
-{
- return isnan(__lcpp_x);
-}
-
-#undef isnan
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isnan(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // isnan
-
-// isnormal
-
-#ifdef isnormal
-
-template <class _A1>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
-{
- return isnormal(__lcpp_x);
-}
-
-#undef isnormal
-
-template <class _A1>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
-isnormal(_A1 __lcpp_x) _NOEXCEPT
-{
- return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
-}
-
-#endif // isnormal
-
-// isgreater
-
-#ifdef isgreater
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return isgreater(__lcpp_x, __lcpp_y);
-}
-
-#undef isgreater
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // isgreater
-
-// isgreaterequal
-
-#ifdef isgreaterequal
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return isgreaterequal(__lcpp_x, __lcpp_y);
-}
-
-#undef isgreaterequal
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // isgreaterequal
-
-// isless
-
-#ifdef isless
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return isless(__lcpp_x, __lcpp_y);
-}
-
-#undef isless
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // isless
-
-// islessequal
-
-#ifdef islessequal
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return islessequal(__lcpp_x, __lcpp_y);
-}
-
-#undef islessequal
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // islessequal
-
-// islessgreater
-
-#ifdef islessgreater
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return islessgreater(__lcpp_x, __lcpp_y);
-}
-
-#undef islessgreater
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // islessgreater
-
-// isunordered
-
-#ifdef isunordered
-
-template <class _A1, class _A2>
-_LIBCPP_ALWAYS_INLINE
-bool
-__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- return isunordered(__lcpp_x, __lcpp_y);
-}
-
-#undef isunordered
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename std::enable_if
-<
- std::is_arithmetic<_A1>::value &&
- std::is_arithmetic<_A2>::value,
- bool
->::type
-isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename std::__promote<_A1, _A2>::type type;
- return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
-}
-
-#endif // isunordered
-
_LIBCPP_BEGIN_NAMESPACE_STD
using ::signbit;
@@ -652,794 +323,130 @@ using ::isunordered;
using ::float_t;
using ::double_t;
-// abs
-
-#if defined(__sun__)
+#ifndef _AIX
using ::abs;
#endif
-#if !defined(_AIX) && !defined(__sun__)
-inline _LIBCPP_INLINE_VISIBILITY
-float
-abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
-
-inline _LIBCPP_INLINE_VISIBILITY
-double
-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);}
-#endif // !defined(_AIX)
-
#ifndef __sun__
-
-// acos
-
using ::acos;
using ::acosf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-acos(_A1 __lcpp_x) _NOEXCEPT {return acos((double)__lcpp_x);}
-
-// asin
-
using ::asin;
using ::asinf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-asin(_A1 __lcpp_x) _NOEXCEPT {return asin((double)__lcpp_x);}
-
-// atan
-
using ::atan;
using ::atanf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-atan(_A1 __lcpp_x) _NOEXCEPT {return atan((double)__lcpp_x);}
-
-// atan2
-
using ::atan2;
using ::atan2f;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-atan2(_A1 __lcpp_y, _A2 __lcpp_x) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return atan2((__result_type)__lcpp_y, (__result_type)__lcpp_x);
-}
-
-// ceil
-
using ::ceil;
using ::ceilf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-ceil(_A1 __lcpp_x) _NOEXCEPT {return ceil((double)__lcpp_x);}
-
-// cos
-
using ::cos;
using ::cosf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-cos(_A1 __lcpp_x) _NOEXCEPT {return cos((double)__lcpp_x);}
-
-// cosh
-
using ::cosh;
using ::coshf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-cosh(_A1 __lcpp_x) _NOEXCEPT {return cosh((double)__lcpp_x);}
-
#endif // __sun__
-// exp
using ::exp;
using ::expf;
#ifndef __sun__
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-exp(_A1 __lcpp_x) _NOEXCEPT {return exp((double)__lcpp_x);}
-
-// fabs
-
using ::fabs;
using ::fabsf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-fabs(_A1 __lcpp_x) _NOEXCEPT {return fabs((double)__lcpp_x);}
-
-// floor
-
using ::floor;
using ::floorf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-floor(_A1 __lcpp_x) _NOEXCEPT {return floor((double)__lcpp_x);}
-
-// fmod
-
#endif //__sun__
+
using ::fmod;
using ::fmodf;
-#ifndef __sun__
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-fmod(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return fmod((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-
-// frexp
+#ifndef __sun__
using ::frexp;
using ::frexpf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-frexp(_A1 __lcpp_x, int* __lcpp_e) _NOEXCEPT {return frexp((double)__lcpp_x, __lcpp_e);}
-
-// ldexp
-
using ::ldexp;
using ::ldexpf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-ldexp(_A1 __lcpp_x, int __lcpp_e) _NOEXCEPT {return ldexp((double)__lcpp_x, __lcpp_e);}
-
-// log
-
#endif // __sun__
+
using ::log;
using ::logf;
-#ifndef __sun__
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-log(_A1 __lcpp_x) _NOEXCEPT {return log((double)__lcpp_x);}
-
-
-// log10
+#ifndef __sun__
using ::log10;
using ::log10f;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-log10(_A1 __lcpp_x) _NOEXCEPT {return log10((double)__lcpp_x);}
-
-// modf
-
using ::modf;
using ::modff;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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
-
#endif // __sun__
+
using ::pow;
using ::powf;
#ifndef __sun__
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-pow(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return pow((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// sin
-
using ::sin;
using ::sinf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-sin(_A1 __lcpp_x) _NOEXCEPT {return sin((double)__lcpp_x);}
-
-// sinh
-
using ::sinh;
using ::sinhf;
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-sinh(_A1 __lcpp_x) _NOEXCEPT {return sinh((double)__lcpp_x);}
-
-// sqrt
-
#endif // __sun__
+
using ::sqrt;
using ::sqrtf;
-
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-sqrt(_A1 __lcpp_x) _NOEXCEPT {return sqrt((double)__lcpp_x);}
-
-// tan
-
using ::tan;
using ::tanf;
-#ifndef __sun__
-
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-tan(_A1 __lcpp_x) _NOEXCEPT {return tan((double)__lcpp_x);}
-
-// tanh
+#ifndef __sun__
using ::tanh;
using ::tanhf;
-#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
-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 enable_if<is_integral<_A1>::value, double>::type
-tanh(_A1 __lcpp_x) _NOEXCEPT {return tanh((double)__lcpp_x);}
-
-// acosh
-
#ifndef _LIBCPP_MSVCRT
using ::acosh;
using ::acoshf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-acosh(_A1 __lcpp_x) _NOEXCEPT {return acosh((double)__lcpp_x);}
-#endif
-
-// asinh
-
-#ifndef _LIBCPP_MSVCRT
using ::asinh;
using ::asinhf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-asinh(_A1 __lcpp_x) _NOEXCEPT {return asinh((double)__lcpp_x);}
-#endif
-
-// atanh
-
-#ifndef _LIBCPP_MSVCRT
using ::atanh;
using ::atanhf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-atanh(_A1 __lcpp_x) _NOEXCEPT {return atanh((double)__lcpp_x);}
-#endif
-
-// cbrt
-
-#ifndef _LIBCPP_MSVCRT
using ::cbrt;
using ::cbrtf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-cbrt(_A1 __lcpp_x) _NOEXCEPT {return cbrt((double)__lcpp_x);}
#endif
-// copysign
-
using ::copysign;
using ::copysignf;
-#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);
-}
-inline _LIBCPP_INLINE_VISIBILITY long double
-copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
- return copysignl(__lcpp_x, __lcpp_y);
-}
-#endif
-
-template <class _A1, class _A2>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-copysign(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return copysign((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
#ifndef _LIBCPP_MSVCRT
-
-// erf
-
using ::erf;
using ::erff;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-erf(_A1 __lcpp_x) _NOEXCEPT {return erf((double)__lcpp_x);}
-
-// erfc
-
using ::erfc;
using ::erfcf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-erfc(_A1 __lcpp_x) _NOEXCEPT {return erfc((double)__lcpp_x);}
-
-// exp2
-
using ::exp2;
using ::exp2f;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-exp2(_A1 __lcpp_x) _NOEXCEPT {return exp2((double)__lcpp_x);}
-
-// expm1
-
using ::expm1;
using ::expm1f;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-expm1(_A1 __lcpp_x) _NOEXCEPT {return expm1((double)__lcpp_x);}
-
-// fdim
-
using ::fdim;
using ::fdimf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-fdim(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return fdim((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// fma
-
using ::fmaf;
using ::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);}
-
-template <class _A1, class _A2, class _A3>
-inline _LIBCPP_INLINE_VISIBILITY
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value &&
- is_arithmetic<_A3>::value,
- __promote<_A1, _A2, _A3>
->::type
-fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2, _A3>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value &&
- is_same<_A3, __result_type>::value)), "");
- return fma((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
-}
-
-// fmax
-
using ::fmax;
using ::fmaxf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-fmax(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return fmax((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// fmin
-
using ::fmin;
using ::fminf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-fmin(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return fmin((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// hypot
-
using ::hypot;
using ::hypotf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-hypot(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// ilogb
-
using ::ilogb;
using ::ilogbf;
-
-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 enable_if<is_integral<_A1>::value, int>::type
-ilogb(_A1 __lcpp_x) _NOEXCEPT {return ilogb((double)__lcpp_x);}
-
-// lgamma
-
using ::lgamma;
using ::lgammaf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-lgamma(_A1 __lcpp_x) _NOEXCEPT {return lgamma((double)__lcpp_x);}
-
-
-// llrint
-
using ::llrint;
using ::llrintf;
-
-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 enable_if<is_integral<_A1>::value, long long>::type
-llrint(_A1 __lcpp_x) _NOEXCEPT {return llrint((double)__lcpp_x);}
-
-// llround
-
using ::llround;
using ::llroundf;
-
-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 enable_if<is_integral<_A1>::value, long long>::type
-llround(_A1 __lcpp_x) _NOEXCEPT {return llround((double)__lcpp_x);}
-
-// log1p
-
using ::log1p;
using ::log1pf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-log1p(_A1 __lcpp_x) _NOEXCEPT {return log1p((double)__lcpp_x);}
-
-// log2
-
using ::log2;
using ::log2f;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-log2(_A1 __lcpp_x) _NOEXCEPT {return log2((double)__lcpp_x);}
-
-// logb
-
using ::logb;
using ::logbf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-logb(_A1 __lcpp_x) _NOEXCEPT {return logb((double)__lcpp_x);}
-
-// lrint
-
using ::lrint;
using ::lrintf;
-
-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 enable_if<is_integral<_A1>::value, long>::type
-lrint(_A1 __lcpp_x) _NOEXCEPT {return lrint((double)__lcpp_x);}
-
-// lround
-
using ::lround;
using ::lroundf;
-
-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 enable_if<is_integral<_A1>::value, long>::type
-lround(_A1 __lcpp_x) _NOEXCEPT {return lround((double)__lcpp_x);}
-
#endif // _LIBCPP_MSVCRT
#endif // __sun__
-// nan
-
#ifndef _LIBCPP_MSVCRT
using ::nan;
using ::nanf;
@@ -1447,183 +454,28 @@ using ::nanf;
#ifndef __sun__
#ifndef _LIBCPP_MSVCRT
-
-// nearbyint
-
using ::nearbyint;
using ::nearbyintf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-nearbyint(_A1 __lcpp_x) _NOEXCEPT {return nearbyint((double)__lcpp_x);}
-
-// nextafter
-
using ::nextafter;
using ::nextafterf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-nextafter(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return nextafter((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// nexttoward
-
using ::nexttoward;
using ::nexttowardf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-nexttoward(_A1 __lcpp_x, long double __lcpp_y) _NOEXCEPT {return nexttoward((double)__lcpp_x, __lcpp_y);}
-
-// remainder
-
using ::remainder;
using ::remainderf;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-remainder(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return remainder((__result_type)__lcpp_x, (__result_type)__lcpp_y);
-}
-
-// remquo
-
using ::remquo;
using ::remquof;
-
-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
-typename __lazy_enable_if
-<
- is_arithmetic<_A1>::value &&
- is_arithmetic<_A2>::value,
- __promote<_A1, _A2>
->::type
-remquo(_A1 __lcpp_x, _A2 __lcpp_y, int* __lcpp_z) _NOEXCEPT
-{
- typedef typename __promote<_A1, _A2>::type __result_type;
- static_assert((!(is_same<_A1, __result_type>::value &&
- is_same<_A2, __result_type>::value)), "");
- return remquo((__result_type)__lcpp_x, (__result_type)__lcpp_y, __lcpp_z);
-}
-
-// rint
-
using ::rint;
using ::rintf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-rint(_A1 __lcpp_x) _NOEXCEPT {return rint((double)__lcpp_x);}
-
-// round
-
using ::round;
using ::roundf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-round(_A1 __lcpp_x) _NOEXCEPT {return round((double)__lcpp_x);}
-
-// scalbln
-
using ::scalbln;
using ::scalblnf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-scalbln(_A1 __lcpp_x, long __lcpp_y) _NOEXCEPT {return scalbln((double)__lcpp_x, __lcpp_y);}
-
-// scalbn
-
using ::scalbn;
using ::scalbnf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-scalbn(_A1 __lcpp_x, int __lcpp_y) _NOEXCEPT {return scalbn((double)__lcpp_x, __lcpp_y);}
-
-// tgamma
-
using ::tgamma;
using ::tgammaf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-tgamma(_A1 __lcpp_x) _NOEXCEPT {return tgamma((double)__lcpp_x);}
-
-// trunc
-
using ::trunc;
using ::truncf;
-
-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 enable_if<is_integral<_A1>::value, double>::type
-trunc(_A1 __lcpp_x) _NOEXCEPT {return trunc((double)__lcpp_x);}
-
#endif // !_LIBCPP_MSVCRT
using ::acosl;
@@ -1647,6 +499,7 @@ using ::sinl;
using ::sinhl;
using ::sqrtl;
using ::tanl;
+
#ifndef _LIBCPP_MSVCRT
using ::tanhl;
using ::acoshl;
@@ -1654,7 +507,9 @@ using ::asinhl;
using ::atanhl;
using ::cbrtl;
#endif // !_LIBCPP_MSVCRT
+
using ::copysignl;
+
#ifndef _LIBCPP_MSVCRT
using ::erfl;
using ::erfcl;
@@ -1692,6 +547,7 @@ using ::truncl;
using ::lgamma;
using ::lgammaf;
#endif // __sun__
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CMATH
diff --git a/include/complex.h b/include/complex.h
index 7003d31a89cd..c2359665add5 100644
--- a/include/complex.h
+++ b/include/complex.h
@@ -18,6 +18,12 @@
*/
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
#ifdef __cplusplus
#include <ccomplex>
@@ -28,8 +34,4 @@
#endif // __cplusplus
-#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
-#pragma GCC system_header
-#endif
-
#endif // _LIBCPP_COMPLEX_H
diff --git a/include/condition_variable b/include/condition_variable
index 1af2484abd7b..10e007701672 100644
--- a/include/condition_variable
+++ b/include/condition_variable
@@ -124,14 +124,18 @@ class _LIBCPP_TYPE_VIS condition_variable_any
condition_variable __cv_;
shared_ptr<mutex> __mut_;
public:
+ _LIBCPP_INLINE_VISIBILITY
condition_variable_any();
+ _LIBCPP_INLINE_VISIBILITY
void notify_one() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void notify_all() _NOEXCEPT;
template <class _Lock>
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>
@@ -141,27 +145,30 @@ public:
template <class _Lock, class _Clock, class _Duration, class _Predicate>
bool
+ _LIBCPP_INLINE_VISIBILITY
wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
_Predicate __pred);
template <class _Lock, class _Rep, class _Period>
cv_status
+ _LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d);
template <class _Lock, class _Rep, class _Period, class _Predicate>
bool
+ _LIBCPP_INLINE_VISIBILITY
wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
_Predicate __pred);
};
-inline _LIBCPP_INLINE_VISIBILITY
+inline
condition_variable_any::condition_variable_any()
: __mut_(make_shared<mutex>()) {}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
condition_variable_any::notify_one() _NOEXCEPT
{
@@ -169,7 +176,7 @@ condition_variable_any::notify_one() _NOEXCEPT
__cv_.notify_one();
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
condition_variable_any::notify_all() _NOEXCEPT
{
@@ -196,7 +203,7 @@ condition_variable_any::wait(_Lock& __lock)
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
condition_variable_any::wait(_Lock& __lock, _Predicate __pred)
{
@@ -218,7 +225,7 @@ condition_variable_any::wait_until(_Lock& __lock,
} // __mut_.unlock(), __lock.lock()
template <class _Lock, class _Clock, class _Duration, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
condition_variable_any::wait_until(_Lock& __lock,
const chrono::time_point<_Clock, _Duration>& __t,
@@ -231,7 +238,7 @@ condition_variable_any::wait_until(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
cv_status
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d)
@@ -240,7 +247,7 @@ condition_variable_any::wait_for(_Lock& __lock,
}
template <class _Lock, class _Rep, class _Period, class _Predicate>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bool
condition_variable_any::wait_for(_Lock& __lock,
const chrono::duration<_Rep, _Period>& __d,
diff --git a/include/csetjmp b/include/csetjmp
index d0b2c078967d..58a9c73ab56f 100644
--- a/include/csetjmp
+++ b/include/csetjmp
@@ -38,10 +38,6 @@ void longjmp(jmp_buf env, int val);
#pragma GCC system_header
#endif
-#ifndef setjmp
-#define setjmp(env) setjmp(env)
-#endif
-
_LIBCPP_BEGIN_NAMESPACE_STD
using ::jmp_buf;
diff --git a/include/cstddef b/include/cstddef
index c3ca64a9c014..edd106c001bc 100644
--- a/include/cstddef
+++ b/include/cstddef
@@ -35,12 +35,14 @@ Types:
#include <__config>
-#include <stddef.h>
-
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
+// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
+#include_next <stddef.h>
+#include <__nullptr>
+
_LIBCPP_BEGIN_NAMESPACE_STD
using ::ptrdiff_t;
@@ -53,50 +55,6 @@ using ::max_align_t;
typedef long double max_align_t;
#endif
-#ifdef _LIBCPP_HAS_NO_NULLPTR
-
-struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
-{
- void* __lx;
-
- struct __nat {int __for_bool_;};
-
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {}
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
-
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;}
-
- template <class _Tp>
- _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR
- operator _Tp* () const {return 0;}
-
- template <class _Tp, class _Up>
- _LIBCPP_ALWAYS_INLINE
- operator _Tp _Up::* () const {return 0;}
-
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;}
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;}
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;}
- friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;}
-};
-
-inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);}
-
-#define nullptr _VSTD::__get_nullptr_t()
-
-#endif // _LIBCPP_HAS_NO_NULLPTR
-
_LIBCPP_END_NAMESPACE_STD
-#ifndef _LIBCPP_HAS_NO_NULLPTR
-
-namespace std
-{
- typedef decltype(nullptr) nullptr_t;
-}
-
-#endif // _LIBCPP_HAS_NO_NULLPTR
-
#endif // _LIBCPP_CSTDDEF
diff --git a/include/cstdio b/include/cstdio
index d8ba6c2ef383..50fdd3457426 100644
--- a/include/cstdio
+++ b/include/cstdio
@@ -103,41 +103,6 @@ void perror(const char* s);
#pragma GCC system_header
#endif
-// snprintf
-#if defined(_LIBCPP_MSVCRT)
-#include "support/win32/support.h"
-#endif
-
-#ifdef getc
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
-#undef getc
-inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
-#endif // getc
-
-#ifdef putc
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
-#undef putc
-inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
-#endif // putc
-
-#ifdef clearerr
-inline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
-#undef clearerr
-inline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
-#endif // clearerr
-
-#ifdef feof
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
-#undef feof
-inline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
-#endif // feof
-
-#ifdef ferror
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
-#undef ferror
-inline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
-#endif // ferror
-
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE;
diff --git a/include/cstdlib b/include/cstdlib
index 55e15c82192e..10ed231078d8 100644
--- a/include/cstdlib
+++ b/include/cstdlib
@@ -84,9 +84,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config>
#include <stdlib.h>
-#ifdef _LIBCPP_MSVCRT
-#include "support/win32/locale_win32.h"
-#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -131,20 +128,14 @@ using ::getenv;
using ::system;
using ::bsearch;
using ::qsort;
-#undef abs
using ::abs;
-#undef labs
using ::labs;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
-#undef llabs
using ::llabs;
#endif // _LIBCPP_HAS_NO_LONG_LONG
-#undef div
using ::div;
-#undef ldiv
using ::ldiv;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
-#undef lldiv
using ::lldiv;
#endif // _LIBCPP_HAS_NO_LONG_LONG
#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
@@ -162,19 +153,6 @@ using ::quick_exit;
using ::aligned_alloc;
#endif
-// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
-#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
-inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
-#ifndef _LIBCPP_HAS_NO_LONG_LONG
-inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
-#endif // _LIBCPP_HAS_NO_LONG_LONG
-
-inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
-#ifndef _LIBCPP_HAS_NO_LONG_LONG
-inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
-#endif // _LIBCPP_HAS_NO_LONG_LONG
-#endif // _LIBCPP_MSVCRT
-
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CSTDLIB
diff --git a/include/ctype.h b/include/ctype.h
new file mode 100644
index 000000000000..22d6c49be9e1
--- /dev/null
+++ b/include/ctype.h
@@ -0,0 +1,69 @@
+// -*- C++ -*-
+//===---------------------------- ctype.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CTYPE_H
+#define _LIBCPP_CTYPE_H
+
+/*
+ ctype.h synopsis
+
+int isalnum(int c);
+int isalpha(int c);
+int isblank(int c); // C99
+int iscntrl(int c);
+int isdigit(int c);
+int isgraph(int c);
+int islower(int c);
+int isprint(int c);
+int ispunct(int c);
+int isspace(int c);
+int isupper(int c);
+int isxdigit(int c);
+int tolower(int c);
+int toupper(int c);
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <ctype.h>
+
+#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
+#undef iscntrl
+#undef isdigit
+#undef isgraph
+#undef islower
+#undef isprint
+#undef ispunct
+#undef isspace
+#undef isupper
+#undef isxdigit
+#undef tolower
+#undef toupper
+
+#endif
+
+#endif // _LIBCPP_CTYPE_H
diff --git a/include/cwchar b/include/cwchar
index 797a1777c22f..ef4806db2bde 100644
--- a/include/cwchar
+++ b/include/cwchar
@@ -106,9 +106,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
-#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
-#include <support/win32/support.h> // pull in *swprintf defines
-#endif // _LIBCPP_MSVCRT
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -161,16 +158,13 @@ using ::wcscoll;
using ::wcsncmp;
using ::wcsxfrm;
-#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
-
+#ifdef _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
-
#else
-
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
@@ -185,7 +179,6 @@ inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, cons
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
-
#endif
using ::wcscspn;
diff --git a/include/cwctype b/include/cwctype
index 4f89b52db27c..25b2489edf2c 100644
--- a/include/cwctype
+++ b/include/cwctype
@@ -63,150 +63,24 @@ _LIBCPP_BEGIN_NAMESPACE_STD
using ::wint_t;
using ::wctrans_t;
using ::wctype_t;
-
-#ifdef iswalnum
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalnum(wint_t __wc) {return iswalnum(__wc);}
-#undef iswalnum
-inline _LIBCPP_INLINE_VISIBILITY int iswalnum(wint_t __wc) {return __libcpp_iswalnum(__wc);}
-#else // iswalnum
using ::iswalnum;
-#endif
-
-#ifdef iswalpha
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswalpha(wint_t __wc) {return iswalpha(__wc);}
-#undef iswalpha
-inline _LIBCPP_INLINE_VISIBILITY int iswalpha(wint_t __wc) {return __libcpp_iswalpha(__wc);}
-#else // iswalpha
using ::iswalpha;
-#endif
-
-#ifdef iswblank
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswblank(wint_t __wc) {return iswblank(__wc);}
-#undef iswblank
-inline _LIBCPP_INLINE_VISIBILITY int iswblank(wint_t __wc) {return __libcpp_iswblank(__wc);}
-#else // iswblank
using ::iswblank;
-#endif
-
-#ifdef iswcntrl
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswcntrl(wint_t __wc) {return iswcntrl(__wc);}
-#undef iswcntrl
-inline _LIBCPP_INLINE_VISIBILITY int iswcntrl(wint_t __wc) {return __libcpp_iswcntrl(__wc);}
-#else // iswcntrl
using ::iswcntrl;
-#endif
-
-#ifdef iswdigit
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswdigit(wint_t __wc) {return iswdigit(__wc);}
-#undef iswdigit
-inline _LIBCPP_INLINE_VISIBILITY int iswdigit(wint_t __wc) {return __libcpp_iswdigit(__wc);}
-#else // iswdigit
using ::iswdigit;
-#endif
-
-#ifdef iswgraph
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswgraph(wint_t __wc) {return iswgraph(__wc);}
-#undef iswgraph
-inline _LIBCPP_INLINE_VISIBILITY int iswgraph(wint_t __wc) {return __libcpp_iswgraph(__wc);}
-#else // iswgraph
using ::iswgraph;
-#endif
-
-#ifdef iswlower
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswlower(wint_t __wc) {return iswlower(__wc);}
-#undef iswlower
-inline _LIBCPP_INLINE_VISIBILITY int iswlower(wint_t __wc) {return __libcpp_iswlower(__wc);}
-#else // iswlower
using ::iswlower;
-#endif
-
-#ifdef iswprint
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswprint(wint_t __wc) {return iswprint(__wc);}
-#undef iswprint
-inline _LIBCPP_INLINE_VISIBILITY int iswprint(wint_t __wc) {return __libcpp_iswprint(__wc);}
-#else // iswprint
using ::iswprint;
-#endif
-
-#ifdef iswpunct
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswpunct(wint_t __wc) {return iswpunct(__wc);}
-#undef iswpunct
-inline _LIBCPP_INLINE_VISIBILITY int iswpunct(wint_t __wc) {return __libcpp_iswpunct(__wc);}
-#else // iswpunct
using ::iswpunct;
-#endif
-
-#ifdef iswspace
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswspace(wint_t __wc) {return iswspace(__wc);}
-#undef iswspace
-inline _LIBCPP_INLINE_VISIBILITY int iswspace(wint_t __wc) {return __libcpp_iswspace(__wc);}
-#else // iswspace
using ::iswspace;
-#endif
-
-#ifdef iswupper
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswupper(wint_t __wc) {return iswupper(__wc);}
-#undef iswupper
-inline _LIBCPP_INLINE_VISIBILITY int iswupper(wint_t __wc) {return __libcpp_iswupper(__wc);}
-#else // iswupper
using ::iswupper;
-#endif
-
-#ifdef iswxdigit
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswxdigit(wint_t __wc) {return iswxdigit(__wc);}
-#undef iswxdigit
-inline _LIBCPP_INLINE_VISIBILITY int iswxdigit(wint_t __wc) {return __libcpp_iswxdigit(__wc);}
-#else // iswxdigit
using ::iswxdigit;
-#endif
-
-#ifdef iswctype
-inline _LIBCPP_INLINE_VISIBILITY int __libcpp_iswctype(wint_t __w, wctype_t __d) {return iswctype(__w, __d);}
-#undef iswctype
-inline _LIBCPP_INLINE_VISIBILITY int iswctype(wint_t __w, wctype_t __d) {return __libcpp_iswctype(__w, __d);}
-#else // iswctype
using ::iswctype;
-#endif
-
-#ifdef wctype
-inline _LIBCPP_INLINE_VISIBILITY wctype_t __libcpp_wctype(const char* __p) {return wctype(__p);}
-#undef wctype
-inline _LIBCPP_INLINE_VISIBILITY wctype_t wctype(const char* __p) {return __libcpp_wctype(__p);}
-#else // wctype
using ::wctype;
-#endif
-
-#ifdef towlower
-inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towlower(wint_t __wc) {return towlower(__wc);}
-#undef towlower
-inline _LIBCPP_INLINE_VISIBILITY wint_t towlower(wint_t __wc) {return __libcpp_towlower(__wc);}
-#else // towlower
using ::towlower;
-#endif
-
-#ifdef towupper
-inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towupper(wint_t __wc) {return towupper(__wc);}
-#undef towupper
-inline _LIBCPP_INLINE_VISIBILITY wint_t towupper(wint_t __wc) {return __libcpp_towupper(__wc);}
-#else // towupper
using ::towupper;
-#endif
-
-#ifdef towctrans
-inline _LIBCPP_INLINE_VISIBILITY wint_t __libcpp_towctrans(wint_t __wc, wctype_t __d) {return towctrans(__wc, __d);}
-#undef towctrans
-inline _LIBCPP_INLINE_VISIBILITY wint_t towctrans(wint_t __wc, wctype_t __d) {return __libcpp_towctrans(__wc, __d);}
-#else // towctrans
using ::towctrans;
-#endif
-
-#ifdef wctrans
-inline _LIBCPP_INLINE_VISIBILITY wctrans_t __libcpp_wctrans(const char* __p) {return wctrans(__p);}
-#undef wctrans
-inline _LIBCPP_INLINE_VISIBILITY wctrans_t wctrans(const char* __p) {return __libcpp_wctrans(__p);}
-#else // wctrans
using ::wctrans;
-#endif
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/deque b/include/deque
index 5e152e425d0b..c6fbd512a1c6 100644
--- a/include/deque
+++ b/include/deque
@@ -261,8 +261,21 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __l,
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
+template <class _ValueType, class _DiffType>
+struct __deque_block_size {
+ static const _DiffType value = sizeof(_ValueType) < 256 ? 4096 / sizeof(_ValueType) : 16;
+};
+
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
- class _DiffType, _DiffType _BlockSize>
+ class _DiffType, _DiffType _BS =
+#ifdef _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
+// Keep template parameter to avoid changing all template declarations thoughout
+// this file.
+ 0
+#else
+ __deque_block_size<_ValueType, _DiffType>::value
+#endif
+ >
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
{
typedef _MapPointer __map_iterator;
@@ -273,7 +286,7 @@ private:
__map_iterator __m_iter_;
pointer __ptr_;
- static const difference_type __block_size = _BlockSize;
+ static const difference_type __block_size;
public:
typedef _ValueType value_type;
typedef random_access_iterator_tag iterator_category;
@@ -287,7 +300,7 @@ public:
template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
- __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it,
+ __deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, _BS>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
@@ -520,6 +533,12 @@ private:
__deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2> __r);
};
+template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
+ class _DiffType, _DiffType _BlockSize>
+const _DiffType __deque_iterator<_ValueType, _Pointer, _Reference, _MapPointer,
+ _DiffType, _BlockSize>::__block_size =
+ __deque_block_size<_ValueType, _DiffType>::value;
+
// copy
template <class _RAIter,
@@ -532,10 +551,11 @@ copy(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
- pointer __re = *__r.__m_iter_ + _B2;
+ pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@@ -560,11 +580,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + _B1;
+ pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@@ -587,11 +608,12 @@ copy(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + _B1;
+ pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@@ -705,10 +727,11 @@ move(_RAIter __f,
{
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::difference_type difference_type;
typedef typename __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V2, _P2, _R2, _M2, _D2, _B2>::__block_size;
while (__f != __l)
{
pointer __rb = __r.__ptr_;
- pointer __re = *__r.__m_iter_ + _B2;
+ pointer __re = *__r.__m_iter_ + __block_size;
difference_type __bs = __re - __rb;
difference_type __n = __l - __f;
_RAIter __m = __l;
@@ -733,11 +756,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + _B1;
+ pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@@ -760,11 +784,12 @@ move(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
{
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::difference_type difference_type;
typedef typename __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::pointer pointer;
+ const difference_type __block_size = __deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1>::__block_size;
difference_type __n = __l - __f;
while (__n > 0)
{
pointer __fb = __f.__ptr_;
- pointer __fe = *__f.__m_iter_ + _B1;
+ pointer __fe = *__f.__m_iter_ + __block_size;
difference_type __bs = __fe - __fb;
if (__bs > __n)
{
@@ -909,7 +934,7 @@ protected:
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
- static const difference_type __block_size = sizeof(value_type) < 256 ? 4096 / sizeof(value_type) : 16;
+ static const difference_type __block_size;
typedef typename __rebind_alloc_helper<__alloc_traits, pointer>::type __pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
@@ -919,9 +944,9 @@ protected:
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
- difference_type, __block_size> iterator;
+ difference_type> iterator;
typedef __deque_iterator<value_type, const_pointer, const_reference, __map_const_pointer,
- difference_type, __block_size> const_iterator;
+ difference_type> const_iterator;
__map __map_;
size_type __start_;
@@ -939,8 +964,10 @@ protected:
_LIBCPP_INLINE_VISIBILITY
const allocator_type& __alloc() const _NOEXCEPT {return __size_.second();}
+ _LIBCPP_INLINE_VISIBILITY
__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
+ _LIBCPP_INLINE_VISIBILITY
explicit __deque_base(const allocator_type& __a);
public:
~__deque_base();
@@ -997,6 +1024,11 @@ private:
};
template <class _Tp, class _Allocator>
+const typename __deque_base<_Tp, _Allocator>::difference_type
+ __deque_base<_Tp, _Allocator>::__block_size =
+ __deque_block_size<value_type, difference_type>::value;
+
+template <class _Tp, class _Allocator>
bool
__deque_base<_Tp, _Allocator>::__invariants() const
{
@@ -1060,13 +1092,13 @@ __deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__deque_base<_Tp, _Allocator>::__deque_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __start_(0), __size_(0) {}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__deque_base<_Tp, _Allocator>::__deque_base(const allocator_type& __a)
: __map_(__pointer_allocator(__a)), __start_(0), __size_(0, __a) {}
@@ -1164,6 +1196,9 @@ public:
typedef _Tp value_type;
typedef _Allocator allocator_type;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
typedef __deque_base<value_type, allocator_type> __base;
typedef typename __base::__alloc_traits __alloc_traits;
@@ -1211,8 +1246,11 @@ public:
#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
deque(deque&& __c, const allocator_type& __a);
+ _LIBCPP_INLINE_VISIBILITY
deque& operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
@@ -1231,6 +1269,7 @@ public:
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;
// iterators:
@@ -1283,13 +1322,21 @@ public:
bool empty() const _NOEXCEPT {return __base::size() == 0;}
// element access:
+ _LIBCPP_INLINE_VISIBILITY
reference operator[](size_type __i);
+ _LIBCPP_INLINE_VISIBILITY
const_reference operator[](size_type __i) const;
+ _LIBCPP_INLINE_VISIBILITY
reference at(size_type __i);
+ _LIBCPP_INLINE_VISIBILITY
const_reference at(size_type __i) const;
+ _LIBCPP_INLINE_VISIBILITY
reference front();
+ _LIBCPP_INLINE_VISIBILITY
const_reference front() const;
+ _LIBCPP_INLINE_VISIBILITY
reference back();
+ _LIBCPP_INLINE_VISIBILITY
const_reference back() const;
// 23.2.2.3 modifiers:
@@ -1328,6 +1375,7 @@ public:
iterator erase(const_iterator __p);
iterator erase(const_iterator __f, const_iterator __l);
+ _LIBCPP_INLINE_VISIBILITY
void swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
_NOEXCEPT;
@@ -1335,6 +1383,7 @@ public:
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
#endif
+ _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@@ -1507,7 +1556,7 @@ deque<_Tp, _Allocator>::operator=(const deque& __c)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
deque<_Tp, _Allocator>::deque(deque&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value)
: __base(_VSTD::move(__c))
@@ -1515,7 +1564,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
: __base(_VSTD::move(__c), __a)
{
@@ -1527,7 +1576,7 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
deque<_Tp, _Allocator>&
deque<_Tp, _Allocator>::operator=(deque&& __c)
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
@@ -1611,7 +1660,7 @@ deque<_Tp, _Allocator>::assign(size_type __n, const value_type& __v)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_Allocator
deque<_Tp, _Allocator>::get_allocator() const _NOEXCEPT
{
@@ -1670,7 +1719,7 @@ deque<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::operator[](size_type __i)
{
@@ -1679,7 +1728,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::operator[](size_type __i) const
{
@@ -1688,7 +1737,7 @@ deque<_Tp, _Allocator>::operator[](size_type __i) const
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::at(size_type __i)
{
@@ -1699,7 +1748,7 @@ deque<_Tp, _Allocator>::at(size_type __i)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::at(size_type __i) const
{
@@ -1710,7 +1759,7 @@ deque<_Tp, _Allocator>::at(size_type __i) const
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::front()
{
@@ -1719,7 +1768,7 @@ deque<_Tp, _Allocator>::front()
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::front() const
{
@@ -1728,7 +1777,7 @@ deque<_Tp, _Allocator>::front() const
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::reference
deque<_Tp, _Allocator>::back()
{
@@ -1737,7 +1786,7 @@ deque<_Tp, _Allocator>::back()
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename deque<_Tp, _Allocator>::const_reference
deque<_Tp, _Allocator>::back() const
{
@@ -2029,7 +2078,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
- size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
if (__n > __pos)
@@ -2054,7 +2102,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_ty
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
- size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
size_type __de = __base::size() - __pos;
@@ -2119,7 +2166,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __front_spare())
__add_front_capacity(__n - __front_spare());
// __n <= __front_spare()
- size_type __old_n = __n;
iterator __old_begin = __base::begin();
iterator __i = __old_begin;
_BiIter __m = __f;
@@ -2150,7 +2196,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, _BiIter __f, _BiIter __l,
if (__n > __back_capacity)
__add_back_capacity(__n - __back_capacity);
// __n <= __back_capacity
- size_type __old_n = __n;
iterator __old_end = __base::end();
iterator __i = __old_end;
_BiIter __m = __l;
@@ -2685,7 +2730,6 @@ template <class _Tp, class _Allocator>
typename deque<_Tp, _Allocator>::iterator
deque<_Tp, _Allocator>::erase(const_iterator __f)
{
- difference_type __n = 1;
iterator __b = __base::begin();
difference_type __pos = __f - __b;
iterator __p = __b + __pos;
@@ -2781,7 +2825,7 @@ deque<_Tp, _Allocator>::__erase_to_end(const_iterator __f)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
deque<_Tp, _Allocator>::swap(deque& __c)
#if _LIBCPP_STD_VER >= 14
@@ -2795,7 +2839,7 @@ deque<_Tp, _Allocator>::swap(deque& __c)
}
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
deque<_Tp, _Allocator>::clear() _NOEXCEPT
{
diff --git a/include/errno.h b/include/errno.h
new file mode 100644
index 000000000000..ee6429110cc1
--- /dev/null
+++ b/include/errno.h
@@ -0,0 +1,398 @@
+// -*- C++ -*-
+//===-------------------------- errno.h -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_ERRNO_H
+#define _LIBCPP_ERRNO_H
+
+/*
+ errno.h synopsis
+
+Macros:
+
+ EDOM
+ EILSEQ // C99
+ ERANGE
+ errno
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <errno.h>
+
+#ifdef __cplusplus
+
+#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+
+#ifdef ELAST
+
+static const int __elast1 = ELAST+1;
+static const int __elast2 = ELAST+2;
+
+#else
+
+static const int __elast1 = 104;
+static const int __elast2 = 105;
+
+#endif
+
+#ifdef ENOTRECOVERABLE
+
+#define EOWNERDEAD __elast1
+
+#ifdef ELAST
+#undef ELAST
+#define ELAST EOWNERDEAD
+#endif
+
+#elif defined(EOWNERDEAD)
+
+#define ENOTRECOVERABLE __elast1
+#ifdef ELAST
+#undef ELAST
+#define ELAST ENOTRECOVERABLE
+#endif
+
+#else // defined(EOWNERDEAD)
+
+#define EOWNERDEAD __elast1
+#define ENOTRECOVERABLE __elast2
+#ifdef ELAST
+#undef ELAST
+#define ELAST ENOTRECOVERABLE
+#endif
+
+#endif // defined(EOWNERDEAD)
+
+#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
+
+// supply errno values likely to be missing, particularly on Windows
+
+#ifndef EAFNOSUPPORT
+#define EAFNOSUPPORT 9901
+#endif
+
+#ifndef EADDRINUSE
+#define EADDRINUSE 9902
+#endif
+
+#ifndef EADDRNOTAVAIL
+#define EADDRNOTAVAIL 9903
+#endif
+
+#ifndef EISCONN
+#define EISCONN 9904
+#endif
+
+#ifndef EBADMSG
+#define EBADMSG 9905
+#endif
+
+#ifndef ECONNABORTED
+#define ECONNABORTED 9906
+#endif
+
+#ifndef EALREADY
+#define EALREADY 9907
+#endif
+
+#ifndef ECONNREFUSED
+#define ECONNREFUSED 9908
+#endif
+
+#ifndef ECONNRESET
+#define ECONNRESET 9909
+#endif
+
+#ifndef EDESTADDRREQ
+#define EDESTADDRREQ 9910
+#endif
+
+#ifndef EHOSTUNREACH
+#define EHOSTUNREACH 9911
+#endif
+
+#ifndef EIDRM
+#define EIDRM 9912
+#endif
+
+#ifndef EMSGSIZE
+#define EMSGSIZE 9913
+#endif
+
+#ifndef ENETDOWN
+#define ENETDOWN 9914
+#endif
+
+#ifndef ENETRESET
+#define ENETRESET 9915
+#endif
+
+#ifndef ENETUNREACH
+#define ENETUNREACH 9916
+#endif
+
+#ifndef ENOBUFS
+#define ENOBUFS 9917
+#endif
+
+#ifndef ENOLINK
+#define ENOLINK 9918
+#endif
+
+#ifndef ENODATA
+#define ENODATA 9919
+#endif
+
+#ifndef ENOMSG
+#define ENOMSG 9920
+#endif
+
+#ifndef ENOPROTOOPT
+#define ENOPROTOOPT 9921
+#endif
+
+#ifndef ENOSR
+#define ENOSR 9922
+#endif
+
+#ifndef ENOTSOCK
+#define ENOTSOCK 9923
+#endif
+
+#ifndef ENOSTR
+#define ENOSTR 9924
+#endif
+
+#ifndef ENOTCONN
+#define ENOTCONN 9925
+#endif
+
+#ifndef ENOTSUP
+#define ENOTSUP 9926
+#endif
+
+#ifndef ECANCELED
+#define ECANCELED 9927
+#endif
+
+#ifndef EINPROGRESS
+#define EINPROGRESS 9928
+#endif
+
+#ifndef EOPNOTSUPP
+#define EOPNOTSUPP 9929
+#endif
+
+#ifndef EWOULDBLOCK
+#define EWOULDBLOCK 9930
+#endif
+
+#ifndef EOWNERDEAD
+#define EOWNERDEAD 9931
+#endif
+
+#ifndef EPROTO
+#define EPROTO 9932
+#endif
+
+#ifndef EPROTONOSUPPORT
+#define EPROTONOSUPPORT 9933
+#endif
+
+#ifndef ENOTRECOVERABLE
+#define ENOTRECOVERABLE 9934
+#endif
+
+#ifndef ETIME
+#define ETIME 9935
+#endif
+
+#ifndef ETXTBSY
+#define ETXTBSY 9936
+#endif
+
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 9938
+#endif
+
+#ifndef ELOOP
+#define ELOOP 9939
+#endif
+
+#ifndef EOVERFLOW
+#define EOVERFLOW 9940
+#endif
+
+#ifndef EPROTOTYPE
+#define EPROTOTYPE 9941
+#endif
+
+#ifndef ENOSYS
+#define ENOSYS 9942
+#endif
+
+#ifndef EINVAL
+#define EINVAL 9943
+#endif
+
+#ifndef ERANGE
+#define ERANGE 9944
+#endif
+
+#ifndef EILSEQ
+#define EILSEQ 9945
+#endif
+
+// Windows Mobile doesn't appear to define these:
+
+#ifndef E2BIG
+#define E2BIG 9946
+#endif
+
+#ifndef EDOM
+#define EDOM 9947
+#endif
+
+#ifndef EFAULT
+#define EFAULT 9948
+#endif
+
+#ifndef EBADF
+#define EBADF 9949
+#endif
+
+#ifndef EPIPE
+#define EPIPE 9950
+#endif
+
+#ifndef EXDEV
+#define EXDEV 9951
+#endif
+
+#ifndef EBUSY
+#define EBUSY 9952
+#endif
+
+#ifndef ENOTEMPTY
+#define ENOTEMPTY 9953
+#endif
+
+#ifndef ENOEXEC
+#define ENOEXEC 9954
+#endif
+
+#ifndef EEXIST
+#define EEXIST 9955
+#endif
+
+#ifndef EFBIG
+#define EFBIG 9956
+#endif
+
+#ifndef ENAMETOOLONG
+#define ENAMETOOLONG 9957
+#endif
+
+#ifndef ENOTTY
+#define ENOTTY 9958
+#endif
+
+#ifndef EINTR
+#define EINTR 9959
+#endif
+
+#ifndef ESPIPE
+#define ESPIPE 9960
+#endif
+
+#ifndef EIO
+#define EIO 9961
+#endif
+
+#ifndef EISDIR
+#define EISDIR 9962
+#endif
+
+#ifndef ECHILD
+#define ECHILD 9963
+#endif
+
+#ifndef ENOLCK
+#define ENOLCK 9964
+#endif
+
+#ifndef ENOSPC
+#define ENOSPC 9965
+#endif
+
+#ifndef ENXIO
+#define ENXIO 9966
+#endif
+
+#ifndef ENODEV
+#define ENODEV 9967
+#endif
+
+#ifndef ENOENT
+#define ENOENT 9968
+#endif
+
+#ifndef ESRCH
+#define ESRCH 9969
+#endif
+
+#ifndef ENOTDIR
+#define ENOTDIR 9970
+#endif
+
+#ifndef ENOMEM
+#define ENOMEM 9971
+#endif
+
+#ifndef EPERM
+#define EPERM 9972
+#endif
+
+#ifndef EACCES
+#define EACCES 9973
+#endif
+
+#ifndef EROFS
+#define EROFS 9974
+#endif
+
+#ifndef EDEADLK
+#define EDEADLK 9975
+#endif
+
+#ifndef EAGAIN
+#define EAGAIN 9976
+#endif
+
+#ifndef ENFILE
+#define ENFILE 9977
+#endif
+
+#ifndef EMFILE
+#define EMFILE 9978
+#endif
+
+#ifndef EMLINK
+#define EMLINK 9979
+#endif
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_ERRNO_H
diff --git a/include/exception b/include/exception
index 5a905e7e58d8..686e4ecd0578 100644
--- a/include/exception
+++ b/include/exception
@@ -235,7 +235,7 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
is_polymorphic<_Ep>::value
>::type* = 0)
{
- const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
+ const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
if (__nep)
__nep->rethrow_nested();
}
diff --git a/include/experimental/algorithm b/include/experimental/algorithm
index a2e956f281a0..ffaa793b6d4e 100644
--- a/include/experimental/algorithm
+++ b/include/experimental/algorithm
@@ -50,6 +50,12 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last,
_LIBCPP_BEGIN_NAMESPACE_LFTS
+template <class _ForwardIterator, class _Searcher>
+_LIBCPP_INLINE_VISIBILITY
+_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
+{ return __s(__f, __l); }
+
+
template <class _PopulationIterator, class _SampleIterator, class _Distance,
class _UniformRandomNumberGenerator>
_LIBCPP_INLINE_VISIBILITY
diff --git a/include/experimental/any b/include/experimental/any
new file mode 100644
index 000000000000..603788484dd5
--- /dev/null
+++ b/include/experimental/any
@@ -0,0 +1,590 @@
+// -*- C++ -*-
+//===------------------------------ any -----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_EXPERIMENTAL_ANY
+#define _LIBCPP_EXPERIMENTAL_ANY
+
+/*
+ experimental/any synopsis
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+ class bad_any_cast : public bad_cast
+ {
+ public:
+ virtual const char* what() const noexcept;
+ };
+
+ class any
+ {
+ public:
+
+ // 6.3.1 any construct/destruct
+ any() noexcept;
+
+ any(const any& other);
+ any(any&& other) noexcept;
+
+ template <class ValueType>
+ any(ValueType&& value);
+
+ ~any();
+
+ // 6.3.2 any assignments
+ any& operator=(const any& rhs);
+ any& operator=(any&& rhs) noexcept;
+
+ template <class ValueType>
+ any& operator=(ValueType&& rhs);
+
+ // 6.3.3 any modifiers
+ void clear() noexcept;
+ void swap(any& rhs) noexcept;
+
+ // 6.3.4 any observers
+ bool empty() const noexcept;
+ const type_info& type() const noexcept;
+ };
+
+ // 6.4 Non-member functions
+ void swap(any& x, any& y) noexcept;
+
+ template<class ValueType>
+ ValueType any_cast(const any& operand);
+ template<class ValueType>
+ ValueType any_cast(any& operand);
+ template<class ValueType>
+ ValueType any_cast(any&& operand);
+
+ template<class ValueType>
+ const ValueType* any_cast(const any* operand) noexcept;
+ template<class ValueType>
+ ValueType* any_cast(any* operand) noexcept;
+
+} // namespace fundamentals_v1
+} // namespace experimental
+} // namespace std
+
+*/
+
+#include <experimental/__config>
+#include <memory>
+#include <new>
+#include <typeinfo>
+#include <type_traits>
+#include <cstdlib>
+#include <cassert>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_LFTS
+
+class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
+{
+public:
+ virtual const char* what() const _NOEXCEPT;
+};
+
+#if _LIBCPP_STD_VER > 11 // C++ > 11
+
+_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
+inline void __throw_bad_any_cast()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw bad_any_cast();
+#else
+ assert(!"bad_any_cast");
+#endif
+}
+
+// Forward declarations
+class any;
+
+template <class _ValueType>
+typename add_pointer<typename add_const<_ValueType>::type>::type
+any_cast(any const *) _NOEXCEPT;
+
+template <class _ValueType>
+typename add_pointer<_ValueType>::type
+any_cast(any *) _NOEXCEPT;
+
+namespace __any_imp
+{
+ typedef typename aligned_storage<3*sizeof(void*), alignment_of<void*>::value>::type
+ _Buffer;
+
+ template <class _Tp>
+ struct _IsSmallObject
+ : public integral_constant<bool
+ , sizeof(_Tp) <= sizeof(_Buffer)
+ && alignment_of<_Buffer>::value
+ % alignment_of<_Tp>::value == 0
+ && is_nothrow_move_constructible<_Tp>::value
+ >
+ {};
+
+ enum class _Action
+ {
+ _Destroy,
+ _Copy,
+ _Move,
+ _Get,
+ _TypeInfo
+ };
+
+ template <class _Tp>
+ struct _SmallHandler;
+
+ template <class _Tp>
+ struct _LargeHandler;
+
+ template <class _Tp>
+ using _Handler = typename conditional<_IsSmallObject<_Tp>::value
+ , _SmallHandler<_Tp>
+ , _LargeHandler<_Tp>
+ >::type;
+ template <class _ValueType>
+ using _EnableIfNotAny = typename
+ enable_if<
+ !is_same<typename decay<_ValueType>::type, any>::value
+ >::type;
+
+} // namespace __any_imp
+
+class any
+{
+public:
+ // 6.3.1 any construct/destruct
+ _LIBCPP_INLINE_VISIBILITY
+ any() _NOEXCEPT : __h(nullptr) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ any(any const & __other) : __h(nullptr)
+ {
+ if (__other.__h) __other.__call(_Action::_Copy, this);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ any(any && __other) _NOEXCEPT : __h(nullptr)
+ {
+ if (__other.__h) __other.__call(_Action::_Move, this);
+ }
+
+ template <
+ class _ValueType
+ , class = __any_imp::_EnableIfNotAny<_ValueType>
+ >
+ any(_ValueType && __value);
+
+ _LIBCPP_INLINE_VISIBILITY
+ ~any()
+ {
+ this->clear();
+ }
+
+ // 6.3.2 any assignments
+ _LIBCPP_INLINE_VISIBILITY
+ any & operator=(any const & __rhs)
+ {
+ any(__rhs).swap(*this);
+ return *this;
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ any & operator=(any && __rhs) _NOEXCEPT
+ {
+ any(_VSTD::move(__rhs)).swap(*this);
+ return *this;
+ }
+
+ template <
+ class _ValueType
+ , class = __any_imp::_EnableIfNotAny<_ValueType>
+ >
+ any & operator=(_ValueType && __rhs);
+
+ // 6.3.3 any modifiers
+ _LIBCPP_INLINE_VISIBILITY
+ void clear() _NOEXCEPT
+ {
+ if (__h) this->__call(_Action::_Destroy);
+ }
+
+ void swap(any & __rhs) _NOEXCEPT;
+
+ // 6.3.4 any observers
+ _LIBCPP_INLINE_VISIBILITY
+ bool empty() const _NOEXCEPT
+ {
+ return __h == nullptr;
+ }
+
+#if !defined(_LIBCPP_NO_RTTI)
+ _LIBCPP_INLINE_VISIBILITY
+ const type_info & type() const _NOEXCEPT
+ {
+ if (__h) {
+ return *static_cast<type_info const *>(this->__call(_Action::_TypeInfo));
+ } else {
+ return typeid(void);
+ }
+ }
+#endif
+
+private:
+ typedef __any_imp::_Action _Action;
+
+ typedef void* (*_HandleFuncPtr)(_Action, any const *, any *, const type_info *);
+
+ union _Storage
+ {
+ void * __ptr;
+ __any_imp::_Buffer __buf;
+ };
+
+ _LIBCPP_ALWAYS_INLINE
+ void * __call(_Action __a, any * __other = nullptr,
+ type_info const * __info = nullptr) const
+ {
+ return __h(__a, this, __other, __info);
+ }
+
+ _LIBCPP_ALWAYS_INLINE
+ void * __call(_Action __a, any * __other = nullptr,
+ type_info const * __info = nullptr)
+ {
+ return __h(__a, this, __other, __info);
+ }
+
+ template <class>
+ friend struct __any_imp::_SmallHandler;
+ template <class>
+ friend struct __any_imp::_LargeHandler;
+
+ template <class _ValueType>
+ friend typename add_pointer<typename add_const<_ValueType>::type>::type
+ any_cast(any const *) _NOEXCEPT;
+
+ template <class _ValueType>
+ friend typename add_pointer<_ValueType>::type
+ any_cast(any *) _NOEXCEPT;
+
+ _HandleFuncPtr __h;
+ _Storage __s;
+};
+
+namespace __any_imp
+{
+
+ template <class _Tp>
+ struct _LIBCPP_TYPE_VIS_ONLY _SmallHandler
+ {
+ _LIBCPP_INLINE_VISIBILITY
+ static void* __handle(_Action __act, any const * __this, any * __other,
+ type_info const * __info)
+ {
+ switch (__act)
+ {
+ case _Action::_Destroy:
+ __destroy(const_cast<any &>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any &>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any &>(*__this), __info);
+ case _Action::_TypeInfo:
+ return __type_info();
+ }
+ }
+
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ static void __create(any & __dest, _Up && __v)
+ {
+ ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Up>(__v));
+ __dest.__h = &_SmallHandler::__handle;
+ }
+
+ private:
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __destroy(any & __this)
+ {
+ _Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
+ __value.~_Tp();
+ __this.__h = nullptr;
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __copy(any const & __this, any & __dest)
+ {
+ _SmallHandler::__create(__dest, *static_cast<_Tp const *>(
+ static_cast<void const *>(&__this.__s.__buf)));
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __move(any & __this, any & __dest)
+ {
+ _SmallHandler::__create(__dest, _VSTD::move(
+ *static_cast<_Tp*>(static_cast<void*>(&__this.__s.__buf))));
+ __destroy(__this);
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void* __get(any & __this, type_info const * __info)
+ {
+#if !defined(_LIBCPP_NO_RTTI)
+ if (typeid(_Tp) == *__info) {
+ return static_cast<void*>(&__this.__s.__buf);
+ }
+ return nullptr;
+#else
+ return static_cast<void*>(&__this.__s.__buf);
+#endif
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void* __type_info()
+ {
+#if !defined(_LIBCPP_NO_RTTI)
+ return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
+#else
+ return nullptr;
+#endif
+ }
+ };
+
+ template <class _Tp>
+ struct _LIBCPP_TYPE_VIS_ONLY _LargeHandler
+ {
+ _LIBCPP_INLINE_VISIBILITY
+ static void* __handle(_Action __act, any const * __this, any * __other,
+ type_info const * __info)
+ {
+ switch (__act)
+ {
+ case _Action::_Destroy:
+ __destroy(const_cast<any &>(*__this));
+ return nullptr;
+ case _Action::_Copy:
+ __copy(*__this, *__other);
+ return nullptr;
+ case _Action::_Move:
+ __move(const_cast<any &>(*__this), *__other);
+ return nullptr;
+ case _Action::_Get:
+ return __get(const_cast<any &>(*__this), __info);
+ case _Action::_TypeInfo:
+ return __type_info();
+ }
+ }
+
+ template <class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ static void __create(any & __dest, _Up && __v)
+ {
+ 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<_Up>(__v));
+ __dest.__s.__ptr = __hold.release();
+ __dest.__h = &_LargeHandler::__handle;
+ }
+
+ private:
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __destroy(any & __this)
+ {
+ delete static_cast<_Tp*>(__this.__s.__ptr);
+ __this.__h = nullptr;
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __copy(any const & __this, any & __dest)
+ {
+ _LargeHandler::__create(__dest, *static_cast<_Tp const *>(__this.__s.__ptr));
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void __move(any & __this, any & __dest)
+ {
+ __dest.__s.__ptr = __this.__s.__ptr;
+ __dest.__h = &_LargeHandler::__handle;
+ __this.__h = nullptr;
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void* __get(any & __this, type_info const * __info)
+ {
+#if !defined(_LIBCPP_NO_RTTI)
+ if (typeid(_Tp) == *__info) {
+ return static_cast<void*>(__this.__s.__ptr);
+ }
+ return nullptr;
+#else
+ return static_cast<void*>(__this.__s.__ptr);
+#endif
+ }
+
+ _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
+ static void* __type_info()
+ {
+#if !defined(_LIBCPP_NO_RTTI)
+ return const_cast<void*>(static_cast<void const *>(&typeid(_Tp)));
+#else
+ return nullptr;
+#endif
+ }
+ };
+
+} // namespace __any_imp
+
+
+template <class _ValueType, class>
+_LIBCPP_INLINE_VISIBILITY
+any::any(_ValueType && __v) : __h(nullptr)
+{
+ typedef typename decay<_ValueType>::type _Tp;
+ static_assert(is_copy_constructible<_Tp>::value,
+ "_ValueType must be CopyConstructible.");
+ typedef __any_imp::_Handler<_Tp> _HandlerType;
+ _HandlerType::__create(*this, _VSTD::forward<_ValueType>(__v));
+}
+
+template <class _ValueType, class>
+_LIBCPP_INLINE_VISIBILITY
+any & any::operator=(_ValueType && __v)
+{
+ typedef typename decay<_ValueType>::type _Tp;
+ static_assert(is_copy_constructible<_Tp>::value,
+ "_ValueType must be CopyConstructible.");
+ any(_VSTD::forward<_ValueType>(__v)).swap(*this);
+ return *this;
+}
+
+inline _LIBCPP_INLINE_VISIBILITY
+void any::swap(any & __rhs) _NOEXCEPT
+{
+ if (__h && __rhs.__h) {
+ any __tmp;
+ __rhs.__call(_Action::_Move, &__tmp);
+ this->__call(_Action::_Move, &__rhs);
+ __tmp.__call(_Action::_Move, this);
+ }
+ else if (__h) {
+ this->__call(_Action::_Move, &__rhs);
+ }
+ else if (__rhs.__h) {
+ __rhs.__call(_Action::_Move, this);
+ }
+}
+
+// 6.4 Non-member functions
+
+inline _LIBCPP_INLINE_VISIBILITY
+void swap(any & __lhs, any & __rhs) _NOEXCEPT
+{
+ __lhs.swap(__rhs);
+}
+
+template <class _ValueType>
+_LIBCPP_INLINE_VISIBILITY
+_ValueType any_cast(any const & __v)
+{
+ static_assert(
+ is_reference<_ValueType>::value
+ || is_copy_constructible<_ValueType>::value,
+ "_ValueType is required to be a reference or a CopyConstructible type.");
+ typedef typename add_const<typename remove_reference<_ValueType>::type>::type
+ _Tp;
+ _Tp * __tmp = any_cast<_Tp>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return *__tmp;
+}
+
+template <class _ValueType>
+_LIBCPP_INLINE_VISIBILITY
+_ValueType any_cast(any & __v)
+{
+ static_assert(
+ is_reference<_ValueType>::value
+ || is_copy_constructible<_ValueType>::value,
+ "_ValueType is required to be a reference or a CopyConstructible type.");
+ typedef typename remove_reference<_ValueType>::type _Tp;
+ _Tp * __tmp = any_cast<_Tp>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return *__tmp;
+}
+
+template <class _ValueType>
+_LIBCPP_INLINE_VISIBILITY
+_ValueType any_cast(any && __v)
+{
+ static_assert(
+ is_reference<_ValueType>::value
+ || is_copy_constructible<_ValueType>::value,
+ "_ValueType is required to be a reference or a CopyConstructible type.");
+ typedef typename remove_reference<_ValueType>::type _Tp;
+ _Tp * __tmp = any_cast<_Tp>(&__v);
+ if (__tmp == nullptr)
+ __throw_bad_any_cast();
+ return *__tmp;
+}
+
+template <class _ValueType>
+inline _LIBCPP_INLINE_VISIBILITY
+typename add_pointer<typename add_const<_ValueType>::type>::type
+any_cast(any const * __any) _NOEXCEPT
+{
+ static_assert(!is_reference<_ValueType>::value,
+ "_ValueType may not be a reference.");
+ return any_cast<_ValueType>(const_cast<any *>(__any));
+}
+
+template <class _ValueType>
+_LIBCPP_INLINE_VISIBILITY
+typename add_pointer<_ValueType>::type
+any_cast(any * __any) _NOEXCEPT
+{
+ using __any_imp::_Action;
+ static_assert(!is_reference<_ValueType>::value,
+ "_ValueType may not be a reference.");
+ typedef typename add_pointer<_ValueType>::type _ReturnType;
+ if (__any && __any->__h) {
+
+ return static_cast<_ReturnType>(
+ __any->__call(_Action::_Get, nullptr,
+#if !defined(_LIBCPP_NO_RTTI)
+ &typeid(_ValueType)
+#else
+ nullptr
+#endif
+ ));
+
+ }
+ return nullptr;
+}
+
+#endif // _LIBCPP_STD_VER > 11
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif // _LIBCPP_EXPERIMENTAL_ANY
diff --git a/include/experimental/dynarray b/include/experimental/dynarray
index a0258628dfa6..f40a6ca188b8 100644
--- a/include/experimental/dynarray
+++ b/include/experimental/dynarray
@@ -137,7 +137,7 @@ public:
private:
size_t __size_;
value_type * __base_;
- _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
+ _LIBCPP_ALWAYS_INLINE dynarray () noexcept : __size_(0), __base_(nullptr) {}
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
{
diff --git a/include/experimental/functional b/include/experimental/functional
new file mode 100644
index 000000000000..c7a78695b809
--- /dev/null
+++ b/include/experimental/functional
@@ -0,0 +1,454 @@
+// -*- C++ -*-
+//===-------------------------- functional --------------------------------===//
+//
+// 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_EXPERIMENTAL_FUNCTIONAL
+#define _LIBCPP_EXPERIMENTAL_FUNCTIONAL
+
+/*
+ experimental/functional synopsis
+
+#include <algorithm>
+
+namespace std {
+namespace experimental {
+inline namespace fundamentals_v1 {
+
+ // See C++14 20.9.9, Function object binders
+ template <class T> constexpr bool is_bind_expression_v
+ = is_bind_expression<T>::value;
+ template <class T> constexpr int is_placeholder_v
+ = is_placeholder<T>::value;
+
+ // 4.2, Class template function
+ template<class> class function; // undefined
+ template<class R, class... ArgTypes> class function<R(ArgTypes...)>;
+
+ template<class R, class... ArgTypes>
+ void swap(function<R(ArgTypes...)>&, function<R(ArgTypes...)>&);
+
+ template<class R, class... ArgTypes>
+ bool operator==(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
+ template<class R, class... ArgTypes>
+ bool operator==(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+ template<class R, class... ArgTypes>
+ bool operator!=(const function<R(ArgTypes...)>&, nullptr_t) noexcept;
+ template<class R, class... ArgTypes>
+ bool operator!=(nullptr_t, const function<R(ArgTypes...)>&) noexcept;
+
+ // 4.3, Searchers
+ template<class ForwardIterator, class BinaryPredicate = equal_to<>>
+ class default_searcher;
+
+ template<class RandomAccessIterator,
+ class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
+ class BinaryPredicate = equal_to<>>
+ class boyer_moore_searcher;
+
+ template<class RandomAccessIterator,
+ class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
+ class BinaryPredicate = equal_to<>>
+ class boyer_moore_horspool_searcher;
+
+ template<class ForwardIterator, class BinaryPredicate = equal_to<>>
+ default_searcher<ForwardIterator, BinaryPredicate>
+ make_default_searcher(ForwardIterator pat_first, ForwardIterator pat_last,
+ BinaryPredicate pred = BinaryPredicate());
+
+ template<class RandomAccessIterator,
+ class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
+ class BinaryPredicate = equal_to<>>
+ boyer_moore_searcher<RandomAccessIterator, Hash, BinaryPredicate>
+ make_boyer_moore_searcher(
+ RandomAccessIterator pat_first, RandomAccessIterator pat_last,
+ Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+
+ template<class RandomAccessIterator,
+ class Hash = hash<typename iterator_traits<RandomAccessIterator>::value_type>,
+ class BinaryPredicate = equal_to<>>
+ boyer_moore_horspool_searcher<RandomAccessIterator, Hash, BinaryPredicate>
+ make_boyer_moore_horspool_searcher(
+ RandomAccessIterator pat_first, RandomAccessIterator pat_last,
+ Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+
+ } // namespace fundamentals_v1
+ } // namespace experimental
+
+ template<class R, class... ArgTypes, class Alloc>
+ struct uses_allocator<experimental::function<R(ArgTypes...)>, Alloc>;
+
+} // namespace std
+
+*/
+
+#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_BEGIN_NAMESPACE_LFTS
+
+#if _LIBCPP_STD_VER > 11
+// default searcher
+template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+_LIBCPP_TYPE_VIS
+class default_searcher {
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ default_searcher(_ForwardIterator __f, _ForwardIterator __l,
+ _BinaryPredicate __p = _BinaryPredicate())
+ : __first_(__f), __last_(__l), __pred_(__p) {}
+
+ template <typename _ForwardIterator2>
+ _LIBCPP_INLINE_VISIBILITY
+ _ForwardIterator2 operator () (_ForwardIterator2 __f, _ForwardIterator2 __l) const
+ {
+ return _VSTD::search(__f, __l, __first_, __last_, __pred_);
+ }
+
+private:
+ _ForwardIterator __first_;
+ _ForwardIterator __last_;
+ _BinaryPredicate __pred_;
+ };
+
+template<class _ForwardIterator, class _BinaryPredicate = equal_to<>>
+_LIBCPP_INLINE_VISIBILITY
+default_searcher<_ForwardIterator, _BinaryPredicate>
+make_default_searcher( _ForwardIterator __f, _ForwardIterator __l, _BinaryPredicate __p = _BinaryPredicate ())
+{
+ return default_searcher<_ForwardIterator, _BinaryPredicate>(__f, __l, __p);
+}
+
+template<class _Key, class _Value, class _Hash, class _BinaryPredicate, bool /*useArray*/> class _BMSkipTable;
+
+// General case for BM data searching; use a map
+template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
+class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, false> {
+public: // TODO private:
+ typedef _Value value_type;
+ typedef _Key key_type;
+
+ const _Value __default_value_;
+ std::unordered_map<_Key, _Value, _Hash, _BinaryPredicate> __table;
+
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ _BMSkipTable(std::size_t __sz, _Value __default, _Hash __hf, _BinaryPredicate __pred)
+ : __default_value_(__default), __table(__sz, __hf, __pred) {}
+
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(const key_type &__key, value_type __val)
+ {
+ __table [__key] = __val; // Would skip_.insert (val) be better here?
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ value_type operator [](const key_type & __key) const
+ {
+ auto __it = __table.find (__key);
+ return __it == __table.end() ? __default_value_ : __it->second;
+ }
+};
+
+
+// Special case small numeric values; use an array
+template<class _Key, typename _Value, class _Hash, class _BinaryPredicate>
+class _BMSkipTable<_Key, _Value, _Hash, _BinaryPredicate, true> {
+private:
+ typedef _Value value_type;
+ typedef _Key key_type;
+
+ typedef typename std::make_unsigned<key_type>::type unsigned_key_type;
+ typedef std::array<value_type, _VSTD::numeric_limits<unsigned_key_type>::max()> skip_map;
+ skip_map __table;
+
+public:
+ _LIBCPP_INLINE_VISIBILITY
+ _BMSkipTable(std::size_t /*__sz*/, _Value __default, _Hash /*__hf*/, _BinaryPredicate /*__pred*/)
+ {
+ std::fill_n(__table.begin(), __table.size(), __default);
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ void insert(key_type __key, value_type __val)
+ {
+ __table[static_cast<unsigned_key_type>(__key)] = __val;
+ }
+
+ _LIBCPP_INLINE_VISIBILITY
+ value_type operator [](key_type __key) const
+ {
+ return __table[static_cast<unsigned_key_type>(__key)];
+ }
+};
+
+
+template <class _RandomAccessIterator1,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+_LIBCPP_TYPE_VIS
+class boyer_moore_searcher {
+private:
+ typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
+ typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
+ typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
+ _VSTD::is_integral<value_type>::value && // what about enums?
+ sizeof(value_type) == 1 &&
+ is_same<_Hash, hash<value_type>>::value &&
+ is_same<_BinaryPredicate, equal_to<>>::value
+ > skip_table_type;
+
+public:
+ boyer_moore_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
+ _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__f), __last_(__l), __pred_(__pred),
+ __pattern_length_(_VSTD::distance(__first_, __last_)),
+ __skip_{make_shared<skip_table_type>(__pattern_length_, -1, __hf, __pred_)},
+ __suffix_{make_shared<vector<difference_type>>(__pattern_length_ + 1)}
+ {
+ // build the skip table
+ for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
+ __skip_->insert(*__f, __i);
+
+ this->__build_suffix_table ( __first_, __last_, __pred_ );
+ }
+
+ template <typename _RandomAccessIterator2>
+ _RandomAccessIterator2
+ operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
+ {
+ static_assert ( std::is_same<
+ typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
+ typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
+ >::value,
+ "Corpus and Pattern iterators must point to the same type" );
+
+ if (__f == __l ) return __l; // empty corpus
+ if (__first_ == __last_) return __f; // empty pattern
+
+ // If the pattern is larger than the corpus, we can't find it!
+ if ( __pattern_length_ > _VSTD::distance (__f, __l))
+ return __l;
+
+ // Do the search
+ return this->__search(__f, __l);
+ }
+
+public: // TODO private:
+ _RandomAccessIterator1 __first_;
+ _RandomAccessIterator1 __last_;
+ _BinaryPredicate __pred_;
+ difference_type __pattern_length_;
+ shared_ptr<skip_table_type> __skip_;
+ shared_ptr<vector<difference_type>> __suffix_;
+
+ template <typename _RandomAccessIterator2>
+ _RandomAccessIterator2 __search(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
+ {
+ _RandomAccessIterator2 __cur = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ const skip_table_type & __skip = *__skip_.get();
+ const vector<difference_type> & __suffix = *__suffix_.get();
+
+ while (__cur <= __last)
+ {
+
+ // Do we match right where we are?
+ difference_type __j = __pattern_length_;
+ while (__pred_(__first_ [__j-1], __cur [__j-1])) {
+ __j--;
+ // We matched - we're done!
+ if ( __j == 0 )
+ return __cur;
+ }
+
+ // Since we didn't match, figure out how far to skip forward
+ difference_type __k = __skip[__cur [ __j - 1 ]];
+ difference_type __m = __j - __k - 1;
+ if (__k < __j && __m > __suffix[ __j ])
+ __cur += __m;
+ else
+ __cur += __suffix[ __j ];
+ }
+
+ return __l; // We didn't find anything
+ }
+
+
+ template<typename _Iterator, typename _Container>
+ void __compute_bm_prefix ( _Iterator __f, _Iterator __l, _BinaryPredicate __pred, _Container &__prefix )
+ {
+ const std::size_t __count = _VSTD::distance(__f, __l);
+
+ __prefix[0] = 0;
+ std::size_t __k = 0;
+ for ( std::size_t __i = 1; __i < __count; ++__i )
+ {
+ while ( __k > 0 && !__pred ( __f[__k], __f[__i] ))
+ __k = __prefix [ __k - 1 ];
+
+ if ( __pred ( __f[__k], __f[__i] ))
+ __k++;
+ __prefix [ __i ] = __k;
+ }
+ }
+
+ void __build_suffix_table(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
+ _BinaryPredicate __pred)
+ {
+ const std::size_t __count = _VSTD::distance(__f, __l);
+ vector<difference_type> & __suffix = *__suffix_.get();
+ if (__count > 0)
+ {
+ _VSTD::vector<value_type> __scratch(__count);
+
+ __compute_bm_prefix(__f, __l, __pred, __scratch);
+ for ( std::size_t __i = 0; __i <= __count; __i++ )
+ __suffix[__i] = __count - __scratch[__count-1];
+
+ typedef _VSTD::reverse_iterator<_RandomAccessIterator1> _RevIter;
+ __compute_bm_prefix(_RevIter(__l), _RevIter(__f), __pred, __scratch);
+
+ for ( std::size_t __i = 0; __i < __count; __i++ )
+ {
+ const std::size_t __j = __count - __scratch[__i];
+ const difference_type __k = __i - __scratch[__i] + 1;
+
+ if (__suffix[__j] > __k)
+ __suffix[__j] = __k;
+ }
+ }
+ }
+
+};
+
+template<class _RandomAccessIterator,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+_LIBCPP_INLINE_VISIBILITY
+boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
+make_boyer_moore_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
+ _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
+{
+ return boyer_moore_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
+}
+
+// boyer-moore-horspool
+template <class _RandomAccessIterator1,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator1>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+_LIBCPP_TYPE_VIS
+class boyer_moore_horspool_searcher {
+private:
+ typedef typename std::iterator_traits<_RandomAccessIterator1>::difference_type difference_type;
+ typedef typename std::iterator_traits<_RandomAccessIterator1>::value_type value_type;
+ typedef _BMSkipTable<value_type, difference_type, _Hash, _BinaryPredicate,
+ _VSTD::is_integral<value_type>::value && // what about enums?
+ sizeof(value_type) == 1 &&
+ is_same<_Hash, hash<value_type>>::value &&
+ is_same<_BinaryPredicate, equal_to<>>::value
+ > skip_table_type;
+
+public:
+ boyer_moore_horspool_searcher(_RandomAccessIterator1 __f, _RandomAccessIterator1 __l,
+ _Hash __hf = _Hash(), _BinaryPredicate __pred = _BinaryPredicate())
+ : __first_(__f), __last_(__l), __pred_(__pred),
+ __pattern_length_(_VSTD::distance(__first_, __last_)),
+ __skip_{_VSTD::make_shared<skip_table_type>(__pattern_length_, __pattern_length_, __hf, __pred_)}
+ {
+ // build the skip table
+ if ( __f != __l )
+ {
+ __l = __l - 1;
+ for ( difference_type __i = 0; __f != __l; ++__f, (void) ++__i )
+ __skip_->insert(*__f, __pattern_length_ - 1 - __i);
+ }
+ }
+
+ template <typename _RandomAccessIterator2>
+ _RandomAccessIterator2
+ operator ()(_RandomAccessIterator2 __f, _RandomAccessIterator2 __l) const
+ {
+ static_assert ( std::is_same<
+ typename std::decay<typename std::iterator_traits<_RandomAccessIterator1>::value_type>::type,
+ typename std::decay<typename std::iterator_traits<_RandomAccessIterator2>::value_type>::type
+ >::value,
+ "Corpus and Pattern iterators must point to the same type" );
+
+ if (__f == __l ) return __l; // empty corpus
+ if (__first_ == __last_) return __f; // empty pattern
+
+ // If the pattern is larger than the corpus, we can't find it!
+ if ( __pattern_length_ > _VSTD::distance (__f, __l))
+ return __l;
+
+ // Do the search
+ return this->__search(__f, __l);
+ }
+
+private:
+ _RandomAccessIterator1 __first_;
+ _RandomAccessIterator1 __last_;
+ _BinaryPredicate __pred_;
+ difference_type __pattern_length_;
+ shared_ptr<skip_table_type> __skip_;
+
+ template <typename _RandomAccessIterator2>
+ _RandomAccessIterator2 __search ( _RandomAccessIterator2 __f, _RandomAccessIterator2 __l ) const {
+ _RandomAccessIterator2 __cur = __f;
+ const _RandomAccessIterator2 __last = __l - __pattern_length_;
+ const skip_table_type & __skip = *__skip_.get();
+
+ while (__cur <= __last)
+ {
+ // Do we match right where we are?
+ difference_type __j = __pattern_length_;
+ while (__pred_(__first_[__j-1], __cur[__j-1]))
+ {
+ __j--;
+ // We matched - we're done!
+ if ( __j == 0 )
+ return __cur;
+ }
+ __cur += __skip[__cur[__pattern_length_-1]];
+ }
+
+ return __l;
+ }
+};
+
+template<class _RandomAccessIterator,
+ class _Hash = hash<typename iterator_traits<_RandomAccessIterator>::value_type>,
+ class _BinaryPredicate = equal_to<>>
+_LIBCPP_INLINE_VISIBILITY
+boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>
+make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIterator __l,
+ _Hash __hf = _Hash(), _BinaryPredicate __p = _BinaryPredicate ())
+{
+ return boyer_moore_horspool_searcher<_RandomAccessIterator, _Hash, _BinaryPredicate>(__f, __l, __hf, __p);
+}
+
+#endif // _LIBCPP_STD_VER > 11
+
+_LIBCPP_END_NAMESPACE_LFTS
+
+#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
diff --git a/include/ext/hash_map b/include/ext/hash_map
index 31fcedfb9f9e..0e4ab6910eb5 100644
--- a/include/ext/hash_map
+++ b/include/ext/hash_map
@@ -681,7 +681,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
diff --git a/include/float.h b/include/float.h
new file mode 100644
index 000000000000..1acfdc6188f2
--- /dev/null
+++ b/include/float.h
@@ -0,0 +1,83 @@
+// -*- C++ -*-
+//===--------------------------- float.h ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_FLOAT_H
+#define _LIBCPP_FLOAT_H
+
+/*
+ float.h synopsis
+
+Macros:
+
+ FLT_ROUNDS
+ FLT_EVAL_METHOD // C99
+ FLT_RADIX
+
+ FLT_MANT_DIG
+ DBL_MANT_DIG
+ LDBL_MANT_DIG
+
+ DECIMAL_DIG // C99
+
+ FLT_DIG
+ DBL_DIG
+ LDBL_DIG
+
+ FLT_MIN_EXP
+ DBL_MIN_EXP
+ LDBL_MIN_EXP
+
+ FLT_MIN_10_EXP
+ DBL_MIN_10_EXP
+ LDBL_MIN_10_EXP
+
+ FLT_MAX_EXP
+ DBL_MAX_EXP
+ LDBL_MAX_EXP
+
+ FLT_MAX_10_EXP
+ DBL_MAX_10_EXP
+ LDBL_MAX_10_EXP
+
+ FLT_MAX
+ DBL_MAX
+ LDBL_MAX
+
+ FLT_EPSILON
+ DBL_EPSILON
+ LDBL_EPSILON
+
+ FLT_MIN
+ DBL_MIN
+ LDBL_MIN
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <float.h>
+
+#ifdef __cplusplus
+
+#ifndef FLT_EVAL_METHOD
+#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
+#endif
+
+#ifndef DECIMAL_DIG
+#define DECIMAL_DIG __DECIMAL_DIG__
+#endif
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_FLOAT_H
diff --git a/include/forward_list b/include/forward_list
index 8a87fc5e1f26..adbc32cf861c 100644
--- a/include/forward_list
+++ b/include/forward_list
@@ -537,6 +537,9 @@ public:
typedef _Tp value_type;
typedef _Alloc allocator_type;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
typedef value_type& reference;
typedef const value_type& const_reference;
typedef typename allocator_traits<allocator_type>::pointer pointer;
diff --git a/include/functional b/include/functional
index 5ee941763020..dbe9b01bbd86 100644
--- a/include/functional
+++ b/include/functional
@@ -1234,11 +1234,9 @@ 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);}
-#ifdef _LIBCPP_HAS_NO_VARIADICS
-
-#include <__functional_03>
-
-#else // _LIBCPP_HAS_NO_VARIADICS
+////////////////////////////////////////////////////////////////////////////////
+// MEMFUN
+//==============================================================================
template <class _Tp>
class __mem_fn
@@ -1251,26 +1249,130 @@ private:
type __f_;
public:
- _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) : __f_(__f) {}
+ _LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
+#ifndef _LIBCPP_HAS_NO_VARIADICS
// invoke
template <class... _ArgTypes>
- _LIBCPP_INLINE_VISIBILITY
- typename __invoke_return<type, _ArgTypes...>::type
- operator() (_ArgTypes&&... __args) const
- {
- return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
- }
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return<type, _ArgTypes...>::type
+ operator() (_ArgTypes&&... __args) const {
+ return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
+ }
+#else
+
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return0<type, _A0>::type
+ operator() (_A0& __a0) const {
+ return __invoke(__f_, __a0);
+ }
+
+ template <class _A0>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return0<type, _A0 const>::type
+ operator() (_A0 const& __a0) const {
+ return __invoke(__f_, __a0);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0, _A1>::type
+ operator() (_A0& __a0, _A1& __a1) const {
+ return __invoke(__f_, __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0 const, _A1>::type
+ operator() (_A0 const& __a0, _A1& __a1) const {
+ return __invoke(__f_, __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0, _A1 const>::type
+ operator() (_A0& __a0, _A1 const& __a1) const {
+ return __invoke(__f_, __a0, __a1);
+ }
+
+ template <class _A0, class _A1>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return1<type, _A0 const, _A1 const>::type
+ operator() (_A0 const& __a0, _A1 const& __a1) const {
+ return __invoke(__f_, __a0, __a1);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1, _A2>::type
+ operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1, _A2>::type
+ operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1 const, _A2>::type
+ operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1, _A2 const>::type
+ operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
+ operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
+ operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
+ operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+
+ template <class _A0, class _A1, class _A2>
+ _LIBCPP_INLINE_VISIBILITY
+ typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
+ operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
+ return __invoke(__f_, __a0, __a1, __a2);
+ }
+#endif
};
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp _Tp::*>
-mem_fn(_Rp _Tp::* __pm)
+mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
{
return __mem_fn<_Rp _Tp::*>(__pm);
}
+////////////////////////////////////////////////////////////////////////////////
+// FUNCTION
+//==============================================================================
+
// bad_function_call
class _LIBCPP_EXCEPTION_ABI bad_function_call
@@ -1283,7 +1385,7 @@ template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
namespace __function
{
-template<class _Rp, class ..._ArgTypes>
+template<class _Rp>
struct __maybe_derive_from_unary_function
{
};
@@ -1294,7 +1396,7 @@ struct __maybe_derive_from_unary_function<_Rp(_A1)>
{
};
-template<class _Rp, class ..._ArgTypes>
+template<class _Rp>
struct __maybe_derive_from_binary_function
{
};
@@ -1305,6 +1407,28 @@ struct __maybe_derive_from_binary_function<_Rp(_A1, _A2)>
{
};
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Fp const&) { return true; }
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Fp* __ptr) { return __ptr; }
+
+template <class _Ret, class _Class>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(_Ret _Class::*__ptr) { return __ptr; }
+
+template <class _Fp>
+_LIBCPP_INLINE_VISIBILITY
+bool __not_null(function<_Fp> const& __f) { return !!__f; }
+
+} // namespace __function
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
+namespace __function {
+
template<class _Fp> class __base;
template<class _Rp, class ..._ArgTypes>
@@ -1440,28 +1564,6 @@ class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_ArgTypes...)>
typename aligned_storage<3*sizeof(void*)>::type __buf_;
__base* __f_;
- template <class _Fp>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const _Fp&) {return true;}
- template <class _R2, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (*__p)(_Ap...)) {return __p;}
- template <class _R2, class _Cp, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_Ap...)) {return __p;}
- template <class _R2, class _Cp, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const) {return __p;}
- template <class _R2, class _Cp, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_Ap...) volatile) {return __p;}
- template <class _R2, class _Cp, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(_R2 (_Cp::*__p)(_Ap...) const volatile) {return __p;}
- template <class _R2, class ..._Ap>
- _LIBCPP_INLINE_VISIBILITY
- static bool __not_null(const function<_R2(_Ap...)>& __p) {return !!__p;}
-
template <class _Fp, bool = !is_same<_Fp, function>::value &&
__invokable<_Fp&, _ArgTypes...>::value>
struct __callable;
@@ -1626,7 +1728,7 @@ function<_Rp(_ArgTypes...)>::function(_Fp __f,
>::type*)
: __f_(0)
{
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, allocator<_Fp>, _Rp(_ArgTypes...)> _FF;
if (sizeof(_FF) <= sizeof(__buf_) && is_nothrow_copy_constructible<_Fp>::value)
@@ -1653,7 +1755,7 @@ function<_Rp(_ArgTypes...)>::function(allocator_arg_t, const _Alloc& __a0, _Fp _
: __f_(0)
{
typedef allocator_traits<_Alloc> __alloc_traits;
- if (__not_null(__f))
+ if (__function::__not_null(__f))
{
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _FF;
typedef typename __rebind_alloc_helper<__alloc_traits, _FF>::type _Ap;
@@ -1848,6 +1950,16 @@ void
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
{return __x.swap(__y);}
+#else // _LIBCPP_HAS_NO_VARIADICS
+
+#include <__functional_03>
+
+#endif
+
+////////////////////////////////////////////////////////////////////////////////
+// BIND
+//==============================================================================
+
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
@@ -1878,6 +1990,9 @@ template<int _Np>
struct __is_placeholder<placeholders::__ph<_Np> >
: public integral_constant<int, _Np> {};
+
+#ifndef _LIBCPP_HAS_NO_VARIADICS
+
template <class _Tp, class _Uj>
inline _LIBCPP_INLINE_VISIBILITY
_Tp&
@@ -2402,14 +2517,14 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
size_t __b;
size_t __c;
size_t __d;
- };
+ } __s;
} __u;
- __u.__a = 0;
- __u.__b = 0;
- __u.__c = 0;
- __u.__d = 0;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
+ __u.__s.__c = 0;
+ __u.__s.__d = 0;
__u.__t = __v;
- return __u.__a ^ __u.__b ^ __u.__c ^ __u.__d;
+ return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
#elif defined(__x86_64__)
// Zero out padding bits
union
@@ -2419,12 +2534,12 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<long double>
{
size_t __a;
size_t __b;
- };
+ } __s;
} __u;
- __u.__a = 0;
- __u.__b = 0;
+ __u.__s.__a = 0;
+ __u.__s.__b = 0;
__u.__t = __v;
- return __u.__a ^ __u.__b;
+ return __u.__s.__a ^ __u.__s.__b;
#else
return __scalar_hash<long double>::operator()(__v);
#endif
diff --git a/include/future b/include/future
index 5b5afe6e2771..ce15eafbf7e4 100644
--- a/include/future
+++ b/include/future
@@ -512,6 +512,16 @@ public:
virtual ~future_error() _NOEXCEPT;
};
+inline _LIBCPP_ALWAYS_INLINE
+void __throw_future_error(future_errc _Ev)
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw future_error(make_error_code(_Ev));
+#else
+ assert(!"future_error");
+#endif
+}
+
class _LIBCPP_TYPE_VIS __assoc_sub_state
: public __shared_count
{
@@ -566,6 +576,7 @@ public:
void wait();
template <class _Rep, class _Period>
future_status
+ _LIBCPP_INLINE_VISIBILITY
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
template <class _Clock, class _Duration>
future_status
@@ -589,7 +600,7 @@ __assoc_sub_state::wait_until(const chrono::time_point<_Clock, _Duration>& __abs
}
template <class _Rep, class _Period>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
future_status
__assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const
{
@@ -645,10 +656,8 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+ __throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@@ -664,10 +673,8 @@ __assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
#endif
{
unique_lock<mutex> __lk(this->__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+ __throw_future_error(future_errc::promise_already_satisfied);
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@@ -725,10 +732,8 @@ void
__assoc_state<_Rp&>::set_value(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+ __throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed | base::ready;
__cv_.notify_all();
@@ -739,10 +744,8 @@ void
__assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
{
unique_lock<mutex> __lk(this->__mut_);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (this->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
-#endif
+ __throw_future_error(future_errc::promise_already_satisfied);
__value_ = _VSTD::addressof(__arg);
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
@@ -849,6 +852,7 @@ class __deferred_assoc_state
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@@ -858,7 +862,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@@ -895,6 +899,7 @@ class __deferred_assoc_state<void, _Fp>
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
explicit __deferred_assoc_state(_Fp&& __f);
#endif
@@ -904,7 +909,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@@ -943,6 +948,7 @@ class __async_assoc_state
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@@ -952,7 +958,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Rp, class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@@ -997,6 +1003,7 @@ class __async_assoc_state<void, _Fp>
virtual void __on_zero_shared() _NOEXCEPT;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
explicit __async_assoc_state(_Fp&& __f);
#endif
@@ -1006,7 +1013,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Fp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
: __func_(_VSTD::forward<_Fp>(__f))
{
@@ -1108,6 +1115,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
+ _LIBCPP_INLINE_VISIBILITY
shared_future<_Rp> share();
// retrieving the value
@@ -1138,10 +1146,8 @@ template <class _Rp>
future<_Rp>::future(__assoc_state<_Rp>* __state)
: __state_(__state)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
- throw future_error(make_error_code(future_errc::future_already_retrieved));
-#endif
+ __throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@@ -1212,6 +1218,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
+ _LIBCPP_INLINE_VISIBILITY
shared_future<_Rp&> share();
// retrieving the value
@@ -1242,10 +1249,8 @@ template <class _Rp>
future<_Rp&>::future(__assoc_state<_Rp&>* __state)
: __state_(__state)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_->__has_future_attached())
- throw future_error(make_error_code(future_errc::future_already_retrieved));
-#endif
+ __throw_future_error(future_errc::future_already_retrieved);
__state_->__add_shared();
__state_->__set_future_attached();
}
@@ -1311,6 +1316,7 @@ private:
public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~future();
+ _LIBCPP_INLINE_VISIBILITY
shared_future<void> share();
// retrieving the value
@@ -1445,10 +1451,8 @@ template <class _Rp>
future<_Rp>
promise<_Rp>::get_future()
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
return future<_Rp>(__state_);
}
@@ -1456,10 +1460,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(const _Rp& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@@ -1469,10 +1471,8 @@ template <class _Rp>
void
promise<_Rp>::set_value(_Rp&& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value(_VSTD::move(__r));
}
@@ -1482,10 +1482,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception(exception_ptr __p)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@@ -1493,10 +1491,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@@ -1506,10 +1502,8 @@ template <class _Rp>
void
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(_VSTD::move(__r));
}
@@ -1519,10 +1513,8 @@ template <class _Rp>
void
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@@ -1619,10 +1611,8 @@ template <class _Rp>
future<_Rp&>
promise<_Rp&>::get_future()
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
return future<_Rp&>(__state_);
}
@@ -1630,10 +1620,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value(_Rp& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value(__r);
}
@@ -1641,10 +1629,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception(exception_ptr __p)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_exception(__p);
}
@@ -1652,10 +1638,8 @@ template <class _Rp>
void
promise<_Rp&>::set_value_at_thread_exit(_Rp& __r)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_value_at_thread_exit(__r);
}
@@ -1663,10 +1647,8 @@ template <class _Rp>
void
promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
-#endif
+ __throw_future_error(future_errc::no_state);
__state_->set_exception_at_thread_exit(__p);
}
@@ -1861,6 +1843,7 @@ public:
void swap(__packaged_task_function&) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
_Rp operator()(_ArgTypes...) const;
};
@@ -2000,7 +1983,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f)
}
template<class _Rp, class ..._ArgTypes>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_Rp
__packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) const
{
@@ -2087,11 +2070,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
+ __throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
+ __throw_future_error(future_errc::promise_already_satisfied);
+#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2109,11 +2092,11 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
+ __throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
+ __throw_future_error(future_errc::promise_already_satisfied);
+#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2131,10 +2114,8 @@ template<class _Rp, class ..._ArgTypes>
void
packaged_task<_Rp(_ArgTypes...)>::reset()
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
- throw future_error(make_error_code(future_errc::no_state));
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@@ -2218,11 +2199,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::operator()(_ArgTypes... __args)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
+ __throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
+ __throw_future_error(future_errc::promise_already_satisfied);
+#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2241,11 +2222,11 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::make_ready_at_thread_exit(_ArgTypes... __args)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__p_.__state_ == nullptr)
- throw future_error(make_error_code(future_errc::no_state));
+ __throw_future_error(future_errc::no_state);
if (__p_.__state_->__has_value())
- throw future_error(make_error_code(future_errc::promise_already_satisfied));
+ __throw_future_error(future_errc::promise_already_satisfied);
+#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
@@ -2264,10 +2245,8 @@ template<class ..._ArgTypes>
void
packaged_task<void(_ArgTypes...)>::reset()
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (!valid())
- throw future_error(make_error_code(future_errc::no_state));
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_future_error(future_errc::no_state);
__p_ = promise<result_type>();
}
@@ -2592,7 +2571,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
}
template <class _Rp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_future<_Rp>
future<_Rp>::share()
{
@@ -2600,7 +2579,7 @@ future<_Rp>::share()
}
template <class _Rp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_future<_Rp&>
future<_Rp&>::share()
{
@@ -2609,7 +2588,7 @@ future<_Rp&>::share()
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_future<void>
future<void>::share()
{
diff --git a/include/inttypes.h b/include/inttypes.h
new file mode 100644
index 000000000000..5c5618bef884
--- /dev/null
+++ b/include/inttypes.h
@@ -0,0 +1,251 @@
+// -*- C++ -*-
+//===--------------------------- inttypes.h -------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_INTTYPES_H
+#define _LIBCPP_INTTYPES_H
+
+/*
+ inttypes.h synopsis
+
+This entire header is C99 / C++0X
+
+#include <stdint.h> // <cinttypes> includes <cstdint>
+
+Macros:
+
+ PRId8
+ PRId16
+ PRId32
+ PRId64
+
+ PRIdLEAST8
+ PRIdLEAST16
+ PRIdLEAST32
+ PRIdLEAST64
+
+ PRIdFAST8
+ PRIdFAST16
+ PRIdFAST32
+ PRIdFAST64
+
+ PRIdMAX
+ PRIdPTR
+
+ PRIi8
+ PRIi16
+ PRIi32
+ PRIi64
+
+ PRIiLEAST8
+ PRIiLEAST16
+ PRIiLEAST32
+ PRIiLEAST64
+
+ PRIiFAST8
+ PRIiFAST16
+ PRIiFAST32
+ PRIiFAST64
+
+ PRIiMAX
+ PRIiPTR
+
+ PRIo8
+ PRIo16
+ PRIo32
+ PRIo64
+
+ PRIoLEAST8
+ PRIoLEAST16
+ PRIoLEAST32
+ PRIoLEAST64
+
+ PRIoFAST8
+ PRIoFAST16
+ PRIoFAST32
+ PRIoFAST64
+
+ PRIoMAX
+ PRIoPTR
+
+ PRIu8
+ PRIu16
+ PRIu32
+ PRIu64
+
+ PRIuLEAST8
+ PRIuLEAST16
+ PRIuLEAST32
+ PRIuLEAST64
+
+ PRIuFAST8
+ PRIuFAST16
+ PRIuFAST32
+ PRIuFAST64
+
+ PRIuMAX
+ PRIuPTR
+
+ PRIx8
+ PRIx16
+ PRIx32
+ PRIx64
+
+ PRIxLEAST8
+ PRIxLEAST16
+ PRIxLEAST32
+ PRIxLEAST64
+
+ PRIxFAST8
+ PRIxFAST16
+ PRIxFAST32
+ PRIxFAST64
+
+ PRIxMAX
+ PRIxPTR
+
+ PRIX8
+ PRIX16
+ PRIX32
+ PRIX64
+
+ PRIXLEAST8
+ PRIXLEAST16
+ PRIXLEAST32
+ PRIXLEAST64
+
+ PRIXFAST8
+ PRIXFAST16
+ PRIXFAST32
+ PRIXFAST64
+
+ PRIXMAX
+ PRIXPTR
+
+ SCNd8
+ SCNd16
+ SCNd32
+ SCNd64
+
+ SCNdLEAST8
+ SCNdLEAST16
+ SCNdLEAST32
+ SCNdLEAST64
+
+ SCNdFAST8
+ SCNdFAST16
+ SCNdFAST32
+ SCNdFAST64
+
+ SCNdMAX
+ SCNdPTR
+
+ SCNi8
+ SCNi16
+ SCNi32
+ SCNi64
+
+ SCNiLEAST8
+ SCNiLEAST16
+ SCNiLEAST32
+ SCNiLEAST64
+
+ SCNiFAST8
+ SCNiFAST16
+ SCNiFAST32
+ SCNiFAST64
+
+ SCNiMAX
+ SCNiPTR
+
+ SCNo8
+ SCNo16
+ SCNo32
+ SCNo64
+
+ SCNoLEAST8
+ SCNoLEAST16
+ SCNoLEAST32
+ SCNoLEAST64
+
+ SCNoFAST8
+ SCNoFAST16
+ SCNoFAST32
+ SCNoFAST64
+
+ SCNoMAX
+ SCNoPTR
+
+ SCNu8
+ SCNu16
+ SCNu32
+ SCNu64
+
+ SCNuLEAST8
+ SCNuLEAST16
+ SCNuLEAST32
+ SCNuLEAST64
+
+ SCNuFAST8
+ SCNuFAST16
+ SCNuFAST32
+ SCNuFAST64
+
+ SCNuMAX
+ SCNuPTR
+
+ SCNx8
+ SCNx16
+ SCNx32
+ SCNx64
+
+ SCNxLEAST8
+ SCNxLEAST16
+ SCNxLEAST32
+ SCNxLEAST64
+
+ SCNxFAST8
+ SCNxFAST16
+ SCNxFAST32
+ SCNxFAST64
+
+ SCNxMAX
+ SCNxPTR
+
+Types:
+
+ imaxdiv_t
+
+intmax_t imaxabs(intmax_t j);
+imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
+intmax_t strtoimax(const char* restrict nptr, char** restrict endptr, int base);
+uintmax_t strtoumax(const char* restrict nptr, char** restrict endptr, int base);
+intmax_t wcstoimax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <inttypes.h>
+
+#ifdef __cplusplus
+
+#include <stdint.h>
+
+#undef imaxabs
+#undef imaxdiv
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_INTTYPES_H
diff --git a/include/ios b/include/ios
index ff79998b0bbf..1deb5f613c8a 100644
--- a/include/ios
+++ b/include/ios
@@ -114,9 +114,9 @@ class basic_ios
public:
// types:
typedef charT char_type;
- typedef typename traits::int_type int_type;
- typedef typename traits::pos_type pos_type;
- typedef typename traits::off_type off_type;
+ typedef typename traits::int_type int_type; // removed in C++17
+ typedef typename traits::pos_type pos_type; // removed in C++17
+ typedef typename traits::off_type off_type; // removed in C++17
typedef traits traits_type;
operator unspecified-bool-type() const;
@@ -216,7 +216,7 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__locale>
#include <system_error>
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include <atomic> // for __xindex_
#endif
@@ -254,14 +254,12 @@ public:
static const fmtflags floatfield = scientific | fixed;
typedef unsigned int iostate;
- typedef iostate io_state;
static const iostate badbit = 0x1;
static const iostate eofbit = 0x2;
static const iostate failbit = 0x4;
static const iostate goodbit = 0x0;
typedef unsigned int openmode;
- typedef openmode open_mode;
static const openmode app = 0x01;
static const openmode ate = 0x02;
static const openmode binary = 0x04;
@@ -270,10 +268,15 @@ public:
static const openmode trunc = 0x20;
enum seekdir {beg, cur, end};
- typedef seekdir seek_dir;
+
+#if _LIBCPP_STD_VER <= 14
+ typedef iostate io_state;
+ typedef openmode open_mode;
+ typedef seekdir seek_dir;
typedef _VSTD::streamoff streamoff;
typedef _VSTD::streampos streampos;
+#endif
class _LIBCPP_TYPE_VIS Init;
@@ -367,7 +370,9 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
+// enabled with clang.
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
static atomic<int> __xindex_;
#else
static int __xindex_;
diff --git a/include/istream b/include/istream
index 168a4d0635f6..c6a272e75ef1 100644
--- a/include/istream
+++ b/include/istream
@@ -304,7 +304,7 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_type>* __sb)
: __gc_(0)
{
@@ -314,7 +314,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_streambuf<char_type, traits_
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
: __gc_(__rhs.__gc_)
{
@@ -323,7 +323,7 @@ basic_istream<_CharT, _Traits>::basic_istream(basic_istream&& __rhs)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator=(basic_istream&& __rhs)
{
@@ -339,7 +339,7 @@ basic_istream<_CharT, _Traits>::~basic_istream()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
{
@@ -725,7 +725,7 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&))
{
@@ -733,7 +733,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_istream& (*__pf)(basic_istream&
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
(*__pf)(basic_ios<char_type, traits_type>&))
@@ -743,7 +743,7 @@ basic_istream<_CharT, _Traits>::operator>>(basic_ios<char_type, traits_type>&
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::operator>>(ios_base& (*__pf)(ios_base&))
{
@@ -800,7 +800,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
}
template<class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
{
@@ -808,7 +808,7 @@ operator>>(basic_istream<char, _Traits>& __is, unsigned char* __s)
}
template<class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, signed char* __s)
{
@@ -843,7 +843,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
}
template<class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
{
@@ -851,7 +851,7 @@ operator>>(basic_istream<char, _Traits>& __is, unsigned char& __c)
}
template<class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<char, _Traits>&
operator>>(basic_istream<char, _Traits>& __is, signed char& __c)
{
@@ -947,7 +947,7 @@ basic_istream<_CharT, _Traits>::get()
}
template<class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(char_type& __c)
{
@@ -1006,7 +1006,7 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
}
template<class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n)
{
@@ -1068,7 +1068,7 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
}
template<class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __sb)
{
@@ -1129,7 +1129,7 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
}
template<class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n)
{
@@ -1407,6 +1407,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
try
{
#endif // _LIBCPP_NO_EXCEPTIONS
+ this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
@@ -1461,7 +1462,7 @@ ws(basic_istream<_CharT, _Traits>& __is)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
{
@@ -1503,7 +1504,7 @@ public:
};
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, traits_type>* __sb)
: basic_istream<_CharT, _Traits>(__sb)
{
@@ -1512,14 +1513,14 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
{
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_iostream<_CharT, _Traits>&
basic_iostream<_CharT, _Traits>::operator=(basic_iostream&& __rhs)
{
@@ -1535,7 +1536,7 @@ basic_iostream<_CharT, _Traits>::~basic_iostream()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_iostream<_CharT, _Traits>::swap(basic_iostream& __rhs)
{
@@ -1644,7 +1645,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
@@ -1655,7 +1656,7 @@ getline(basic_istream<_CharT, _Traits>& __is,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str, _CharT __dlm)
@@ -1664,7 +1665,7 @@ getline(basic_istream<_CharT, _Traits>&& __is,
}
template<class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istream<_CharT, _Traits>&
getline(basic_istream<_CharT, _Traits>&& __is,
basic_string<_CharT, _Traits, _Allocator>& __str)
diff --git a/include/iterator b/include/iterator
index c06ef8f6777d..8dd6bd59c1a8 100644
--- a/include/iterator
+++ b/include/iterator
@@ -513,12 +513,12 @@ distance(_InputIter __first, _InputIter __last)
return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
}
-template <class _ForwardIter>
+template <class _InputIter>
inline _LIBCPP_INLINE_VISIBILITY
-_ForwardIter
-next(_ForwardIter __x,
- typename iterator_traits<_ForwardIter>::difference_type __n = 1,
- typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
+_InputIter
+next(_InputIter __x,
+ typename iterator_traits<_InputIter>::difference_type __n = 1,
+ typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0)
{
_VSTD::advance(__x, __n);
return __x;
diff --git a/include/list b/include/list
index 14201a80e348..28d505582c0d 100644
--- a/include/list
+++ b/include/list
@@ -191,19 +191,10 @@ template <class _Tp, class _VoidPtr> struct __list_node;
template <class _Tp, class _VoidPtr>
struct __list_node_base
{
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<__list_node<_Tp, _VoidPtr> > pointer;
-#else
- rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
-#endif
-
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<__list_node_base> __base_pointer;
-#else
- rebind<__list_node_base>::other __base_pointer;
-#endif
+ typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
+ pointer;
+ typedef typename __rebind_pointer<_VoidPtr, __list_node_base>::type
+ __base_pointer;
pointer __prev_;
pointer __next_;
@@ -232,12 +223,8 @@ template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_it
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_iterator
{
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
-#else
- rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
-#endif
+ typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
+ __node_pointer;
__node_pointer __ptr_;
@@ -262,13 +249,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef value_type& reference;
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<value_type>
-#else
- rebind<value_type>::other
-#endif
- pointer;
+ typedef typename __rebind_pointer<_VoidPtr, value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
@@ -365,12 +346,8 @@ public:
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
{
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
-#else
- rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
-#endif
+ typedef typename __rebind_pointer<_VoidPtr, __list_node<_Tp, _VoidPtr> >::type
+ __node_pointer;
__node_pointer __ptr_;
@@ -392,13 +369,7 @@ public:
typedef bidirectional_iterator_tag iterator_category;
typedef _Tp value_type;
typedef const value_type& reference;
- typedef typename pointer_traits<_VoidPtr>::template
-#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
- rebind<const value_type>
-#else
- rebind<const value_type>::other
-#endif
- pointer;
+ typedef typename __rebind_pointer<_VoidPtr, const value_type>::type pointer;
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
diff --git a/include/locale b/include/locale
index e683ba33ae9d..84cb5a5ef6cd 100644
--- a/include/locale
+++ b/include/locale
@@ -1888,6 +1888,9 @@ protected:
virtual const string_type& __r() const;
virtual const string_type& __x() const;
virtual const string_type& __X() const;
+
+ _LIBCPP_ALWAYS_INLINE
+ ~__time_get_c_storage() {}
};
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
@@ -3773,11 +3776,14 @@ private:
wstring_convert(const wstring_convert& __wc);
wstring_convert& operator=(const wstring_convert& __wc);
public:
+ _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT_AFTER_CXX11 wstring_convert(_Codecvt* __pcvt = new _Codecvt);
+ _LIBCPP_ALWAYS_INLINE
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
+ _LIBCPP_ALWAYS_INLINE
wstring_convert(wstring_convert&& __wc);
#endif
~wstring_convert();
@@ -3811,7 +3817,7 @@ public:
};
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
-inline _LIBCPP_ALWAYS_INLINE
+inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt)
: __cvtptr_(__pcvt), __cvtstate_(), __cvtcount_(0)
@@ -3819,7 +3825,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
}
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
-inline _LIBCPP_ALWAYS_INLINE
+inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(_Codecvt* __pcvt, state_type __state)
: __cvtptr_(__pcvt), __cvtstate_(__state), __cvtcount_(0)
@@ -3838,7 +3844,7 @@ wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Codecvt, class _Elem, class _Wide_alloc, class _Byte_alloc>
-inline _LIBCPP_ALWAYS_INLINE
+inline
wstring_convert<_Codecvt, _Elem, _Wide_alloc, _Byte_alloc>::
wstring_convert(wstring_convert&& __wc)
: __byte_err_string_(_VSTD::move(__wc.__byte_err_string_)),
@@ -4313,18 +4319,9 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::seekoff(off_type __off, ios_base::seekdir
int __width = __cv_->encoding();
if (__cv_ == 0 || __bufptr_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1));
- // __width > 0 || __off == 0
- switch (__way)
- {
- case ios_base::beg:
- break;
- case ios_base::cur:
- break;
- case ios_base::end:
- break;
- default:
+ // __width > 0 || __off == 0, now check __way
+ if (__way != ios_base::beg && __way != ios_base::cur && __way != ios_base::end)
return pos_type(off_type(-1));
- }
pos_type __r = __bufptr_->pubseekoff(__width * __off, __way, __om);
__r.state(__st_);
return __r;
diff --git a/include/map b/include/map
index eb6b8ed05308..adfb4cdb5e9e 100644
--- a/include/map
+++ b/include/map
@@ -840,6 +840,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
@@ -1523,7 +1526,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Compare, class _Allocator>
@@ -1696,6 +1699,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
class _LIBCPP_TYPE_VIS_ONLY value_compare
: public binary_function<value_type, value_type, bool>
{
diff --git a/include/math.h b/include/math.h
new file mode 100644
index 000000000000..20205544d51d
--- /dev/null
+++ b/include/math.h
@@ -0,0 +1,1419 @@
+// -*- C++ -*-
+//===---------------------------- math.h ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_MATH_H
+#define _LIBCPP_MATH_H
+
+/*
+ math.h synopsis
+
+Macros:
+
+ HUGE_VAL
+ HUGE_VALF // C99
+ HUGE_VALL // C99
+ INFINITY // C99
+ NAN // C99
+ FP_INFINITE // C99
+ FP_NAN // C99
+ FP_NORMAL // C99
+ FP_SUBNORMAL // C99
+ FP_ZERO // C99
+ FP_FAST_FMA // C99
+ FP_FAST_FMAF // C99
+ FP_FAST_FMAL // C99
+ FP_ILOGB0 // C99
+ FP_ILOGBNAN // C99
+ MATH_ERRNO // C99
+ MATH_ERREXCEPT // C99
+ math_errhandling // C99
+
+Types:
+
+ float_t // C99
+ double_t // C99
+
+// C90
+
+floating_point abs(floating_point x);
+
+floating_point acos (arithmetic x);
+float acosf(float x);
+long double acosl(long double x);
+
+floating_point asin (arithmetic x);
+float asinf(float x);
+long double asinl(long double x);
+
+floating_point atan (arithmetic x);
+float atanf(float x);
+long double atanl(long double x);
+
+floating_point atan2 (arithmetic y, arithmetic x);
+float atan2f(float y, float x);
+long double atan2l(long double y, long double x);
+
+floating_point ceil (arithmetic x);
+float ceilf(float x);
+long double ceill(long double x);
+
+floating_point cos (arithmetic x);
+float cosf(float x);
+long double cosl(long double x);
+
+floating_point cosh (arithmetic x);
+float coshf(float x);
+long double coshl(long double x);
+
+floating_point exp (arithmetic x);
+float expf(float x);
+long double expl(long double x);
+
+floating_point fabs (arithmetic x);
+float fabsf(float x);
+long double fabsl(long double x);
+
+floating_point floor (arithmetic x);
+float floorf(float x);
+long double floorl(long double x);
+
+floating_point fmod (arithmetic x, arithmetic y);
+float fmodf(float x, float y);
+long double fmodl(long double x, long double y);
+
+floating_point frexp (arithmetic value, int* exp);
+float frexpf(float value, int* exp);
+long double frexpl(long double value, int* exp);
+
+floating_point ldexp (arithmetic value, int exp);
+float ldexpf(float value, int exp);
+long double ldexpl(long double value, int exp);
+
+floating_point log (arithmetic x);
+float logf(float x);
+long double logl(long double x);
+
+floating_point log10 (arithmetic x);
+float log10f(float x);
+long double log10l(long double x);
+
+floating_point modf (floating_point value, floating_point* iptr);
+float modff(float value, float* iptr);
+long double modfl(long double value, long double* iptr);
+
+floating_point pow (arithmetic x, arithmetic y);
+float powf(float x, float y);
+long double powl(long double x, long double y);
+
+floating_point sin (arithmetic x);
+float sinf(float x);
+long double sinl(long double x);
+
+floating_point sinh (arithmetic x);
+float sinhf(float x);
+long double sinhl(long double x);
+
+floating_point sqrt (arithmetic x);
+float sqrtf(float x);
+long double sqrtl(long double x);
+
+floating_point tan (arithmetic x);
+float tanf(float x);
+long double tanl(long double x);
+
+floating_point tanh (arithmetic x);
+float tanhf(float x);
+long double tanhl(long double x);
+
+// C99
+
+bool signbit(arithmetic x);
+
+int fpclassify(arithmetic x);
+
+bool isfinite(arithmetic x);
+bool isinf(arithmetic x);
+bool isnan(arithmetic x);
+bool isnormal(arithmetic x);
+
+bool isgreater(arithmetic x, arithmetic y);
+bool isgreaterequal(arithmetic x, arithmetic y);
+bool isless(arithmetic x, arithmetic y);
+bool islessequal(arithmetic x, arithmetic y);
+bool islessgreater(arithmetic x, arithmetic y);
+bool isunordered(arithmetic x, arithmetic y);
+
+floating_point acosh (arithmetic x);
+float acoshf(float x);
+long double acoshl(long double x);
+
+floating_point asinh (arithmetic x);
+float asinhf(float x);
+long double asinhl(long double x);
+
+floating_point atanh (arithmetic x);
+float atanhf(float x);
+long double atanhl(long double x);
+
+floating_point cbrt (arithmetic x);
+float cbrtf(float x);
+long double cbrtl(long double x);
+
+floating_point copysign (arithmetic x, arithmetic y);
+float copysignf(float x, float y);
+long double copysignl(long double x, long double y);
+
+floating_point erf (arithmetic x);
+float erff(float x);
+long double erfl(long double x);
+
+floating_point erfc (arithmetic x);
+float erfcf(float x);
+long double erfcl(long double x);
+
+floating_point exp2 (arithmetic x);
+float exp2f(float x);
+long double exp2l(long double x);
+
+floating_point expm1 (arithmetic x);
+float expm1f(float x);
+long double expm1l(long double x);
+
+floating_point fdim (arithmetic x, arithmetic y);
+float fdimf(float x, float y);
+long double fdiml(long double x, long double y);
+
+floating_point fma (arithmetic x, arithmetic y, arithmetic z);
+float fmaf(float x, float y, float z);
+long double fmal(long double x, long double y, long double z);
+
+floating_point fmax (arithmetic x, arithmetic y);
+float fmaxf(float x, float y);
+long double fmaxl(long double x, long double y);
+
+floating_point fmin (arithmetic x, arithmetic y);
+float fminf(float x, float y);
+long double fminl(long double x, long double y);
+
+floating_point hypot (arithmetic x, arithmetic y);
+float hypotf(float x, float y);
+long double hypotl(long double x, long double y);
+
+int ilogb (arithmetic x);
+int ilogbf(float x);
+int ilogbl(long double x);
+
+floating_point lgamma (arithmetic x);
+float lgammaf(float x);
+long double lgammal(long double x);
+
+long long llrint (arithmetic x);
+long long llrintf(float x);
+long long llrintl(long double x);
+
+long long llround (arithmetic x);
+long long llroundf(float x);
+long long llroundl(long double x);
+
+floating_point log1p (arithmetic x);
+float log1pf(float x);
+long double log1pl(long double x);
+
+floating_point log2 (arithmetic x);
+float log2f(float x);
+long double log2l(long double x);
+
+floating_point logb (arithmetic x);
+float logbf(float x);
+long double logbl(long double x);
+
+long lrint (arithmetic x);
+long lrintf(float x);
+long lrintl(long double x);
+
+long lround (arithmetic x);
+long lroundf(float x);
+long lroundl(long double x);
+
+double nan (const char* str);
+float nanf(const char* str);
+long double nanl(const char* str);
+
+floating_point nearbyint (arithmetic x);
+float nearbyintf(float x);
+long double nearbyintl(long double x);
+
+floating_point nextafter (arithmetic x, arithmetic y);
+float nextafterf(float x, float y);
+long double nextafterl(long double x, long double y);
+
+floating_point nexttoward (arithmetic x, long double y);
+float nexttowardf(float x, long double y);
+long double nexttowardl(long double x, long double y);
+
+floating_point remainder (arithmetic x, arithmetic y);
+float remainderf(float x, float y);
+long double remainderl(long double x, long double y);
+
+floating_point remquo (arithmetic x, arithmetic y, int* pquo);
+float remquof(float x, float y, int* pquo);
+long double remquol(long double x, long double y, int* pquo);
+
+floating_point rint (arithmetic x);
+float rintf(float x);
+long double rintl(long double x);
+
+floating_point round (arithmetic x);
+float roundf(float x);
+long double roundl(long double x);
+
+floating_point scalbln (arithmetic x, long ex);
+float scalblnf(float x, long ex);
+long double scalblnl(long double x, long ex);
+
+floating_point scalbn (arithmetic x, int ex);
+float scalbnf(float x, int ex);
+long double scalbnl(long double x, int ex);
+
+floating_point tgamma (arithmetic x);
+float tgammaf(float x);
+long double tgammal(long double x);
+
+floating_point trunc (arithmetic x);
+float truncf(float x);
+long double truncl(long double x);
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <math.h>
+
+#ifdef __cplusplus
+
+// We support including .h headers inside 'extern "C"' contexts, so switch
+// back to C++ linkage before including these C++ headers.
+extern "C++" {
+
+#include <type_traits>
+
+#ifdef _LIBCPP_MSVCRT
+#include "support/win32/math_win32.h"
+#endif
+
+// signbit
+
+#ifdef signbit
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+ return signbit(__lcpp_x);
+}
+
+#undef signbit
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // signbit
+
+// fpclassify
+
+#ifdef fpclassify
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+int
+__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+ return fpclassify(__lcpp_x);
+}
+
+#undef fpclassify
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // fpclassify
+
+// isfinite
+
+#ifdef isfinite
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
+{
+ return isfinite(__lcpp_x);
+}
+
+#undef isfinite
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isfinite(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // isfinite
+
+// isinf
+
+#ifdef isinf
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
+{
+ return isinf(__lcpp_x);
+}
+
+#undef isinf
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isinf(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // isinf
+
+// isnan
+
+#ifdef isnan
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
+{
+ return isnan(__lcpp_x);
+}
+
+#undef isnan
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isnan(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // isnan
+
+// isnormal
+
+#ifdef isnormal
+
+template <class _A1>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT
+{
+ return isnormal(__lcpp_x);
+}
+
+#undef isnormal
+
+template <class _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+isnormal(_A1 __lcpp_x) _NOEXCEPT
+{
+ return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x);
+}
+
+#endif // isnormal
+
+// isgreater
+
+#ifdef isgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return isgreater(__lcpp_x, __lcpp_y);
+}
+
+#undef isgreater
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // isgreater
+
+// isgreaterequal
+
+#ifdef isgreaterequal
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return isgreaterequal(__lcpp_x, __lcpp_y);
+}
+
+#undef isgreaterequal
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // isgreaterequal
+
+// isless
+
+#ifdef isless
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return isless(__lcpp_x, __lcpp_y);
+}
+
+#undef isless
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // isless
+
+// islessequal
+
+#ifdef islessequal
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return islessequal(__lcpp_x, __lcpp_y);
+}
+
+#undef islessequal
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // islessequal
+
+// islessgreater
+
+#ifdef islessgreater
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return islessgreater(__lcpp_x, __lcpp_y);
+}
+
+#undef islessgreater
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // islessgreater
+
+// isunordered
+
+#ifdef isunordered
+
+template <class _A1, class _A2>
+_LIBCPP_ALWAYS_INLINE
+bool
+__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ return isunordered(__lcpp_x, __lcpp_y);
+}
+
+#undef isunordered
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ bool
+>::type
+isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2>::type type;
+ return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y);
+}
+
+#endif // isunordered
+
+#ifndef __sun__
+
+// abs
+
+#if !defined(_AIX)
+inline _LIBCPP_INLINE_VISIBILITY
+float
+abs(float __lcpp_x) _NOEXCEPT {return fabsf(__lcpp_x);}
+
+inline _LIBCPP_INLINE_VISIBILITY
+double
+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);}
+#endif // !defined(_AIX)
+
+// acos
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// asin
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// atan
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// atan2
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// ceil
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// cos
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// cosh
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// exp
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// fabs
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// floor
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// fmod
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// frexp
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// ldexp
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// log
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// log10
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// modf
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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))
+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>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// sin
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// sinh
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// sqrt
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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
+
+#endif // __sun__
+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);}
+#ifndef __sun__
+
+// tan
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// tanh
+
+#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
+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);}
+
+// 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);}
+
+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
+
+// 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);}
+
+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
+
+// 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);}
+
+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
+
+// 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);}
+
+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
+
+// 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);
+}
+inline _LIBCPP_INLINE_VISIBILITY long double
+copysign(long double __lcpp_x, long double __lcpp_y) _NOEXCEPT {
+ return copysignl(__lcpp_x, __lcpp_y);
+}
+#endif
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+#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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+template <class _A1, class _A2, class _A3>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value &&
+ std::is_arithmetic<_A3>::value,
+ std::__promote<_A1, _A2, _A3>
+>::type
+fma(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
+{
+ typedef typename std::__promote<_A1, _A2, _A3>::type __result_type;
+ 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);
+}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+template <class _A1, class _A2>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::__lazy_enable_if
+<
+ std::is_arithmetic<_A1>::value &&
+ std::is_arithmetic<_A2>::value,
+ std::__promote<_A1, _A2>
+>::type
+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);
+}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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);}
+
+// 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);}
+
+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
+#endif // __sun__
+
+} // extern "C++"
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_MATH_H
diff --git a/include/memory b/include/memory
index 22311aaace92..65369d2632c4 100644
--- a/include/memory
+++ b/include/memory
@@ -612,7 +612,7 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
#include <cassert>
#endif
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
# include <atomic>
#endif
@@ -932,6 +932,15 @@ public:
{return _VSTD::addressof(__r);}
};
+template <class _From, class _To>
+struct __rebind_pointer {
+#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
+ typedef typename pointer_traits<_From>::template rebind<_To> type;
+#else
+ typedef typename pointer_traits<_From>::template rebind<_To>::other type;
+#endif
+};
+
// allocator_traits
namespace __has_pointer_type_imp
@@ -1669,7 +1678,7 @@ private:
{return __a.max_size();}
_LIBCPP_INLINE_VISIBILITY
static size_type __max_size(false_type, const allocator_type&)
- {return numeric_limits<size_type>::max();}
+ {return numeric_limits<size_type>::max() / sizeof(value_type);}
_LIBCPP_INLINE_VISIBILITY
static allocator_type
@@ -1900,6 +1909,10 @@ public:
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(const _Tp& __element)
{::new(&*__x_) _Tp(__element); return *this;}
+#if _LIBCPP_STD_VER >= 14
+ _LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator=(_Tp&& __element)
+ {::new(&*__x_) _Tp(_VSTD::move(__element)); return *this;}
+#endif
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator& operator++() {++__x_; return *this;}
_LIBCPP_INLINE_VISIBILITY raw_storage_iterator operator++(int)
{raw_storage_iterator __t(*this); ++__x_; return __t;}
@@ -2659,10 +2672,17 @@ public:
: __ptr_(__u->release(), _VSTD::forward<deleter_type>(__u->get_deleter())) {}
template <class _Up, class _Ep>
- _LIBCPP_INLINE_VISIBILITY unique_ptr& operator=(unique_ptr<_Up, _Ep> __u)
+ _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<deleter_type>(__u.get_deleter());
+ __ptr_.second() = _VSTD::forward<_Ep>(__u.get_deleter());
return *this;
}
@@ -3420,7 +3440,7 @@ struct __scalar_hash<_Tp, 2>
{
size_t __a;
size_t __b;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3442,7 +3462,7 @@ struct __scalar_hash<_Tp, 3>
size_t __a;
size_t __b;
size_t __c;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3465,7 +3485,7 @@ struct __scalar_hash<_Tp, 4>
size_t __b;
size_t __c;
size_t __d;
- };
+ } __s;
} __u;
__u.__t = __v;
return __murmur2_or_cityhash<size_t>()(&__u, sizeof(__u));
@@ -3854,7 +3874,9 @@ private:
struct __nat {int __for_bool_;};
public:
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr() _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
template<class _Yp>
explicit shared_ptr(_Yp* __p,
@@ -3867,15 +3889,18 @@ public:
typename enable_if<is_convertible<_Yp*, element_type*>::value, __nat>::type = __nat());
template <class _Dp> shared_ptr(nullptr_t __p, _Dp __d);
template <class _Dp, class _Alloc> shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a);
- template<class _Yp> shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(const shared_ptr<_Yp>& __r, element_type* __p) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr(shared_ptr&& __r) _NOEXCEPT;
- template<class _Yp> shared_ptr(shared_ptr<_Yp>&& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type = __nat())
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -3932,6 +3957,7 @@ public:
~shared_ptr();
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(const shared_ptr& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3939,8 +3965,10 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
shared_ptr& operator=(shared_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3948,6 +3976,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr<_Tp>&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp>&& __r);
template<class _Yp>
typename enable_if
@@ -3956,6 +3985,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr
>::type&
+ _LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@@ -3965,6 +3995,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
shared_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(auto_ptr<_Yp> __r);
#endif
template <class _Yp, class _Dp>
@@ -3975,12 +4006,16 @@ public:
shared_ptr&
>::type
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
operator=(unique_ptr<_Yp, _Dp> __r);
#endif
+ _LIBCPP_INLINE_VISIBILITY
void swap(shared_ptr& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -3988,6 +4023,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p);
template<class _Yp, class _Dp>
typename enable_if
@@ -3995,6 +4031,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d);
template<class _Yp, class _Dp, class _Alloc>
typename enable_if
@@ -4002,6 +4039,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
reset(_Yp* __p, _Dp __d, _Alloc __a);
_LIBCPP_INLINE_VISIBILITY
@@ -4103,7 +4141,7 @@ private:
};
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
: __ptr_(0),
@@ -4112,7 +4150,7 @@ shared_ptr<_Tp>::shared_ptr() _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
shared_ptr<_Tp>::shared_ptr(nullptr_t) _NOEXCEPT
: __ptr_(0),
@@ -4235,7 +4273,7 @@ shared_ptr<_Tp>::shared_ptr(nullptr_t __p, _Dp __d, _Alloc __a)
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEXCEPT
: __ptr_(__p),
__cntrl_(__r.__cntrl_)
@@ -4245,7 +4283,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r, element_type *__p) _NOEX
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -4256,7 +4294,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@@ -4270,7 +4308,7 @@ shared_ptr<_Tp>::shared_ptr(const shared_ptr<_Yp>& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -4281,7 +4319,7 @@ shared_ptr<_Tp>::shared_ptr(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>::shared_ptr(shared_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat>::type)
_NOEXCEPT
@@ -4568,7 +4606,7 @@ shared_ptr<_Tp>::~shared_ptr()
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
{
@@ -4578,7 +4616,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4593,7 +4631,7 @@ shared_ptr<_Tp>::operator=(const shared_ptr<_Yp>& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
shared_ptr<_Tp>&
shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
{
@@ -4603,7 +4641,7 @@ shared_ptr<_Tp>::operator=(shared_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4617,7 +4655,7 @@ shared_ptr<_Tp>::operator=(shared_ptr<_Yp>&& __r)
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
!is_array<_Yp>::value &&
@@ -4632,7 +4670,7 @@ shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
template<class _Tp>
template <class _Yp, class _Dp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
!is_array<_Yp>::value &&
@@ -4680,7 +4718,7 @@ shared_ptr<_Tp>::operator=(unique_ptr<_Yp, _Dp> __r)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
{
@@ -4689,7 +4727,7 @@ shared_ptr<_Tp>::swap(shared_ptr& __r) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
shared_ptr<_Tp>::reset() _NOEXCEPT
{
@@ -4698,7 +4736,7 @@ shared_ptr<_Tp>::reset() _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4711,7 +4749,7 @@ shared_ptr<_Tp>::reset(_Yp* __p)
template<class _Tp>
template<class _Yp, class _Dp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -4724,7 +4762,7 @@ shared_ptr<_Tp>::reset(_Yp* __p, _Dp __d)
template<class _Tp>
template<class _Yp, class _Dp, class _Alloc>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5041,23 +5079,27 @@ private:
__shared_weak_count* __cntrl_;
public:
+ _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR weak_ptr() _NOEXCEPT;
- template<class _Yp> weak_ptr(shared_ptr<_Yp> const& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr const& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr(weak_ptr<_Yp> const& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr(weak_ptr&& __r) _NOEXCEPT;
- template<class _Yp> weak_ptr(weak_ptr<_Yp>&& __r,
+ template<class _Yp> _LIBCPP_INLINE_VISIBILITY weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type = 0)
_NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~weak_ptr();
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr const& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -5065,10 +5107,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
weak_ptr& operator=(weak_ptr&& __r) _NOEXCEPT;
template<class _Yp>
typename enable_if
@@ -5076,6 +5120,7 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -5086,9 +5131,12 @@ public:
is_convertible<_Yp*, element_type*>::value,
weak_ptr&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void swap(weak_ptr& __r) _NOEXCEPT;
+ _LIBCPP_INLINE_VISIBILITY
void reset() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
@@ -5112,7 +5160,7 @@ public:
};
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_LIBCPP_CONSTEXPR
weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
: __ptr_(0),
@@ -5121,7 +5169,7 @@ weak_ptr<_Tp>::weak_ptr() _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -5132,7 +5180,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5145,7 +5193,7 @@ weak_ptr<_Tp>::weak_ptr(shared_ptr<_Yp> const& __r,
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5159,7 +5207,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp> const& __r,
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
: __ptr_(__r.__ptr_),
__cntrl_(__r.__cntrl_)
@@ -5170,7 +5218,7 @@ weak_ptr<_Tp>::weak_ptr(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>::weak_ptr(weak_ptr<_Yp>&& __r,
typename enable_if<is_convertible<_Yp*, _Tp*>::value, __nat*>::type)
_NOEXCEPT
@@ -5191,7 +5239,7 @@ weak_ptr<_Tp>::~weak_ptr()
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
{
@@ -5201,7 +5249,7 @@ weak_ptr<_Tp>::operator=(weak_ptr const& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5216,7 +5264,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp> const& __r) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
weak_ptr<_Tp>&
weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
{
@@ -5226,7 +5274,7 @@ weak_ptr<_Tp>::operator=(weak_ptr&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5242,7 +5290,7 @@ weak_ptr<_Tp>::operator=(weak_ptr<_Yp>&& __r) _NOEXCEPT
template<class _Tp>
template<class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
is_convertible<_Yp*, _Tp*>::value,
@@ -5255,7 +5303,7 @@ weak_ptr<_Tp>::operator=(shared_ptr<_Yp> const& __r) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
weak_ptr<_Tp>::swap(weak_ptr& __r) _NOEXCEPT
{
@@ -5272,7 +5320,7 @@ swap(weak_ptr<_Tp>& __x, weak_ptr<_Tp>& __y) _NOEXCEPT
}
template<class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
weak_ptr<_Tp>::reset() _NOEXCEPT
{
@@ -5305,7 +5353,11 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
return __r;
}
+#if _LIBCPP_STD_VER > 14
+template <class _Tp = void> struct owner_less;
+#else
template <class _Tp> struct owner_less;
+#endif
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
@@ -5339,6 +5391,30 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
{return __x.owner_before(__y);}
};
+#if _LIBCPP_STD_VER > 14
+template <>
+struct _LIBCPP_TYPE_VIS_ONLY owner_less<void>
+{
+ template <class _Tp, class _Up>
+ _LIBCPP_INLINE_VISIBILITY
+ bool operator()( shared_ptr<_Tp> const& __x, shared_ptr<_Up> const& __y) const
+ {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
+ {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
+ {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
+ {return __x.owner_before(__y);}
+ typedef void is_transparent;
+};
+#endif
+
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
{
@@ -5381,7 +5457,9 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
-#if __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
+// enabled with clang.
+#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
class _LIBCPP_TYPE_VIS __sp_mut
{
@@ -5507,7 +5585,7 @@ atomic_compare_exchange_weak_explicit(shared_ptr<_Tp>* __p, shared_ptr<_Tp>* __v
return atomic_compare_exchange_weak(__p, __v, __w);
}
-#endif // __has_feature(cxx_atomic) && !defined(_LIBCPP_HAS_NO_THREADS)
+#endif // defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
//enum class
struct _LIBCPP_TYPE_VIS pointer_safety
@@ -5574,6 +5652,15 @@ template <typename _Alloc>
_LIBCPP_INLINE_VISIBILITY
void __swap_allocator(_Alloc &, _Alloc &, false_type) _NOEXCEPT {}
+template <typename _Alloc, typename _Traits=allocator_traits<_Alloc> >
+struct __noexcept_move_assign_container : public integral_constant<bool,
+ _Traits::propagate_on_container_move_assignment::value
+#if _LIBCPP_STD_VER > 14
+ || _Traits::is_always_equal::value
+#else
+ && is_nothrow_move_assignable<_Alloc>::value
+#endif
+ > {};
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/module.modulemap b/include/module.modulemap
index 3c0700eca443..3fb7428411df 100644
--- a/include/module.modulemap
+++ b/include/module.modulemap
@@ -455,9 +455,13 @@ module std [system] {
export *
}
+ // FIXME: We don't have modules for the <foo.h> headers, because they might
+ // be included from the C library's headers, and that would create a #include
+ // cycle. For the same reason, we don't have a module for __config.
+ //module __config { header "__config" export * }
+
// FIXME: These should be private.
module __bit_reference { header "__bit_reference" export * }
- module __config { header "__config" export * }
module __debug { header "__debug" export * }
module __functional_base { header "__functional_base" export * }
module __hash_table { header "__hash_table" export * }
diff --git a/include/mutex b/include/mutex
index 373d75b09789..a0875a568ec6 100644
--- a/include/mutex
+++ b/include/mutex
@@ -179,7 +179,9 @@ template<class Callable, class ...Args>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
+#ifndef _LIBCPP_HAS_NO_THREADS
#include <sched.h>
+#endif
#include <__undef_min_max>
diff --git a/include/ostream b/include/ostream
index f55fd40856ec..01157b2377db 100644
--- a/include/ostream
+++ b/include/ostream
@@ -275,7 +275,7 @@ basic_ostream<_CharT, _Traits>::sentry::~sentry()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_type>* __sb)
{
this->init(__sb);
@@ -284,14 +284,14 @@ basic_ostream<_CharT, _Traits>::basic_ostream(basic_streambuf<char_type, traits_
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>::basic_ostream(basic_ostream&& __rhs)
{
this->move(__rhs);
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator=(basic_ostream&& __rhs)
{
@@ -307,7 +307,7 @@ basic_ostream<_CharT, _Traits>::~basic_ostream()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs)
{
@@ -315,7 +315,7 @@ basic_ostream<_CharT, _Traits>::swap(basic_ostream& __rhs)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&))
{
@@ -323,7 +323,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_ostream& (*__pf)(basic_ostream&
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>&
(*__pf)(basic_ios<char_type,traits_type>&))
@@ -333,7 +333,7 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_ios<char_type, traits_type>&
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(ios_base& (*__pf)(ios_base&))
{
@@ -989,7 +989,7 @@ basic_ostream<_CharT, _Traits>::flush()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_ostream<_CharT, _Traits>::pos_type
basic_ostream<_CharT, _Traits>::tellp()
{
@@ -999,7 +999,7 @@ basic_ostream<_CharT, _Traits>::tellp()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
@@ -1013,7 +1013,7 @@ basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
@@ -1027,7 +1027,7 @@ basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
endl(basic_ostream<_CharT, _Traits>& __os)
{
@@ -1037,7 +1037,7 @@ endl(basic_ostream<_CharT, _Traits>& __os)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
ends(basic_ostream<_CharT, _Traits>& __os)
{
@@ -1046,7 +1046,7 @@ ends(basic_ostream<_CharT, _Traits>& __os)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
flush(basic_ostream<_CharT, _Traits>& __os)
{
@@ -1057,7 +1057,7 @@ flush(basic_ostream<_CharT, _Traits>& __os)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Stream, class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
!is_lvalue_reference<_Stream>::value &&
@@ -1081,7 +1081,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
{
@@ -1089,7 +1089,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
}
template<class _CharT, class _Traits, class _Yp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p)
{
diff --git a/include/random b/include/random
index 64382a3d9aa6..794bf7b3fd15 100644
--- a/include/random
+++ b/include/random
@@ -3119,6 +3119,7 @@ public:
independent_bits_engine<_Eng, _Wp, _UI>& __x);
private:
+ _LIBCPP_INLINE_VISIBILITY
result_type __eval(false_type);
result_type __eval(true_type);
@@ -3144,7 +3145,7 @@ private:
};
template<class _Engine, size_t __w, class _UIntType>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_UIntType
independent_bits_engine<_Engine, __w, _UIntType>::__eval(false_type)
{
@@ -3735,7 +3736,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
- template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+ template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@@ -3765,7 +3766,7 @@ public:
template<class _RealType>
template<class _URNG>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename uniform_real_distribution<_RealType>::result_type
uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@@ -3851,7 +3852,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
- template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+ template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@@ -3878,7 +3879,7 @@ public:
};
template<class _URNG>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
bernoulli_distribution::result_type
bernoulli_distribution::operator()(_URNG& __g, const param_type& __p)
{
@@ -5522,7 +5523,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
result_type operator()(_URNG& __g)
{return (*this)(__g, __p_);}
- template<class _URNG> result_type operator()(_URNG& __g, const param_type& __p);
+ template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p);
// property functions
_LIBCPP_INLINE_VISIBILITY
@@ -5552,7 +5553,7 @@ public:
template <class _RealType>
template<class _URNG>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_RealType
cauchy_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p)
{
@@ -6044,9 +6045,6 @@ basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is,
discrete_distribution<_IT>& __x)
{
- typedef discrete_distribution<_IT> _Eng;
- typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@@ -6358,7 +6356,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_constant_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
@@ -6698,7 +6695,6 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
{
typedef piecewise_linear_distribution<_RT> _Eng;
typedef typename _Eng::result_type result_type;
- typedef typename _Eng::param_type param_type;
__save_flags<_CharT, _Traits> __lx(__is);
__is.flags(ios_base::dec | ios_base::skipws);
size_t __n;
diff --git a/include/ratio b/include/ratio
index f623a062f2ce..8f708ce478d3 100644
--- a/include/ratio
+++ b/include/ratio
@@ -62,6 +62,19 @@ typedef ratio< 1000000000000000000, 1> exa;
typedef ratio< 1000000000000000000000, 1> zetta; // not supported
typedef ratio<1000000000000000000000000, 1> yotta; // not supported
+ // 20.11.5, ratio comparison
+ template <class R1, class R2> constexpr bool ratio_equal_v
+ = ratio_equal<R1, R2>::value; // C++17
+ template <class R1, class R2> constexpr bool ratio_not_equal_v
+ = ratio_not_equal<R1, R2>::value; // C++17
+ template <class R1, class R2> constexpr bool ratio_less_v
+ = ratio_less<R1, R2>::value; // C++17
+ template <class R1, class R2> constexpr bool ratio_less_equal_v
+ = ratio_less_equal<R1, R2>::value; // C++17
+ template <class R1, class R2> constexpr bool ratio_greater_v
+ = ratio_greater<R1, R2>::value; // C++17
+ template <class R1, class R2> constexpr bool ratio_greater_equal_v
+ = ratio_greater_equal<R1, R2>::value; // C++17
}
*/
@@ -485,6 +498,26 @@ struct __ratio_gcd
__static_lcm<_R1::den, _R2::den>::value> type;
};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_equal_v
+ = ratio_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_not_equal_v
+ = ratio_not_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_v
+ = ratio_less<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_less_equal_v
+ = ratio_less_equal<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_v
+ = ratio_greater<_R1, _R2>::value;
+
+template <class _R1, class _R2> _LIBCPP_CONSTEXPR bool ratio_greater_equal_v
+ = ratio_greater_equal<_R1, _R2>::value;
+#endif
+
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_RATIO
diff --git a/include/regex b/include/regex
index bd48fb8da04b..b9dac4765cdf 100644
--- a/include/regex
+++ b/include/regex
@@ -762,6 +762,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <memory>
#include <vector>
#include <deque>
+#include <cassert>
#include <__undef_min_max>
@@ -955,6 +956,17 @@ public:
regex_constants::error_type code() const {return __code_;}
};
+template <regex_constants::error_type _Ev>
+_LIBCPP_ALWAYS_INLINE
+void __throw_regex_error()
+{
+#ifndef _LIBCPP_NO_EXCEPTIONS
+ throw regex_error(_Ev);
+#else
+ assert(!"regex_error");
+#endif
+}
+
template <class _CharT>
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
{
@@ -1036,6 +1048,7 @@ private:
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
+ _LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(wchar_t __ch, int __radix) const;
};
@@ -1258,7 +1271,7 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
}
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
int
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
{
@@ -1721,6 +1734,8 @@ template <class _CharT>
void
__back_ref<_CharT>::__exec(__state& __s) const
{
+ if (__mexp_ > __s.__sub_matches_.size())
+ __throw_regex_error<regex_constants::error_backref>();
sub_match<const _CharT*>& __sm = __s.__sub_matches_[__mexp_-1];
if (__sm.matched)
{
@@ -2256,10 +2271,8 @@ public:
}
else
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__b.size() != 1 || __e.size() != 1)
- throw regex_error(regex_constants::error_collate);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_collate>();
if (__icase_)
{
__b[0] = __traits_.translate_nocase(__b[0]);
@@ -2952,7 +2965,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
- : base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
+ : base(__s), __exp_(__exp), __mexp_(__mexp), __invert_(__invert) {}
virtual void __exec(__state&) const;
};
@@ -3012,10 +3025,8 @@ basic_regex<_CharT, _Traits>::__parse(_ForwardIterator __first,
case egrep:
__first = __parse_egrep(__first, __last);
break;
-#ifndef _LIBCPP_NO_EXCEPTIONS
default:
- throw regex_error(regex_constants::__re_err_grammar);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::__re_err_grammar>();
}
return __first;
}
@@ -3046,10 +3057,8 @@ basic_regex<_CharT, _Traits>::__parse_basic_reg_exp(_ForwardIterator __first,
}
}
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first != __last)
- throw regex_error(regex_constants::__re_err_empty);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::__re_err_empty>();
}
return __first;
}
@@ -3062,19 +3071,15 @@ basic_regex<_CharT, _Traits>::__parse_extended_reg_exp(_ForwardIterator __first,
{
__owns_one_state<_CharT>* __sa = __end_;
_ForwardIterator __temp = __parse_ERE_branch(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::__re_err_empty);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::__re_err_empty>();
__first = __temp;
while (__first != __last && *__first == '|')
{
__owns_one_state<_CharT>* __sb = __end_;
__temp = __parse_ERE_branch(++__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::__re_err_empty);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::__re_err_empty>();
__push_alternation(__sa, __sb);
__first = __temp;
}
@@ -3088,10 +3093,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_branch(_ForwardIterator __first,
_ForwardIterator __last)
{
_ForwardIterator __temp = __parse_ERE_expression(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::__re_err_empty);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::__re_err_empty>();
do
{
__first = __temp;
@@ -3126,10 +3129,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_expression(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__temp = __parse_extended_reg_exp(++__temp, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__temp;
@@ -3194,10 +3195,8 @@ basic_regex<_CharT, _Traits>::__parse_nondupl_RE(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
__first = __parse_RE_expression(__temp, __last);
__temp = __parse_Back_close_paren(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
__first = __temp;
}
@@ -3511,22 +3510,16 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __min = 0;
__first = __temp;
__temp = __parse_DUP_COUNT(__first, __last, __min);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
if (*__first != ',')
{
__temp = __parse_Back_close_brace(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
__push_loop(__min, __min, __s, __mexp_begin, __mexp_end,
true);
__first = __temp;
@@ -3537,18 +3530,14 @@ basic_regex<_CharT, _Traits>::__parse_RE_dupl_symbol(_ForwardIterator __first,
int __max = -1;
__first = __parse_DUP_COUNT(__first, __last, __max);
__temp = __parse_Back_close_brace(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
if (__max == -1)
__push_greedy_inf_repeat(__min, __s, __mexp_begin, __mexp_end);
else
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end,
true);
}
@@ -3608,15 +3597,11 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __min;
_ForwardIterator __temp = __parse_DUP_COUNT(++__first, __last, __min);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
__first = __temp;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
switch (*__first)
{
case '}':
@@ -3631,10 +3616,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
break;
case ',':
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
if (*__first == '}')
{
++__first;
@@ -3650,20 +3633,14 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
{
int __max = -1;
__temp = __parse_DUP_COUNT(__first, __last, __max);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __first)
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
__first = __temp;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != '}')
- throw regex_error(regex_constants::error_brace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brace>();
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__max < __min)
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
if (__grammar == ECMAScript && __first != __last && *__first == '?')
{
++__first;
@@ -3673,10 +3650,8 @@ basic_regex<_CharT, _Traits>::__parse_ERE_dupl_symbol(_ForwardIterator __first,
__push_loop(__min, __max, __s, __mexp_begin, __mexp_end);
}
break;
-#ifndef _LIBCPP_NO_EXCEPTIONS
default:
- throw regex_error(regex_constants::error_badbrace);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_badbrace>();
}
}
break;
@@ -3694,10 +3669,8 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
if (__first != __last && *__first == '[')
{
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
bool __negate = false;
if (*__first == '^')
{
@@ -3706,29 +3679,23 @@ basic_regex<_CharT, _Traits>::__parse_bracket_expression(_ForwardIterator __firs
}
__bracket_expression<_CharT, _Traits>* __ml = __start_matching_list(__negate);
// __ml owned by *this
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
if ((__flags_ & 0x1F0) != ECMAScript && *__first == ']')
{
__ml->__add_char(']');
++__first;
}
__first = __parse_follow_list(__first, __last, __ml);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
if (*__first == '-')
{
__ml->__add_char('-');
++__first;
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ']')
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
++__first;
}
return __first;
@@ -3848,10 +3815,8 @@ basic_regex<_CharT, _Traits>::__parse_class_escape(_ForwardIterator __first,
basic_string<_CharT>& __str,
__bracket_expression<_CharT, _Traits>* __ml)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case 0:
@@ -3892,10 +3857,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
_ForwardIterator __last,
basic_string<_CharT>* __str)
{
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
switch (*__first)
{
case '\\':
@@ -3963,10 +3926,8 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
else
__push_char(_CharT(__val));
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
else
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
return __first;
}
@@ -3982,18 +3943,14 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
value_type _Equal_close[2] = {'=', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Equal_close,
_Equal_close+2);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __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);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__collate_name.empty())
- throw regex_error(regex_constants::error_collate);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_collate>();
string_type __equiv_name =
__traits_.transform_primary(__collate_name.begin(),
__collate_name.end());
@@ -4009,10 +3966,8 @@ basic_regex<_CharT, _Traits>::__parse_equivalence_class(_ForwardIterator __first
case 2:
__ml->__add_digraph(__collate_name[0], __collate_name[1]);
break;
-#ifndef _LIBCPP_NO_EXCEPTIONS
default:
- throw regex_error(regex_constants::error_collate);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_collate>();
}
}
__first = _VSTD::next(__temp, 2);
@@ -4031,18 +3986,14 @@ basic_regex<_CharT, _Traits>::__parse_character_class(_ForwardIterator __first,
value_type _Colon_close[2] = {':', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Colon_close,
_Colon_close+2);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [: ... :]
typedef typename _Traits::char_class_type char_class_type;
char_class_type __class_type =
__traits_.lookup_classname(__first, __temp, __flags_ & icase);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__class_type == 0)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
__ml->__add_class(__class_type);
__first = _VSTD::next(__temp, 2);
return __first;
@@ -4060,22 +4011,17 @@ basic_regex<_CharT, _Traits>::__parse_collating_symbol(_ForwardIterator __first,
value_type _Dot_close[2] = {'.', ']'};
_ForwardIterator __temp = _VSTD::search(__first, __last, _Dot_close,
_Dot_close+2);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last)
- throw regex_error(regex_constants::error_brack);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_brack>();
// [__first, __temp) contains all text in [. ... .]
- typedef typename _Traits::string_type string_type;
__col_sym = __traits_.lookup_collatename(__first, __temp);
switch (__col_sym.size())
{
case 1:
case 2:
break;
-#ifndef _LIBCPP_NO_EXCEPTIONS
default:
- throw regex_error(regex_constants::error_collate);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_collate>();
}
__first = _VSTD::next(__temp, 2);
return __first;
@@ -4219,10 +4165,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
__marked_count_ += __mexp;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@@ -4234,10 +4178,8 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
__marked_count_ += __mexp;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
__first = ++__temp;
}
break;
@@ -4274,19 +4216,15 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
case '(':
{
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
_ForwardIterator __temp = _VSTD::next(__first);
if (__temp != __last && *__first == '?' && *__temp == ':')
{
++__open_count_;
__first = __parse_ecma_exp(++__temp, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
--__open_count_;
++__first;
}
@@ -4296,16 +4234,20 @@ basic_regex<_CharT, _Traits>::__parse_atom(_ForwardIterator __first,
unsigned __temp_count = __marked_count_;
++__open_count_;
__first = __parse_ecma_exp(__first, __last);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last || *__first != ')')
- throw regex_error(regex_constants::error_paren);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_paren>();
__push_end_marked_subexpression(__temp_count);
--__open_count_;
++__first;
}
}
break;
+ case '*':
+ case '+':
+ case '?':
+ case '{':
+ __throw_regex_error<regex_constants::error_badrepeat>();
+ break;
default:
__first = __parse_pattern_character(__first, __last);
break;
@@ -4360,10 +4302,8 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
unsigned __v = *__first - '0';
for (++__first; '0' <= *__first && *__first <= '9'; ++__first)
__v = 10 * __v + *__first - '0';
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__v > mark_count())
- throw regex_error(regex_constants::error_backref);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_backref>();
__push_back_ref(__v);
}
}
@@ -4479,62 +4419,42 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(_CharT(*__t % 32));
__first = ++__t;
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
else
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
else
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
break;
case 'u':
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
// drop through
case 'x':
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
++__first;
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__hd = __traits_.value(*__first, 16);
-#ifndef _LIBCPP_NO_EXCEPTIONS
if (__hd == -1)
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
__sum = 16 * __sum + static_cast<unsigned>(__hd);
if (__str)
*__str = _CharT(__sum);
@@ -4558,10 +4478,8 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(*__first);
++__first;
}
-#ifndef _LIBCPP_NO_EXCEPTIONS
else
- throw regex_error(regex_constants::error_escape);
-#endif // _LIBCPP_NO_EXCEPTIONS
+ __throw_regex_error<regex_constants::error_escape>();
break;
}
}
@@ -5422,8 +5340,8 @@ match_results<_BidirectionalIterator, _Allocator>::match_results(
__unmatched_(),
__prefix_(),
__suffix_(),
- __position_start_(),
- __ready_(false)
+ __ready_(false),
+ __position_start_()
{
}
@@ -5648,9 +5566,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.pop_back();
break;
default:
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw regex_error(regex_constants::__re_err_unknown);
-#endif
+ __throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
@@ -5720,9 +5636,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
__states.pop_back();
break;
default:
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw regex_error(regex_constants::__re_err_unknown);
-#endif
+ __throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());
@@ -5808,9 +5722,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__states.pop_back();
break;
default:
-#ifndef _LIBCPP_NO_EXCEPTIONS
- throw regex_error(regex_constants::__re_err_unknown);
-#endif
+ __throw_regex_error<regex_constants::__re_err_unknown>();
break;
}
} while (!__states.empty());
diff --git a/include/scoped_allocator b/include/scoped_allocator
index cd4987ad9bb6..9436dac9c199 100644
--- a/include/scoped_allocator
+++ b/include/scoped_allocator
@@ -58,6 +58,8 @@ public:
template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept;
+ scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
+ scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator() noexcept;
@@ -457,6 +459,8 @@ public:
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT
: base(_VSTD::move(__other)) {}
+ // scoped_allocator_adaptor& operator=(const scoped_allocator_adaptor&) = default;
+ // scoped_allocator_adaptor& operator=(scoped_allocator_adaptor&&) = default;
// ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY
diff --git a/include/set b/include/set
index 9d64a521da11..ac69e085241f 100644
--- a/include/set
+++ b/include/set
@@ -409,6 +409,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
@@ -819,6 +822,9 @@ public:
typedef value_type& reference;
typedef const value_type& const_reference;
+ static_assert((is_same<typename allocator_type::value_type, value_type>::value),
+ "Allocator::value_type must be same type as value_type");
+
private:
typedef __tree<value_type, value_compare, allocator_type> __base;
typedef allocator_traits<allocator_type> __alloc_traits;
diff --git a/include/setjmp.h b/include/setjmp.h
new file mode 100644
index 000000000000..464b4a540897
--- /dev/null
+++ b/include/setjmp.h
@@ -0,0 +1,45 @@
+// -*- C++ -*-
+//===--------------------------- setjmp.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SETJMP_H
+#define _LIBCPP_SETJMP_H
+
+/*
+ setjmp.h synopsis
+
+Macros:
+
+ setjmp
+
+Types:
+
+ jmp_buf
+
+void longjmp(jmp_buf env, int val);
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <setjmp.h>
+
+#ifdef __cplusplus
+
+#ifndef setjmp
+#define setjmp(env) setjmp(env)
+#endif
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_SETJMP_H
diff --git a/include/sstream b/include/sstream
index 27ae78f9d45f..308c3b62f2bc 100644
--- a/include/sstream
+++ b/include/sstream
@@ -236,7 +236,7 @@ protected:
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch)
: __hm_(0),
__mode_(__wch)
@@ -245,7 +245,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
ios_base::openmode __wch)
: __hm_(0),
@@ -425,7 +425,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
swap(basic_stringbuf<_CharT, _Traits, _Allocator>& __x,
basic_stringbuf<_CharT, _Traits, _Allocator>& __y)
@@ -607,7 +607,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
ios_base::openmode __wch)
@@ -654,7 +654,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch)
: basic_istream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::in)
@@ -662,7 +662,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_istream<_CharT, _Traits>(&__sb_),
@@ -673,7 +673,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@@ -693,7 +693,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs)
{
@@ -702,7 +702,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rh
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
basic_istringstream<_CharT, _Traits, _Allocator>& __y)
@@ -711,7 +711,7 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@@ -719,7 +719,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<_CharT, _Traits, _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>::str() const
{
@@ -727,7 +727,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
@@ -773,7 +773,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch)
: basic_ostream<_CharT, _Traits>(&__sb_),
__sb_(__wch | ios_base::out)
@@ -781,7 +781,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_ostream<_CharT, _Traits>(&__sb_),
@@ -792,7 +792,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@@ -812,7 +812,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs)
{
@@ -821,7 +821,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rh
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
basic_ostringstream<_CharT, _Traits, _Allocator>& __y)
@@ -830,7 +830,7 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@@ -838,7 +838,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<_CharT, _Traits, _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
{
@@ -846,7 +846,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
@@ -892,7 +892,7 @@ public:
};
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch)
: basic_iostream<_CharT, _Traits>(&__sb_),
__sb_(__wch)
@@ -900,7 +900,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::op
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s,
ios_base::openmode __wch)
: basic_iostream<_CharT, _Traits>(&__sb_),
@@ -911,7 +911,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_))
@@ -931,7 +931,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&&
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
{
@@ -940,7 +940,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
basic_stringstream<_CharT, _Traits, _Allocator>& __y)
@@ -949,7 +949,7 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_stringbuf<_CharT, _Traits, _Allocator>*
basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
{
@@ -957,7 +957,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_string<_CharT, _Traits, _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>::str() const
{
@@ -965,7 +965,7 @@ basic_stringstream<_CharT, _Traits, _Allocator>::str() const
}
template <class _CharT, class _Traits, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
{
diff --git a/include/stddef.h b/include/stddef.h
new file mode 100644
index 000000000000..8841bbea2978
--- /dev/null
+++ b/include/stddef.h
@@ -0,0 +1,62 @@
+// -*- C++ -*-
+//===--------------------------- stddef.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(__need_ptrdiff_t) || defined(__need_size_t) || \
+ defined(__need_wchar_t) || defined(__need_NULL) || defined(__need_wint_t)
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stddef.h>
+
+#elif !defined(_LIBCPP_STDDEF_H)
+#define _LIBCPP_STDDEF_H
+
+/*
+ stddef.h synopsis
+
+Macros:
+
+ offsetof(type,member-designator)
+ NULL
+
+Types:
+
+ ptrdiff_t
+ size_t
+ max_align_t
+ nullptr_t
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stddef.h>
+
+#ifdef __cplusplus
+
+extern "C++" {
+#include <__nullptr>
+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)
+typedef long double max_align_t;
+#endif
+
+#endif
+
+#endif // _LIBCPP_STDDEF_H
diff --git a/include/stdio.h b/include/stdio.h
new file mode 100644
index 000000000000..56fb2d83bb28
--- /dev/null
+++ b/include/stdio.h
@@ -0,0 +1,127 @@
+// -*- C++ -*-
+//===---------------------------- stdio.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(__need_FILE) || defined(__need___FILE)
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stdio.h>
+
+#elif !defined(_LIBCPP_STDIO_H)
+#define _LIBCPP_STDIO_H
+
+/*
+ stdio.h synopsis
+
+Macros:
+
+ BUFSIZ
+ EOF
+ FILENAME_MAX
+ FOPEN_MAX
+ L_tmpnam
+ NULL
+ SEEK_CUR
+ SEEK_END
+ SEEK_SET
+ TMP_MAX
+ _IOFBF
+ _IOLBF
+ _IONBF
+ stderr
+ stdin
+ stdout
+
+Types:
+
+FILE
+fpos_t
+size_t
+
+int remove(const char* filename);
+int rename(const char* old, const char* new);
+FILE* tmpfile(void);
+char* tmpnam(char* s);
+int fclose(FILE* stream);
+int fflush(FILE* stream);
+FILE* fopen(const char* restrict filename, const char* restrict mode);
+FILE* freopen(const char* restrict filename, const char * restrict mode,
+ FILE * restrict stream);
+void setbuf(FILE* restrict stream, char* restrict buf);
+int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
+int fprintf(FILE* restrict stream, const char* restrict format, ...);
+int fscanf(FILE* restrict stream, const char * restrict format, ...);
+int printf(const char* restrict format, ...);
+int scanf(const char* restrict format, ...);
+int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99
+int sprintf(char* restrict s, const char* restrict format, ...);
+int sscanf(const char* restrict s, const char* restrict format, ...);
+int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
+int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99
+int vprintf(const char* restrict format, va_list arg);
+int vscanf(const char* restrict format, va_list arg); // C99
+int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99
+ va_list arg);
+int vsprintf(char* restrict s, const char* restrict format, va_list arg);
+int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
+int fgetc(FILE* stream);
+char* fgets(char* restrict s, int n, FILE* restrict stream);
+int fputc(int c, FILE* stream);
+int fputs(const char* restrict s, FILE* restrict stream);
+int getc(FILE* stream);
+int getchar(void);
+char* gets(char* s); // removed in C++14
+int putc(int c, FILE* stream);
+int putchar(int c);
+int puts(const char* s);
+int ungetc(int c, FILE* stream);
+size_t fread(void* restrict ptr, size_t size, size_t nmemb,
+ FILE* restrict stream);
+size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
+ FILE* restrict stream);
+int fgetpos(FILE* restrict stream, fpos_t* restrict pos);
+int fseek(FILE* stream, long offset, int whence);
+int fsetpos(FILE*stream, const fpos_t* pos);
+long ftell(FILE* stream);
+void rewind(FILE* stream);
+void clearerr(FILE* stream);
+int feof(FILE* stream);
+int ferror(FILE* stream);
+void perror(const char* s);
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stdio.h>
+
+#ifdef __cplusplus
+
+// snprintf
+#if defined(_LIBCPP_MSVCRT)
+extern "C++" {
+#include "support/win32/support.h"
+}
+#endif
+
+#undef getc
+#undef putc
+#undef clearerr
+#undef feof
+#undef ferror
+
+#endif
+
+#endif // _LIBCPP_STDIO_H
diff --git a/include/stdlib.h b/include/stdlib.h
new file mode 100644
index 000000000000..12fd676a15f5
--- /dev/null
+++ b/include/stdlib.h
@@ -0,0 +1,130 @@
+// -*- C++ -*-
+//===--------------------------- stdlib.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(__need_malloc_and_calloc)
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stdlib.h>
+
+#elif !defined(_LIBCPP_STDLIB_H)
+#define _LIBCPP_STDLIB_H
+
+/*
+ stdlib.h synopsis
+
+Macros:
+
+ EXIT_FAILURE
+ EXIT_SUCCESS
+ MB_CUR_MAX
+ NULL
+ RAND_MAX
+
+Types:
+
+ size_t
+ div_t
+ ldiv_t
+ lldiv_t // C99
+
+double atof (const char* nptr);
+int atoi (const char* nptr);
+long atol (const char* nptr);
+long long atoll(const char* nptr); // C99
+double strtod (const char* restrict nptr, char** restrict endptr);
+float strtof (const char* restrict nptr, char** restrict endptr); // C99
+long double strtold (const char* restrict nptr, char** restrict endptr); // C99
+long strtol (const char* restrict nptr, char** restrict endptr, int base);
+long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99
+unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base);
+unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99
+int rand(void);
+void srand(unsigned int seed);
+void* calloc(size_t nmemb, size_t size);
+void free(void* ptr);
+void* malloc(size_t size);
+void* realloc(void* ptr, size_t size);
+void abort(void);
+int atexit(void (*func)(void));
+void exit(int status);
+void _Exit(int status);
+char* getenv(const char* name);
+int system(const char* string);
+void* bsearch(const void* key, const void* base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+void qsort(void* base, size_t nmemb, size_t size,
+ int (*compar)(const void *, const void *));
+int abs( int j);
+long abs( long j);
+long long abs(long long j); // C++0X
+long labs( long j);
+long long llabs(long long j); // C99
+div_t div( int numer, int denom);
+ldiv_t div( long numer, long denom);
+lldiv_t div(long long numer, long long denom); // C++0X
+ldiv_t ldiv( long numer, long denom);
+lldiv_t lldiv(long long numer, long long denom); // C99
+int mblen(const char* s, size_t n);
+int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
+int wctomb(char* s, wchar_t wchar);
+size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
+size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
+int at_quick_exit(void (*func)(void)) // C++11
+void quick_exit(int status); // C++11
+void *aligned_alloc(size_t alignment, size_t size); // C11
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <stdlib.h>
+
+#ifdef __cplusplus
+
+extern "C++" {
+
+#ifdef _LIBCPP_MSVCRT
+#include "support/win32/locale_win32.h"
+#endif // _LIBCPP_MSVCRT
+
+#undef abs
+#undef div
+#undef labs
+#undef ldiv
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+#undef llabs
+#undef lldiv
+#endif
+
+// MSVCRT already has the correct prototype in <stdlib.h> if __cplusplus is defined
+#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
+inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+
+inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);}
+#ifndef _LIBCPP_HAS_NO_LONG_LONG
+inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
+#endif // _LIBCPP_HAS_NO_LONG_LONG
+#endif // _LIBCPP_MSVCRT / __sun__ / _AIX
+
+} // extern "C++"
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_STDLIB_H
diff --git a/include/streambuf b/include/streambuf
index 603c68038796..e75e8be2271d 100644
--- a/include/streambuf
+++ b/include/streambuf
@@ -220,7 +220,7 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
locale
basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
{
@@ -231,7 +231,7 @@ basic_streambuf<_CharT, _Traits>::pubimbue(const locale& __loc)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
locale
basic_streambuf<_CharT, _Traits>::getloc() const
{
@@ -239,7 +239,7 @@ basic_streambuf<_CharT, _Traits>::getloc() const
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
basic_streambuf<_CharT, _Traits>*
basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
{
@@ -247,7 +247,7 @@ basic_streambuf<_CharT, _Traits>::pubsetbuf(char_type* __s, streamsize __n)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
ios_base::seekdir __way,
@@ -257,7 +257,7 @@ basic_streambuf<_CharT, _Traits>::pubseekoff(off_type __off,
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
ios_base::openmode __which)
@@ -266,7 +266,7 @@ basic_streambuf<_CharT, _Traits>::pubseekpos(pos_type __sp,
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
int
basic_streambuf<_CharT, _Traits>::pubsync()
{
@@ -274,7 +274,7 @@ basic_streambuf<_CharT, _Traits>::pubsync()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
streamsize
basic_streambuf<_CharT, _Traits>::in_avail()
{
@@ -284,7 +284,7 @@ basic_streambuf<_CharT, _Traits>::in_avail()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::snextc()
{
@@ -294,7 +294,7 @@ basic_streambuf<_CharT, _Traits>::snextc()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sbumpc()
{
@@ -304,7 +304,7 @@ basic_streambuf<_CharT, _Traits>::sbumpc()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sgetc()
{
@@ -314,7 +314,7 @@ basic_streambuf<_CharT, _Traits>::sgetc()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
streamsize
basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
{
@@ -322,7 +322,7 @@ basic_streambuf<_CharT, _Traits>::sgetn(char_type* __s, streamsize __n)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
{
@@ -332,7 +332,7 @@ basic_streambuf<_CharT, _Traits>::sputbackc(char_type __c)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sungetc()
{
@@ -342,7 +342,7 @@ basic_streambuf<_CharT, _Traits>::sungetc()
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
{
@@ -353,7 +353,7 @@ basic_streambuf<_CharT, _Traits>::sputc(char_type __c)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
streamsize
basic_streambuf<_CharT, _Traits>::sputn(const char_type* __s, streamsize __n)
{
@@ -411,7 +411,7 @@ basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_streambuf<_CharT, _Traits>::gbump(int __n)
{
@@ -419,7 +419,7 @@ basic_streambuf<_CharT, _Traits>::gbump(int __n)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
char_type* __gend)
@@ -430,7 +430,7 @@ basic_streambuf<_CharT, _Traits>::setg(char_type* __gbeg, char_type* __gnext,
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_streambuf<_CharT, _Traits>::pbump(int __n)
{
@@ -438,7 +438,7 @@ basic_streambuf<_CharT, _Traits>::pbump(int __n)
}
template <class _CharT, class _Traits>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
basic_streambuf<_CharT, _Traits>::setp(char_type* __pbeg, char_type* __pend)
{
diff --git a/include/string b/include/string
index 6be21955b146..ee5db1aab63b 100644
--- a/include/string
+++ b/include/string
@@ -115,8 +115,8 @@ public:
basic_string& operator=(const basic_string& str);
basic_string& operator=(basic_string&& str)
noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ allocator_type::propagate_on_container_move_assignment::value ||
+ allocator_type::is_always_equal::value ); // C++17
basic_string& operator=(const value_type* s);
basic_string& operator=(value_type c);
basic_string& operator=(initializer_list<value_type>);
@@ -517,10 +517,14 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
{return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
+ _LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@@ -550,7 +554,7 @@ char_traits<_CharT>::compare(const char_type* __s1, const char_type* __s2, size_
}
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
char_traits<_CharT>::length(const char_type* __s)
{
@@ -561,7 +565,7 @@ char_traits<_CharT>::length(const char_type* __s)
}
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const _CharT*
char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@@ -595,7 +599,7 @@ char_traits<_CharT>::move(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_CharT*
char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -607,7 +611,7 @@ char_traits<_CharT>::copy(char_type* __s1, const char_type* __s2, size_t __n)
}
template <class _CharT>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_CharT*
char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
{
@@ -726,11 +730,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
+ _LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
+ _LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@@ -742,10 +752,10 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char16_t>
static inline _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;}
static inline _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT
- {return int_type(0xDFFF);}
+ {return int_type(0xFFFF);}
};
-inline _LIBCPP_INLINE_VISIBILITY
+inline
int
char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -759,7 +769,7 @@ char_traits<char16_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
char_traits<char16_t>::length(const char_type* __s)
{
@@ -769,7 +779,7 @@ char_traits<char16_t>::length(const char_type* __s)
return __len;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const char16_t*
char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@@ -782,7 +792,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char16_t*
char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -802,7 +812,7 @@ char_traits<char16_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char16_t*
char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -813,7 +823,7 @@ char_traits<char16_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char16_t*
char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@@ -839,11 +849,17 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
static inline _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;}
+ _LIBCPP_INLINE_VISIBILITY
static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static size_t length(const char_type* __s);
+ _LIBCPP_INLINE_VISIBILITY
static const char_type* find(const char_type* __s, size_t __n, const char_type& __a);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* move(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
static char_type* assign(char_type* __s, size_t __n, char_type __a);
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
@@ -858,7 +874,7 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits<char32_t>
{return int_type(0xFFFFFFFF);}
};
-inline _LIBCPP_INLINE_VISIBILITY
+inline
int
char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -872,7 +888,7 @@ char_traits<char32_t>::compare(const char_type* __s1, const char_type* __s2, siz
return 0;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
size_t
char_traits<char32_t>::length(const char_type* __s)
{
@@ -882,7 +898,7 @@ char_traits<char32_t>::length(const char_type* __s)
return __len;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const char32_t*
char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& __a)
{
@@ -895,7 +911,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
return 0;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char32_t*
char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -915,7 +931,7 @@ char_traits<char32_t>::move(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char32_t*
char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
{
@@ -926,7 +942,7 @@ char_traits<char32_t>::copy(char_type* __s1, const char_type* __s2, size_t __n)
return __r;
}
-inline _LIBCPP_INLINE_VISIBILITY
+inline
char32_t*
char_traits<char32_t>::assign(char_type* __s, size_t __n, char_type __a)
{
@@ -1185,7 +1201,7 @@ _LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __basic_string_common<true>)
#pragma warning( pop )
#endif // _LIBCPP_MSVC
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template <class _CharT, size_t = sizeof(_CharT)>
struct __padding
@@ -1198,7 +1214,7 @@ struct __padding<_CharT, 1>
{
};
-#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
template<class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_string
@@ -1234,7 +1250,7 @@ public:
private:
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
struct __long
{
@@ -1294,7 +1310,7 @@ private:
value_type __data_[__min_cap];
};
-#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
union __ulx{__long __lx; __short __lxx;};
@@ -1377,8 +1393,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& operator=(basic_string&& __str)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
basic_string& operator=(value_type __c);
@@ -1445,7 +1460,8 @@ public:
_LIBCPP_INLINE_VISIBILITY size_type length() const _NOEXCEPT {return size();}
_LIBCPP_INLINE_VISIBILITY size_type max_size() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY size_type capacity() const _NOEXCEPT
- {return (__is_long() ? __get_long_cap() : __min_cap) - 1;}
+ {return (__is_long() ? __get_long_cap()
+ : static_cast<size_type>(__min_cap)) - 1;}
void resize(size_type __n, value_type __c);
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
@@ -1509,6 +1525,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_string& assign(basic_string&& str)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{*this = _VSTD::move(str); return *this;}
#endif
basic_string& assign(const basic_string& __str, size_type __pos, size_type __n=npos);
@@ -1697,7 +1714,7 @@ private:
const allocator_type& __alloc() const _NOEXCEPT
{return __r_.second();}
-#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
+#ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@@ -1715,7 +1732,7 @@ private:
{return __r_.first().__s.__size_;}
# endif
-#else // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#else // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
@@ -1733,7 +1750,7 @@ private:
{return __r_.first().__s.__size_ >> 1;}
# endif
-#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
+#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_long_size(size_type __s) _NOEXCEPT
@@ -1785,11 +1802,11 @@ private:
template <size_type __a> static
_LIBCPP_INLINE_VISIBILITY
size_type __align_it(size_type __s) _NOEXCEPT
- {return __s + (__a-1) & ~(__a-1);}
+ {return (__s + (__a-1)) & ~(__a-1);}
enum {__alignment = 16};
static _LIBCPP_INLINE_VISIBILITY
size_type __recommend(size_type __s) _NOEXCEPT
- {return (__s < __min_cap ? __min_cap :
+ {return (__s < __min_cap ? static_cast<size_type>(__min_cap) :
__align_it<sizeof(value_type) < __alignment ?
__alignment/sizeof(value_type) : 1 > (__s+1)) - 1;}
@@ -1845,11 +1862,16 @@ private:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
- void __move_assign(basic_string& __str, false_type);
+ void __move_assign(basic_string& __str, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __move_assign(basic_string& __str, true_type)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT;
+#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
#endif
+#endif
_LIBCPP_INLINE_VISIBILITY
void
@@ -1936,7 +1958,12 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string()
template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
- : __r_(__a)
+#if _LIBCPP_STD_VER <= 14
+ _NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
+#else
+ _NOEXCEPT
+#endif
+: __r_(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -2425,6 +2452,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__alloc() != __str.__alloc())
assign(__str);
@@ -2436,7 +2464,11 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, true_type)
+#if _LIBCPP_STD_VER > 14
+ _NOEXCEPT
+#else
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
+#endif
{
clear();
shrink_to_fit();
@@ -2449,8 +2481,7 @@ template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
basic_string<_CharT, _Traits, _Allocator>&
basic_string<_CharT, _Traits, _Allocator>::operator=(basic_string&& __str)
- _NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__str, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@@ -3782,7 +3813,11 @@ bool
operator==(const _CharT* __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{
- return __rhs.compare(__lhs) == 0;
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT(__lhs != nullptr, "operator==(char*, basic_string): received nullptr");
+ size_t __lhs_len = _Traits::length(__lhs);
+ if (__lhs_len != __rhs.size()) return false;
+ return __rhs.compare(0, _String::npos, __lhs, __lhs_len) == 0;
}
template<class _CharT, class _Traits, class _Allocator>
@@ -3791,7 +3826,11 @@ bool
operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs,
const _CharT* __rhs) _NOEXCEPT
{
- return __lhs.compare(__rhs) == 0;
+ typedef basic_string<_CharT, _Traits, _Allocator> _String;
+ _LIBCPP_ASSERT(__rhs != nullptr, "operator==(basic_string, char*): received nullptr");
+ size_t __rhs_len = _Traits::length(__rhs);
+ if (__rhs_len != __lhs.size()) return false;
+ return __lhs.compare(0, _String::npos, __rhs, __rhs_len) == 0;
}
// operator!=
diff --git a/include/support/musl/xlocale.h b/include/support/musl/xlocale.h
new file mode 100644
index 000000000000..3e31c99596ce
--- /dev/null
+++ b/include/support/musl/xlocale.h
@@ -0,0 +1,58 @@
+// -*- C++ -*-
+//===------------------- support/musl/xlocale.h ------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+// This adds support for the extended locale functions that are currently
+// missing from the Musl C library.
+//
+// This only works when the specified locale is "C" or "POSIX", but that's
+// about as good as we can do without implementing full xlocale support
+// in Musl.
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_SUPPORT_MUSL_XLOCALE_H
+#define _LIBCPP_SUPPORT_MUSL_XLOCALE_H
+
+#include <cstdlib>
+#include <cwchar>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static inline long long strtoll_l(const char *nptr, char **endptr, int base,
+ locale_t) {
+ return strtoll(nptr, endptr, base);
+}
+
+static inline unsigned long long strtoull_l(const char *nptr, char **endptr,
+ int base, locale_t) {
+ return strtoull(nptr, endptr, base);
+}
+
+static inline long long wcstoll_l(const wchar_t *nptr, wchar_t **endptr,
+ int base, locale_t) {
+ return wcstoll(nptr, endptr, base);
+}
+
+static inline unsigned long long wcstoull_l(const wchar_t *nptr,
+ wchar_t **endptr, int base,
+ locale_t) {
+ return wcstoull(nptr, endptr, base);
+}
+
+static inline long double wcstold_l(const wchar_t *nptr, wchar_t **endptr,
+ locale_t) {
+ return wcstold(nptr, endptr);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _LIBCPP_SUPPORT_MUSL_XLOCALE_H
diff --git a/include/system_error b/include/system_error
index 66bf6d6c4249..134bb3274031 100644
--- a/include/system_error
+++ b/include/system_error
@@ -371,7 +371,7 @@ public:
error_category() _NOEXCEPT;
#else
_LIBCPP_ALWAYS_INLINE
- _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT;
+ _LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT
#endif
private:
error_category(const error_category&);// = delete;
diff --git a/include/thread b/include/thread
index 8a30102f427e..6857e9edb68b 100644
--- a/include/thread
+++ b/include/thread
@@ -113,11 +113,38 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
_LIBCPP_BEGIN_NAMESPACE_STD
+template <class _Tp> class __thread_specific_ptr;
+class _LIBCPP_TYPE_VIS __thread_struct;
+class _LIBCPP_HIDDEN __thread_struct_imp;
+class __assoc_sub_state;
+
+_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
+
+class _LIBCPP_TYPE_VIS __thread_struct
+{
+ __thread_struct_imp* __p_;
+
+ __thread_struct(const __thread_struct&);
+ __thread_struct& operator=(const __thread_struct&);
+public:
+ __thread_struct();
+ ~__thread_struct();
+
+ void notify_all_at_thread_exit(condition_variable*, mutex*);
+ void __make_ready_at_thread_exit(__assoc_sub_state*);
+};
+
template <class _Tp>
class __thread_specific_ptr
{
pthread_key_t __key_;
+ // Only __thread_local_data() may construct a __thread_specific_ptr
+ // and only with _Tp == __thread_struct.
+ static_assert((is_same<_Tp, __thread_struct>::value), "");
+ __thread_specific_ptr();
+ friend _LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
+
__thread_specific_ptr(const __thread_specific_ptr&);
__thread_specific_ptr& operator=(const __thread_specific_ptr&);
@@ -125,7 +152,6 @@ class __thread_specific_ptr
public:
typedef _Tp* pointer;
- __thread_specific_ptr();
~__thread_specific_ptr();
_LIBCPP_INLINE_VISIBILITY
@@ -159,7 +185,10 @@ __thread_specific_ptr<_Tp>::__thread_specific_ptr()
template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{
- pthread_key_delete(__key_);
+ // __thread_specific_ptr is only created with a static storage duration
+ // so this destructor is only invoked during program termination. Invoking
+ // pthread_key_delete(__key_) may prevent other threads from deleting their
+ // thread local data. For this reason we leak the key.
}
template <class _Tp>
@@ -289,6 +318,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;}
+ _LIBCPP_INLINE_VISIBILITY
thread& operator=(thread&& __t) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -307,26 +337,6 @@ public:
static unsigned hardware_concurrency() _NOEXCEPT;
};
-class __assoc_sub_state;
-
-class _LIBCPP_HIDDEN __thread_struct_imp;
-
-class _LIBCPP_TYPE_VIS __thread_struct
-{
- __thread_struct_imp* __p_;
-
- __thread_struct(const __thread_struct&);
- __thread_struct& operator=(const __thread_struct&);
-public:
- __thread_struct();
- ~__thread_struct();
-
- void notify_all_at_thread_exit(condition_variable*, mutex*);
- void __make_ready_at_thread_exit(__assoc_sub_state*);
-};
-
-_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
-
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args, size_t ..._Indices>
@@ -390,7 +400,7 @@ thread::thread(_Fp __f)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-inline _LIBCPP_INLINE_VISIBILITY
+inline
thread&
thread::operator=(thread&& __t) _NOEXCEPT
{
diff --git a/include/tuple b/include/tuple
index 3a22aa5ff5ac..cb1e27d93cf2 100644
--- a/include/tuple
+++ b/include/tuple
@@ -80,28 +80,33 @@ template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // cons
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
template <class... T> class tuple_size<tuple<T...>>;
-template <intsize_t I, class T> class tuple_element; // undefined
-template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
-template <size_t _Ip, class ..._Tp>
- using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type; // C++14
+template <size_t I, class T> class tuple_element; // undefined
+template <size_t I, class... T> class tuple_element<I, tuple<T...>>;
+template <size_t I, class T>
+ using tuple_element_t = typename tuple_element <I, T>::type; // C++14
// 20.4.1.5, element access:
-template <intsize_t I, class... T>
+template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept; // constexpr in C++14
-template <intsize_t I, class... T>
- typename const tuple_element<I, tuple<T...>>::type &
+template <size_t I, class... T>
+ const typename tuple_element<I, tuple<T...>>::type&
get(const tuple<T...>&) noexcept; // constexpr in C++14
-template <intsize_t I, class... T>
+template <size_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
get(tuple<T...>&&) noexcept; // constexpr in C++14
+template <size_t I, class... T>
+ const typename tuple_element<I, tuple<T...>>::type&&
+ get(const tuple<T...>&&) noexcept; // constexpr in C++14
template <class T1, class... T>
constexpr T1& get(tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
- constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14
+ constexpr const T1& get(const tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
+template <class T1, class... T>
+ constexpr const T1&& get(const tuple<T...>&&) noexcept; // C++14
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
@@ -507,6 +512,8 @@ class _LIBCPP_TYPE_VIS_ONLY tuple
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
+ template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
+ const typename tuple_element<_Jp, tuple<_Up...> >::type&& get(const tuple<_Up...>&&) _NOEXCEPT;
public:
template <bool _Dummy = true, class = typename enable_if<
@@ -766,6 +773,16 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
+template <size_t _Ip, class ..._Tp>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
+get(const tuple<_Tp...>&& __t) _NOEXCEPT
+{
+ typedef typename tuple_element<_Ip, tuple<_Tp...> >::type type;
+ return static_cast<const type&&>(
+ static_cast<const __tuple_leaf<_Ip, type>&&>(__t.base_).get());
+}
+
#if _LIBCPP_STD_VER > 11
// get by type
template <typename _T1, size_t _Idx, typename... _Args>
@@ -822,6 +839,13 @@ constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
+template <class _T1, class... _Args>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const&& get(tuple<_Args...> const&& __tup) noexcept
+{
+ return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
+}
+
#endif
// tie
diff --git a/include/type_traits b/include/type_traits
index a0c1bc565c04..b7adfebceeb9 100644
--- a/include/type_traits
+++ b/include/type_traits
@@ -203,8 +203,160 @@ namespace std
using result_of_t = typename result_of<F(ArgTypes...)>::type; // C++14
template <class...>
- using void_t = void;
-} // C++17
+ using void_t = void; // C++17
+
+ // See C++14 20.10.4.1, primary type categories
+ template <class T> constexpr bool is_void_v
+ = is_void<T>::value; // C++17
+ template <class T> constexpr bool is_null_pointer_v
+ = is_null_pointer<T>::value; // C++17
+ template <class T> constexpr bool is_integral_v
+ = is_integral<T>::value; // C++17
+ template <class T> constexpr bool is_floating_point_v
+ = is_floating_point<T>::value; // C++17
+ template <class T> constexpr bool is_array_v
+ = is_array<T>::value; // C++17
+ template <class T> constexpr bool is_pointer_v
+ = is_pointer<T>::value; // C++17
+ template <class T> constexpr bool is_lvalue_reference_v
+ = is_lvalue_reference<T>::value; // C++17
+ template <class T> constexpr bool is_rvalue_reference_v
+ = is_rvalue_reference<T>::value; // C++17
+ template <class T> constexpr bool is_member_object_pointer_v
+ = is_member_object_pointer<T>::value; // C++17
+ template <class T> constexpr bool is_member_function_pointer_v
+ = is_member_function_pointer<T>::value; // C++17
+ template <class T> constexpr bool is_enum_v
+ = is_enum<T>::value; // C++17
+ template <class T> constexpr bool is_union_v
+ = is_union<T>::value; // C++17
+ template <class T> constexpr bool is_class_v
+ = is_class<T>::value; // C++17
+ template <class T> constexpr bool is_function_v
+ = is_function<T>::value; // C++17
+
+ // See C++14 20.10.4.2, composite type categories
+ template <class T> constexpr bool is_reference_v
+ = is_reference<T>::value; // C++17
+ template <class T> constexpr bool is_arithmetic_v
+ = is_arithmetic<T>::value; // C++17
+ template <class T> constexpr bool is_fundamental_v
+ = is_fundamental<T>::value; // C++17
+ template <class T> constexpr bool is_object_v
+ = is_object<T>::value; // C++17
+ template <class T> constexpr bool is_scalar_v
+ = is_scalar<T>::value; // C++17
+ template <class T> constexpr bool is_compound_v
+ = is_compound<T>::value; // C++17
+ template <class T> constexpr bool is_member_pointer_v
+ = is_member_pointer<T>::value; // C++17
+
+ // See C++14 20.10.4.3, type properties
+ template <class T> constexpr bool is_const_v
+ = is_const<T>::value; // C++17
+ template <class T> constexpr bool is_volatile_v
+ = is_volatile<T>::value; // C++17
+ template <class T> constexpr bool is_trivial_v
+ = is_trivial<T>::value; // C++17
+ template <class T> constexpr bool is_trivially_copyable_v
+ = is_trivially_copyable<T>::value; // C++17
+ template <class T> constexpr bool is_standard_layout_v
+ = is_standard_layout<T>::value; // C++17
+ template <class T> constexpr bool is_pod_v
+ = is_pod<T>::value; // C++17
+ template <class T> constexpr bool is_literal_type_v
+ = is_literal_type<T>::value; // C++17
+ template <class T> constexpr bool is_empty_v
+ = is_empty<T>::value; // C++17
+ template <class T> constexpr bool is_polymorphic_v
+ = is_polymorphic<T>::value; // C++17
+ template <class T> constexpr bool is_abstract_v
+ = 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_signed_v
+ = is_signed<T>::value; // C++17
+ template <class T> constexpr bool is_unsigned_v
+ = is_unsigned<T>::value; // C++17
+ template <class T, class... Args> constexpr bool is_constructible_v
+ = is_constructible<T, Args...>::value; // C++17
+ template <class T> constexpr bool is_default_constructible_v
+ = is_default_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_copy_constructible_v
+ = is_copy_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_move_constructible_v
+ = is_move_constructible<T>::value; // C++17
+ template <class T, class U> constexpr bool is_assignable_v
+ = is_assignable<T, U>::value; // C++17
+ template <class T> constexpr bool is_copy_assignable_v
+ = is_copy_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_move_assignable_v
+ = is_move_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_destructible_v
+ = is_destructible<T>::value; // C++17
+ template <class T, class... Args> constexpr bool is_trivially_constructible_v
+ = is_trivially_constructible<T, Args...>::value; // C++17
+ template <class T> constexpr bool is_trivially_default_constructible_v
+ = is_trivially_default_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_trivially_copy_constructible_v
+ = is_trivially_copy_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_trivially_move_constructible_v
+ = is_trivially_move_constructible<T>::value; // C++17
+ template <class T, class U> constexpr bool is_trivially_assignable_v
+ = is_trivially_assignable<T, U>::value; // C++17
+ template <class T> constexpr bool is_trivially_copy_assignable_v
+ = is_trivially_copy_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_trivially_move_assignable_v
+ = is_trivially_move_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_trivially_destructible_v
+ = is_trivially_destructible<T>::value; // C++17
+ template <class T, class... Args> constexpr bool is_nothrow_constructible_v
+ = is_nothrow_constructible<T, Args...>::value; // C++17
+ template <class T> constexpr bool is_nothrow_default_constructible_v
+ = is_nothrow_default_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_nothrow_copy_constructible_v
+ = is_nothrow_copy_constructible<T>::value; // C++17
+ template <class T> constexpr bool is_nothrow_move_constructible_v
+ = is_nothrow_move_constructible<T>::value; // C++17
+ template <class T, class U> constexpr bool is_nothrow_assignable_v
+ = is_nothrow_assignable<T, U>::value; // C++17
+ template <class T> constexpr bool is_nothrow_copy_assignable_v
+ = is_nothrow_copy_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_nothrow_move_assignable_v
+ = is_nothrow_move_assignable<T>::value; // C++17
+ template <class T> constexpr bool is_nothrow_destructible_v
+ = is_nothrow_destructible<T>::value; // C++17
+ template <class T> constexpr bool has_virtual_destructor_v
+ = has_virtual_destructor<T>::value; // C++17
+
+ // See C++14 20.10.5, type property queries
+ template <class T> constexpr size_t alignment_of_v
+ = alignment_of<T>::value; // C++17
+ template <class T> constexpr size_t rank_v
+ = rank<T>::value; // C++17
+ template <class T, unsigned I = 0> constexpr size_t extent_v
+ = extent<T, I>::value; // C++17
+
+ // See C++14 20.10.6, type relations
+ template <class T, class U> constexpr bool is_same_v
+ = is_same<T, U>::value; // C++17
+ template <class Base, class Derived> constexpr bool is_base_of_v
+ = is_base_of<Base, Derived>::value; // C++17
+ template <class From, class To> constexpr bool is_convertible_v
+ = is_convertible<From, To>::value; // C++17
+
+ // [meta.logical], logical operator traits:
+ template<class... B> struct conjunction; // C++17
+ template<class... B>
+ constexpr bool conjunction_v = conjunction<B...>::value; // C++17
+ template<class... B> struct disjunction; // C++17
+ template<class... B>
+ constexpr bool disjunction_v = disjunction<B...>::value; // C++17
+ template<class B> struct negation; // C++17
+ template<class B>
+ constexpr bool negation_v = negation<B>::value; // C++17
+
+}
*/
#include <__config>
@@ -244,6 +396,55 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY enable_if<true, _Tp> {typedef
template <bool _Bp, class _Tp = void> using enable_if_t = typename enable_if<_Bp, _Tp>::type;
#endif
+// addressof
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+_Tp*
+addressof(_Tp& __x) _NOEXCEPT
+{
+ return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
+}
+
+#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
+// Objective-C++ Automatic Reference Counting uses qualified pointers
+// that require special addressof() signatures. When
+// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
+// itself is providing these definitions. Otherwise, we provide them.
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__strong _Tp*
+addressof(__strong _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__weak _Tp*
+addressof(__weak _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__autoreleasing _Tp*
+addressof(__autoreleasing _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+
+template <class _Tp>
+inline _LIBCPP_INLINE_VISIBILITY
+__unsafe_unretained _Tp*
+addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
+{
+ return &__x;
+}
+#endif
struct __two {char __lx[2];};
@@ -269,24 +470,111 @@ _LIBCPP_CONSTEXPR const _Tp integral_constant<_Tp, __v>::value;
#if _LIBCPP_STD_VER > 14
template <bool __b>
using bool_constant = integral_constant<bool, __b>;
-#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
+#define _LIBCPP_BOOL_CONSTANT(__b) bool_constant<(__b)>
#else
-#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
+#define _LIBCPP_BOOL_CONSTANT(__b) integral_constant<bool,(__b)>
#endif
typedef _LIBCPP_BOOL_CONSTANT(true) true_type;
typedef _LIBCPP_BOOL_CONSTANT(false) false_type;
+#if !defined(_LIBCPP_HAS_NO_VARIADICS)
+
+// __lazy_and
+
+template <bool _Last, class ..._Preds>
+struct __lazy_and_impl;
+
+template <class ..._Preds>
+struct __lazy_and_impl<false, _Preds...> : false_type {};
+
+template <>
+struct __lazy_and_impl<true> : true_type {};
+
+template <class _Pred>
+struct __lazy_and_impl<true, _Pred> : integral_constant<bool, _Pred::type::value> {};
+
+template <class _Hp, class ..._Tp>
+struct __lazy_and_impl<true, _Hp, _Tp...> : __lazy_and_impl<_Hp::type::value, _Tp...> {};
+
+template <class _P1, class ..._Pr>
+struct __lazy_and : __lazy_and_impl<_P1::type::value, _Pr...> {};
+
+// __lazy_or
+
+template <bool _List, class ..._Preds>
+struct __lazy_or_impl;
+
+template <class ..._Preds>
+struct __lazy_or_impl<true, _Preds...> : true_type {};
+
+template <>
+struct __lazy_or_impl<false> : false_type {};
+
+template <class _Hp, class ..._Tp>
+struct __lazy_or_impl<false, _Hp, _Tp...>
+ : __lazy_or_impl<_Hp::type::value, _Tp...> {};
+
+template <class _P1, class ..._Pr>
+struct __lazy_or : __lazy_or_impl<_P1::type::value, _Pr...> {};
+
+// __lazy_not
+
+template <class _Pred>
+struct __lazy_not : integral_constant<bool, !_Pred::type::value> {};
+
+// __and_
+template<class...> struct __and_;
+template<> struct __and_<> : true_type {};
+
+template<class _B0> struct __and_<_B0> : _B0 {};
+
+template<class _B0, class _B1>
+struct __and_<_B0, _B1> : conditional<_B0::value, _B1, _B0>::type {};
+
+template<class _B0, class _B1, class _B2, class... _Bn>
+struct __and_<_B0, _B1, _B2, _Bn...>
+ : conditional<_B0::value, __and_<_B1, _B2, _Bn...>, _B0>::type {};
+
+// __or_
+template<class...> struct __or_;
+template<> struct __or_<> : false_type {};
+
+template<class _B0> struct __or_<_B0> : _B0 {};
+
+template<class _B0, class _B1>
+struct __or_<_B0, _B1> : conditional<_B0::value, _B0, _B1>::type {};
+
+template<class _B0, class _B1, class _B2, class... _Bn>
+struct __or_<_B0, _B1, _B2, _Bn...>
+ : conditional<_B0::value, _B0, __or_<_B1, _B2, _Bn...> >::type {};
+
+// __not_
+template<class _Tp>
+struct __not_ : conditional<_Tp::value, false_type, true_type>::type {};
+
+#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
+
// is_const
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_const<_Tp const> : public true_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_const_v
+ = is_const<_Tp>::value;
+#endif
+
// is_volatile
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_volatile<_Tp volatile> : public true_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_volatile_v
+ = is_volatile<_Tp>::value;
+#endif
+
// remove_const
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_const {typedef _Tp type;};
@@ -319,6 +607,11 @@ template <> struct __libcpp_is_void<void> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
: public __libcpp_is_void<typename remove_cv<_Tp>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_void_v
+ = is_void<_Tp>::value;
+#endif
+
// __is_nullptr_t
template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
@@ -330,6 +623,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
#if _LIBCPP_STD_VER > 11
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
: public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
+
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_null_pointer_v
+ = is_null_pointer<_Tp>::value;
+#endif
#endif
// is_integral
@@ -360,6 +658,11 @@ template <> struct __libcpp_is_integral<__uint128_t> : public tr
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_integral
: public __libcpp_is_integral<typename remove_cv<_Tp>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_integral_v
+ = is_integral<_Tp>::value;
+#endif
+
// is_floating_point
template <class _Tp> struct __libcpp_is_floating_point : public false_type {};
@@ -370,6 +673,11 @@ template <> struct __libcpp_is_floating_point<long double> : public tru
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_floating_point
: public __libcpp_is_floating_point<typename remove_cv<_Tp>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_floating_point_v
+ = is_floating_point<_Tp>::value;
+#endif
+
// is_array
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array
@@ -379,6 +687,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[]>
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY is_array<_Tp[_Np]>
: public true_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_array_v
+ = is_array<_Tp>::value;
+#endif
+
// is_pointer
template <class _Tp> struct __libcpp_is_pointer : public false_type {};
@@ -387,6 +700,11 @@ template <class _Tp> struct __libcpp_is_pointer<_Tp*> : public true_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pointer
: public __libcpp_is_pointer<typename remove_cv<_Tp>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_pointer_v
+ = is_pointer<_Tp>::value;
+#endif
+
// is_reference
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_lvalue_reference : public false_type {};
@@ -403,6 +721,16 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&> : public t
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_reference<_Tp&&> : public true_type {};
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_reference_v
+ = is_reference<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_lvalue_reference_v
+ = is_lvalue_reference<_Tp>::value;
+
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_rvalue_reference_v
+ = is_rvalue_reference<_Tp>::value;
+#endif
// is_union
#if __has_feature(is_union) || (_GNUC_VER >= 403)
@@ -418,6 +746,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_union
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_union_v
+ = is_union<_Tp>::value;
+#endif
+
// is_class
#if __has_feature(is_class) || (_GNUC_VER >= 403)
@@ -438,11 +771,21 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_class
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_class_v
+ = is_class<_Tp>::value;
+#endif
+
// is_same
template <class _Tp, class _Up> struct _LIBCPP_TYPE_VIS_ONLY is_same : public false_type {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_same<_Tp, _Tp> : public true_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, class _Up> _LIBCPP_CONSTEXPR bool is_same_v
+ = is_same<_Tp, _Up>::value;
+#endif
+
// is_function
namespace __libcpp_is_function_imp
@@ -468,13 +811,18 @@ template <class _Tp> struct __libcpp_is_function<_Tp, true> : public false_type
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
: public __libcpp_is_function<_Tp> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_function_v
+ = is_function<_Tp>::value;
+#endif
+
// is_member_function_pointer
// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
//
-template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
+template <class _MP, bool _IsMemberFunctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{ // forward declaration; specializations later
};
@@ -490,6 +838,11 @@ struct __libcpp_is_member_function_pointer<_Ret _Class::*>
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type>::type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_function_pointer_v
+ = is_member_function_pointer<_Tp>::value;
+#endif
+
// is_member_pointer
template <class _Tp> struct __libcpp_is_member_pointer : public false_type {};
@@ -498,12 +851,22 @@ template <class _Tp, class _Up> struct __libcpp_is_member_pointer<_Tp _Up::*> :
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_pointer
: public __libcpp_is_member_pointer<typename remove_cv<_Tp>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_pointer_v
+ = is_member_pointer<_Tp>::value;
+#endif
+
// is_member_object_pointer
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_object_pointer
: public integral_constant<bool, is_member_pointer<_Tp>::value &&
!is_member_function_pointer<_Tp>::value> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_member_object_pointer_v
+ = is_member_object_pointer<_Tp>::value;
+#endif
+
// is_enum
#if __has_feature(is_enum) || (_GNUC_VER >= 403)
@@ -527,12 +890,22 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_enum
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_enum_v
+ = is_enum<_Tp>::value;
+#endif
+
// is_arithmetic
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_arithmetic
: public integral_constant<bool, is_integral<_Tp>::value ||
is_floating_point<_Tp>::value> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_arithmetic_v
+ = is_arithmetic<_Tp>::value;
+#endif
+
// is_fundamental
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
@@ -540,6 +913,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_fundamental
__is_nullptr_t<_Tp>::value ||
is_arithmetic<_Tp>::value> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_fundamental_v
+ = is_fundamental<_Tp>::value;
+#endif
+
// is_scalar
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
@@ -551,6 +929,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_scalar
template <> struct _LIBCPP_TYPE_VIS_ONLY is_scalar<nullptr_t> : public true_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_scalar_v
+ = is_scalar<_Tp>::value;
+#endif
+
// is_object
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
@@ -559,11 +942,21 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_object
is_union<_Tp>::value ||
is_class<_Tp>::value > {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_object_v
+ = is_object<_Tp>::value;
+#endif
+
// is_compound
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_compound
: public integral_constant<bool, !is_fundamental<_Tp>::value> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_compound_v
+ = is_compound<_Tp>::value;
+#endif
+
// add_const
template <class _Tp, bool = is_reference<_Tp>::value ||
@@ -701,6 +1094,11 @@ template <class _Tp> struct __libcpp_is_signed<_Tp, false> : public false_type {
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __libcpp_is_signed<_Tp> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_signed_v
+ = is_signed<_Tp>::value;
+#endif
+
// is_unsigned
template <class _Tp, bool = is_integral<_Tp>::value>
@@ -716,6 +1114,11 @@ template <class _Tp> struct __libcpp_is_unsigned<_Tp, false> : public false_type
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_unsigned : public __libcpp_is_unsigned<_Tp> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_unsigned_v
+ = is_unsigned<_Tp>::value;
+#endif
+
// rank
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank
@@ -725,6 +1128,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[]>
template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY rank<_Tp[_Np]>
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR size_t rank_v
+ = rank<_Tp>::value;
+#endif
+
// extent
template <class _Tp, unsigned _Ip = 0> struct _LIBCPP_TYPE_VIS_ONLY extent
@@ -738,6 +1146,11 @@ template <class _Tp, size_t _Np> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], 0
template <class _Tp, size_t _Np, unsigned _Ip> struct _LIBCPP_TYPE_VIS_ONLY extent<_Tp[_Np], _Ip>
: public integral_constant<size_t, extent<_Tp, _Ip-1>::value> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, unsigned _Ip = 0> _LIBCPP_CONSTEXPR size_t extent_v
+ = extent<_Tp, _Ip>::value;
+#endif
+
// remove_extent
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY remove_extent
@@ -804,6 +1217,11 @@ template <class _Tp> struct __libcpp_abstract<_Tp, false> : public false_type {}
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_abstract : public __libcpp_abstract<_Tp> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_abstract_v
+ = is_abstract<_Tp>::value;
+#endif
+
// is_final
#if defined(_LIBCPP_HAS_IS_FINAL)
@@ -819,6 +1237,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY
is_final : public integral_constant<bool, __is_final(_Tp)> {};
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_final_v
+ = is_final<_Tp>::value;
+#endif
+
// is_base_of
#ifdef _LIBCPP_HAS_IS_BASE_OF
@@ -854,6 +1277,11 @@ struct _LIBCPP_TYPE_VIS_ONLY is_base_of
#endif // _LIBCPP_HAS_IS_BASE_OF
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Bp, class _Dp> _LIBCPP_CONSTEXPR bool is_base_of_v
+ = is_base_of<_Bp, _Dp>::value;
+#endif
+
// is_convertible
#if __has_feature(is_convertible_to) && !defined(_LIBCPP_USE_IS_CONVERTIBLE_FALLBACK)
@@ -981,6 +1409,11 @@ template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY is_convertible
#endif // __has_feature(is_convertible_to)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _From, class _To> _LIBCPP_CONSTEXPR bool is_convertible_v
+ = is_convertible<_From, _To>::value;
+#endif
+
// is_empty
#if __has_feature(is_empty) || (_GNUC_VER >= 407)
@@ -1012,6 +1445,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_empty : public __libcpp_emp
#endif // __has_feature(is_empty)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_empty_v
+ = is_empty<_Tp>::value;
+#endif
+
// is_polymorphic
#if __has_feature(is_polymorphic) || defined(_LIBCPP_MSVC)
@@ -1032,6 +1470,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_polymorphic
#endif // __has_feature(is_polymorphic)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_polymorphic_v
+ = is_polymorphic<_Tp>::value;
+#endif
+
// has_virtual_destructor
#if __has_feature(has_virtual_destructor) || (_GNUC_VER >= 403)
@@ -1046,11 +1489,21 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY has_virtual_destructor
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool has_virtual_destructor_v
+ = has_virtual_destructor<_Tp>::value;
+#endif
+
// alignment_of
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY alignment_of
: public integral_constant<size_t, __alignof__(_Tp)> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR size_t alignment_of_v
+ = alignment_of<_Tp>::value;
+#endif
+
// aligned_storage
template <class _Hp, class _Tp>
@@ -1143,7 +1596,7 @@ struct _LIBCPP_TYPE_VIS_ONLY aligned_storage
union type
{
_Aligner __align;
- unsigned char __data[_Len];
+ unsigned char __data[(_Len + _Align - 1)/_Align * _Align];
};
};
@@ -1158,7 +1611,7 @@ struct _LIBCPP_TYPE_VIS_ONLY aligned_storage<_Len, n>\
{\
struct _ALIGNAS(n) type\
{\
- unsigned char __lx[_Len];\
+ unsigned char __lx[(_Len + n - 1)/n * n];\
};\
}
@@ -1290,18 +1743,6 @@ public:
template <class _A1, class _A2 = void, class _A3 = void>
class __promote : public __promote_imp<_A1, _A2, _A3> {};
-#ifdef _LIBCPP_STORE_AS_OPTIMIZATION
-
-// __transform
-
-template <class _Tp, size_t = sizeof(_Tp), bool = is_scalar<_Tp>::value> struct __transform {typedef _Tp type;};
-template <class _Tp> struct __transform<_Tp, 1, true> {typedef unsigned char type;};
-template <class _Tp> struct __transform<_Tp, 2, true> {typedef unsigned short type;};
-template <class _Tp> struct __transform<_Tp, 4, true> {typedef unsigned int type;};
-template <class _Tp> struct __transform<_Tp, 8, true> {typedef unsigned long long type;};
-
-#endif // _LIBCPP_STORE_AS_OPTIMIZATION
-
// make_signed / make_unsigned
typedef
@@ -1482,21 +1923,19 @@ public:
template <class _Tp, class _Up>
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, void>
{
-private:
-#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
- static _Tp&& __t();
- static _Up&& __u();
-#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
- static _Tp __t();
- static _Up __u();
-#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-public:
- typedef typename remove_reference<decltype(true ? __t() : __u())>::type type;
+ typedef typename decay<decltype(
+ true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
+ )>::type type;
};
#else // _LIBCPP_HAS_NO_VARIADICS
-template <class ..._Tp> struct common_type;
+// bullet 1 - sizeof...(Tp) == 0
+
+template <class ..._Tp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type {};
+
+// bullet 2 - sizeof...(Tp) == 1
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp>
@@ -1504,23 +1943,46 @@ struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp>
typedef typename decay<_Tp>::type type;
};
+// bullet 3 - sizeof...(Tp) == 2
+
+template <class _Tp, class _Up, class = void>
+struct __common_type2 {};
+
template <class _Tp, class _Up>
-struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up>
+struct __common_type2<_Tp, _Up,
+ typename __void_t<decltype(
+ true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
+ )>::type>
{
-private:
- static _Tp&& __t();
- static _Up&& __u();
- static bool __f();
-public:
- typedef typename decay<decltype(__f() ? __t() : __u())>::type type;
+ typedef typename decay<decltype(
+ true ? _VSTD::declval<_Tp>() : _VSTD::declval<_Up>()
+ )>::type type;
};
+template <class _Tp, class _Up>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up>
+ : __common_type2<_Tp, _Up> {};
+
+// bullet 4 - sizeof...(Tp) > 2
+
+template <class ...Tp> struct __common_types;
+
+template <class, class = void>
+struct __common_type_impl {};
+
template <class _Tp, class _Up, class ..._Vp>
-struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
+struct __common_type_impl<__common_types<_Tp, _Up, _Vp...>,
+ typename __void_t<typename common_type<_Tp, _Up>::type>::type>
{
- typedef typename common_type<typename common_type<_Tp, _Up>::type, _Vp...>::type type;
+ typedef typename common_type<
+ typename common_type<_Tp, _Up>::type, _Vp...
+ >::type type;
};
+template <class _Tp, class _Up, class ..._Vp>
+struct _LIBCPP_TYPE_VIS_ONLY common_type<_Tp, _Up, _Vp...>
+ : __common_type_impl<__common_types<_Tp, _Up, _Vp...> > {};
+
#if _LIBCPP_STD_VER > 11
template <class ..._Tp> using common_type_t = typename common_type<_Tp...>::type;
#endif
@@ -1564,12 +2026,22 @@ template <class _Tp, class _Arg>
struct is_assignable
: public __is_assignable_imp<_Tp, _Arg> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_assignable_v
+ = is_assignable<_Tp, _Arg>::value;
+#endif
+
// is_copy_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_copy_assignable
: public is_assignable<typename add_lvalue_reference<_Tp>::type,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_assignable_v
+ = is_copy_assignable<_Tp>::value;
+#endif
+
// is_move_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable
@@ -1580,6 +2052,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_move_assignable
: public is_copy_assignable<_Tp> {};
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_assignable_v
+ = is_move_assignable<_Tp>::value;
+#endif
+
// is_destructible
// if it's a reference, return true
@@ -1638,6 +2115,11 @@ template <>
struct is_destructible<void>
: public _VSTD::false_type {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_destructible_v
+ = is_destructible<_Tp>::value;
+#endif
+
// move
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -2672,6 +3154,11 @@ struct __is_constructible2_imp<false, _Ap[], _A0, _A1>
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // __has_feature(is_constructible)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_constructible_v
+ = is_constructible<_Tp, _Args...>::value;
+#endif
+
// is_default_constructible
template <class _Tp>
@@ -2679,6 +3166,11 @@ struct _LIBCPP_TYPE_VIS_ONLY is_default_constructible
: public is_constructible<_Tp>
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_default_constructible_v
+ = is_default_constructible<_Tp>::value;
+#endif
+
// is_copy_constructible
template <class _Tp>
@@ -2686,6 +3178,11 @@ struct _LIBCPP_TYPE_VIS_ONLY is_copy_constructible
: public is_constructible<_Tp,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_copy_constructible_v
+ = is_copy_constructible<_Tp>::value;
+#endif
+
// is_move_constructible
template <class _Tp>
@@ -2697,6 +3194,11 @@ struct _LIBCPP_TYPE_VIS_ONLY is_move_constructible
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_move_constructible_v
+ = is_move_constructible<_Tp>::value;
+#endif
+
// is_trivially_constructible
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2824,18 +3326,33 @@ struct _LIBCPP_TYPE_VIS_ONLY is_trivially_constructible<_Tp, _Tp&,
#endif // _LIBCPP_HAS_NO_VARIADICS
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+template <class _Tp, class... _Args> _LIBCPP_CONSTEXPR bool is_trivially_constructible_v
+ = is_trivially_constructible<_Tp, _Args...>::value;
+#endif
+
// is_trivially_default_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_default_constructible
: public is_trivially_constructible<_Tp>
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_default_constructible_v
+ = is_trivially_default_constructible<_Tp>::value;
+#endif
+
// is_trivially_copy_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_constructible
: public is_trivially_constructible<_Tp, typename add_lvalue_reference<const _Tp>::type>
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_constructible_v
+ = is_trivially_copy_constructible<_Tp>::value;
+#endif
+
// is_trivially_move_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructible
@@ -2846,6 +3363,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_constructibl
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_constructible_v
+ = is_trivially_move_constructible<_Tp>::value;
+#endif
+
// is_trivially_assignable
#if __has_feature(is_trivially_assignable) || _GNUC_VER >= 501
@@ -2884,12 +3406,22 @@ struct is_trivially_assignable<_Tp&, _Tp&&>
#endif // !__has_feature(is_trivially_assignable)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_trivially_assignable_v
+ = is_trivially_assignable<_Tp, _Arg>::value;
+#endif
+
// is_trivially_copy_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copy_assignable
: public is_trivially_assignable<typename add_lvalue_reference<_Tp>::type,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copy_assignable_v
+ = is_trivially_copy_assignable<_Tp>::value;
+#endif
+
// is_trivially_move_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
@@ -2901,6 +3433,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_move_assignable
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_move_assignable_v
+ = is_trivially_move_assignable<_Tp>::value;
+#endif
+
// is_trivially_destructible
#if __has_feature(has_trivial_destructor) || (_GNUC_VER >= 403)
@@ -2917,6 +3454,14 @@ template <class _Tp> struct __libcpp_trivial_destructor
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
: public __libcpp_trivial_destructor<typename remove_all_extents<_Tp>::type> {};
+template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible<_Tp[]>
+ : public false_type {};
+
+#endif
+
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_destructible_v
+ = is_trivially_destructible<_Tp>::value;
#endif
// is_nothrow_constructible
@@ -3079,18 +3624,33 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&,
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // __has_feature(is_nothrow_constructible)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
+template <class _Tp, class ..._Args> _LIBCPP_CONSTEXPR bool is_nothrow_constructible_v
+ = is_nothrow_constructible<_Tp, _Args...>::value;
+#endif
+
// is_nothrow_default_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_default_constructible
: public is_nothrow_constructible<_Tp>
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_default_constructible_v
+ = is_nothrow_default_constructible<_Tp>::value;
+#endif
+
// is_nothrow_copy_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_constructible
: public is_nothrow_constructible<_Tp,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_constructible_v
+ = is_nothrow_copy_constructible<_Tp>::value;
+#endif
+
// is_nothrow_move_constructible
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
@@ -3101,6 +3661,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_constructible
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_constructible_v
+ = is_nothrow_move_constructible<_Tp>::value;
+#endif
+
// is_nothrow_assignable
#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
@@ -3169,12 +3734,22 @@ struct is_nothrow_assignable<_Tp&, _Tp&&>
#endif // __has_feature(cxx_noexcept)
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp, class _Arg> _LIBCPP_CONSTEXPR bool is_nothrow_assignable_v
+ = is_nothrow_assignable<_Tp, _Arg>::value;
+#endif
+
// is_nothrow_copy_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_copy_assignable
: public is_nothrow_assignable<typename add_lvalue_reference<_Tp>::type,
typename add_lvalue_reference<typename add_const<_Tp>::type>::type> {};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_copy_assignable_v
+ = is_nothrow_copy_assignable<_Tp>::value;
+#endif
+
// is_nothrow_move_assignable
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
@@ -3186,6 +3761,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_move_assignable
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_move_assignable_v
+ = is_nothrow_move_assignable<_Tp>::value;
+#endif
+
// is_nothrow_destructible
#if __has_feature(cxx_noexcept) || (_GNUC_VER >= 407 && __cplusplus >= 201103L)
@@ -3241,6 +3821,15 @@ template <class _Tp> struct __libcpp_nothrow_destructor
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible
: public __libcpp_nothrow_destructor<typename remove_all_extents<_Tp>::type> {};
+template <class _Tp>
+struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_destructible<_Tp[]>
+ : public false_type {};
+
+#endif
+
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_nothrow_destructible_v
+ = is_nothrow_destructible<_Tp>::value;
#endif
// is_pod
@@ -3260,6 +3849,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_pod
#endif
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_pod_v
+ = is_pod<_Tp>::value;
+#endif
+
// is_literal_type;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
@@ -3271,6 +3865,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_literal_type
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_literal_type_v
+ = is_literal_type<_Tp>::value;
+#endif
+
// is_standard_layout;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
@@ -3281,6 +3880,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_standard_layout
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_standard_layout_v
+ = is_standard_layout<_Tp>::value;
+#endif
+
// is_trivially_copyable;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
@@ -3293,6 +3897,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_copyable
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivially_copyable_v
+ = is_trivially_copyable<_Tp>::value;
+#endif
+
// is_trivial;
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
@@ -3304,6 +3913,11 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivial
#endif
{};
+#if _LIBCPP_STD_VER > 14 && !defined(_LIBCPP_HAS_NO_VARIABLE_TEMPLATES)
+template <class _Tp> _LIBCPP_CONSTEXPR bool is_trivial_v
+ = is_trivial<_Tp>::value;
+#endif
+
#ifndef _LIBCPP_HAS_NO_VARIADICS
// Check for complete types
@@ -3692,34 +4306,34 @@ struct __sfinae_underlying_type
template <class _Tp>
struct __sfinae_underlying_type<_Tp, false> {};
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
int __convert_to_integral(int __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
unsigned __convert_to_integral(unsigned __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
long __convert_to_integral(long __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
unsigned long __convert_to_integral(unsigned long __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
long long __convert_to_integral(long long __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
unsigned long long __convert_to_integral(unsigned long long __val) {return __val; }
#ifndef _LIBCPP_HAS_NO_INT128
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
__int128_t __convert_to_integral(__int128_t __val) { return __val; }
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
__uint128_t __convert_to_integral(__uint128_t __val) { return __val; }
#endif
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_ALWAYS_INLINE
+inline _LIBCPP_INLINE_VISIBILITY
typename __sfinae_underlying_type<_Tp>::__promoted_type
__convert_to_integral(_Tp __val) { return __val; }
@@ -3759,7 +4373,21 @@ struct __has_operator_addressof
#if _LIBCPP_STD_VER > 14
template <class...> using void_t = void;
-#endif
+
+# ifndef _LIBCPP_HAS_NO_VARIADICS
+template <class... _Args>
+struct conjunction : __and_<_Args...> {};
+template<class... _Args> constexpr bool conjunction_v = conjunction<_Args...>::value;
+
+template <class... _Args>
+struct disjunction : __or_<_Args...> {};
+template<class... _Args> constexpr bool disjunction_v = disjunction<_Args...>::value;
+
+template <class _Tp>
+struct negation : __not_<_Tp> {};
+template<class _Tp> constexpr bool negation_v = negation<_Tp>::value;
+# endif // _LIBCPP_HAS_NO_VARIADICS
+#endif // _LIBCPP_STD_VER > 14
_LIBCPP_END_NAMESPACE_STD
diff --git a/include/unordered_map b/include/unordered_map
index cf70ab62f69e..3c774d4094e0 100644
--- a/include/unordered_map
+++ b/include/unordered_map
@@ -1511,7 +1511,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__cc.second));
__h.get_deleter().__second_constructed = true;
- return _VSTD::move(__h); // explicitly moved for C++03
+ return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
diff --git a/include/utility b/include/utility
index 54cfc8bc1592..c9f5785b3d4e 100644
--- a/include/utility
+++ b/include/utility
@@ -52,6 +52,9 @@ template <class T>
>::type
move_if_noexcept(T& x) noexcept; // constexpr in C++14
+template <class T> constexpr add_const<T>_t& as_const(T& t) noexcept; // C++17
+template <class T> void as_const(const T&&) = delete; // C++17
+
template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
template <class T1, class T2>
@@ -110,22 +113,41 @@ template<size_t I, class T1, class T2>
get(pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
- const typename const tuple_element<I, pair<T1, T2> >::type&
+ const typename tuple_element<I, pair<T1, T2> >::type&
get(const pair<T1, T2>&) noexcept; // constexpr in C++14
template<size_t I, class T1, class T2>
typename tuple_element<I, pair<T1, T2> >::type&&
get(pair<T1, T2>&&) noexcept; // constexpr in C++14
+template<size_t I, class T1, class T2>
+ const typename tuple_element<I, pair<T1, T2> >::type&&
+ get(const pair<T1, T2>&&) noexcept; // constexpr in C++14
+
template<class T1, class T2>
constexpr T1& get(pair<T1, T2>&) noexcept; // C++14
-template<size_t I, class T1, class T2>
- constexpr T1 const& get(pair<T1, T2> const &) noexcept; // C++14
+template<class T1, class T2>
+ constexpr const T1& get(const pair<T1, T2>&) noexcept; // C++14
-template<size_t I, class T1, class T2>
+template<class T1, class T2>
constexpr T1&& get(pair<T1, T2>&&) noexcept; // C++14
+template<class T1, class T2>
+ constexpr const T1&& get(const pair<T1, T2>&&) noexcept; // C++14
+
+template<class T1, class T2>
+ constexpr T1& get(pair<T2, T1>&) noexcept; // C++14
+
+template<class T1, class T2>
+ constexpr const T1& get(const pair<T2, T1>&) noexcept; // C++14
+
+template<class T1, class T2>
+ constexpr T1&& get(pair<T2, T1>&&) noexcept; // C++14
+
+template<class T1, class T2>
+ constexpr const T1&& get(const pair<T2, T1>&&) noexcept; // C++14
+
// C++14
template<class T, T... I>
@@ -242,6 +264,11 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
return _VSTD::move(__x);
}
+#if _LIBCPP_STD_VER > 14
+template <class _Tp> constexpr add_const_t<_Tp>& as_const(_Tp& __t) noexcept { return __t; }
+template <class _Tp> void as_const(const _Tp&&) = delete;
+#endif
+
struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
@@ -261,6 +288,12 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
// pair(const pair&) = default;
// pair(pair&&) = default;
+#ifndef _LIBCPP_HAS_NO_DEFAULT_FUNCTION_TEMPLATE_ARGS
+ 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>
+#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
@@ -388,8 +421,9 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
__is_nothrow_swappable<second_type>::value)
{
- _VSTD::iter_swap(&first, &__p.first);
- _VSTD::iter_swap(&second, &__p.second);
+ using _VSTD::swap;
+ swap(first, __p.first);
+ swap(second, __p.second);
}
private:
@@ -551,6 +585,12 @@ struct __get_pair<0>
_T1&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
+ template <class _T1, class _T2>
+ static
+ _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
};
@@ -577,6 +617,12 @@ struct __get_pair<1>
_T2&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
+ template <class _T1, class _T2>
+ static
+ _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
};
@@ -606,6 +652,14 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT
return __get_pair<_Ip>::get(_VSTD::move(__p));
}
+template <size_t _Ip, class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
+const typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
+get(const pair<_T1, _T2>&& __p) _NOEXCEPT
+{
+ return __get_pair<_Ip>::get(_VSTD::move(__p));
+}
+
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
@@ -632,6 +686,13 @@ constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const && get(pair<_T1, _T2> const&& __p) _NOEXCEPT
+{
+ return __get_pair<0>::get(_VSTD::move(__p));
+}
+
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
{
return __get_pair<1>::get(__p);
@@ -651,6 +712,13 @@ constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
return __get_pair<1>::get(_VSTD::move(__p));
}
+template <class _T1, class _T2>
+inline _LIBCPP_INLINE_VISIBILITY
+constexpr _T1 const && get(pair<_T2, _T1> const&& __p) _NOEXCEPT
+{
+ return __get_pair<1>::get(_VSTD::move(__p));
+}
+
#endif
#if _LIBCPP_STD_VER > 11
@@ -671,6 +739,16 @@ struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
template<size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
+#if __has_builtin(__make_integer_seq) && !defined(_LIBCPP_TESTING_FALLBACK_MAKE_INTEGER_SEQUENCE)
+
+template <class _Tp, _Tp _Ep>
+struct __make_integer_sequence
+{
+ typedef __make_integer_seq<integer_sequence, _Tp, _Ep> type;
+};
+
+#else
+
namespace __detail {
template<typename _Tp, size_t ..._Extra> struct __repeat;
@@ -724,10 +802,14 @@ struct __make_integer_sequence
{
static_assert(is_integral<_Tp>::value,
"std::make_integer_sequence can only be instantiated with an integral type" );
- static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
- typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
+ static_assert(0 <= _Ep, "std::make_integer_sequence must have a non-negative sequence length");
+ // Workaround GCC bug by preventing bad installations when 0 <= _Ep
+ // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68929
+ typedef __make_integer_sequence_unchecked<_Tp, 0 <= _Ep ? _Ep : 0> type;
};
+#endif
+
template<class _Tp, _Tp _Np>
using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;
diff --git a/include/valarray b/include/valarray
index bdaa58836f39..bde644e8719b 100644
--- a/include/valarray
+++ b/include/valarray
@@ -802,11 +802,14 @@ public:
// construct/destroy:
_LIBCPP_INLINE_VISIBILITY
valarray() : __begin_(0), __end_(0) {}
- explicit valarray(size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
+ inline explicit valarray(size_t __n);
+ _LIBCPP_INLINE_VISIBILITY
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
+ _LIBCPP_INLINE_VISIBILITY
valarray(valarray&& __v) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -816,22 +819,31 @@ public:
valarray(const gslice_array<value_type>& __ga);
valarray(const mask_array<value_type>& __ma);
valarray(const indirect_array<value_type>& __ia);
+ inline _LIBCPP_INLINE_VISIBILITY
~valarray();
// assignment:
valarray& operator=(const valarray& __v);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _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
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const slice_array<value_type>& __sa);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const gslice_array<value_type>& __ga);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const mask_array<value_type>& __ma);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const indirect_array<value_type>& __ia);
template <class _ValExpr>
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator=(const __val_expr<_ValExpr>& __v);
// element access:
@@ -842,24 +854,38 @@ public:
value_type& operator[](size_t __i) {return __begin_[__i];}
// subset operations:
+ _LIBCPP_INLINE_VISIBILITY
__val_expr<__slice_expr<const valarray&> > operator[](slice __s) const;
+ _LIBCPP_INLINE_VISIBILITY
slice_array<value_type> operator[](slice __s);
+ _LIBCPP_INLINE_VISIBILITY
__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
+ _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
+ _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
+ _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
+ _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
+ _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
@@ -870,15 +896,25 @@ public:
valarray<bool> operator!() const;
// computed assignment:
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator*= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator/= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator%= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator+= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator-= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator^= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator&= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator|= (const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator<<=(const value_type& __x);
+ _LIBCPP_INLINE_VISIBILITY
valarray& operator>>=(const value_type& __x);
template <class _Expr>
@@ -887,6 +923,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator*= (const _Expr& __v);
template <class _Expr>
@@ -895,6 +932,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator/= (const _Expr& __v);
template <class _Expr>
@@ -903,6 +941,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator%= (const _Expr& __v);
template <class _Expr>
@@ -911,6 +950,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator+= (const _Expr& __v);
template <class _Expr>
@@ -919,6 +959,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator-= (const _Expr& __v);
template <class _Expr>
@@ -927,6 +968,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator^= (const _Expr& __v);
template <class _Expr>
@@ -935,6 +977,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator|= (const _Expr& __v);
template <class _Expr>
@@ -943,6 +986,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator&= (const _Expr& __v);
template <class _Expr>
@@ -951,6 +995,7 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator<<= (const _Expr& __v);
template <class _Expr>
@@ -959,16 +1004,21 @@ public:
__is_val_expr<_Expr>::value,
valarray&
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator>>= (const _Expr& __v);
// member functions:
+ _LIBCPP_INLINE_VISIBILITY
void swap(valarray& __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return static_cast<size_t>(__end_ - __begin_);}
+ _LIBCPP_INLINE_VISIBILITY
value_type sum() const;
+ _LIBCPP_INLINE_VISIBILITY
value_type min() const;
+ _LIBCPP_INLINE_VISIBILITY
value_type max() const;
valarray shift (int __i) const;
@@ -1114,6 +1164,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const _Expr& __v) const;
template <class _Expr>
@@ -1122,6 +1173,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator*=(const _Expr& __v) const;
template <class _Expr>
@@ -1130,6 +1182,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator/=(const _Expr& __v) const;
template <class _Expr>
@@ -1138,6 +1191,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator%=(const _Expr& __v) const;
template <class _Expr>
@@ -1146,6 +1200,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator+=(const _Expr& __v) const;
template <class _Expr>
@@ -1154,6 +1209,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator-=(const _Expr& __v) const;
template <class _Expr>
@@ -1162,6 +1218,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator^=(const _Expr& __v) const;
template <class _Expr>
@@ -1170,6 +1227,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator&=(const _Expr& __v) const;
template <class _Expr>
@@ -1178,6 +1236,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator|=(const _Expr& __v) const;
template <class _Expr>
@@ -1186,6 +1245,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator<<=(const _Expr& __v) const;
template <class _Expr>
@@ -1194,10 +1254,13 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator>>=(const _Expr& __v) const;
+ _LIBCPP_INLINE_VISIBILITY
const slice_array& operator=(const slice_array& __sa) const;
+ _LIBCPP_INLINE_VISIBILITY
void operator=(const value_type& __x) const;
private:
@@ -1213,7 +1276,7 @@ private:
};
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const slice_array<_Tp>&
slice_array<_Tp>::operator=(const slice_array& __sa) const
{
@@ -1226,7 +1289,7 @@ slice_array<_Tp>::operator=(const slice_array& __sa) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1241,7 +1304,7 @@ slice_array<_Tp>::operator=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1256,7 +1319,7 @@ slice_array<_Tp>::operator*=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1271,7 +1334,7 @@ slice_array<_Tp>::operator/=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1286,7 +1349,7 @@ slice_array<_Tp>::operator%=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1301,7 +1364,7 @@ slice_array<_Tp>::operator+=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1316,7 +1379,7 @@ slice_array<_Tp>::operator-=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1331,7 +1394,7 @@ slice_array<_Tp>::operator^=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1346,7 +1409,7 @@ slice_array<_Tp>::operator&=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1361,7 +1424,7 @@ slice_array<_Tp>::operator|=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1376,7 +1439,7 @@ slice_array<_Tp>::operator<<=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1390,7 +1453,7 @@ slice_array<_Tp>::operator>>=(const _Expr& __v) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
slice_array<_Tp>::operator=(const value_type& __x) const
{
@@ -1484,6 +1547,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const _Expr& __v) const;
template <class _Expr>
@@ -1492,6 +1556,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator*=(const _Expr& __v) const;
template <class _Expr>
@@ -1500,6 +1565,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator/=(const _Expr& __v) const;
template <class _Expr>
@@ -1508,6 +1574,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator%=(const _Expr& __v) const;
template <class _Expr>
@@ -1516,6 +1583,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator+=(const _Expr& __v) const;
template <class _Expr>
@@ -1524,6 +1592,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator-=(const _Expr& __v) const;
template <class _Expr>
@@ -1532,6 +1601,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator^=(const _Expr& __v) const;
template <class _Expr>
@@ -1540,6 +1610,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator&=(const _Expr& __v) const;
template <class _Expr>
@@ -1548,6 +1619,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator|=(const _Expr& __v) const;
template <class _Expr>
@@ -1556,6 +1628,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator<<=(const _Expr& __v) const;
template <class _Expr>
@@ -1564,10 +1637,13 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator>>=(const _Expr& __v) const;
+ _LIBCPP_INLINE_VISIBILITY
const gslice_array& operator=(const gslice_array& __ga) const;
+ _LIBCPP_INLINE_VISIBILITY
void operator=(const value_type& __x) const;
// gslice_array(const gslice_array&) = default;
@@ -1576,20 +1652,16 @@ public:
// gslice_array& operator=(gslice_array&&) = default;
private:
- _LIBCPP_INLINE_VISIBILITY
gslice_array(const gslice& __gs, const valarray<value_type>& __v)
: __vp_(const_cast<value_type*>(__v.__begin_)),
__1d_(__gs.__1d_)
{}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
-
- _LIBCPP_INLINE_VISIBILITY
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
template <class> friend class valarray;
@@ -1597,7 +1669,7 @@ private:
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1613,7 +1685,7 @@ gslice_array<_Tp>::operator=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1629,7 +1701,7 @@ gslice_array<_Tp>::operator*=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1645,7 +1717,7 @@ gslice_array<_Tp>::operator/=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1661,7 +1733,7 @@ gslice_array<_Tp>::operator%=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1677,7 +1749,7 @@ gslice_array<_Tp>::operator+=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1693,7 +1765,7 @@ gslice_array<_Tp>::operator-=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1709,7 +1781,7 @@ gslice_array<_Tp>::operator^=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1725,7 +1797,7 @@ gslice_array<_Tp>::operator&=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1741,7 +1813,7 @@ gslice_array<_Tp>::operator|=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1757,7 +1829,7 @@ gslice_array<_Tp>::operator<<=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1772,7 +1844,7 @@ gslice_array<_Tp>::operator>>=(const _Expr& __v) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const gslice_array<_Tp>&
gslice_array<_Tp>::operator=(const gslice_array& __ga) const
{
@@ -1785,7 +1857,7 @@ gslice_array<_Tp>::operator=(const gslice_array& __ga) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
gslice_array<_Tp>::operator=(const value_type& __x) const
{
@@ -1813,6 +1885,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const _Expr& __v) const;
template <class _Expr>
@@ -1821,6 +1894,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator*=(const _Expr& __v) const;
template <class _Expr>
@@ -1829,6 +1903,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator/=(const _Expr& __v) const;
template <class _Expr>
@@ -1837,6 +1912,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator%=(const _Expr& __v) const;
template <class _Expr>
@@ -1845,6 +1921,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator+=(const _Expr& __v) const;
template <class _Expr>
@@ -1853,6 +1930,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator-=(const _Expr& __v) const;
template <class _Expr>
@@ -1861,6 +1939,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator^=(const _Expr& __v) const;
template <class _Expr>
@@ -1869,6 +1948,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator&=(const _Expr& __v) const;
template <class _Expr>
@@ -1877,6 +1957,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator|=(const _Expr& __v) const;
template <class _Expr>
@@ -1885,6 +1966,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator<<=(const _Expr& __v) const;
template <class _Expr>
@@ -1893,10 +1975,13 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator>>=(const _Expr& __v) const;
+ _LIBCPP_INLINE_VISIBILITY
const mask_array& operator=(const mask_array& __ma) const;
+ _LIBCPP_INLINE_VISIBILITY
void operator=(const value_type& __x) const;
// mask_array(const mask_array&) = default;
@@ -1921,7 +2006,7 @@ private:
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1936,7 +2021,7 @@ mask_array<_Tp>::operator=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1951,7 +2036,7 @@ mask_array<_Tp>::operator*=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1966,7 +2051,7 @@ mask_array<_Tp>::operator/=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1981,7 +2066,7 @@ mask_array<_Tp>::operator%=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -1996,7 +2081,7 @@ mask_array<_Tp>::operator+=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2011,7 +2096,7 @@ mask_array<_Tp>::operator-=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2026,7 +2111,7 @@ mask_array<_Tp>::operator^=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2041,7 +2126,7 @@ mask_array<_Tp>::operator&=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2056,7 +2141,7 @@ mask_array<_Tp>::operator|=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2071,7 +2156,7 @@ mask_array<_Tp>::operator<<=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2085,7 +2170,7 @@ mask_array<_Tp>::operator>>=(const _Expr& __v) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const mask_array<_Tp>&
mask_array<_Tp>::operator=(const mask_array& __ma) const
{
@@ -2096,7 +2181,7 @@ mask_array<_Tp>::operator=(const mask_array& __ma) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
mask_array<_Tp>::operator=(const value_type& __x) const
{
@@ -2158,6 +2243,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator=(const _Expr& __v) const;
template <class _Expr>
@@ -2166,6 +2252,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator*=(const _Expr& __v) const;
template <class _Expr>
@@ -2174,6 +2261,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator/=(const _Expr& __v) const;
template <class _Expr>
@@ -2182,6 +2270,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator%=(const _Expr& __v) const;
template <class _Expr>
@@ -2190,6 +2279,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator+=(const _Expr& __v) const;
template <class _Expr>
@@ -2198,6 +2288,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator-=(const _Expr& __v) const;
template <class _Expr>
@@ -2206,6 +2297,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator^=(const _Expr& __v) const;
template <class _Expr>
@@ -2214,6 +2306,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator&=(const _Expr& __v) const;
template <class _Expr>
@@ -2222,6 +2315,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator|=(const _Expr& __v) const;
template <class _Expr>
@@ -2230,6 +2324,7 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator<<=(const _Expr& __v) const;
template <class _Expr>
@@ -2238,10 +2333,13 @@ public:
__is_val_expr<_Expr>::value,
void
>::type
+ _LIBCPP_INLINE_VISIBILITY
operator>>=(const _Expr& __v) const;
+ _LIBCPP_INLINE_VISIBILITY
const indirect_array& operator=(const indirect_array& __ia) const;
+ _LIBCPP_INLINE_VISIBILITY
void operator=(const value_type& __x) const;
// indirect_array(const indirect_array&) = default;
@@ -2271,7 +2369,7 @@ private:
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2286,7 +2384,7 @@ indirect_array<_Tp>::operator=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2301,7 +2399,7 @@ indirect_array<_Tp>::operator*=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2316,7 +2414,7 @@ indirect_array<_Tp>::operator/=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2331,7 +2429,7 @@ indirect_array<_Tp>::operator%=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2346,7 +2444,7 @@ indirect_array<_Tp>::operator+=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2361,7 +2459,7 @@ indirect_array<_Tp>::operator-=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2376,7 +2474,7 @@ indirect_array<_Tp>::operator^=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2391,7 +2489,7 @@ indirect_array<_Tp>::operator&=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2406,7 +2504,7 @@ indirect_array<_Tp>::operator|=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2421,7 +2519,7 @@ indirect_array<_Tp>::operator<<=(const _Expr& __v) const
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -2435,7 +2533,7 @@ indirect_array<_Tp>::operator>>=(const _Expr& __v) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
const indirect_array<_Tp>&
indirect_array<_Tp>::operator=(const indirect_array& __ia) const
{
@@ -2448,7 +2546,7 @@ indirect_array<_Tp>::operator=(const indirect_array& __ia) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
indirect_array<_Tp>::operator=(const value_type& __x) const
{
@@ -2650,7 +2748,7 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
// valarray
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>::valarray(size_t __n)
: __begin_(0),
__end_(0)
@@ -2659,7 +2757,7 @@ valarray<_Tp>::valarray(size_t __n)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>::valarray(const value_type& __x, size_t __n)
: __begin_(0),
__end_(0)
@@ -2720,7 +2818,7 @@ valarray<_Tp>::valarray(const valarray& __v)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
: __begin_(__v.__begin_),
__end_(__v.__end_)
@@ -2874,7 +2972,7 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>::~valarray()
{
resize(0);
@@ -2896,7 +2994,7 @@ valarray<_Tp>::operator=(const valarray& __v)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
{
@@ -2913,7 +3011,7 @@ valarray<_Tp>::operator=(valarray&& __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(initializer_list<value_type> __il)
{
@@ -2926,7 +3024,7 @@ valarray<_Tp>::operator=(initializer_list<value_type> __il)
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const value_type& __x)
{
@@ -2935,7 +3033,7 @@ valarray<_Tp>::operator=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
{
@@ -2947,7 +3045,7 @@ valarray<_Tp>::operator=(const slice_array<value_type>& __sa)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
{
@@ -2961,7 +3059,7 @@ valarray<_Tp>::operator=(const gslice_array<value_type>& __ga)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
{
@@ -2975,7 +3073,7 @@ valarray<_Tp>::operator=(const mask_array<value_type>& __ma)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
{
@@ -2990,7 +3088,7 @@ valarray<_Tp>::operator=(const indirect_array<value_type>& __ia)
template <class _Tp>
template <class _ValExpr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
{
@@ -3004,7 +3102,7 @@ valarray<_Tp>::operator=(const __val_expr<_ValExpr>& __v)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__slice_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](slice __s) const
{
@@ -3012,7 +3110,7 @@ valarray<_Tp>::operator[](slice __s) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
slice_array<_Tp>
valarray<_Tp>::operator[](slice __s)
{
@@ -3020,7 +3118,7 @@ valarray<_Tp>::operator[](slice __s)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](const gslice& __gs) const
{
@@ -3028,7 +3126,7 @@ valarray<_Tp>::operator[](const gslice& __gs) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
gslice_array<_Tp>
valarray<_Tp>::operator[](const gslice& __gs)
{
@@ -3038,7 +3136,7 @@ valarray<_Tp>::operator[](const gslice& __gs)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](gslice&& __gs) const
{
@@ -3046,7 +3144,7 @@ valarray<_Tp>::operator[](gslice&& __gs) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
gslice_array<_Tp>
valarray<_Tp>::operator[](gslice&& __gs)
{
@@ -3056,7 +3154,7 @@ valarray<_Tp>::operator[](gslice&& __gs)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__mask_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](const valarray<bool>& __vb) const
{
@@ -3064,7 +3162,7 @@ valarray<_Tp>::operator[](const valarray<bool>& __vb) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
mask_array<_Tp>
valarray<_Tp>::operator[](const valarray<bool>& __vb)
{
@@ -3074,7 +3172,7 @@ valarray<_Tp>::operator[](const valarray<bool>& __vb)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__mask_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](valarray<bool>&& __vb) const
{
@@ -3082,7 +3180,7 @@ valarray<_Tp>::operator[](valarray<bool>&& __vb) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
mask_array<_Tp>
valarray<_Tp>::operator[](valarray<bool>&& __vb)
{
@@ -3092,7 +3190,7 @@ valarray<_Tp>::operator[](valarray<bool>&& __vb)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
{
@@ -3100,7 +3198,7 @@ valarray<_Tp>::operator[](const valarray<size_t>& __vs) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
indirect_array<_Tp>
valarray<_Tp>::operator[](const valarray<size_t>& __vs)
{
@@ -3110,7 +3208,7 @@ valarray<_Tp>::operator[](const valarray<size_t>& __vs)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
__val_expr<__indirect_expr<const valarray<_Tp>&> >
valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
{
@@ -3118,7 +3216,7 @@ valarray<_Tp>::operator[](valarray<size_t>&& __vs) const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
indirect_array<_Tp>
valarray<_Tp>::operator[](valarray<size_t>&& __vs)
{
@@ -3196,7 +3294,7 @@ valarray<_Tp>::operator!() const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator*=(const value_type& __x)
{
@@ -3206,7 +3304,7 @@ valarray<_Tp>::operator*=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator/=(const value_type& __x)
{
@@ -3216,7 +3314,7 @@ valarray<_Tp>::operator/=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator%=(const value_type& __x)
{
@@ -3226,7 +3324,7 @@ valarray<_Tp>::operator%=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator+=(const value_type& __x)
{
@@ -3236,7 +3334,7 @@ valarray<_Tp>::operator+=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator-=(const value_type& __x)
{
@@ -3246,7 +3344,7 @@ valarray<_Tp>::operator-=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator^=(const value_type& __x)
{
@@ -3256,7 +3354,7 @@ valarray<_Tp>::operator^=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator&=(const value_type& __x)
{
@@ -3266,7 +3364,7 @@ valarray<_Tp>::operator&=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator|=(const value_type& __x)
{
@@ -3276,7 +3374,7 @@ valarray<_Tp>::operator|=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator<<=(const value_type& __x)
{
@@ -3286,7 +3384,7 @@ valarray<_Tp>::operator<<=(const value_type& __x)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
valarray<_Tp>&
valarray<_Tp>::operator>>=(const value_type& __x)
{
@@ -3297,7 +3395,7 @@ valarray<_Tp>::operator>>=(const value_type& __x)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3313,7 +3411,7 @@ valarray<_Tp>::operator*=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3329,7 +3427,7 @@ valarray<_Tp>::operator/=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3345,7 +3443,7 @@ valarray<_Tp>::operator%=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3361,7 +3459,7 @@ valarray<_Tp>::operator+=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3377,7 +3475,7 @@ valarray<_Tp>::operator-=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3393,7 +3491,7 @@ valarray<_Tp>::operator^=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3409,7 +3507,7 @@ valarray<_Tp>::operator|=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3425,7 +3523,7 @@ valarray<_Tp>::operator&=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3441,7 +3539,7 @@ valarray<_Tp>::operator<<=(const _Expr& __v)
template <class _Tp>
template <class _Expr>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
typename enable_if
<
__is_val_expr<_Expr>::value,
@@ -3456,7 +3554,7 @@ valarray<_Tp>::operator>>=(const _Expr& __v)
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
{
@@ -3465,7 +3563,7 @@ valarray<_Tp>::swap(valarray& __v) _NOEXCEPT
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_Tp
valarray<_Tp>::sum() const
{
@@ -3479,7 +3577,7 @@ valarray<_Tp>::sum() const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_Tp
valarray<_Tp>::min() const
{
@@ -3489,7 +3587,7 @@ valarray<_Tp>::min() const
}
template <class _Tp>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
_Tp
valarray<_Tp>::max() const
{
diff --git a/include/vector b/include/vector
index c168c8ea60ad..dbc0dd321824 100644
--- a/include/vector
+++ b/include/vector
@@ -51,8 +51,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ allocator_type::propagate_on_container_move_assignment::value ||
+ allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@@ -175,8 +175,8 @@ public:
vector& operator=(const vector& x);
vector& operator=(vector&& x)
noexcept(
- allocator_type::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ allocator_type::propagate_on_container_move_assignment::value ||
+ allocator_type::is_always_equal::value); // C++17
vector& operator=(initializer_list<value_type> il);
template <class InputIterator>
void assign(InputIterator first, InputIterator last);
@@ -562,9 +562,7 @@ public:
vector(vector&& __x, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __x)
- _NOEXCEPT_(
- __alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@@ -687,9 +685,11 @@ public:
_LIBCPP_INLINE_VISIBILITY void push_back(value_type&& __x);
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args>
+ _LIBCPP_INLINE_VISIBILITY
void emplace_back(_Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
+ _LIBCPP_INLINE_VISIBILITY
void pop_back();
iterator insert(const_iterator __position, const_reference __x);
@@ -768,6 +768,7 @@ private:
void deallocate() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
void __construct_at_end(size_type __n);
+ _LIBCPP_INLINE_VISIBILITY
void __construct_at_end(size_type __n, const_reference __x);
template <class _ForwardIterator>
typename enable_if
@@ -787,7 +788,8 @@ private:
void __move_range(pointer __from_s, pointer __from_e, pointer __to);
void __move_assign(vector& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
- void __move_assign(vector& __c, false_type);
+ void __move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
{
@@ -991,7 +993,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
@@ -1303,9 +1305,7 @@ template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
- _NOEXCEPT_(
- __alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__x, integral_constant<bool,
__alloc_traits::propagate_on_container_move_assignment::value>());
@@ -1315,6 +1315,7 @@ vector<_Tp, _Allocator>::operator=(vector&& __x)
template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::__move_assign(vector& __c, false_type)
+ _NOEXCEPT_(__alloc_traits::is_always_equal::value)
{
if (__base::__alloc() != __c.__alloc())
{
@@ -1629,7 +1630,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
template <class _Tp, class _Allocator>
template <class... _Args>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
@@ -1650,7 +1651,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
-inline _LIBCPP_INLINE_VISIBILITY
+inline
void
vector<_Tp, _Allocator>::pop_back()
{
@@ -1897,9 +1898,11 @@ vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __firs
pointer __old_last = this->__end_;
for (; this->__end_ != this->__end_cap() && __first != __last; ++__first)
{
+ __RAII_IncreaseAnnotator __annotator(*this);
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_),
*__first);
++this->__end_;
+ __annotator.__done();
}
__split_buffer<value_type, allocator_type&> __v(__a);
if (__first != __last)
@@ -2211,9 +2214,7 @@ public:
vector(vector&& __v, const allocator_type& __a);
_LIBCPP_INLINE_VISIBILITY
vector& operator=(vector&& __v)
- _NOEXCEPT_(
- __alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value);
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value));
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY
@@ -2836,9 +2837,7 @@ template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
- _NOEXCEPT_(
- __alloc_traits::propagate_on_container_move_assignment::value &&
- is_nothrow_move_assignable<allocator_type>::value)
+ _NOEXCEPT_((__noexcept_move_assign_container<_Allocator, __alloc_traits>::value))
{
__move_assign(__v, integral_constant<bool,
__storage_traits::propagate_on_container_move_assignment::value>());
diff --git a/include/wchar.h b/include/wchar.h
new file mode 100644
index 000000000000..da34f735edf3
--- /dev/null
+++ b/include/wchar.h
@@ -0,0 +1,136 @@
+// -*- C++ -*-
+//===--------------------------- wchar.h ----------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#if defined(__need_wint_t) || defined(__need_mbstate_t)
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <wchar.h>
+
+#elif !defined(_LIBCPP_WCHAR_H)
+#define _LIBCPP_WCHAR_H
+
+/*
+ wchar.h synopsis
+
+Macros:
+
+ NULL
+ WCHAR_MAX
+ WCHAR_MIN
+ WEOF
+
+Types:
+
+ mbstate_t
+ size_t
+ tm
+ wint_t
+
+int fwprintf(FILE* restrict stream, const wchar_t* restrict format, ...);
+int fwscanf(FILE* restrict stream, const wchar_t* restrict format, ...);
+int swprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, ...);
+int swscanf(const wchar_t* restrict s, const wchar_t* restrict format, ...);
+int vfwprintf(FILE* restrict stream, const wchar_t* restrict format, va_list arg);
+int vfwscanf(FILE* restrict stream, const wchar_t* restrict format, va_list arg); // C99
+int vswprintf(wchar_t* restrict s, size_t n, const wchar_t* restrict format, va_list arg);
+int vswscanf(const wchar_t* restrict s, const wchar_t* restrict format, va_list arg); // C99
+int vwprintf(const wchar_t* restrict format, va_list arg);
+int vwscanf(const wchar_t* restrict format, va_list arg); // C99
+int wprintf(const wchar_t* restrict format, ...);
+int wscanf(const wchar_t* restrict format, ...);
+wint_t fgetwc(FILE* stream);
+wchar_t* fgetws(wchar_t* restrict s, int n, FILE* restrict stream);
+wint_t fputwc(wchar_t c, FILE* stream);
+int fputws(const wchar_t* restrict s, FILE* restrict stream);
+int fwide(FILE* stream, int mode);
+wint_t getwc(FILE* stream);
+wint_t getwchar();
+wint_t putwc(wchar_t c, FILE* stream);
+wint_t putwchar(wchar_t c);
+wint_t ungetwc(wint_t c, FILE* stream);
+double wcstod(const wchar_t* restrict nptr, wchar_t** restrict endptr);
+float wcstof(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
+long double wcstold(const wchar_t* restrict nptr, wchar_t** restrict endptr); // C99
+long wcstol(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+long long wcstoll(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
+unsigned long wcstoul(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base);
+unsigned long long wcstoull(const wchar_t* restrict nptr, wchar_t** restrict endptr, int base); // C99
+wchar_t* wcscpy(wchar_t* restrict s1, const wchar_t* restrict s2);
+wchar_t* wcsncpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wcscat(wchar_t* restrict s1, const wchar_t* restrict s2);
+wchar_t* wcsncat(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+int wcscmp(const wchar_t* s1, const wchar_t* s2);
+int wcscoll(const wchar_t* s1, const wchar_t* s2);
+int wcsncmp(const wchar_t* s1, const wchar_t* s2, size_t n);
+size_t wcsxfrm(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+const wchar_t* wcschr(const wchar_t* s, wchar_t c);
+ wchar_t* wcschr( wchar_t* s, wchar_t c);
+size_t wcscspn(const wchar_t* s1, const wchar_t* s2);
+size_t wcslen(const wchar_t* s);
+const wchar_t* wcspbrk(const wchar_t* s1, const wchar_t* s2);
+ wchar_t* wcspbrk( wchar_t* s1, const wchar_t* s2);
+const wchar_t* wcsrchr(const wchar_t* s, wchar_t c);
+ wchar_t* wcsrchr( wchar_t* s, wchar_t c);
+size_t wcsspn(const wchar_t* s1, const wchar_t* s2);
+const wchar_t* wcsstr(const wchar_t* s1, const wchar_t* s2);
+ wchar_t* wcsstr( wchar_t* s1, const wchar_t* s2);
+wchar_t* wcstok(wchar_t* restrict s1, const wchar_t* restrict s2, wchar_t** restrict ptr);
+const wchar_t* wmemchr(const wchar_t* s, wchar_t c, size_t n);
+ wchar_t* wmemchr( wchar_t* s, wchar_t c, size_t n);
+int wmemcmp(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wmemcpy(wchar_t* restrict s1, const wchar_t* restrict s2, size_t n);
+wchar_t* wmemmove(wchar_t* s1, const wchar_t* s2, size_t n);
+wchar_t* wmemset(wchar_t* s, wchar_t c, size_t n);
+size_t wcsftime(wchar_t* restrict s, size_t maxsize, const wchar_t* restrict format,
+ const tm* restrict timeptr);
+wint_t btowc(int c);
+int wctob(wint_t c);
+int mbsinit(const mbstate_t* ps);
+size_t mbrlen(const char* restrict s, size_t n, mbstate_t* restrict ps);
+size_t mbrtowc(wchar_t* restrict pwc, const char* restrict s, size_t n, mbstate_t* restrict ps);
+size_t wcrtomb(char* restrict s, wchar_t wc, mbstate_t* restrict ps);
+size_t mbsrtowcs(wchar_t* restrict dst, const char** restrict src, size_t len,
+ mbstate_t* restrict ps);
+size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
+ mbstate_t* restrict ps);
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#ifdef __cplusplus
+#define __CORRECT_ISO_CPP_WCHAR_H_PROTO
+#endif
+
+#include_next <wchar.h>
+
+// Let <cwchar> know if we have const-correct overloads for wcschr and friends.
+#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+#elif defined(__GLIBC_PREREQ)
+# if __GLIBC_PREREQ(2, 10)
+# define _LIBCPP_WCHAR_H_HAS_CONST_OVERLOADS 1
+# endif
+#endif
+
+#if defined(__cplusplus) && (defined(_LIBCPP_MSVCRT) || defined(__MINGW32__))
+extern "C++" {
+#include <support/win32/support.h> // pull in *swprintf defines
+} // extern "C++"
+#endif // __cplusplus && _LIBCPP_MSVCRT
+
+#endif // _LIBCPP_WCHAR_H
diff --git a/include/wctype.h b/include/wctype.h
new file mode 100644
index 000000000000..f9c5a47754bb
--- /dev/null
+++ b/include/wctype.h
@@ -0,0 +1,79 @@
+// -*- C++ -*-
+//===--------------------------- wctype.h ---------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_WCTYPE_H
+#define _LIBCPP_WCTYPE_H
+
+/*
+ wctype.h synopsis
+
+Macros:
+
+ WEOF
+
+Types:
+
+ wint_t
+ wctrans_t
+ wctype_t
+
+int iswalnum(wint_t wc);
+int iswalpha(wint_t wc);
+int iswblank(wint_t wc); // C99
+int iswcntrl(wint_t wc);
+int iswdigit(wint_t wc);
+int iswgraph(wint_t wc);
+int iswlower(wint_t wc);
+int iswprint(wint_t wc);
+int iswpunct(wint_t wc);
+int iswspace(wint_t wc);
+int iswupper(wint_t wc);
+int iswxdigit(wint_t wc);
+int iswctype(wint_t wc, wctype_t desc);
+wctype_t wctype(const char* property);
+wint_t towlower(wint_t wc);
+wint_t towupper(wint_t wc);
+wint_t towctrans(wint_t wc, wctrans_t desc);
+wctrans_t wctrans(const char* property);
+
+*/
+
+#include <__config>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#include_next <wctype.h>
+
+#ifdef __cplusplus
+
+#undef iswalnum
+#undef iswalpha
+#undef iswblank
+#undef iswcntrl
+#undef iswdigit
+#undef iswgraph
+#undef iswlower
+#undef iswprint
+#undef iswpunct
+#undef iswspace
+#undef iswupper
+#undef iswxdigit
+#undef iswctype
+#undef wctype
+#undef towlower
+#undef towupper
+#undef towctrans
+#undef wctrans
+
+#endif // __cplusplus
+
+#endif // _LIBCPP_WCTYPE_H