Update to libc++ 6.0 (#6619)
* Update libc++ sources to 6.0.0 * Update symbols * Update AUTHORS * Also build `vector.cpp` * Also compile `functional.cpp`
This commit is contained in:
Родитель
877e717c5e
Коммит
b5313f6504
1
AUTHORS
1
AUTHORS
|
@ -336,3 +336,4 @@ a license to everyone to use it as detailed in LICENSE.)
|
|||
* Tyler Limkemann <tslimkemann42 gmail.com>
|
||||
* Ben Smith <binji@google.com> (copyright owned by Google, Inc.)
|
||||
* Sylvain Beucler <beuc@beuc.net>
|
||||
* Patrik Weiskircher <patrik@weiskircher.name>
|
||||
|
|
|
@ -20,7 +20,7 @@ endif()
|
|||
|
||||
if (LIBCXX_INSTALL_HEADERS)
|
||||
install(DIRECTORY .
|
||||
DESTINATION include/c++/v1
|
||||
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
COMPONENT cxx-headers
|
||||
FILES_MATCHING
|
||||
${LIBCXX_HEADER_PATTERN}
|
||||
|
@ -44,7 +44,7 @@ if (LIBCXX_INSTALL_HEADERS)
|
|||
set(generated_config_deps generate_config_header)
|
||||
# Install the generated header as __config.
|
||||
install(FILES ${LIBCXX_BINARY_DIR}/__generated_config
|
||||
DESTINATION include/c++/v1
|
||||
DESTINATION ${LIBCXX_INSTALL_PREFIX}include/c++/v1
|
||||
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
|
||||
RENAME __config
|
||||
COMPONENT cxx-headers)
|
||||
|
@ -58,9 +58,12 @@ if (LIBCXX_INSTALL_HEADERS)
|
|||
COMMAND "${CMAKE_COMMAND}"
|
||||
-DCMAKE_INSTALL_COMPONENT=cxx-headers
|
||||
-P "${CMAKE_BINARY_DIR}/cmake_install.cmake")
|
||||
# Stripping is a no-op for headers
|
||||
add_custom_target(install-cxx-headers-stripped DEPENDS install-cxx-headers)
|
||||
|
||||
add_custom_target(libcxx-headers)
|
||||
add_custom_target(install-libcxx-headers DEPENDS install-cxx-headers)
|
||||
add_custom_target(install-libcxx-headers-stripped DEPENDS install-cxx-headers-stripped)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
#include <__config>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator;
|
||||
|
@ -1273,4 +1275,6 @@ private:
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___BIT_REFERENCE
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
#ifndef _LIBCPP_BSD_LOCALE_DEFAULTS_H
|
||||
#define _LIBCPP_BSD_LOCALE_DEFAULTS_H
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#define __libcpp_mb_cur_max_l(loc) MB_CUR_MAX_L(loc)
|
||||
#define __libcpp_btowc_l(ch, loc) btowc_l(ch, loc)
|
||||
#define __libcpp_wctob_l(wch, loc) wctob_l(wch, loc)
|
||||
|
|
|
@ -15,31 +15,33 @@
|
|||
#define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <memory>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
typedef _VSTD::remove_pointer<locale_t>::type __use_locale_struct;
|
||||
typedef _VSTD::unique_ptr<__use_locale_struct, decltype(&uselocale)> __locale_raii;
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
decltype(MB_CUR_MAX) __libcpp_mb_cur_max_l(locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return MB_CUR_MAX;
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
wint_t __libcpp_btowc_l(int __c, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return btowc(__c);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
int __libcpp_wctob_l(wint_t __c, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return wctob(__c);
|
||||
}
|
||||
|
||||
|
@ -47,14 +49,14 @@ inline _LIBCPP_ALWAYS_INLINE
|
|||
size_t __libcpp_wcsnrtombs_l(char *__dest, const wchar_t **__src, size_t __nwc,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return wcsnrtombs(__dest, __src, __nwc, __len, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
size_t __libcpp_wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return wcrtomb(__s, __wc, __ps);
|
||||
}
|
||||
|
||||
|
@ -62,7 +64,7 @@ inline _LIBCPP_ALWAYS_INLINE
|
|||
size_t __libcpp_mbsnrtowcs_l(wchar_t * __dest, const char **__src, size_t __nms,
|
||||
size_t __len, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbsnrtowcs(__dest, __src, __nms, __len, __ps);
|
||||
}
|
||||
|
||||
|
@ -70,28 +72,28 @@ inline _LIBCPP_ALWAYS_INLINE
|
|||
size_t __libcpp_mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbrtowc(__pwc, __s, __n, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
int __libcpp_mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbtowc(__pwc, __pmb, __max);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
size_t __libcpp_mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbrlen(__s, __n, __ps);
|
||||
}
|
||||
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
lconv *__libcpp_localeconv_l(locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return localeconv();
|
||||
}
|
||||
|
||||
|
@ -99,7 +101,7 @@ inline _LIBCPP_ALWAYS_INLINE
|
|||
size_t __libcpp_mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
|
||||
mbstate_t *__ps, locale_t __l)
|
||||
{
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
return mbsrtowcs(__dest, __src, __len, __ps);
|
||||
}
|
||||
|
||||
|
@ -107,7 +109,7 @@ inline
|
|||
int __libcpp_snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
int __res = vsnprintf(__s, __n, __format, __va);
|
||||
va_end(__va);
|
||||
return __res;
|
||||
|
@ -117,7 +119,7 @@ inline
|
|||
int __libcpp_asprintf_l(char **__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
int __res = vasprintf(__s, __format, __va);
|
||||
va_end(__va);
|
||||
return __res;
|
||||
|
@ -127,7 +129,7 @@ inline
|
|||
int __libcpp_sscanf_l(const char *__s, locale_t __l, const char *__format, ...) {
|
||||
va_list __va;
|
||||
va_start(__va, __format);
|
||||
__locale_raii __current( uselocale(__l), uselocale );
|
||||
__libcpp_locale_guard __current(__l);
|
||||
int __res = vsscanf(__s, __format, __va);
|
||||
va_end(__va);
|
||||
return __res;
|
||||
|
|
|
@ -12,8 +12,10 @@
|
|||
#define _LIBCPP_CONFIG
|
||||
|
||||
#if defined(_MSC_VER) && !defined(__clang__)
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
|
@ -23,31 +25,46 @@
|
|||
|
||||
#ifdef __GNUC__
|
||||
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
|
||||
// The _GNUC_VER_NEW macro better represents the new GCC versioning scheme
|
||||
// introduced in GCC 5.0.
|
||||
#define _GNUC_VER_NEW (_GNUC_VER * 10 + __GNUC_PATCHLEVEL__)
|
||||
#else
|
||||
#define _GNUC_VER 0
|
||||
#define _GNUC_VER_NEW 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 4000
|
||||
#define _LIBCPP_VERSION 6000
|
||||
|
||||
#ifndef _LIBCPP_ABI_VERSION
|
||||
#define _LIBCPP_ABI_VERSION 1
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__) || defined(__EMSCRIPTEN__) // XXX EMSCRIPTEN: Add define to avoid selecting coff format which activates declspec defines (the ELF define is actually never used)
|
||||
#define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
#elif defined(__MACH__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_MACHO 1
|
||||
#elif defined(_WIN32)
|
||||
#define _LIBCPP_OBJECT_FORMAT_COFF 1
|
||||
#elif defined(__wasm__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_WASM 1
|
||||
#else
|
||||
#error Unknown object file format
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
// Change short string representation so that string data starts at offset 0,
|
||||
// improving its alignment in some cases.
|
||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
// Fix deque iterator type in order to support incomplete types.
|
||||
#define _LIBCPP_ABI_INCOMPLETE_TYPES_IN_DEQUE
|
||||
// Fix undefined behavior in how std::list stores it's linked nodes.
|
||||
// Fix undefined behavior in how std::list stores its linked nodes.
|
||||
#define _LIBCPP_ABI_LIST_REMOVE_NODE_POINTER_UB
|
||||
// Fix undefined behavior in how __tree stores its end and parent nodes.
|
||||
#define _LIBCPP_ABI_TREE_REMOVE_NODE_POINTER_UB
|
||||
// Fix undefined behavior in how __hash_table stores it's pointer types
|
||||
// Fix undefined behavior in how __hash_table stores its pointer types.
|
||||
#define _LIBCPP_ABI_FIX_UNORDERED_NODE_POINTER_UB
|
||||
#define _LIBCPP_ABI_FORWARD_LIST_REMOVE_NODE_POINTER_UB
|
||||
#define _LIBCPP_ABI_FIX_UNORDERED_CONTAINER_SIZE_TYPE
|
||||
#define _LIBCPP_ABI_VARIADIC_LOCK_GUARD
|
||||
// Don't use a nullptr_t simulation type in C++03 instead using C++11 nullptr
|
||||
// provided under the alternate keyword __nullptr, which changes the mangling
|
||||
// of nullptr_t. This option is ABI incompatible with GCC in C++03 mode.
|
||||
|
@ -57,10 +74,23 @@
|
|||
// `pointer_safety` and `get_pointer_safety()` will no longer be available
|
||||
// in C++03.
|
||||
#define _LIBCPP_ABI_POINTER_SAFETY_ENUM_TYPE
|
||||
// Define a key function for `bad_function_call` in the library, to centralize
|
||||
// its vtable and typeinfo to libc++ rather than having all other libraries
|
||||
// using that class define their own copies.
|
||||
#define _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
|
||||
// Enable optimized version of __do_get_(un)signed which avoids redundant copies.
|
||||
#define _LIBCPP_ABI_OPTIMIZED_LOCALE_NUM_GET
|
||||
// Use the smallest possible integer type to represent the index of the variant.
|
||||
// Previously libc++ used "unsigned int" exclusivly.
|
||||
#define _LIBCPP_ABI_VARIANT_INDEX_TYPE_OPTIMIZATION
|
||||
#elif _LIBCPP_ABI_VERSION == 1
|
||||
#if !defined(_WIN32)
|
||||
// Enable compiling a definition of error_category() into the libc++ dylib.
|
||||
#define _LIBCPP_DEPRECATED_ABI_EXTERNAL_ERROR_CATEGORY_CONSTRUCTOR
|
||||
#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
// Enable compiling copies of now inline methods into the dylib to support
|
||||
// applications compiled against older libraries. This is unnecessary with
|
||||
// COFF dllexport semantics, since dllexport forces a non-inline definition
|
||||
// of inline functions to be emitted anyway. Our own non-inline copy would
|
||||
// conflict with the dllexport-emitted copy, so we disable it.
|
||||
#define _LIBCPP_DEPRECATED_ABI_LEGACY_LIBRARY_DEFINITIONS_FOR_INLINE_FUNCTIONS
|
||||
#endif
|
||||
// Feature macros for disabling pre ABI v1 features. All of these options
|
||||
// are deprecated.
|
||||
|
@ -95,11 +125,25 @@
|
|||
#ifndef __has_feature
|
||||
#define __has_feature(__x) 0
|
||||
#endif
|
||||
#ifndef __has_cpp_attribute
|
||||
#define __has_cpp_attribute(__x) 0
|
||||
#endif
|
||||
// '__is_identifier' returns '0' if '__x' is a reserved identifier provided by
|
||||
// the compiler and '1' otherwise.
|
||||
#ifndef __is_identifier
|
||||
#define __is_identifier(__x) 1
|
||||
#endif
|
||||
#ifndef __has_declspec_attribute
|
||||
#define __has_declspec_attribute(__x) 0
|
||||
#endif
|
||||
|
||||
#define __has_keyword(__x) !(__is_identifier(__x))
|
||||
|
||||
#ifdef __has_include
|
||||
#define __libcpp_has_include(__x) __has_include(__x)
|
||||
#else
|
||||
#define __libcpp_has_include(__x) 0
|
||||
#endif
|
||||
|
||||
#if defined(__clang__)
|
||||
#define _LIBCPP_COMPILER_CLANG
|
||||
|
@ -115,16 +159,26 @@
|
|||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CLANG_VER
|
||||
# define _LIBCPP_CLANG_VER 0
|
||||
#define _LIBCPP_CLANG_VER 0
|
||||
#endif
|
||||
|
||||
// FIXME: ABI detection should be done via compiler builtin macros. This
|
||||
// is just a placeholder until Clang implements such macros. For now assume
|
||||
// that Windows compilers pretending to be MSVC++ target the microsoft ABI.
|
||||
#if defined(_WIN32) && defined(_MSC_VER)
|
||||
// that Windows compilers pretending to be MSVC++ target the Microsoft ABI,
|
||||
// and allow the user to explicitly specify the ABI to handle cases where this
|
||||
// heuristic falls short.
|
||||
#if defined(_LIBCPP_ABI_FORCE_ITANIUM) && defined(_LIBCPP_ABI_FORCE_MICROSOFT)
|
||||
# error "Only one of _LIBCPP_ABI_FORCE_ITANIUM and _LIBCPP_ABI_FORCE_MICROSOFT can be defined"
|
||||
#elif defined(_LIBCPP_ABI_FORCE_ITANIUM)
|
||||
# define _LIBCPP_ABI_ITANIUM
|
||||
#elif defined(_LIBCPP_ABI_FORCE_MICROSOFT)
|
||||
# define _LIBCPP_ABI_MICROSOFT
|
||||
#else
|
||||
# define _LIBCPP_ABI_ITANIUM
|
||||
# if defined(_WIN32) && defined(_MSC_VER)
|
||||
# define _LIBCPP_ABI_MICROSOFT
|
||||
# else
|
||||
# define _LIBCPP_ABI_ITANIUM
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Need to detect which libc we're using if we're on Linux.
|
||||
|
@ -137,36 +191,30 @@
|
|||
|
||||
#ifdef __LITTLE_ENDIAN__
|
||||
#if __LITTLE_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN 0
|
||||
#define _LIBCPP_LITTLE_ENDIAN
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
#endif // __LITTLE_ENDIAN__
|
||||
|
||||
#ifdef __BIG_ENDIAN__
|
||||
#if __BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN
|
||||
#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
|
||||
#define _LIBCPP_LITTLE_ENDIAN
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define _LIBCPP_LITTLE_ENDIAN 0
|
||||
#define _LIBCPP_BIG_ENDIAN 1
|
||||
#define _LIBCPP_BIG_ENDIAN
|
||||
#endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#endif // __BYTE_ORDER__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# ifndef __LONG_LONG_SUPPORTED
|
||||
# define _LIBCPP_HAS_NO_LONG_LONG
|
||||
|
@ -176,38 +224,48 @@
|
|||
#ifdef __NetBSD__
|
||||
# include <sys/endian.h>
|
||||
# if _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# else // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN
|
||||
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
#endif // __NetBSD__
|
||||
|
||||
#if defined(_WIN32)
|
||||
# define _LIBCPP_WIN32API 1
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_WIN32API
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# define _LIBCPP_SHORT_WCHAR 1
|
||||
|
||||
// If mingw not explicitly detected, assume using MS C runtime only.
|
||||
# ifndef __MINGW32__
|
||||
// Both MinGW and native MSVC provide a "MSVC"-like enviroment
|
||||
# define _LIBCPP_MSVCRT_LIKE
|
||||
// If mingw not explicitly detected, assume using MS C runtime only if
|
||||
// a MS compatibility version is specified.
|
||||
# if defined(_MSC_VER) && !defined(__MINGW32__)
|
||||
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
|
||||
# endif
|
||||
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
|
||||
# define _LIBCPP_HAS_BITSCAN64
|
||||
# endif
|
||||
# if defined(_LIBCPP_MSVCRT)
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
|
||||
// Some CRT APIs are unavailable to store apps
|
||||
#if defined(WINAPI_FAMILY)
|
||||
#include <winapifamily.h>
|
||||
#if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
|
||||
(!defined(WINAPI_PARTITION_SYSTEM) || \
|
||||
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
|
||||
#define _LIBCPP_WINDOWS_STORE_APP
|
||||
#endif
|
||||
#endif
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
#ifdef __sun__
|
||||
# include <sys/isa_defs.h>
|
||||
# ifdef _LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# else
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN
|
||||
# endif
|
||||
#endif // __sun__
|
||||
|
||||
|
@ -217,6 +275,8 @@
|
|||
// random data even when using sandboxing mechanisms such as chroots,
|
||||
// Capsicum, etc.
|
||||
# define _LIBCPP_USING_ARC4_RANDOM
|
||||
#elif defined(__Fuchsia__)
|
||||
# define _LIBCPP_USING_GETENTROPY
|
||||
#elif defined(__native_client__)
|
||||
// NaCl's sandbox (which PNaCl also runs in) doesn't allow filesystem access,
|
||||
// including accesses to the special files under /dev. C++11's
|
||||
|
@ -228,20 +288,18 @@
|
|||
# define _LIBCPP_USING_DEV_RANDOM
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
|
||||
# include <endian.h>
|
||||
# if __BYTE_ORDER == __LITTLE_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN 0
|
||||
# define _LIBCPP_LITTLE_ENDIAN
|
||||
# elif __BYTE_ORDER == __BIG_ENDIAN
|
||||
# define _LIBCPP_LITTLE_ENDIAN 0
|
||||
# define _LIBCPP_BIG_ENDIAN 1
|
||||
# define _LIBCPP_BIG_ENDIAN
|
||||
# else // __BYTE_ORDER == __BIG_ENDIAN
|
||||
# error unable to determine endian
|
||||
# endif
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
|
||||
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
|
||||
|
||||
#if __has_attribute(__no_sanitize__)
|
||||
#if __has_attribute(__no_sanitize__) && !defined(_LIBCPP_COMPILER_GCC)
|
||||
#define _LIBCPP_NO_CFI __attribute__((__no_sanitize__("cfi")))
|
||||
#else
|
||||
#define _LIBCPP_NO_CFI
|
||||
|
@ -252,7 +310,7 @@
|
|||
// _LIBCPP_ALTERNATE_STRING_LAYOUT is an old name for
|
||||
// _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT left here for backward compatibility.
|
||||
#if (defined(__APPLE__) && !defined(__i386__) && !defined(__x86_64__) && \
|
||||
!defined(__arm__)) || \
|
||||
(!defined(__arm__) || __ARM_ARCH_7K__ >= 2)) || \
|
||||
defined(_LIBCPP_ALTERNATE_STRING_LAYOUT)
|
||||
#define _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
#endif
|
||||
|
@ -274,7 +332,7 @@ typedef __char32_t char32_t;
|
|||
#define _LIBCPP_NO_EXCEPTIONS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rtti))
|
||||
#if !(__has_feature(cxx_rtti)) && !defined(_LIBCPP_NO_RTTI)
|
||||
#define _LIBCPP_NO_RTTI
|
||||
#endif
|
||||
|
||||
|
@ -297,7 +355,7 @@ typedef __char32_t char32_t;
|
|||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
# if __has_extension(cxx_nullptr) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# define nullptr __nullptr
|
||||
# else
|
||||
# define _LIBCPP_HAS_NO_NULLPTR
|
||||
|
@ -335,7 +393,6 @@ typedef __char32_t char32_t;
|
|||
|
||||
#if __has_feature(objc_arc_weak)
|
||||
#define _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
#define _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_constexpr))
|
||||
|
@ -401,6 +458,14 @@ namespace std {
|
|||
// Allow for build-time disabling of unsigned integer sanitization
|
||||
#if !defined(_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK) && __has_attribute(no_sanitize)
|
||||
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK __attribute__((__no_sanitize__("unsigned-integer-overflow")))
|
||||
#endif
|
||||
|
||||
#if __has_builtin(__builtin_launder)
|
||||
#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
|
||||
#endif
|
||||
|
||||
#if !__is_identifier(__has_unique_object_representations)
|
||||
#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
|
||||
#endif
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_GCC)
|
||||
|
@ -472,20 +537,27 @@ namespace std {
|
|||
|
||||
#endif // __GXX_EXPERIMENTAL_CXX0X__
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { inline namespace _LIBCPP_NAMESPACE {
|
||||
#define _LIBCPP_END_NAMESPACE_STD } }
|
||||
#define _VSTD std::_LIBCPP_NAMESPACE
|
||||
|
||||
namespace std {
|
||||
namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
|
||||
inline namespace _LIBCPP_NAMESPACE {
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_ASAN) && !defined(__SANITIZE_ADDRESS__)
|
||||
#define _LIBCPP_HAS_NO_ASAN
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER >= 700
|
||||
#define _LIBCPP_COMPILER_HAS_BUILTIN_LAUNDER
|
||||
#endif
|
||||
|
||||
#if _GNUC_VER >= 700
|
||||
#define _LIBCPP_HAS_UNIQUE_OBJECT_REPRESENTATIONS
|
||||
#endif
|
||||
|
||||
#elif defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
||||
#define _LIBCPP_TOSTRING2(x) #x
|
||||
|
@ -551,14 +623,6 @@ namespace std {
|
|||
|
||||
#endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM]
|
||||
|
||||
#if defined(__ELF__) || defined(__EMSCRIPTEN__) // XXX EMSCRIPTEN: Add define to avoid selecting coff format which activates declspec defines (the ELF define is actually never used)
|
||||
#define _LIBCPP_OBJECT_FORMAT_ELF 1
|
||||
#elif defined(__MACH__)
|
||||
#define _LIBCPP_OBJECT_FORMAT_MACHO 1
|
||||
#else
|
||||
#define _LIBCPP_OBJECT_FORMAT_COFF 1
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_DLL_VIS
|
||||
|
@ -579,10 +643,11 @@ namespace std {
|
|||
|
||||
#define _LIBCPP_TYPE_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_FUNC_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXTERN_VIS _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_DLL_VIS
|
||||
#define _LIBCPP_HIDDEN
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#define _LIBCPP_TEMPLATE_VIS
|
||||
#define _LIBCPP_FUNC_VIS_ONLY
|
||||
#define _LIBCPP_ENUM_VIS
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
|
@ -604,6 +669,15 @@ namespace std {
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
// The inline should be removed once PR32114 is resolved
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS inline _LIBCPP_HIDDEN
|
||||
#else
|
||||
#define _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS
|
||||
#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default")))
|
||||
|
@ -614,22 +688,26 @@ namespace std {
|
|||
|
||||
#ifndef _LIBCPP_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# if __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# endif
|
||||
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TYPE_VIS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TEMPLATE_VIS
|
||||
# define _LIBCPP_TEMPLATE_VIS _LIBCPP_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS)
|
||||
# if __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_TEMPLATE_VIS __attribute__ ((__visibility__("default")))
|
||||
# endif
|
||||
# else
|
||||
# define _LIBCPP_TEMPLATE_VIS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_FUNC_VIS_ONLY
|
||||
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
|
||||
#ifndef _LIBCPP_EXTERN_VIS
|
||||
# define _LIBCPP_EXTERN_VIS
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_OVERRIDABLE_FUNC_VIS
|
||||
|
@ -654,7 +732,7 @@ namespace std {
|
|||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default")))
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__visibility__("default")))
|
||||
# else
|
||||
# define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS
|
||||
# endif
|
||||
|
@ -739,7 +817,7 @@ template <unsigned> struct __static_assert_check {};
|
|||
|
||||
#ifdef _LIBCPP_HAS_NO_DECLTYPE
|
||||
// GCC 4.6 provides __decltype in all standard modes.
|
||||
#if !__is_identifier(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
|
||||
#if __has_keyword(__decltype) || _LIBCPP_CLANG_VER >= 304 || _GNUC_VER >= 406
|
||||
# define decltype(__x) __decltype(__x)
|
||||
#else
|
||||
# define decltype(__x) __typeof__(__x)
|
||||
|
@ -802,7 +880,14 @@ template <unsigned> struct __static_assert_check {};
|
|||
# else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
# endif
|
||||
# if !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
|
@ -817,7 +902,7 @@ template <unsigned> struct __static_assert_check {};
|
|||
#define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT) || \
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) || \
|
||||
defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
|
||||
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
|
||||
#endif
|
||||
|
@ -858,8 +943,10 @@ template <unsigned> struct __static_assert_check {};
|
|||
# define _LIBCPP_STD_VER 11
|
||||
# elif __cplusplus <= 201402L
|
||||
# define _LIBCPP_STD_VER 14
|
||||
# elif __cplusplus <= 201703L
|
||||
# define _LIBCPP_STD_VER 17
|
||||
# else
|
||||
# define _LIBCPP_STD_VER 16 // current year, or date of c++17 ratification
|
||||
# define _LIBCPP_STD_VER 18 // current year, or date of c++2a ratification
|
||||
# endif
|
||||
#endif // _LIBCPP_STD_VER
|
||||
|
||||
|
@ -889,9 +976,22 @@ template <unsigned> struct __static_assert_check {};
|
|||
#define _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
#endif
|
||||
|
||||
// FIXME: Remove all usages of this macro once compilers catch up.
|
||||
#if !defined(__cpp_inline_variables) || (__cpp_inline_variables < 201606L)
|
||||
# define _LIBCPP_HAS_NO_INLINE_VARIABLES
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX17 constexpr
|
||||
#else
|
||||
#define _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
#endif
|
||||
|
||||
#if __has_cpp_attribute(nodiscard) && _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_NODISCARD_AFTER_CXX17)
|
||||
#define _LIBCPP_NODISCARD_AFTER_CXX17 [[nodiscard]]
|
||||
#else
|
||||
#define _LIBCPP_NODISCARD_AFTER_CXX17
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 14 && defined(__cpp_inline_variables) && (__cpp_inline_variables >= 201606L)
|
||||
# define _LIBCPP_INLINE_VAR inline
|
||||
#else
|
||||
# define _LIBCPP_INLINE_VAR
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
@ -912,7 +1012,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
# if defined(__GNUC__) && ((__GNUC__ >= 5) || (__GNUC__ == 4 && \
|
||||
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2))) && !defined(__GXX_RTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
|
||||
# elif defined(_LIBCPP_COMPILER_MSVC) && !defined(_CPPRTTI)
|
||||
# define _LIBCPP_NO_RTTI
|
||||
# endif
|
||||
#endif
|
||||
|
@ -923,7 +1023,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
|
||||
// Thread API
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
!defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_WIN32) && \
|
||||
!defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__Fuchsia__) || \
|
||||
defined(__NetBSD__) || \
|
||||
|
@ -931,7 +1033,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__) || \
|
||||
defined(__EMSCRIPTEN__)
|
||||
defined(__EMSCRIPTEN__) || \
|
||||
(defined(__MINGW32__) && __libcpp_has_include(<pthread.h>))
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(_LIBCPP_WIN32API)
|
||||
# define _LIBCPP_HAS_THREAD_API_WIN32
|
||||
|
@ -946,7 +1049,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
# error _LIBCPP_HAS_EXTERNAL_THREAD_API may not be defined when \
|
||||
# error _LIBCPP_HAS_THREAD_API_EXTERNAL may not be defined when \
|
||||
_LIBCPP_HAS_NO_THREADS is defined.
|
||||
#endif
|
||||
|
||||
|
@ -971,7 +1074,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#endif
|
||||
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || \
|
||||
defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
defined(__Fuchsia__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
#endif
|
||||
|
||||
|
@ -981,7 +1084,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#define _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
|
||||
#endif
|
||||
|
||||
#if __has_feature(cxx_atomic) || __has_extension(c_atomic)
|
||||
#if __has_feature(cxx_atomic) || __has_extension(c_atomic) || __has_keyword(_Atomic)
|
||||
#define _LIBCPP_HAS_C_ATOMIC_IMP
|
||||
#elif _GNUC_VER > 407
|
||||
#define _LIBCPP_HAS_GCC_ATOMIC_IMP
|
||||
|
@ -996,10 +1099,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#define _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
#endif
|
||||
|
||||
#if (defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS) && defined(__clang__) \
|
||||
&& __has_attribute(acquire_capability))
|
||||
#if defined(_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS)
|
||||
#if defined(__clang__) && __has_attribute(acquire_capability)
|
||||
// Work around the attribute handling in clang. When both __declspec and
|
||||
// __attribute__ are present, the processing goes awry preventing the definition
|
||||
// of the types.
|
||||
#if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
#define _LIBCPP_HAS_THREAD_SAFETY_ANNOTATIONS
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(require_constant_initialization)
|
||||
#define _LIBCPP_SAFE_STATIC __attribute__((__require_constant_initialization__))
|
||||
|
@ -1008,7 +1117,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#endif
|
||||
|
||||
#if !__has_builtin(__builtin_addressof) && _GNUC_VER < 700
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
# define _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
|
||||
|
@ -1017,6 +1126,165 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if __has_attribute(diagnose_if) && !defined(_LIBCPP_DISABLE_ADDITIONAL_DIAGNOSTICS)
|
||||
# define _LIBCPP_DIAGNOSE_WARNING(...) \
|
||||
__attribute__((diagnose_if(__VA_ARGS__, "warning")))
|
||||
# define _LIBCPP_DIAGNOSE_ERROR(...) \
|
||||
__attribute__((diagnose_if(__VA_ARGS__, "error")))
|
||||
#else
|
||||
# define _LIBCPP_DIAGNOSE_WARNING(...)
|
||||
# define _LIBCPP_DIAGNOSE_ERROR(...)
|
||||
#endif
|
||||
|
||||
#if __has_attribute(fallthough) || _GNUC_VER >= 700
|
||||
// Use a function like macro to imply that it must be followed by a semicolon
|
||||
#define _LIBCPP_FALLTHROUGH() __attribute__((__fallthrough__))
|
||||
#else
|
||||
#define _LIBCPP_FALLTHROUGH() ((void)0)
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && \
|
||||
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
#else
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ENABLE_CXX17_REMOVED_FEATURES)
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE
|
||||
# define _LIBCPP_ENABLE_CXX17_REMOVED_BINDERS
|
||||
#endif // _LIBCPP_ENABLE_CXX17_REMOVED_FEATURES
|
||||
|
||||
#if !defined(__cpp_deduction_guides) || __cpp_deduction_guides < 201611
|
||||
# define _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
#endif
|
||||
|
||||
#if !__has_keyword(__is_aggregate) && (_GNUC_VER_NEW < 7001)
|
||||
# define _LIBCPP_HAS_NO_IS_AGGREGATE
|
||||
#endif
|
||||
|
||||
#if !defined(__cpp_coroutines) || __cpp_coroutines < 201703L
|
||||
# define _LIBCPP_HAS_NO_COROUTINES
|
||||
#endif
|
||||
|
||||
// Decide whether to use availability macros.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCPP_DISABLE_AVAILABILITY) && \
|
||||
__has_feature(attribute_availability_with_strict) && \
|
||||
__has_feature(attribute_availability_in_templates)
|
||||
#ifdef __APPLE__
|
||||
#define _LIBCPP_USE_AVAILABILITY_APPLE
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Define availability macros.
|
||||
#if defined(_LIBCPP_USE_AVAILABILITY_APPLE)
|
||||
#define _LIBCPP_AVAILABILITY_SHARED_MUTEX \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS __attribute__((unavailable))
|
||||
#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH __attribute__((unavailable))
|
||||
#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST __attribute__((unavailable))
|
||||
#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.12))) \
|
||||
__attribute__((availability(ios,strict,introduced=10.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=10.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=3.0)))
|
||||
#define _LIBCPP_AVAILABILITY_FUTURE_ERROR \
|
||||
__attribute__((availability(ios,strict,introduced=6.0)))
|
||||
#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR \
|
||||
__attribute__((availability(macosx,strict,introduced=10.9))) \
|
||||
__attribute__((availability(ios,strict,introduced=7.0)))
|
||||
#else
|
||||
#define _LIBCPP_AVAILABILITY_SHARED_MUTEX
|
||||
#define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
#define _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
|
||||
#define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
#define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
|
||||
#define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
|
||||
#define _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
#define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
|
||||
#define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
|
||||
#define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
|
||||
#endif
|
||||
|
||||
// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
#define _LIBCPP_AVAILABILITY_DYNARRAY
|
||||
#define _LIBCPP_AVAILABILITY_FUTURE
|
||||
#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
#else
|
||||
#define _LIBCPP_AVAILABILITY_DYNARRAY _LIBCPP_AVAILABILITY_BAD_ARRAY_LENGTH
|
||||
#define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
#define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST \
|
||||
_LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
#endif
|
||||
|
||||
// Availability of stream API in the dylib got dropped and re-added. The
|
||||
// extern template should effectively be available at:
|
||||
// availability(macosx,introduced=10.9)
|
||||
// availability(ios,introduced=7.0)
|
||||
#if defined(_LIBCPP_USE_AVAILABILITY_APPLE) && \
|
||||
((defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && \
|
||||
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ < 1090) || \
|
||||
(defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && \
|
||||
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ < 70000))
|
||||
#define _LIBCPP_AVAILABILITY_NO_STREAMS_EXTERN_TEMPLATE
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_IBM)
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
|
||||
# define _LIBCPP_PUSH_MACROS
|
||||
# define _LIBCPP_POP_MACROS
|
||||
#else
|
||||
// Don't warn about macro conflicts when we can restore them at the
|
||||
// end of the header.
|
||||
# ifndef _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
|
||||
# define _LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS
|
||||
# endif
|
||||
# if defined(_LIBCPP_COMPILER_MSVC)
|
||||
# define _LIBCPP_PUSH_MACROS \
|
||||
__pragma(push_macro("min")) \
|
||||
__pragma(push_macro("max"))
|
||||
# define _LIBCPP_POP_MACROS \
|
||||
__pragma(pop_macro("min")) \
|
||||
__pragma(pop_macro("max"))
|
||||
# else
|
||||
# define _LIBCPP_PUSH_MACROS \
|
||||
_Pragma("push_macro(\"min\")") \
|
||||
_Pragma("push_macro(\"max\")")
|
||||
# define _LIBCPP_POP_MACROS \
|
||||
_Pragma("pop_macro(\"min\")") \
|
||||
_Pragma("pop_macro(\"max\")")
|
||||
# endif
|
||||
#endif // defined(_LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO)
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# if defined(_DLL)
|
||||
# pragma(lib, "c++.lib")
|
||||
# else
|
||||
# pragma(lib, "libc++.lib")
|
||||
# endif
|
||||
#endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#cmakedefine _LIBCPP_ABI_VERSION @_LIBCPP_ABI_VERSION@
|
||||
#cmakedefine _LIBCPP_ABI_UNSTABLE
|
||||
#cmakedefine _LIBCPP_ABI_FORCE_ITANIUM
|
||||
#cmakedefine _LIBCPP_ABI_FORCE_MICROSOFT
|
||||
#cmakedefine _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
|
||||
#cmakedefine _LIBCPP_HAS_NO_STDIN
|
||||
#cmakedefine _LIBCPP_HAS_NO_STDOUT
|
||||
|
@ -23,5 +25,8 @@
|
|||
#cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
|
||||
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_NO_VCRUNTIME
|
||||
|
||||
@_LIBCPP_ABI_DEFINES@
|
||||
|
||||
#endif // _LIBCPP_CONFIG_SITE
|
||||
|
|
|
@ -74,7 +74,7 @@ typedef void(*__libcpp_debug_function_type)(__libcpp_debug_info const&);
|
|||
|
||||
/// __libcpp_debug_function - The handler function called when a _LIBCPP_ASSERT
|
||||
/// fails.
|
||||
extern __libcpp_debug_function_type __libcpp_debug_function;
|
||||
extern _LIBCPP_EXTERN_VIS __libcpp_debug_function_type __libcpp_debug_function;
|
||||
|
||||
/// __libcpp_abort_debug_function - A debug handler that aborts when called.
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS
|
||||
|
|
|
@ -704,7 +704,7 @@ function<_Rp()>::target()
|
|||
{
|
||||
if (__f_ == 0)
|
||||
return (_Tp*)0;
|
||||
return (_Tp*)__f_->target(typeid(_Tp));
|
||||
return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
|
||||
}
|
||||
|
||||
template<class _Rp>
|
||||
|
@ -980,7 +980,7 @@ function<_Rp(_A0)>::target()
|
|||
{
|
||||
if (__f_ == 0)
|
||||
return (_Tp*)0;
|
||||
return (_Tp*)__f_->target(typeid(_Tp));
|
||||
return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0>
|
||||
|
@ -1256,7 +1256,7 @@ function<_Rp(_A0, _A1)>::target()
|
|||
{
|
||||
if (__f_ == 0)
|
||||
return (_Tp*)0;
|
||||
return (_Tp*)__f_->target(typeid(_Tp));
|
||||
return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0, class _A1>
|
||||
|
@ -1532,7 +1532,7 @@ function<_Rp(_A0, _A1, _A2)>::target()
|
|||
{
|
||||
if (__f_ == 0)
|
||||
return (_Tp*)0;
|
||||
return (_Tp*)__f_->target(typeid(_Tp));
|
||||
return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
|
||||
}
|
||||
|
||||
template<class _Rp, class _A0, class _A1, class _A2>
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <typeinfo>
|
||||
#include <exception>
|
||||
#include <new>
|
||||
#include <utility>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
@ -23,13 +24,6 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Arg, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS unary_function
|
||||
{
|
||||
typedef _Arg argument_type;
|
||||
typedef _Result result_type;
|
||||
};
|
||||
|
||||
template <class _Arg1, class _Arg2, class _Result>
|
||||
struct _LIBCPP_TEMPLATE_VIS binary_function
|
||||
{
|
||||
|
@ -257,7 +251,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile>
|
|||
};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
// 3 or more arguments
|
||||
|
||||
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4>
|
||||
|
@ -302,10 +296,6 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
|||
typedef _Rp result_type;
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
|
@ -322,7 +312,7 @@ struct __invoke_return
|
|||
template <class _Ret>
|
||||
struct __invoke_void_return_wrapper
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static _Ret __call(_Args&&... __args) {
|
||||
return __invoke(_VSTD::forward<_Args>(__args)...);
|
||||
|
@ -353,7 +343,7 @@ struct __invoke_void_return_wrapper
|
|||
template <>
|
||||
struct __invoke_void_return_wrapper<void>
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static void __call(_Args&&... __args) {
|
||||
__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
|
@ -395,7 +385,7 @@ public:
|
|||
// construct/copy/destroy
|
||||
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
|
||||
: __f_(_VSTD::addressof(__f)) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
|
||||
#endif
|
||||
|
||||
|
@ -403,7 +393,7 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;}
|
||||
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -516,7 +506,7 @@ public:
|
|||
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
};
|
||||
|
||||
|
||||
|
@ -558,26 +548,23 @@ template <class _Tp> void cref(const _Tp&&) = delete;
|
|||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp1, class _Tp2 = void>
|
||||
struct __is_transparent
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
|
||||
};
|
||||
template <class _Tp, class, class = void>
|
||||
struct __is_transparent : false_type {};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __is_transparent<_Tp, _Up,
|
||||
typename __void_t<typename _Tp::is_transparent>::type>
|
||||
: true_type {};
|
||||
#endif
|
||||
|
||||
// allocator_arg_t
|
||||
|
||||
struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { };
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||
#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MEMORY)
|
||||
extern const allocator_arg_t allocator_arg;
|
||||
#else
|
||||
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr allocator_arg_t allocator_arg = allocator_arg_t();
|
||||
#endif
|
||||
|
||||
// uses_allocator
|
||||
|
@ -614,10 +601,10 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator
|
|||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp, class _Alloc>
|
||||
constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t uses_allocator_v = uses_allocator<_Tp, _Alloc>::value;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
// allocator construction
|
||||
|
||||
|
@ -669,7 +656,7 @@ void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&...
|
|||
__storage, __a, _VSTD::forward<_Args>(__args)...
|
||||
);
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
|
@ -27,9 +26,12 @@
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Tp>
|
||||
union __hash_value_type;
|
||||
|
@ -38,6 +40,15 @@ template <class _Key, class _Tp>
|
|||
struct __hash_value_type;
|
||||
#endif
|
||||
|
||||
template <class _Key, class _Cp, class _Hash,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
|
||||
class __unordered_map_hasher;
|
||||
|
||||
template <class _Key, class _Cp, class _Pred,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value
|
||||
>
|
||||
class __unordered_map_equal;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_hash_value_type_imp : false_type {};
|
||||
|
@ -126,7 +137,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||
size_t
|
||||
__next_hash_pow2(size_t __n)
|
||||
{
|
||||
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
|
||||
return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1)));
|
||||
}
|
||||
|
||||
|
||||
|
@ -788,8 +799,7 @@ public:
|
|||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
: __data_(__size, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
|
@ -797,8 +807,7 @@ public:
|
|||
{
|
||||
__x.size() = 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __data_.first();}
|
||||
|
@ -856,6 +865,37 @@ public:
|
|||
template <class> friend class __hash_map_node_destructor;
|
||||
};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class _Hash, class _Equal, class _Alloc>
|
||||
struct __diagnose_hash_table_helper {
|
||||
static constexpr bool __trigger_diagnostics()
|
||||
_LIBCPP_DIAGNOSE_WARNING(__check_hash_requirements<_Key, _Hash>::value
|
||||
&& !__invokable<_Hash const&, _Key const&>::value,
|
||||
"the specified hash functor does not provide a const call operator")
|
||||
_LIBCPP_DIAGNOSE_WARNING(is_copy_constructible<_Equal>::value
|
||||
&& !__invokable<_Equal const&, _Key const&, _Key const&>::value,
|
||||
"the specified comparator type does not provide a const call operator")
|
||||
{
|
||||
static_assert(__check_hash_requirements<_Key, _Hash>::value,
|
||||
"the specified hash does not meet the Hash requirements");
|
||||
static_assert(is_copy_constructible<_Equal>::value,
|
||||
"the specified comparator is required to be copy constructible");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Value, class _Hash, class _Equal, class _Alloc>
|
||||
struct __diagnose_hash_table_helper<
|
||||
__hash_value_type<_Key, _Value>,
|
||||
__unordered_map_hasher<_Key, __hash_value_type<_Key, _Value>, _Hash>,
|
||||
__unordered_map_equal<_Key, __hash_value_type<_Key, _Value>, _Equal>,
|
||||
_Alloc>
|
||||
: __diagnose_hash_table_helper<_Key, _Hash, _Equal, _Alloc>
|
||||
{
|
||||
};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
class __hash_table
|
||||
{
|
||||
|
@ -918,6 +958,10 @@ private:
|
|||
typedef allocator_traits<__pointer_allocator> __pointer_alloc_traits;
|
||||
typedef typename __bucket_list_deleter::pointer __node_pointer_pointer;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
static_assert(__diagnose_hash_table_helper<_Tp, _Hash, _Equal, _Alloc>::__trigger_diagnostics(), "");
|
||||
#endif
|
||||
|
||||
// --- Member data begin ---
|
||||
__bucket_list __bucket_list_;
|
||||
__compressed_pair<__first_node, __node_allocator> __p1_;
|
||||
|
@ -1357,7 +1401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
|||
const key_equal& __eql,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __hf),
|
||||
__p3_(1.0f, __eql)
|
||||
{
|
||||
|
@ -1366,7 +1410,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const hasher& __hf,
|
|||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0),
|
||||
__p3_(1.0f)
|
||||
{
|
||||
|
@ -1378,7 +1422,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u)
|
|||
__bucket_list_deleter(allocator_traits<__pointer_allocator>::
|
||||
select_on_container_copy_construction(
|
||||
__u.__bucket_list_.get_deleter().__alloc()), 0)),
|
||||
__p1_(allocator_traits<__node_allocator>::
|
||||
__p1_(__second_tag(), allocator_traits<__node_allocator>::
|
||||
select_on_container_copy_construction(__u.__node_alloc())),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
|
@ -1389,7 +1433,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
|||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, __u.hash_function()),
|
||||
__p3_(__u.__p3_)
|
||||
{
|
||||
|
@ -1423,7 +1467,7 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
|||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
const allocator_type& __a)
|
||||
: __bucket_list_(nullptr, __bucket_list_deleter(__pointer_allocator(__a), 0)),
|
||||
__p1_(__node_allocator(__a)),
|
||||
__p1_(__second_tag(), __node_allocator(__a)),
|
||||
__p2_(0, _VSTD::move(__u.hash_function())),
|
||||
__p3_(_VSTD::move(__u.__p3_))
|
||||
{
|
||||
|
@ -1449,10 +1493,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
|||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
{
|
||||
#if defined(_LIBCPP_CXX03_LANG)
|
||||
static_assert((is_copy_constructible<key_equal>::value),
|
||||
"Predicate must be copy-constructible.");
|
||||
static_assert((is_copy_constructible<hasher>::value),
|
||||
"Hasher must be copy-constructible.");
|
||||
#endif
|
||||
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
__get_db()->__erase_c(this);
|
||||
|
@ -2621,6 +2668,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
|
|||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP__HASH_TABLE
|
||||
|
|
|
@ -1 +1 @@
|
|||
4000
|
||||
6000
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <cstdint>
|
||||
#include <cctype>
|
||||
#include <locale.h>
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif defined(_AIX)
|
||||
# include <support/ibm/xlocale.h>
|
||||
|
@ -34,12 +34,14 @@
|
|||
# include <support/solaris/xlocale.h>
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
# include <support/newlib/xlocale.h>
|
||||
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) \
|
||||
#elif (defined(__APPLE__) || defined(__FreeBSD__) \
|
||||
|| defined(__EMSCRIPTEN__) || defined(__IBMCPP__))
|
||||
# include <xlocale.h>
|
||||
#elif defined(__Fuchsia__)
|
||||
# include <support/fuchsia/xlocale.h>
|
||||
#elif defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# include <support/musl/xlocale.h>
|
||||
#endif // __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
@ -47,6 +49,51 @@
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
|
||||
struct __libcpp_locale_guard {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__libcpp_locale_guard() {
|
||||
if (__old_loc_)
|
||||
uselocale(__old_loc_);
|
||||
}
|
||||
|
||||
locale_t __old_loc_;
|
||||
private:
|
||||
__libcpp_locale_guard(__libcpp_locale_guard const&);
|
||||
__libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
|
||||
};
|
||||
#elif defined(_LIBCPP_MSVCRT_LIKE)
|
||||
struct __libcpp_locale_guard {
|
||||
__libcpp_locale_guard(locale_t __l) :
|
||||
__status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)),
|
||||
__locale_collate(setlocale(LC_COLLATE, __l.__get_locale())),
|
||||
__locale_ctype(setlocale(LC_CTYPE, __l.__get_locale())),
|
||||
__locale_monetary(setlocale(LC_MONETARY, __l.__get_locale())),
|
||||
__locale_numeric(setlocale(LC_NUMERIC, __l.__get_locale())),
|
||||
__locale_time(setlocale(LC_TIME, __l.__get_locale()))
|
||||
// LC_MESSAGES is not supported on Windows.
|
||||
{}
|
||||
~__libcpp_locale_guard() {
|
||||
setlocale(LC_COLLATE, __locale_collate);
|
||||
setlocale(LC_CTYPE, __locale_ctype);
|
||||
setlocale(LC_MONETARY, __locale_monetary);
|
||||
setlocale(LC_NUMERIC, __locale_numeric);
|
||||
setlocale(LC_TIME, __locale_time);
|
||||
_configthreadlocale(__status);
|
||||
}
|
||||
int __status;
|
||||
char* __locale_collate;
|
||||
char* __locale_ctype;
|
||||
char* __locale_monetary;
|
||||
char* __locale_numeric;
|
||||
char* __locale_time;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _LIBCPP_TYPE_VIS locale;
|
||||
|
||||
template <class _Facet>
|
||||
|
@ -67,6 +114,7 @@ public:
|
|||
class _LIBCPP_TYPE_VIS id;
|
||||
|
||||
typedef int category;
|
||||
_LIBCPP_AVAILABILITY_LOCALE_CATEGORY
|
||||
static const category // values assigned here are for exposition only
|
||||
none = 0,
|
||||
collate = LC_COLLATE_MASK,
|
||||
|
@ -92,13 +140,16 @@ public:
|
|||
|
||||
const locale& operator=(const locale&) _NOEXCEPT;
|
||||
|
||||
template <class _Facet> locale combine(const locale&) const;
|
||||
template <class _Facet>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
locale combine(const locale&) const;
|
||||
|
||||
// locale operations:
|
||||
string name() const;
|
||||
bool operator==(const locale&) const;
|
||||
bool operator!=(const locale& __y) const {return !(*this == __y);}
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool operator()(const basic_string<_CharT, _Traits, _Allocator>&,
|
||||
const basic_string<_CharT, _Traits, _Allocator>&) const;
|
||||
|
||||
|
@ -342,7 +393,7 @@ public:
|
|||
static const mask punct = _ISpunct;
|
||||
static const mask xdigit = _ISxdigit;
|
||||
static const mask blank = _ISblank;
|
||||
#elif defined(_LIBCPP_MSVCRT)
|
||||
#elif defined(_LIBCPP_MSVCRT_LIKE)
|
||||
typedef unsigned short mask;
|
||||
static const mask space = _SPACE;
|
||||
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
|
||||
|
|
|
@ -16,10 +16,15 @@
|
|||
#include <system_error>
|
||||
#include <__threading_support>
|
||||
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_THREADS
|
||||
|
@ -34,7 +39,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mutex
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__libcpp_mutex_t __m_ = _LIBCPP_MUTEX_INITIALIZER;
|
||||
#else
|
||||
__libcpp_mutex_t __m_;
|
||||
|
@ -42,8 +47,8 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(capability("mutex")) mut
|
|||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
constexpr mutex() _NOEXCEPT = default;
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
constexpr mutex() = default;
|
||||
#else
|
||||
mutex() _NOEXCEPT {__m_ = (__libcpp_mutex_t)_LIBCPP_MUTEX_INITIALIZER;}
|
||||
#endif
|
||||
|
@ -62,11 +67,14 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
|
||||
};
|
||||
|
||||
static_assert(is_nothrow_default_constructible<mutex>::value,
|
||||
"the default constructor for std::mutex must be nothrow");
|
||||
|
||||
struct _LIBCPP_TYPE_VIS defer_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS try_to_lock_t {};
|
||||
struct _LIBCPP_TYPE_VIS adopt_lock_t {};
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||
#if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_MUTEX)
|
||||
|
||||
extern const defer_lock_t defer_lock;
|
||||
extern const try_to_lock_t try_to_lock;
|
||||
|
@ -74,27 +82,15 @@ extern const adopt_lock_t adopt_lock;
|
|||
|
||||
#else
|
||||
|
||||
constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr defer_lock_t defer_lock = defer_lock_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr try_to_lock_t try_to_lock = try_to_lock_t();
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
// Forward declare lock_guard as a variadic template even in C++03 to keep
|
||||
// the mangling consistent between dialects.
|
||||
#if defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
|
||||
template <class ..._Mutexes>
|
||||
class _LIBCPP_TEMPLATE_VIS lock_guard;
|
||||
#endif
|
||||
|
||||
template <class _Mutex>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATION(scoped_lockable)
|
||||
#if !defined(_LIBCPP_ABI_VARIADIC_LOCK_GUARD)
|
||||
lock_guard
|
||||
#else
|
||||
lock_guard<_Mutex>
|
||||
#endif
|
||||
{
|
||||
public:
|
||||
typedef _Mutex mutex_type;
|
||||
|
@ -162,7 +158,7 @@ private:
|
|||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
|
@ -179,7 +175,7 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
@ -291,7 +287,7 @@ _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(cv_status)
|
|||
|
||||
class _LIBCPP_TYPE_VIS condition_variable
|
||||
{
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__libcpp_condvar_t __cv_ = _LIBCPP_CONDVAR_INITIALIZER;
|
||||
#else
|
||||
__libcpp_condvar_t __cv_;
|
||||
|
@ -299,7 +295,7 @@ class _LIBCPP_TYPE_VIS condition_variable
|
|||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
constexpr condition_variable() _NOEXCEPT = default;
|
||||
#else
|
||||
condition_variable() _NOEXCEPT {__cv_ = (__libcpp_condvar_t)_LIBCPP_CONDVAR_INITIALIZER;}
|
||||
|
@ -316,20 +312,24 @@ public:
|
|||
|
||||
void wait(unique_lock<mutex>& __lk) _NOEXCEPT;
|
||||
template <class _Predicate>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
void wait(unique_lock<mutex>& __lk, _Predicate __pred);
|
||||
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
||||
template <class _Clock, class _Duration, class _Predicate>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
bool
|
||||
wait_until(unique_lock<mutex>& __lk,
|
||||
const chrono::time_point<_Clock, _Duration>& __t,
|
||||
_Predicate __pred);
|
||||
|
||||
template <class _Rep, class _Period>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_for(unique_lock<mutex>& __lk,
|
||||
const chrono::duration<_Rep, _Period>& __d);
|
||||
|
@ -435,4 +435,6 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MUTEX_BASE
|
||||
|
|
|
@ -6,12 +6,14 @@
|
|||
#include <type_traits>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <bool>
|
||||
|
@ -66,7 +68,7 @@ public:
|
|||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
|
||||
|
@ -74,7 +76,7 @@ public:
|
|||
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value) ||
|
||||
!__alloc_traits::propagate_on_container_move_assignment::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
|
@ -99,14 +101,12 @@ public:
|
|||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#endif // !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_front() {__destruct_at_begin(__begin_+1);}
|
||||
_LIBCPP_INLINE_VISIBILITY void pop_back() {__destruct_at_end(__end_-1);}
|
||||
|
@ -343,7 +343,7 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
|||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
|
@ -361,7 +361,7 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
|||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __alloc_rr& __a)
|
||||
: __end_cap_(__a)
|
||||
: __end_cap_(__second_tag(), __a)
|
||||
{
|
||||
if (__a == __c.__alloc())
|
||||
{
|
||||
|
@ -405,7 +405,7 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
|
@ -492,7 +492,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
|||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
|
@ -524,7 +524,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
|||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -556,7 +556,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
|||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
|
@ -588,8 +588,6 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
|||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
void
|
||||
|
@ -621,9 +619,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -634,7 +630,8 @@ swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
|
|||
__x.swap(__y);
|
||||
}
|
||||
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_SPLIT_BUFFER
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
static const int __limit = 8;
|
||||
|
@ -355,4 +357,6 @@ __stdoutbuf<_CharT>::imbue(const locale& __loc)
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___STD_STREAM
|
||||
|
|
|
@ -57,14 +57,16 @@ template <> struct char_traits<wchar_t>;
|
|||
#include <cstdio> // For EOF.
|
||||
#include <memory> // for __murmur2_or_cityhash
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// char_traits
|
||||
|
@ -870,4 +872,6 @@ struct __quoted_output_proxy
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___STRING
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#define _LIBCPP_THREADING_SUPPORT
|
||||
|
||||
#include <__config>
|
||||
#include <chrono>
|
||||
#include <errno.h>
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
|
@ -25,14 +27,15 @@
|
|||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
#elif defined(_LIBCPP_HAS_THREAD_API_WIN32)
|
||||
#include <assert.h>
|
||||
#include <Windows.h>
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
#include <fibersapi.h>
|
||||
|
||||
#include <chrono>
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
#if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \
|
||||
defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)
|
||||
#define _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_FUNC_VIS
|
||||
|
@ -67,6 +70,8 @@ typedef pthread_once_t __libcpp_exec_once_flag;
|
|||
typedef pthread_t __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thrad Local Storage
|
||||
|
@ -92,6 +97,8 @@ typedef INIT_ONCE __libcpp_exec_once_flag;
|
|||
typedef DWORD __libcpp_thread_id;
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
typedef HANDLE __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
|
@ -108,7 +115,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
|||
int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m);
|
||||
|
@ -120,7 +127,7 @@ _LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
|||
int __libcpp_mutex_lock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY _LIBCPP_NO_THREAD_SAFETY_ANALYSIS
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m);
|
||||
|
@ -151,11 +158,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
|||
void (*init_routine)(void));
|
||||
|
||||
// Thread id
|
||||
#if defined(__APPLE__) && !defined(__arm__)
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
mach_port_t __libcpp_thread_get_port();
|
||||
#endif
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
|
@ -163,6 +165,9 @@ _LIBCPP_THREAD_ABI_VISIBILITY
|
|||
bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2);
|
||||
|
||||
// Thread
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t);
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg);
|
||||
|
@ -182,6 +187,9 @@ int __libcpp_thread_detach(__libcpp_thread_t *__t);
|
|||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_yield();
|
||||
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns);
|
||||
|
||||
// Thread local storage
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
|
@ -227,9 +235,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
|||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m);
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
|
@ -247,9 +255,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
|||
return pthread_mutex_lock(__m);
|
||||
}
|
||||
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
return pthread_mutex_trylock(__m);
|
||||
return pthread_mutex_trylock(__m) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
|
@ -296,12 +304,6 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
|||
}
|
||||
|
||||
// Thread id
|
||||
#if defined(__APPLE__) && !defined(__arm__)
|
||||
mach_port_t __libcpp_thread_get_port() {
|
||||
return pthread_mach_thread_np(pthread_self());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Returns non-zero if the thread ids are equal, otherwise 0
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
|
@ -315,6 +317,10 @@ bool __libcpp_thread_id_less(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
|||
}
|
||||
|
||||
// Thread
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
|
@ -346,6 +352,28 @@ void __libcpp_thread_yield()
|
|||
sched_yield();
|
||||
}
|
||||
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
seconds __s = duration_cast<seconds>(__ns);
|
||||
timespec __ts;
|
||||
typedef decltype(__ts.tv_sec) ts_sec;
|
||||
_LIBCPP_CONSTEXPR ts_sec __ts_sec_max = numeric_limits<ts_sec>::max();
|
||||
|
||||
if (__s.count() < __ts_sec_max)
|
||||
{
|
||||
__ts.tv_sec = static_cast<ts_sec>(__s.count());
|
||||
__ts.tv_nsec = static_cast<decltype(__ts.tv_nsec)>((__ns - __s).count());
|
||||
}
|
||||
else
|
||||
{
|
||||
__ts.tv_sec = __ts_sec_max;
|
||||
__ts.tv_nsec = 999999999; // (10^9 - 1)
|
||||
}
|
||||
|
||||
while (nanosleep(&__ts, &__ts) == -1 && errno == EINTR);
|
||||
}
|
||||
|
||||
// Thread local storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key *__key, void (*__at_exit)(void *))
|
||||
{
|
||||
|
@ -377,10 +405,9 @@ int __libcpp_recursive_mutex_lock(__libcpp_recursive_mutex_t *__m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
bool __libcpp_recursive_mutex_trylock(__libcpp_recursive_mutex_t *__m)
|
||||
{
|
||||
TryEnterCriticalSection(__m);
|
||||
return 0;
|
||||
return TryEnterCriticalSection(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_recursive_mutex_unlock(__libcpp_recursive_mutex_t *__m)
|
||||
|
@ -401,10 +428,9 @@ int __libcpp_mutex_lock(__libcpp_mutex_t *__m)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
bool __libcpp_mutex_trylock(__libcpp_mutex_t *__m)
|
||||
{
|
||||
TryAcquireSRWLockExclusive(__m);
|
||||
return 0;
|
||||
return TryAcquireSRWLockExclusive(__m) != 0;
|
||||
}
|
||||
|
||||
int __libcpp_mutex_unlock(__libcpp_mutex_t *__m)
|
||||
|
@ -452,7 +478,10 @@ int __libcpp_condvar_timedwait(__libcpp_condvar_t *__cv, __libcpp_mutex_t *__m,
|
|||
timeout_ms.count() > 0 ? timeout_ms.count()
|
||||
: 0,
|
||||
0))
|
||||
return GetLastError();
|
||||
{
|
||||
auto __ec = GetLastError();
|
||||
return __ec == ERROR_TIMEOUT ? ETIMEDOUT : __ec;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -503,25 +532,32 @@ struct __libcpp_beginthreadex_thunk_data
|
|||
void *__arg;
|
||||
};
|
||||
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned int WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__data)
|
||||
static inline _LIBCPP_ALWAYS_INLINE unsigned WINAPI
|
||||
__libcpp_beginthreadex_thunk(void *__raw_data)
|
||||
{
|
||||
__libcpp_beginthreadex_thunk_data data =
|
||||
*reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
delete reinterpret_cast<__libcpp_beginthreadex_thunk_data *>(__data);
|
||||
return reinterpret_cast<unsigned int>(data.__func(data.__arg));
|
||||
auto *__data =
|
||||
static_cast<__libcpp_beginthreadex_thunk_data *>(__raw_data);
|
||||
auto *__func = __data->__func;
|
||||
void *__arg = __data->__arg;
|
||||
delete __data;
|
||||
return static_cast<unsigned>(reinterpret_cast<uintptr_t>(__func(__arg)));
|
||||
}
|
||||
|
||||
bool __libcpp_thread_isnull(const __libcpp_thread_t *__t) {
|
||||
return *__t == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
auto *data = new __libcpp_beginthreadex_thunk_data;
|
||||
data->__func = __func;
|
||||
data->__arg = __arg;
|
||||
auto *__data = new __libcpp_beginthreadex_thunk_data;
|
||||
__data->__func = __func;
|
||||
__data->__arg = __arg;
|
||||
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0,
|
||||
*__t = reinterpret_cast<HANDLE>(_beginthreadex(nullptr, 0,
|
||||
__libcpp_beginthreadex_thunk,
|
||||
data, 0, NULL));
|
||||
__data, 0, nullptr));
|
||||
|
||||
if (*__t)
|
||||
return 0;
|
||||
return GetLastError();
|
||||
|
@ -558,6 +594,16 @@ void __libcpp_thread_yield()
|
|||
SwitchToThread();
|
||||
}
|
||||
|
||||
void __libcpp_thread_sleep_for(const chrono::nanoseconds& __ns)
|
||||
{
|
||||
using namespace chrono;
|
||||
// round-up to the nearest milisecond
|
||||
milliseconds __ms =
|
||||
duration_cast<milliseconds>(__ns + chrono::nanoseconds(999999));
|
||||
// FIXME(compnerd) this should be an alertable sleep (WFSO or SleepEx)
|
||||
Sleep(__ms.count());
|
||||
}
|
||||
|
||||
// Thread Local Storage
|
||||
int __libcpp_tls_create(__libcpp_tls_key* __key,
|
||||
void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
|
||||
|
@ -586,6 +632,8 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p)
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
||||
#endif // _LIBCPP_THREADING_SUPPORT
|
||||
|
|
|
@ -17,12 +17,14 @@
|
|||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator> class __tree;
|
||||
|
@ -43,6 +45,10 @@ template <class _Key, class _Value>
|
|||
struct __value_type;
|
||||
#endif
|
||||
|
||||
template <class _Key, class _CP, class _Compare,
|
||||
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
|
||||
class __map_value_compare;
|
||||
|
||||
template <class _Allocator> class __map_node_destructor;
|
||||
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_iterator;
|
||||
template <class _TreeIterator> class _LIBCPP_TEMPLATE_VIS __map_const_iterator;
|
||||
|
@ -78,7 +84,7 @@ __tree_is_left_child(_NodePtr __x) _NOEXCEPT
|
|||
return __x == __x->__parent_->__left_;
|
||||
}
|
||||
|
||||
// Determintes if the subtree rooted at __x is a proper red black subtree. If
|
||||
// Determines if the subtree rooted at __x is a proper red black subtree. If
|
||||
// __x is a proper subtree, returns the black height (null counts as 1). If
|
||||
// __x is an improper subtree, returns 0.
|
||||
template <class _NodePtr>
|
||||
|
@ -113,7 +119,7 @@ __tree_sub_invariant(_NodePtr __x)
|
|||
return __h + __x->__is_black_; // return black height of this node
|
||||
}
|
||||
|
||||
// Determintes if the red black tree rooted at __root is a proper red black tree.
|
||||
// Determines if the red black tree rooted at __root is a proper red black tree.
|
||||
// __root == nullptr is a proper tree. Returns true is __root is a proper
|
||||
// red black tree, else returns false.
|
||||
template <class _NodePtr>
|
||||
|
@ -957,6 +963,25 @@ private:
|
|||
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
struct __diagnose_tree_helper {
|
||||
static constexpr bool __trigger_diagnostics()
|
||||
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
"the specified comparator type does not provide a const call operator")
|
||||
{ return true; }
|
||||
};
|
||||
|
||||
template <class _Key, class _Value, class _KeyComp, class _Alloc>
|
||||
struct __diagnose_tree_helper<
|
||||
__value_type<_Key, _Value>,
|
||||
__map_value_compare<_Key, __value_type<_Key, _Value>, _KeyComp>,
|
||||
_Alloc
|
||||
> : __diagnose_tree_helper<_Key, _KeyComp, _Alloc>
|
||||
{
|
||||
};
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
class __tree
|
||||
{
|
||||
|
@ -1082,7 +1107,7 @@ public:
|
|||
void __assign_unique(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
|
@ -1093,7 +1118,7 @@ public:
|
|||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<value_compare>::value &&
|
||||
is_nothrow_move_assignable<__node_allocator>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
~__tree();
|
||||
|
||||
|
@ -1479,7 +1504,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
|
|||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_allocator(__a)),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
|
@ -1489,7 +1514,7 @@ template <class _Tp, class _Compare, class _Allocator>
|
|||
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp,
|
||||
const allocator_type& __a)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_allocator(__a)),
|
||||
__pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, __comp)
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
|
@ -1646,13 +1671,13 @@ __tree<_Tp, _Compare, _Allocator>::__assign_multi(_InputIterator __first, _Input
|
|||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
: __begin_node_(__iter_pointer()),
|
||||
__pair1_(__node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair1_(__second_tag(), __node_traits::select_on_container_copy_construction(__t.__node_alloc())),
|
||||
__pair3_(0, __t.value_comp())
|
||||
{
|
||||
__begin_node() = __end_node();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
|
@ -1676,7 +1701,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
|||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
|
||||
: __pair1_(__node_allocator(__a)),
|
||||
: __pair1_(__second_tag(), __node_allocator(__a)),
|
||||
__pair3_(0, _VSTD::move(__t.value_comp()))
|
||||
{
|
||||
if (__a == __t.__alloc())
|
||||
|
@ -1782,14 +1807,18 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
{
|
||||
static_assert((is_copy_constructible<value_compare>::value),
|
||||
"Comparator must be copy-constructible.");
|
||||
destroy(__root());
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
static_assert((__diagnose_tree_helper<_Tp, _Compare, _Allocator>::
|
||||
__trigger_diagnostics()), "");
|
||||
#endif
|
||||
destroy(__root());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
|
@ -2658,4 +2687,6 @@ swap(__tree<_Tp, _Compare, _Allocator>& __x,
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___TREE
|
||||
|
|
|
@ -85,7 +85,7 @@ template <class _Tp> struct __tuple_like<const volatile _Tp> : public __tuple_li
|
|||
|
||||
// tuple specializations
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t...> struct __tuple_indices {};
|
||||
|
||||
|
@ -189,7 +189,8 @@ template <size_t _Ip, class ..._Tp>
|
|||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
const typename tuple_element<_Ip, tuple<_Tp...> >::type&&
|
||||
get(const tuple<_Tp...>&&) _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
// pair specializations
|
||||
|
||||
|
@ -205,7 +206,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|||
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
|
||||
get(const pair<_T1, _T2>&) _NOEXCEPT;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <size_t _Ip, class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
|
||||
|
@ -233,7 +234,7 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
|||
const _Tp&
|
||||
get(const array<_Tp, _Size>&) _NOEXCEPT;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
|
@ -245,8 +246,7 @@ const _Tp&&
|
|||
get(const array<_Tp, _Size>&&) _NOEXCEPT;
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_VARIADICS)
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
// __tuple_types
|
||||
|
||||
|
@ -468,9 +468,6 @@ template <size_t _Ip, class ..._Tp>
|
|||
using tuple_element_t = typename tuple_element <_Ip, _Tp...>::type;
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <bool _IsTuple, class _SizeTrait, size_t _Expected>
|
||||
struct __tuple_like_with_size_imp : false_type {};
|
||||
|
||||
|
@ -495,7 +492,7 @@ struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail {
|
|||
template <class ...>
|
||||
static constexpr bool __enable_assign() { return false; }
|
||||
};
|
||||
#endif
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
// -*- C++ -*-
|
||||
//===------------------------ __undef_macros ------------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
|
||||
#ifdef min
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing min")
|
||||
#else
|
||||
#warning: macro min is incompatible with C++. #undefing min
|
||||
#endif
|
||||
#endif
|
||||
#undef min
|
||||
#endif
|
||||
|
||||
#ifdef max
|
||||
#if !defined(_LIBCPP_DISABLE_MACRO_CONFLICT_WARNINGS)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
|
||||
"before any Windows header. #undefing max")
|
||||
#else
|
||||
#warning: macro max is incompatible with C++. #undefing max
|
||||
#endif
|
||||
#endif
|
||||
#undef max
|
||||
#endif
|
|
@ -35,6 +35,9 @@ template <class InputIterator, class Function>
|
|||
Function
|
||||
for_each(InputIterator first, InputIterator last, Function f);
|
||||
|
||||
template<class InputIterator, class Size, class Function>
|
||||
InputIterator for_each_n(InputIterator first, Size n, Function f); // C++17
|
||||
|
||||
template <class InputIterator, class T>
|
||||
InputIterator
|
||||
find(InputIterator first, InputIterator last, const T& value);
|
||||
|
@ -281,12 +284,12 @@ template <class ForwardIterator, class OutputIterator>
|
|||
|
||||
template <class RandomAccessIterator>
|
||||
void
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last); // deprecated in C++14, removed in C++17
|
||||
|
||||
template <class RandomAccessIterator, class RandomNumberGenerator>
|
||||
void
|
||||
random_shuffle(RandomAccessIterator first, RandomAccessIterator last,
|
||||
RandomNumberGenerator& rand); // deprecated in C++14
|
||||
RandomNumberGenerator& rand); // deprecated in C++14, removed in C++17
|
||||
|
||||
template<class PopulationIterator, class SampleIterator,
|
||||
class Distance, class UniformRandomBitGenerator>
|
||||
|
@ -644,18 +647,20 @@ template <class BidirectionalIterator, class Compare>
|
|||
#if defined(__IBMCPP__)
|
||||
#include "support/ibm/support.h"
|
||||
#endif
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#include "support/win32/support.h"
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// I'd like to replace these with _VSTD::equal_to<void>, but can't because:
|
||||
|
@ -729,15 +734,15 @@ struct __less<_T1, const _T1>
|
|||
};
|
||||
|
||||
template <class _Predicate>
|
||||
class __negate
|
||||
class __invert // invert the sense of a comparison
|
||||
{
|
||||
private:
|
||||
_Predicate __p_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __negate() {}
|
||||
_LIBCPP_INLINE_VISIBILITY __invert() {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __negate(_Predicate __p) : __p_(__p) {}
|
||||
explicit __invert(_Predicate __p) : __p_(__p) {}
|
||||
|
||||
template <class _T1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -745,7 +750,7 @@ public:
|
|||
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _T1& __x, const _T2& __y) {return !__p_(__x, __y);}
|
||||
bool operator()(const _T1& __x, const _T2& __y) {return __p_(__y, __x);}
|
||||
};
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
|
@ -783,51 +788,132 @@ struct __debug_less
|
|||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned
|
||||
__ctz(unsigned __x)
|
||||
{
|
||||
unsigned __ctz(unsigned __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned>(__builtin_ctz(__x));
|
||||
#else
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
if (_BitScanForward(&where, __x))
|
||||
return where;
|
||||
return 32;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long
|
||||
__ctz(unsigned long __x)
|
||||
{
|
||||
unsigned long __ctz(unsigned long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned long>(__builtin_ctzl(__x));
|
||||
#else
|
||||
static_assert(sizeof(unsigned long) == sizeof(unsigned), "");
|
||||
return __ctz(static_cast<unsigned>(__x));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long long
|
||||
__ctz(unsigned long long __x)
|
||||
{
|
||||
unsigned long long __ctz(unsigned long long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned long long>(__builtin_ctzll(__x));
|
||||
#else
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
(defined(_M_AMD64) || defined(__x86_64__))
|
||||
if (_BitScanForward64(&where, __x))
|
||||
return static_cast<int>(where);
|
||||
#else
|
||||
// Win32 doesn't have _BitScanForward64 so emulate it with two 32 bit calls.
|
||||
// Scan the Low Word.
|
||||
if (_BitScanForward(&where, static_cast<unsigned long>(__x)))
|
||||
return where;
|
||||
// Scan the High Word.
|
||||
if (_BitScanForward(&where, static_cast<unsigned long>(__x >> 32)))
|
||||
return where + 32; // Create a bit offset from the LSB.
|
||||
#endif
|
||||
return 64;
|
||||
#endif // _LIBCPP_COMPILER_MSVC
|
||||
}
|
||||
|
||||
// Precondition: __x != 0
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned
|
||||
__clz(unsigned __x)
|
||||
{
|
||||
unsigned __clz(unsigned __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned>(__builtin_clz(__x));
|
||||
#else
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
unsigned long where;
|
||||
// Search from LSB to MSB for first set bit.
|
||||
// Returns zero if no set bit is found.
|
||||
if (_BitScanReverse(&where, __x))
|
||||
return 31 - where;
|
||||
return 32; // Undefined Behavior.
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long
|
||||
__clz(unsigned long __x)
|
||||
{
|
||||
unsigned long __clz(unsigned long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned long>(__builtin_clzl (__x));
|
||||
#else
|
||||
static_assert(sizeof(unsigned) == sizeof(unsigned long), "");
|
||||
return __clz(static_cast<unsigned>(__x));
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long long
|
||||
__clz(unsigned long long __x)
|
||||
{
|
||||
unsigned long long __clz(unsigned long long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return static_cast<unsigned long long>(__builtin_clzll(__x));
|
||||
#else
|
||||
unsigned long where;
|
||||
// BitScanReverse scans from MSB to LSB for first set bit.
|
||||
// Returns 0 if no set bit is found.
|
||||
#if defined(_LIBCPP_HAS_BITSCAN64)
|
||||
if (_BitScanReverse64(&where, __x))
|
||||
return static_cast<int>(63 - where);
|
||||
#else
|
||||
// Scan the high 32 bits.
|
||||
if (_BitScanReverse(&where, static_cast<unsigned long>(__x >> 32)))
|
||||
return 63 - (where + 32); // Create a bit offset from the MSB.
|
||||
// Scan the low 32 bits.
|
||||
if (_BitScanReverse(&where, static_cast<unsigned long>(__x)))
|
||||
return 63 - where;
|
||||
#endif
|
||||
return 64; // Undefined Behavior.
|
||||
#endif // _LIBCPP_COMPILER_MSVC
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {return __builtin_popcountll(__x);}
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return __builtin_popcount (__x);
|
||||
#else
|
||||
static_assert(sizeof(unsigned) == 4, "");
|
||||
return __popcnt(__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return __builtin_popcountl (__x);
|
||||
#else
|
||||
static_assert(sizeof(unsigned long) == 4, "");
|
||||
return __popcnt(__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long long __x) {
|
||||
#ifndef _LIBCPP_COMPILER_MSVC
|
||||
return __builtin_popcountll(__x);
|
||||
#else
|
||||
static_assert(sizeof(unsigned long long) == 8, "");
|
||||
return __popcnt64(__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
// all_of
|
||||
|
||||
|
@ -880,6 +966,26 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
|
|||
return __f;
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
// for_each_n
|
||||
|
||||
template <class _InputIterator, class _Size, class _Function>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_InputIterator
|
||||
for_each_n(_InputIterator __first, _Size __orig_n, _Function __f)
|
||||
{
|
||||
typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
while (__n > 0)
|
||||
{
|
||||
__f(*__first);
|
||||
++__first;
|
||||
--__n;
|
||||
}
|
||||
return __first;
|
||||
}
|
||||
#endif
|
||||
|
||||
// find
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
|
@ -2548,7 +2654,7 @@ min(const _Tp& __a, const _Tp& __b)
|
|||
return _VSTD::min(__a, __b, __less<_Tp>());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
|
@ -2566,7 +2672,7 @@ min(initializer_list<_Tp> __t)
|
|||
return *_VSTD::min_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
// max_element
|
||||
|
||||
|
@ -2613,7 +2719,7 @@ max(const _Tp& __a, const _Tp& __b)
|
|||
return _VSTD::max(__a, __b, __less<_Tp>());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
|
@ -2631,7 +2737,7 @@ max(initializer_list<_Tp> __t)
|
|||
return *_VSTD::max_element(__t.begin(), __t.end(), __less<_Tp>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
// clamp
|
||||
|
@ -2732,7 +2838,7 @@ minmax(const _Tp& __a, const _Tp& __b)
|
|||
return _VSTD::minmax(__a, __b, __less<_Tp>());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
|
@ -2779,7 +2885,7 @@ minmax(initializer_list<_Tp> __t)
|
|||
return _VSTD::minmax(__t, __less<_Tp>());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
// random_shuffle
|
||||
|
||||
|
@ -2804,11 +2910,11 @@ struct __log2_imp<0, _Rp>
|
|||
static const size_t value = _Rp + 1;
|
||||
};
|
||||
|
||||
template <class _UI, _UI _Xp>
|
||||
template <class _UIntType, _UIntType _Xp>
|
||||
struct __log2
|
||||
{
|
||||
static const size_t value = __log2_imp<_Xp,
|
||||
sizeof(_UI) * __CHAR_BIT__ - 1>::value;
|
||||
sizeof(_UIntType) * __CHAR_BIT__ - 1>::value;
|
||||
};
|
||||
|
||||
template<class _Engine, class _UIntType>
|
||||
|
@ -2837,7 +2943,7 @@ private:
|
|||
_Engine_result_type __mask0_;
|
||||
_Engine_result_type __mask1_;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
|
||||
+ _Working_result_type(1);
|
||||
#else
|
||||
|
@ -2907,6 +3013,7 @@ template<class _Engine, class _UIntType>
|
|||
_UIntType
|
||||
__independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
||||
{
|
||||
const size_t _WRt = numeric_limits<result_type>::digits;
|
||||
result_type _Sp = 0;
|
||||
for (size_t __k = 0; __k < __n0_; ++__k)
|
||||
{
|
||||
|
@ -2915,7 +3022,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
|||
{
|
||||
__u = __e_() - _Engine::min();
|
||||
} while (__u >= __y0_);
|
||||
if (__w0_ < _WDt)
|
||||
if (__w0_ < _WRt)
|
||||
_Sp <<= __w0_;
|
||||
else
|
||||
_Sp = 0;
|
||||
|
@ -2928,7 +3035,7 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
|
|||
{
|
||||
__u = __e_() - _Engine::min();
|
||||
} while (__u >= __y1_);
|
||||
if (__w0_ < _WDt - 1)
|
||||
if (__w0_ < _WRt - 1)
|
||||
_Sp <<= __w0_ + 1;
|
||||
else
|
||||
_Sp = 0;
|
||||
|
@ -3026,6 +3133,8 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
|
|||
return static_cast<result_type>(__u + __p.a());
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_RANDOM_SHUFFLE) \
|
||||
|| defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
class _LIBCPP_TYPE_VIS __rs_default;
|
||||
|
||||
_LIBCPP_FUNC_VIS __rs_default __rs_get();
|
||||
|
@ -3078,7 +3187,7 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
|
|||
template <class _RandomAccessIterator, class _RandomNumberGenerator>
|
||||
void
|
||||
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_RandomNumberGenerator&& __rand)
|
||||
#else
|
||||
_RandomNumberGenerator& __rand)
|
||||
|
@ -3095,33 +3204,34 @@ random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_PopulationIterator __last, _SampleIterator __output_iter,
|
||||
_Distance __n,
|
||||
_UniformRandomNumberGenerator & __g,
|
||||
input_iterator_tag) {
|
||||
|
||||
_Distance __k = 0;
|
||||
for (; __first != __last && __k < __n; ++__first, (void)++__k)
|
||||
__output[__k] = *__first;
|
||||
__output_iter[__k] = *__first;
|
||||
_Distance __sz = __k;
|
||||
for (; __first != __last; ++__first, (void)++__k) {
|
||||
_Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g);
|
||||
if (__r < __sz)
|
||||
__output[__r] = *__first;
|
||||
__output_iter[__r] = *__first;
|
||||
}
|
||||
return __output + _VSTD::min(__n, __k);
|
||||
return __output_iter + _VSTD::min(__n, __k);
|
||||
}
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_PopulationIterator __last, _SampleIterator __output_iter,
|
||||
_Distance __n,
|
||||
_UniformRandomNumberGenerator& __g,
|
||||
forward_iterator_tag) {
|
||||
|
@ -3130,18 +3240,18 @@ _SampleIterator __sample(_PopulationIterator __first,
|
|||
_Distance __r =
|
||||
_VSTD::uniform_int_distribution<_Distance>(0, --__unsampled_sz)(__g);
|
||||
if (__r < __n) {
|
||||
*__output++ = *__first;
|
||||
*__output_iter++ = *__first;
|
||||
--__n;
|
||||
}
|
||||
}
|
||||
return __output;
|
||||
return __output_iter;
|
||||
}
|
||||
|
||||
template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
||||
class _UniformRandomNumberGenerator>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator __sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_PopulationIterator __last, _SampleIterator __output_iter,
|
||||
_Distance __n, _UniformRandomNumberGenerator& __g) {
|
||||
typedef typename iterator_traits<_PopulationIterator>::iterator_category
|
||||
_PopCategory;
|
||||
|
@ -3153,7 +3263,7 @@ _SampleIterator __sample(_PopulationIterator __first,
|
|||
typedef typename common_type<_Distance, _Difference>::type _CommonType;
|
||||
_LIBCPP_ASSERT(__n >= 0, "N must be a positive number.");
|
||||
return _VSTD::__sample(
|
||||
__first, __last, __output, _CommonType(__n),
|
||||
__first, __last, __output_iter, _CommonType(__n),
|
||||
__g, _PopCategory());
|
||||
}
|
||||
|
||||
|
@ -3162,15 +3272,15 @@ template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
|||
class _UniformRandomNumberGenerator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator sample(_PopulationIterator __first,
|
||||
_PopulationIterator __last, _SampleIterator __output,
|
||||
_PopulationIterator __last, _SampleIterator __output_iter,
|
||||
_Distance __n, _UniformRandomNumberGenerator&& __g) {
|
||||
return _VSTD::__sample(__first, __last, __output, __n, __g);
|
||||
return _VSTD::__sample(__first, __last, __output_iter, __n, __g);
|
||||
}
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
|
||||
void shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last,
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_UniformRandomNumberGenerator&& __g)
|
||||
#else
|
||||
_UniformRandomNumberGenerator& __g)
|
||||
|
@ -4125,10 +4235,6 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
|
|||
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_MSVC
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable: 4231)
|
||||
#endif // _LIBCPP_MSVC
|
||||
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
|
||||
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
|
||||
|
@ -4162,9 +4268,6 @@ _LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less
|
|||
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
|
||||
#ifdef _LIBCPP_MSVC
|
||||
#pragma warning( pop )
|
||||
#endif // _LIBCPP_MSVC
|
||||
|
||||
// lower_bound
|
||||
|
||||
|
@ -4465,7 +4568,7 @@ __buffered_inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator
|
|||
typedef reverse_iterator<value_type*> _Rv;
|
||||
__half_inplace_merge(_Rv(__p), _Rv(__buff),
|
||||
_RBi(__middle), _RBi(__first),
|
||||
_RBi(__last), __negate<_Compare>(__comp));
|
||||
_RBi(__last), __invert<_Compare>(__comp));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5444,9 +5547,9 @@ __set_union(_InputIterator1 __first1, _InputIterator1 __last1,
|
|||
}
|
||||
else
|
||||
{
|
||||
*__result = *__first1;
|
||||
if (!__comp(*__first1, *__first2))
|
||||
++__first2;
|
||||
*__result = *__first1;
|
||||
++__first1;
|
||||
}
|
||||
}
|
||||
|
@ -5797,4 +5900,6 @@ prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last)
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_ALGORITHM
|
||||
|
|
|
@ -45,6 +45,10 @@ namespace std {
|
|||
any& operator=(ValueType&& rhs);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
template <class ValueType, class... Args>
|
||||
decay_t<ValueType>& emplace(Args&&... args);
|
||||
template <class ValueType, class U, class... Args>
|
||||
decay_t<ValueType>& emplace(initializer_list<U>, Args&&...);
|
||||
void reset() noexcept;
|
||||
void swap(any& rhs) noexcept;
|
||||
|
||||
|
@ -73,8 +77,6 @@ namespace std {
|
|||
template<class ValueType>
|
||||
ValueType* any_cast(any* operand) noexcept;
|
||||
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
@ -258,7 +260,7 @@ public:
|
|||
is_copy_constructible<_Tp>::value>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(_Args&&... args);
|
||||
_Tp& emplace(_Args&&... args);
|
||||
|
||||
template <class _ValueType, class _Up, class ..._Args,
|
||||
class _Tp = decay_t<_ValueType>,
|
||||
|
@ -267,7 +269,7 @@ public:
|
|||
is_copy_constructible<_Tp>::value>
|
||||
>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void emplace(initializer_list<_Up>, _Args&&...);
|
||||
_Tp& emplace(initializer_list<_Up>, _Args&&...);
|
||||
|
||||
// 6.3.3 any modifiers
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -364,9 +366,10 @@ namespace __any_imp
|
|||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Args&&... __args) {
|
||||
::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
_Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
__dest.__h = &_SmallHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -439,14 +442,15 @@ namespace __any_imp
|
|||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __create(any & __dest, _Args&&... __args) {
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef __allocator_destructor<_Alloc> _Dp;
|
||||
_Alloc __a;
|
||||
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
_Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
__dest.__s.__ptr = __hold.release();
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -519,16 +523,16 @@ any & any::operator=(_ValueType && __v)
|
|||
|
||||
template <class _ValueType, class ..._Args, class _Tp, class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void any::emplace(_Args&&... __args) {
|
||||
_Tp& any::emplace(_Args&&... __args) {
|
||||
reset();
|
||||
__any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
|
||||
return __any_imp::_Handler<_Tp>::__create(*this, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
template <class _ValueType, class _Up, class ..._Args, class _Tp, class>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
_Tp& any::emplace(initializer_list<_Up> __il, _Args&&... __args) {
|
||||
reset();
|
||||
__any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
|
||||
return __any_imp::_Handler<_Tp>::__create(*this, __il, _VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
|
|
@ -113,6 +113,8 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, size_t _Size>
|
||||
|
@ -181,7 +183,7 @@ struct _LIBCPP_TEMPLATE_VIS array
|
|||
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
|
||||
|
||||
// element access:
|
||||
|
@ -294,6 +296,7 @@ class _LIBCPP_TEMPLATE_VIS tuple_size<array<_Tp, _Size> >
|
|||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
class _LIBCPP_TEMPLATE_VIS tuple_element<_Ip, array<_Tp, _Size> >
|
||||
{
|
||||
static_assert(_Ip < _Size, "Index out of bounds in std::tuple_element<> (std::array)");
|
||||
public:
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
@ -316,7 +319,7 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
|||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
|
@ -336,7 +339,7 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
|||
return _VSTD::move(__a.__elems_[_Ip]);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
|
|
@ -560,6 +560,22 @@ void atomic_signal_fence(memory_order m) noexcept;
|
|||
# define __cpp_lib_atomic_is_always_lock_free 201603L
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
|
||||
__m == memory_order_acquire || \
|
||||
__m == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
|
||||
__m == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
|
||||
_LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
|
||||
__f == memory_order_acq_rel, \
|
||||
"memory order argument to atomic operation is invalid")
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
typedef enum memory_order
|
||||
|
@ -845,16 +861,29 @@ kill_dependency(_Tp __y) _NOEXCEPT
|
|||
return __y;
|
||||
}
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
#define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
#define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
#define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
#define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
#define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
#define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
#if defined(__CLANG_ATOMIC_BOOL_LOCK_FREE)
|
||||
# define ATOMIC_BOOL_LOCK_FREE __CLANG_ATOMIC_BOOL_LOCK_FREE
|
||||
# define ATOMIC_CHAR_LOCK_FREE __CLANG_ATOMIC_CHAR_LOCK_FREE
|
||||
# define ATOMIC_CHAR16_T_LOCK_FREE __CLANG_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
# define ATOMIC_CHAR32_T_LOCK_FREE __CLANG_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
# define ATOMIC_WCHAR_T_LOCK_FREE __CLANG_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
# define ATOMIC_SHORT_LOCK_FREE __CLANG_ATOMIC_SHORT_LOCK_FREE
|
||||
# define ATOMIC_INT_LOCK_FREE __CLANG_ATOMIC_INT_LOCK_FREE
|
||||
# define ATOMIC_LONG_LOCK_FREE __CLANG_ATOMIC_LONG_LOCK_FREE
|
||||
# define ATOMIC_LLONG_LOCK_FREE __CLANG_ATOMIC_LLONG_LOCK_FREE
|
||||
# define ATOMIC_POINTER_LOCK_FREE __CLANG_ATOMIC_POINTER_LOCK_FREE
|
||||
#else
|
||||
# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
# define ATOMIC_CHAR16_T_LOCK_FREE __GCC_ATOMIC_CHAR16_T_LOCK_FREE
|
||||
# define ATOMIC_CHAR32_T_LOCK_FREE __GCC_ATOMIC_CHAR32_T_LOCK_FREE
|
||||
# define ATOMIC_WCHAR_T_LOCK_FREE __GCC_ATOMIC_WCHAR_T_LOCK_FREE
|
||||
# define ATOMIC_SHORT_LOCK_FREE __GCC_ATOMIC_SHORT_LOCK_FREE
|
||||
# define ATOMIC_INT_LOCK_FREE __GCC_ATOMIC_INT_LOCK_FREE
|
||||
# define ATOMIC_LONG_LOCK_FREE __GCC_ATOMIC_LONG_LOCK_FREE
|
||||
# define ATOMIC_LLONG_LOCK_FREE __GCC_ATOMIC_LLONG_LOCK_FREE
|
||||
# define ATOMIC_POINTER_LOCK_FREE __GCC_ATOMIC_POINTER_LOCK_FREE
|
||||
#endif
|
||||
|
||||
// general atomic<T>
|
||||
|
||||
|
@ -881,15 +910,19 @@ struct __atomic_base // false
|
|||
{return static_cast<__atomic_base const volatile*>(this)->is_lock_free();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void store(_Tp __d, memory_order __m = memory_order_seq_cst) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{__c11_atomic_store(&__a_, __d, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void store(_Tp __d, memory_order __m = memory_order_seq_cst) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{__c11_atomic_store(&__a_, __d, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp load(memory_order __m = memory_order_seq_cst) const volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{return __c11_atomic_load(&__a_, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp load(memory_order __m = memory_order_seq_cst) const _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{return __c11_atomic_load(&__a_, __m);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
operator _Tp() const volatile _NOEXCEPT {return load();}
|
||||
|
@ -904,18 +937,22 @@ struct __atomic_base // false
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_weak(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) volatile _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_strong(_Tp& __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{return __c11_atomic_compare_exchange_strong(&__a_, &__e, __d, __s, __f);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool compare_exchange_weak(_Tp& __e, _Tp __d,
|
||||
|
@ -1181,6 +1218,7 @@ template <class _Tp>
|
|||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
}
|
||||
|
@ -1189,6 +1227,7 @@ template <class _Tp>
|
|||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
}
|
||||
|
@ -1217,6 +1256,7 @@ template <class _Tp>
|
|||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_load_explicit(const volatile atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{
|
||||
return __o->load(__m);
|
||||
}
|
||||
|
@ -1225,6 +1265,7 @@ template <class _Tp>
|
|||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m)
|
||||
{
|
||||
return __o->load(__m);
|
||||
}
|
||||
|
@ -1309,6 +1350,7 @@ bool
|
|||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
||||
}
|
||||
|
@ -1318,6 +1360,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||
bool
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d, __s, __f);
|
||||
}
|
||||
|
@ -1330,6 +1373,7 @@ bool
|
|||
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
_Tp* __e, _Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
||||
}
|
||||
|
@ -1340,6 +1384,7 @@ bool
|
|||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d, __s, __f);
|
||||
}
|
||||
|
|
|
@ -113,10 +113,6 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <__bit_reference>
|
||||
#include <cstddef>
|
||||
|
@ -126,7 +122,13 @@ template <size_t N> struct hash<std::bitset<N>>;
|
|||
#include <iosfwd>
|
||||
#include <__functional_base>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -197,11 +199,11 @@ protected:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __hash_code() const _NOEXCEPT;
|
||||
private:
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
void __init(unsigned long long __v, false_type) _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __init(unsigned long long __v, true_type) _NOEXCEPT;
|
||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
unsigned long to_ulong(false_type) const;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unsigned long to_ulong(true_type) const;
|
||||
|
@ -217,24 +219,29 @@ template <size_t _N_words, size_t _Size>
|
|||
inline
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
: __first_{0}
|
||||
#endif
|
||||
{
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
void
|
||||
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
|
||||
{
|
||||
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
|
||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
|
||||
__t[__i] = static_cast<__storage_type>(__v);
|
||||
size_t __sz = _Size;
|
||||
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word, __sz -= __bits_per_word )
|
||||
if ( __sz < __bits_per_word)
|
||||
__t[__i] = static_cast<__storage_type>(__v) & ( 1ULL << __sz ) - 1;
|
||||
else
|
||||
__t[__i] = static_cast<__storage_type>(__v);
|
||||
|
||||
_VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
|
||||
_VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
|
||||
__storage_type(0));
|
||||
|
@ -246,26 +253,31 @@ void
|
|||
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT
|
||||
{
|
||||
__first_[0] = __v;
|
||||
if (_Size < __bits_per_word)
|
||||
__first_[0] &= ( 1ULL << _Size ) - 1;
|
||||
|
||||
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _N_words, size_t _Size>
|
||||
inline
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if __SIZEOF_SIZE_T__ == 8
|
||||
: __first_{__v}
|
||||
#elif __SIZEOF_SIZE_T__ == 4
|
||||
: __first_{static_cast<__storage_type>(__v), static_cast<__storage_type>(__v >> __bits_per_word)}
|
||||
: __first_{static_cast<__storage_type>(__v),
|
||||
_Size >= 2 * __bits_per_word ? static_cast<__storage_type>(__v >> __bits_per_word)
|
||||
: static_cast<__storage_type>((__v >> __bits_per_word) & (__storage_type(1) << (_Size - __bits_per_word)) - 1)}
|
||||
#else
|
||||
#error This constructor has not been ported to this platform
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
|
||||
#endif
|
||||
}
|
||||
|
@ -501,7 +513,10 @@ template <size_t _Size>
|
|||
inline
|
||||
_LIBCPP_CONSTEXPR
|
||||
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
|
||||
: __first_(static_cast<__storage_type>(__v))
|
||||
: __first_(
|
||||
_Size == __bits_per_word ? static_cast<__storage_type>(__v)
|
||||
: static_cast<__storage_type>(__v) & ((__storage_type(1) << _Size) - 1)
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1090,4 +1105,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_BITSET
|
||||
|
|
|
@ -26,7 +26,7 @@ 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
|
||||
template <class Rep> inline constexpr bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<Rep>::value; // C++17
|
||||
|
||||
template <class Rep>
|
||||
|
@ -48,7 +48,7 @@ class duration
|
|||
static_assert(Period::num > 0, "duration period must be positive");
|
||||
public:
|
||||
typedef Rep rep;
|
||||
typedef Period period;
|
||||
typedef typename _Period::type period;
|
||||
|
||||
constexpr duration() = default;
|
||||
template <class Rep2>
|
||||
|
@ -75,8 +75,8 @@ public:
|
|||
|
||||
// arithmetic
|
||||
|
||||
constexpr duration operator+() const;
|
||||
constexpr duration operator-() const;
|
||||
constexpr common_type<duration>::type operator+() const;
|
||||
constexpr common_type<duration>::type operator-() const;
|
||||
constexpr duration& operator++();
|
||||
constexpr duration operator++(int);
|
||||
constexpr duration& operator--();
|
||||
|
@ -283,18 +283,18 @@ typedef steady_clock high_resolution_clock;
|
|||
|
||||
} // chrono
|
||||
|
||||
constexpr chrono::hours operator "" h(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
|
||||
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
|
||||
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
|
||||
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
|
||||
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
|
||||
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
|
||||
constexpr chrono::hours operator ""h(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , ratio<3600,1>> operator ""h(long double); // C++14
|
||||
constexpr chrono::minutes operator ""min(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , ratio<60,1>> operator ""min(long double); // C++14
|
||||
constexpr chrono::seconds operator ""s(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified > operator ""s(long double); // C++14
|
||||
constexpr chrono::milliseconds operator ""ms(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , milli> operator ""ms(long double); // C++14
|
||||
constexpr chrono::microseconds operator ""us(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , micro> operator ""us(long double); // C++14
|
||||
constexpr chrono::nanoseconds operator ""ns(unsigned long long); // C++14
|
||||
constexpr chrono::duration<unspecified , nano> operator ""ns(long double); // C++14
|
||||
|
||||
} // std
|
||||
*/
|
||||
|
@ -305,12 +305,14 @@ constexpr chrono::duration<unspecified , nano> operator "" ns(long doub
|
|||
#include <ratio>
|
||||
#include <limits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace chrono
|
||||
|
@ -417,7 +419,8 @@ template <class _Rep>
|
|||
struct _LIBCPP_TEMPLATE_VIS 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
|
||||
template <class _Rep>
|
||||
_LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool treat_as_floating_point_v
|
||||
= treat_as_floating_point<_Rep>::value;
|
||||
#endif
|
||||
|
||||
|
@ -523,7 +526,7 @@ class _LIBCPP_TEMPLATE_VIS duration
|
|||
|
||||
public:
|
||||
typedef _Rep rep;
|
||||
typedef _Period period;
|
||||
typedef typename _Period::type period;
|
||||
private:
|
||||
rep __rep_;
|
||||
public:
|
||||
|
@ -565,8 +568,8 @@ public:
|
|||
|
||||
// arithmetic
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator+() const {return typename common_type<duration>::type(*this);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR typename common_type<duration>::type operator-() const {return typename common_type<duration>::type(-__rep_);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator++() {++__rep_; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration operator++(int) {return duration(__rep_++);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14 duration& operator--() {--__rep_; return *this;}
|
||||
|
@ -1085,67 +1088,67 @@ inline namespace literals
|
|||
inline namespace chrono_literals
|
||||
{
|
||||
|
||||
constexpr chrono::hours operator"" h(unsigned long long __h)
|
||||
constexpr chrono::hours operator""h(unsigned long long __h)
|
||||
{
|
||||
return chrono::hours(static_cast<chrono::hours::rep>(__h));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
|
||||
constexpr chrono::duration<long double, ratio<3600,1>> operator""h(long double __h)
|
||||
{
|
||||
return chrono::duration<long double, ratio<3600,1>>(__h);
|
||||
}
|
||||
|
||||
|
||||
constexpr chrono::minutes operator"" min(unsigned long long __m)
|
||||
constexpr chrono::minutes operator""min(unsigned long long __m)
|
||||
{
|
||||
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
|
||||
constexpr chrono::duration<long double, ratio<60,1>> operator""min(long double __m)
|
||||
{
|
||||
return chrono::duration<long double, ratio<60,1>> (__m);
|
||||
}
|
||||
|
||||
|
||||
constexpr chrono::seconds operator"" s(unsigned long long __s)
|
||||
constexpr chrono::seconds operator""s(unsigned long long __s)
|
||||
{
|
||||
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double> operator"" s(long double __s)
|
||||
constexpr chrono::duration<long double> operator""s(long double __s)
|
||||
{
|
||||
return chrono::duration<long double> (__s);
|
||||
}
|
||||
|
||||
|
||||
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
|
||||
constexpr chrono::milliseconds operator""ms(unsigned long long __ms)
|
||||
{
|
||||
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
|
||||
constexpr chrono::duration<long double, milli> operator""ms(long double __ms)
|
||||
{
|
||||
return chrono::duration<long double, milli>(__ms);
|
||||
}
|
||||
|
||||
|
||||
constexpr chrono::microseconds operator"" us(unsigned long long __us)
|
||||
constexpr chrono::microseconds operator""us(unsigned long long __us)
|
||||
{
|
||||
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
|
||||
constexpr chrono::duration<long double, micro> operator""us(long double __us)
|
||||
{
|
||||
return chrono::duration<long double, micro> (__us);
|
||||
}
|
||||
|
||||
|
||||
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
|
||||
constexpr chrono::nanoseconds operator""ns(unsigned long long __ns)
|
||||
{
|
||||
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
|
||||
}
|
||||
|
||||
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
|
||||
constexpr chrono::duration<long double, nano> operator""ns(long double __ns)
|
||||
{
|
||||
return chrono::duration<long double, nano> (__ns);
|
||||
}
|
||||
|
@ -1160,4 +1163,6 @@ namespace chrono { // hoist the literals into namespace std::chrono
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_CHRONO
|
||||
|
|
|
@ -398,7 +398,6 @@ using ::cbrtf;
|
|||
using ::copysign;
|
||||
using ::copysignf;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::erf;
|
||||
using ::erff;
|
||||
using ::erfc;
|
||||
|
@ -435,12 +434,10 @@ using ::lrint;
|
|||
using ::lrintf;
|
||||
using ::lround;
|
||||
using ::lroundf;
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
using ::nan;
|
||||
using ::nanf;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::nearbyint;
|
||||
using ::nearbyintf;
|
||||
using ::nextafter;
|
||||
|
@ -463,7 +460,6 @@ using ::tgamma;
|
|||
using ::tgammaf;
|
||||
using ::trunc;
|
||||
using ::truncf;
|
||||
#endif // !_LIBCPP_MSVCRT
|
||||
|
||||
using ::acosl;
|
||||
using ::asinl;
|
||||
|
@ -495,7 +491,6 @@ using ::cbrtl;
|
|||
|
||||
using ::copysignl;
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
using ::erfl;
|
||||
using ::erfcl;
|
||||
using ::exp2l;
|
||||
|
@ -526,7 +521,6 @@ using ::scalblnl;
|
|||
using ::scalbnl;
|
||||
using ::tgammal;
|
||||
using ::truncl;
|
||||
#endif // !_LIBCPP_MSVCRT
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
inline _LIBCPP_INLINE_VISIBILITY float hypot( float x, float y, float z ) { return sqrt(x*x + y*y + z*z); }
|
||||
|
@ -555,7 +549,7 @@ hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
#if __has_builtin(__builtin_isnan)
|
||||
return __builtin_isnan(__lcpp_x);
|
||||
|
@ -567,7 +561,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isnan_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
return isnan(__lcpp_x);
|
||||
}
|
||||
|
@ -575,7 +569,7 @@ __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
#if __has_builtin(__builtin_isinf)
|
||||
return __builtin_isinf(__lcpp_x);
|
||||
|
@ -587,7 +581,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isinf_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
return isinf(__lcpp_x);
|
||||
}
|
||||
|
@ -595,7 +589,7 @@ __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
#if __has_builtin(__builtin_isfinite)
|
||||
return __builtin_isfinite(__lcpp_x);
|
||||
|
@ -607,7 +601,7 @@ __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
|
|||
template <class _A1>
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
|
||||
__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT
|
||||
__libcpp_isfinite_or_builtin(_A1 __lcpp_x) _NOEXCEPT
|
||||
{
|
||||
return isfinite(__lcpp_x);
|
||||
}
|
||||
|
|
|
@ -599,39 +599,39 @@ operator*(const complex<_Tp>& __z, const complex<_Tp>& __w)
|
|||
_Tp __bc = __b * __c;
|
||||
_Tp __x = __ac - __bd;
|
||||
_Tp __y = __ad + __bc;
|
||||
if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
|
||||
if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
|
||||
{
|
||||
bool __recalc = false;
|
||||
if (__libcpp_isinf(__a) || __libcpp_isinf(__b))
|
||||
if (__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b))
|
||||
{
|
||||
__a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
|
||||
__b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
|
||||
if (__libcpp_isnan(__c))
|
||||
__a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
|
||||
__b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
|
||||
if (__libcpp_isnan_or_builtin(__c))
|
||||
__c = copysign(_Tp(0), __c);
|
||||
if (__libcpp_isnan(__d))
|
||||
if (__libcpp_isnan_or_builtin(__d))
|
||||
__d = copysign(_Tp(0), __d);
|
||||
__recalc = true;
|
||||
}
|
||||
if (__libcpp_isinf(__c) || __libcpp_isinf(__d))
|
||||
if (__libcpp_isinf_or_builtin(__c) || __libcpp_isinf_or_builtin(__d))
|
||||
{
|
||||
__c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
|
||||
__d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
|
||||
if (__libcpp_isnan(__a))
|
||||
__c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
|
||||
__d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
|
||||
if (__libcpp_isnan_or_builtin(__a))
|
||||
__a = copysign(_Tp(0), __a);
|
||||
if (__libcpp_isnan(__b))
|
||||
if (__libcpp_isnan_or_builtin(__b))
|
||||
__b = copysign(_Tp(0), __b);
|
||||
__recalc = true;
|
||||
}
|
||||
if (!__recalc && (__libcpp_isinf(__ac) || __libcpp_isinf(__bd) ||
|
||||
__libcpp_isinf(__ad) || __libcpp_isinf(__bc)))
|
||||
if (!__recalc && (__libcpp_isinf_or_builtin(__ac) || __libcpp_isinf_or_builtin(__bd) ||
|
||||
__libcpp_isinf_or_builtin(__ad) || __libcpp_isinf_or_builtin(__bc)))
|
||||
{
|
||||
if (__libcpp_isnan(__a))
|
||||
if (__libcpp_isnan_or_builtin(__a))
|
||||
__a = copysign(_Tp(0), __a);
|
||||
if (__libcpp_isnan(__b))
|
||||
if (__libcpp_isnan_or_builtin(__b))
|
||||
__b = copysign(_Tp(0), __b);
|
||||
if (__libcpp_isnan(__c))
|
||||
if (__libcpp_isnan_or_builtin(__c))
|
||||
__c = copysign(_Tp(0), __c);
|
||||
if (__libcpp_isnan(__d))
|
||||
if (__libcpp_isnan_or_builtin(__d))
|
||||
__d = copysign(_Tp(0), __d);
|
||||
__recalc = true;
|
||||
}
|
||||
|
@ -674,7 +674,7 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
|
|||
_Tp __c = __w.real();
|
||||
_Tp __d = __w.imag();
|
||||
_Tp __logbw = logb(fmax(fabs(__c), fabs(__d)));
|
||||
if (__libcpp_isfinite(__logbw))
|
||||
if (__libcpp_isfinite_or_builtin(__logbw))
|
||||
{
|
||||
__ilogbw = static_cast<int>(__logbw);
|
||||
__c = scalbn(__c, -__ilogbw);
|
||||
|
@ -683,24 +683,24 @@ operator/(const complex<_Tp>& __z, const complex<_Tp>& __w)
|
|||
_Tp __denom = __c * __c + __d * __d;
|
||||
_Tp __x = scalbn((__a * __c + __b * __d) / __denom, -__ilogbw);
|
||||
_Tp __y = scalbn((__b * __c - __a * __d) / __denom, -__ilogbw);
|
||||
if (__libcpp_isnan(__x) && __libcpp_isnan(__y))
|
||||
if (__libcpp_isnan_or_builtin(__x) && __libcpp_isnan_or_builtin(__y))
|
||||
{
|
||||
if ((__denom == _Tp(0)) && (!__libcpp_isnan(__a) || !__libcpp_isnan(__b)))
|
||||
if ((__denom == _Tp(0)) && (!__libcpp_isnan_or_builtin(__a) || !__libcpp_isnan_or_builtin(__b)))
|
||||
{
|
||||
__x = copysign(_Tp(INFINITY), __c) * __a;
|
||||
__y = copysign(_Tp(INFINITY), __c) * __b;
|
||||
}
|
||||
else if ((__libcpp_isinf(__a) || __libcpp_isinf(__b)) && __libcpp_isfinite(__c) && __libcpp_isfinite(__d))
|
||||
else if ((__libcpp_isinf_or_builtin(__a) || __libcpp_isinf_or_builtin(__b)) && __libcpp_isfinite_or_builtin(__c) && __libcpp_isfinite_or_builtin(__d))
|
||||
{
|
||||
__a = copysign(__libcpp_isinf(__a) ? _Tp(1) : _Tp(0), __a);
|
||||
__b = copysign(__libcpp_isinf(__b) ? _Tp(1) : _Tp(0), __b);
|
||||
__a = copysign(__libcpp_isinf_or_builtin(__a) ? _Tp(1) : _Tp(0), __a);
|
||||
__b = copysign(__libcpp_isinf_or_builtin(__b) ? _Tp(1) : _Tp(0), __b);
|
||||
__x = _Tp(INFINITY) * (__a * __c + __b * __d);
|
||||
__y = _Tp(INFINITY) * (__b * __c - __a * __d);
|
||||
}
|
||||
else if (__libcpp_isinf(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite(__a) && __libcpp_isfinite(__b))
|
||||
else if (__libcpp_isinf_or_builtin(__logbw) && __logbw > _Tp(0) && __libcpp_isfinite_or_builtin(__a) && __libcpp_isfinite_or_builtin(__b))
|
||||
{
|
||||
__c = copysign(__libcpp_isinf(__c) ? _Tp(1) : _Tp(0), __c);
|
||||
__d = copysign(__libcpp_isinf(__d) ? _Tp(1) : _Tp(0), __d);
|
||||
__c = copysign(__libcpp_isinf_or_builtin(__c) ? _Tp(1) : _Tp(0), __c);
|
||||
__d = copysign(__libcpp_isinf_or_builtin(__d) ? _Tp(1) : _Tp(0), __d);
|
||||
__x = _Tp(0) * (__a * __c + __b * __d);
|
||||
__y = _Tp(0) * (__b * __c - __a * __d);
|
||||
}
|
||||
|
@ -910,9 +910,9 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||
_Tp
|
||||
norm(const complex<_Tp>& __c)
|
||||
{
|
||||
if (__libcpp_isinf(__c.real()))
|
||||
if (__libcpp_isinf_or_builtin(__c.real()))
|
||||
return abs(__c.real());
|
||||
if (__libcpp_isinf(__c.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__c.imag()))
|
||||
return abs(__c.imag());
|
||||
return __c.real() * __c.real() + __c.imag() * __c.imag();
|
||||
}
|
||||
|
@ -955,7 +955,7 @@ complex<_Tp>
|
|||
proj(const complex<_Tp>& __c)
|
||||
{
|
||||
std::complex<_Tp> __r = __c;
|
||||
if (__libcpp_isinf(__c.real()) || __libcpp_isinf(__c.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
|
||||
__r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
||||
return __r;
|
||||
}
|
||||
|
@ -969,7 +969,7 @@ typename enable_if
|
|||
>::type
|
||||
proj(_Tp __re)
|
||||
{
|
||||
if (__libcpp_isinf(__re))
|
||||
if (__libcpp_isinf_or_builtin(__re))
|
||||
__re = abs(__re);
|
||||
return complex<_Tp>(__re);
|
||||
}
|
||||
|
@ -993,25 +993,25 @@ template<class _Tp>
|
|||
complex<_Tp>
|
||||
polar(const _Tp& __rho, const _Tp& __theta = _Tp(0))
|
||||
{
|
||||
if (__libcpp_isnan(__rho) || signbit(__rho))
|
||||
if (__libcpp_isnan_or_builtin(__rho) || signbit(__rho))
|
||||
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
||||
if (__libcpp_isnan(__theta))
|
||||
if (__libcpp_isnan_or_builtin(__theta))
|
||||
{
|
||||
if (__libcpp_isinf(__rho))
|
||||
if (__libcpp_isinf_or_builtin(__rho))
|
||||
return complex<_Tp>(__rho, __theta);
|
||||
return complex<_Tp>(__theta, __theta);
|
||||
}
|
||||
if (__libcpp_isinf(__theta))
|
||||
if (__libcpp_isinf_or_builtin(__theta))
|
||||
{
|
||||
if (__libcpp_isinf(__rho))
|
||||
if (__libcpp_isinf_or_builtin(__rho))
|
||||
return complex<_Tp>(__rho, _Tp(NAN));
|
||||
return complex<_Tp>(_Tp(NAN), _Tp(NAN));
|
||||
}
|
||||
_Tp __x = __rho * cos(__theta);
|
||||
if (__libcpp_isnan(__x))
|
||||
if (__libcpp_isnan_or_builtin(__x))
|
||||
__x = 0;
|
||||
_Tp __y = __rho * sin(__theta);
|
||||
if (__libcpp_isnan(__y))
|
||||
if (__libcpp_isnan_or_builtin(__y))
|
||||
__y = 0;
|
||||
return complex<_Tp>(__x, __y);
|
||||
}
|
||||
|
@ -1042,13 +1042,13 @@ template<class _Tp>
|
|||
complex<_Tp>
|
||||
sqrt(const complex<_Tp>& __x)
|
||||
{
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(_Tp(INFINITY), __x.imag());
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (__x.real() > _Tp(0))
|
||||
return complex<_Tp>(__x.real(), __libcpp_isnan(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
|
||||
return complex<_Tp>(__libcpp_isnan(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
|
||||
return complex<_Tp>(__x.real(), __libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : copysign(_Tp(0), __x.imag()));
|
||||
return complex<_Tp>(__libcpp_isnan_or_builtin(__x.imag()) ? __x.imag() : _Tp(0), copysign(__x.real(), __x.imag()));
|
||||
}
|
||||
return polar(sqrt(abs(__x)), arg(__x) / _Tp(2));
|
||||
}
|
||||
|
@ -1060,21 +1060,21 @@ complex<_Tp>
|
|||
exp(const complex<_Tp>& __x)
|
||||
{
|
||||
_Tp __i = __x.imag();
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (__x.real() < _Tp(0))
|
||||
{
|
||||
if (!__libcpp_isfinite(__i))
|
||||
if (!__libcpp_isfinite_or_builtin(__i))
|
||||
__i = _Tp(1);
|
||||
}
|
||||
else if (__i == 0 || !__libcpp_isfinite(__i))
|
||||
else if (__i == 0 || !__libcpp_isfinite_or_builtin(__i))
|
||||
{
|
||||
if (__libcpp_isinf(__i))
|
||||
if (__libcpp_isinf_or_builtin(__i))
|
||||
__i = _Tp(NAN);
|
||||
return complex<_Tp>(__x.real(), __i);
|
||||
}
|
||||
}
|
||||
else if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
|
||||
else if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
|
||||
return __x;
|
||||
_Tp __e = exp(__x.real());
|
||||
return complex<_Tp>(__e * cos(__i), __e * sin(__i));
|
||||
|
@ -1132,23 +1132,23 @@ complex<_Tp>
|
|||
asinh(const complex<_Tp>& __x)
|
||||
{
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isnan(__x.imag()))
|
||||
if (__libcpp_isnan_or_builtin(__x.imag()))
|
||||
return __x;
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
}
|
||||
if (__libcpp_isnan(__x.real()))
|
||||
if (__libcpp_isnan_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.imag(), __x.real());
|
||||
if (__x.imag() == 0)
|
||||
return __x;
|
||||
return complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(copysign(__x.imag(), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) + _Tp(1)));
|
||||
return complex<_Tp>(copysign(__z.real(), __x.real()), copysign(__z.imag(), __x.imag()));
|
||||
|
@ -1161,11 +1161,11 @@ complex<_Tp>
|
|||
acosh(const complex<_Tp>& __x)
|
||||
{
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isnan(__x.imag()))
|
||||
if (__libcpp_isnan_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
{
|
||||
if (__x.real() > 0)
|
||||
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
|
||||
|
@ -1176,13 +1176,13 @@ acosh(const complex<_Tp>& __x)
|
|||
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
|
||||
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
|
||||
}
|
||||
if (__libcpp_isnan(__x.real()))
|
||||
if (__libcpp_isnan_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.imag()), __x.real());
|
||||
return complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.imag()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
complex<_Tp> __z = log(__x + sqrt(pow(__x, _Tp(2)) - _Tp(1)));
|
||||
return complex<_Tp>(copysign(__z.real(), _Tp(0)), copysign(__z.imag(), __x.imag()));
|
||||
|
@ -1195,21 +1195,21 @@ complex<_Tp>
|
|||
atanh(const complex<_Tp>& __x)
|
||||
{
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
{
|
||||
return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
}
|
||||
if (__libcpp_isnan(__x.imag()))
|
||||
if (__libcpp_isnan_or_builtin(__x.imag()))
|
||||
{
|
||||
if (__libcpp_isinf(__x.real()) || __x.real() == 0)
|
||||
if (__libcpp_isinf_or_builtin(__x.real()) || __x.real() == 0)
|
||||
return complex<_Tp>(copysign(_Tp(0), __x.real()), __x.imag());
|
||||
return complex<_Tp>(__x.imag(), __x.imag());
|
||||
}
|
||||
if (__libcpp_isnan(__x.real()))
|
||||
if (__libcpp_isnan_or_builtin(__x.real()))
|
||||
{
|
||||
return complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
return complex<_Tp>(copysign(_Tp(0), __x.real()), copysign(__pi/_Tp(2), __x.imag()));
|
||||
}
|
||||
|
@ -1227,11 +1227,11 @@ template<class _Tp>
|
|||
complex<_Tp>
|
||||
sinh(const complex<_Tp>& __x)
|
||||
{
|
||||
if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.real(), _Tp(NAN));
|
||||
if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
|
||||
if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.real(), _Tp(NAN));
|
||||
if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
|
||||
if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
|
||||
return __x;
|
||||
return complex<_Tp>(sinh(__x.real()) * cos(__x.imag()), cosh(__x.real()) * sin(__x.imag()));
|
||||
}
|
||||
|
@ -1242,13 +1242,13 @@ template<class _Tp>
|
|||
complex<_Tp>
|
||||
cosh(const complex<_Tp>& __x)
|
||||
{
|
||||
if (__libcpp_isinf(__x.real()) && !__libcpp_isfinite(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()) && !__libcpp_isfinite_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(abs(__x.real()), _Tp(NAN));
|
||||
if (__x.real() == 0 && !__libcpp_isfinite(__x.imag()))
|
||||
if (__x.real() == 0 && !__libcpp_isfinite_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(_Tp(NAN), __x.real());
|
||||
if (__x.real() == 0 && __x.imag() == 0)
|
||||
return complex<_Tp>(_Tp(1), __x.imag());
|
||||
if (__x.imag() == 0 && !__libcpp_isfinite(__x.real()))
|
||||
if (__x.imag() == 0 && !__libcpp_isfinite_or_builtin(__x.real()))
|
||||
return complex<_Tp>(abs(__x.real()), __x.imag());
|
||||
return complex<_Tp>(cosh(__x.real()) * cos(__x.imag()), sinh(__x.real()) * sin(__x.imag()));
|
||||
}
|
||||
|
@ -1259,19 +1259,19 @@ template<class _Tp>
|
|||
complex<_Tp>
|
||||
tanh(const complex<_Tp>& __x)
|
||||
{
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (!__libcpp_isfinite(__x.imag()))
|
||||
if (!__libcpp_isfinite_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(_Tp(1), _Tp(0));
|
||||
return complex<_Tp>(_Tp(1), copysign(_Tp(0), sin(_Tp(2) * __x.imag())));
|
||||
}
|
||||
if (__libcpp_isnan(__x.real()) && __x.imag() == 0)
|
||||
if (__libcpp_isnan_or_builtin(__x.real()) && __x.imag() == 0)
|
||||
return __x;
|
||||
_Tp __2r(_Tp(2) * __x.real());
|
||||
_Tp __2i(_Tp(2) * __x.imag());
|
||||
_Tp __d(cosh(__2r) + cos(__2i));
|
||||
_Tp __2rsh(sinh(__2r));
|
||||
if (__libcpp_isinf(__2rsh) && __libcpp_isinf(__d))
|
||||
if (__libcpp_isinf_or_builtin(__2rsh) && __libcpp_isinf_or_builtin(__d))
|
||||
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
|
||||
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
|
||||
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
|
||||
|
@ -1294,11 +1294,11 @@ complex<_Tp>
|
|||
acos(const complex<_Tp>& __x)
|
||||
{
|
||||
const _Tp __pi(atan2(+0., -0.));
|
||||
if (__libcpp_isinf(__x.real()))
|
||||
if (__libcpp_isinf_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isnan(__x.imag()))
|
||||
if (__libcpp_isnan_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.imag(), __x.real());
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
{
|
||||
if (__x.real() < _Tp(0))
|
||||
return complex<_Tp>(_Tp(0.75) * __pi, -__x.imag());
|
||||
|
@ -1308,13 +1308,13 @@ acos(const complex<_Tp>& __x)
|
|||
return complex<_Tp>(__pi, signbit(__x.imag()) ? -__x.real() : __x.real());
|
||||
return complex<_Tp>(_Tp(0), signbit(__x.imag()) ? __x.real() : -__x.real());
|
||||
}
|
||||
if (__libcpp_isnan(__x.real()))
|
||||
if (__libcpp_isnan_or_builtin(__x.real()))
|
||||
{
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__x.real(), -__x.imag());
|
||||
return complex<_Tp>(__x.real(), __x.real());
|
||||
}
|
||||
if (__libcpp_isinf(__x.imag()))
|
||||
if (__libcpp_isinf_or_builtin(__x.imag()))
|
||||
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
|
||||
if (__x.real() == 0 && (__x.imag() == 0 || isnan(__x.imag())))
|
||||
return complex<_Tp>(__pi/_Tp(2), -__x.imag());
|
||||
|
|
|
@ -133,12 +133,14 @@ public:
|
|||
void notify_all() _NOEXCEPT;
|
||||
|
||||
template <class _Lock>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
void wait(_Lock& __lock);
|
||||
template <class _Lock, class _Predicate>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void wait(_Lock& __lock, _Predicate __pred);
|
||||
|
||||
template <class _Lock, class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
cv_status
|
||||
wait_until(_Lock& __lock,
|
||||
const chrono::time_point<_Clock, _Duration>& __t);
|
||||
|
|
|
@ -28,6 +28,7 @@ Types:
|
|||
size_t
|
||||
max_align_t
|
||||
nullptr_t
|
||||
byte // C++17
|
||||
|
||||
} // std
|
||||
|
||||
|
@ -48,7 +49,8 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
|||
using ::ptrdiff_t;
|
||||
using ::size_t;
|
||||
|
||||
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T)
|
||||
#if defined(__CLANG_MAX_ALIGN_T_DEFINED) || defined(_GCC_MAX_ALIGN_T) || \
|
||||
defined(__DEFINED_max_align_t)
|
||||
// Re-use the compiler's <stddef.h> max_align_t where possible.
|
||||
using ::max_align_t;
|
||||
#else
|
||||
|
@ -57,4 +59,55 @@ typedef long double max_align_t;
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
namespace std // purposefully not versioned
|
||||
{
|
||||
enum class byte : unsigned char {};
|
||||
|
||||
constexpr byte operator| (byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(
|
||||
static_cast<unsigned int>(__lhs) | static_cast<unsigned int>(__rhs)
|
||||
));
|
||||
}
|
||||
|
||||
constexpr byte& operator|=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = __lhs | __rhs; }
|
||||
|
||||
constexpr byte operator& (byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(
|
||||
static_cast<unsigned int>(__lhs) & static_cast<unsigned int>(__rhs)
|
||||
));
|
||||
}
|
||||
|
||||
constexpr byte& operator&=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = __lhs & __rhs; }
|
||||
|
||||
constexpr byte operator^ (byte __lhs, byte __rhs) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(
|
||||
static_cast<unsigned int>(__lhs) ^ static_cast<unsigned int>(__rhs)
|
||||
));
|
||||
}
|
||||
|
||||
constexpr byte& operator^=(byte& __lhs, byte __rhs) noexcept
|
||||
{ return __lhs = __lhs ^ __rhs; }
|
||||
|
||||
constexpr byte operator~ (byte __b) noexcept
|
||||
{
|
||||
return static_cast<byte>(
|
||||
static_cast<unsigned char>(
|
||||
~static_cast<unsigned int>(__b)
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include <type_traits> // rest of byte
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CSTDDEF
|
||||
|
|
|
@ -98,9 +98,6 @@ void perror(const char* s);
|
|||
|
||||
#include <__config>
|
||||
#include <stdio.h>
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#include <crtversion.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
@ -156,8 +153,7 @@ using ::tmpnam;
|
|||
|
||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11 && \
|
||||
(!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
|
||||
#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::scanf;
|
||||
|
|
|
@ -130,8 +130,10 @@ using ::abort;
|
|||
using ::atexit;
|
||||
using ::exit;
|
||||
using ::_Exit;
|
||||
#ifndef _LIBCPP_WINDOWS_STORE_APP
|
||||
using ::getenv;
|
||||
using ::system;
|
||||
#endif
|
||||
using ::bsearch;
|
||||
using ::qsort;
|
||||
using ::abs;
|
||||
|
|
|
@ -40,15 +40,6 @@ int toupper(int c);
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
// We support including .h headers inside 'extern "C"' contexts, so switch
|
||||
// back to C++ linkage before including these C++ headers.
|
||||
extern "C++" {
|
||||
#include "support/win32/support.h"
|
||||
#include "support/win32/locale_win32.h"
|
||||
}
|
||||
#endif // _LIBCPP_MSVCRT
|
||||
|
||||
#undef isalnum
|
||||
#undef isalpha
|
||||
#undef isblank
|
||||
|
|
|
@ -150,10 +150,6 @@ template <class T, class Allocator>
|
|||
|
||||
*/
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#include <__config>
|
||||
#include <__split_buffer>
|
||||
#include <type_traits>
|
||||
|
@ -162,7 +158,13 @@ template <class T, class Allocator>
|
|||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <__undef_min_max>
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
|
@ -968,13 +970,12 @@ protected:
|
|||
public:
|
||||
~__deque_base();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__deque_base(__deque_base&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
|
||||
__deque_base(__deque_base&& __c, const allocator_type& __a);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void swap(__deque_base& __c)
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
_NOEXCEPT;
|
||||
|
@ -1108,7 +1109,7 @@ __deque_base<_Tp, _Allocator>::~__deque_base()
|
|||
__alloc_traits::deallocate(__alloc(), *__i, __block_size);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c)
|
||||
|
@ -1140,7 +1141,7 @@ __deque_base<_Tp, _Allocator>::__deque_base(__deque_base&& __c, const allocator_
|
|||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
|
@ -1230,18 +1231,16 @@ public:
|
|||
typename enable_if<__is_input_iterator<_InputIter>::value>::type* = 0);
|
||||
deque(const deque& __c);
|
||||
deque(const deque& __c, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
deque(initializer_list<value_type> __il);
|
||||
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
deque& operator=(const deque& __c);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
deque(initializer_list<value_type> __il);
|
||||
deque(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
deque& operator=(initializer_list<value_type> __il) {assign(__il); return *this;}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
deque(deque&& __c) _NOEXCEPT_(is_nothrow_move_constructible<__base>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -1250,7 +1249,10 @@ public:
|
|||
deque& operator=(deque&& __c)
|
||||
_NOEXCEPT_(__alloc_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _InputIter>
|
||||
void assign(_InputIter __f, _InputIter __l,
|
||||
|
@ -1260,10 +1262,6 @@ public:
|
|||
void assign(_RAIter __f, _RAIter __l,
|
||||
typename enable_if<__is_random_access_iterator<_RAIter>::value>::type* = 0);
|
||||
void assign(size_type __n, const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il) {assign(__il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT;
|
||||
|
@ -1316,7 +1314,7 @@ public:
|
|||
void resize(size_type __n);
|
||||
void resize(size_type __n, const value_type& __v);
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT {return __base::size() == 0;}
|
||||
|
||||
// element access:
|
||||
|
@ -1340,8 +1338,7 @@ public:
|
|||
// 23.2.2.3 modifiers:
|
||||
void push_front(const value_type& __v);
|
||||
void push_back(const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
template <class... _Args> reference emplace_back (_Args&&... __args);
|
||||
|
@ -1350,11 +1347,15 @@ public:
|
|||
template <class... _Args> void emplace_back (_Args&&... __args);
|
||||
#endif
|
||||
template <class... _Args> iterator emplace(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
void push_front(value_type&& __v);
|
||||
void push_back(value_type&& __v);
|
||||
iterator insert(const_iterator __p, value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
iterator insert(const_iterator __p, const value_type& __v);
|
||||
iterator insert(const_iterator __p, size_type __n, const value_type& __v);
|
||||
template <class _InputIter>
|
||||
|
@ -1368,11 +1369,7 @@ public:
|
|||
template <class _BiIter>
|
||||
iterator insert(const_iterator __p, _BiIter __f, _BiIter __l,
|
||||
typename enable_if<__is_bidirectional_iterator<_BiIter>::value>::type* = 0);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
void pop_front();
|
||||
void pop_back();
|
||||
iterator erase(const_iterator __p);
|
||||
|
@ -1527,7 +1524,19 @@ deque<_Tp, _Allocator>::deque(const deque& __c, const allocator_type& __a)
|
|||
__append(__c.begin(), __c.end());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>&
|
||||
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il)
|
||||
|
@ -1542,22 +1551,6 @@ deque<_Tp, _Allocator>::deque(initializer_list<value_type> __il, const allocator
|
|||
__append(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
deque<_Tp, _Allocator>&
|
||||
deque<_Tp, _Allocator>::operator=(const deque& __c)
|
||||
{
|
||||
if (this != &__c)
|
||||
{
|
||||
__copy_assign_alloc(__c);
|
||||
assign(__c.begin(), __c.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline
|
||||
deque<_Tp, _Allocator>::deque(deque&& __c)
|
||||
|
@ -1613,7 +1606,7 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, true_type)
|
|||
__base::__move_assign(__c);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class _InputIter>
|
||||
|
@ -1809,8 +1802,20 @@ deque<_Tp, _Allocator>::push_back(const value_type& __v)
|
|||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(const value_type& __v)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_back(value_type&& __v)
|
||||
|
@ -1823,8 +1828,6 @@ deque<_Tp, _Allocator>::push_back(value_type&& __v)
|
|||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
@ -1846,24 +1849,6 @@ deque<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(const value_type& __v)
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), __v);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
deque<_Tp, _Allocator>::push_front(value_type&& __v)
|
||||
|
@ -1877,7 +1862,6 @@ deque<_Tp, _Allocator>::push_front(value_type&& __v)
|
|||
++__base::size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
|
@ -1900,8 +1884,121 @@ deque<_Tp, _Allocator>::emplace_front(_Args&&... __args)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
|
@ -1964,126 +2061,6 @@ deque<_Tp, _Allocator>::insert(const_iterator __p, const value_type& __v)
|
|||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, value_type&& __v)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::move(__v));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::move(__v));
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__v);
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
template <class... _Args>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
size_type __pos = __p - __base::begin();
|
||||
size_type __to_end = __base::size() - __pos;
|
||||
allocator_type& __a = __base::__alloc();
|
||||
if (__pos < __to_end)
|
||||
{ // insert by shifting things backward
|
||||
if (__front_spare() == 0)
|
||||
__add_front_capacity();
|
||||
// __front_spare() >= 1
|
||||
if (__pos == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*--__base::begin()), _VSTD::forward<_Args>(__args)...);
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __b = __base::begin();
|
||||
iterator __bm1 = _VSTD::prev(__b);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
|
||||
--__base::__start_;
|
||||
++__base::size();
|
||||
if (__pos > 1)
|
||||
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
|
||||
*__b = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // insert by shifting things forward
|
||||
if (__back_spare() == 0)
|
||||
__add_back_capacity();
|
||||
// __back_capacity >= 1
|
||||
size_type __de = __base::size() - __pos;
|
||||
if (__de == 0)
|
||||
{
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__base::end()), _VSTD::forward<_Args>(__args)...);
|
||||
++__base::size();
|
||||
}
|
||||
else
|
||||
{
|
||||
__temp_value<value_type, _Allocator> __tmp(this->__alloc(), _VSTD::forward<_Args>(__args)...);
|
||||
iterator __e = __base::end();
|
||||
iterator __em1 = _VSTD::prev(__e);
|
||||
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
|
||||
++__base::size();
|
||||
if (__de > 1)
|
||||
__e = _VSTD::move_backward(__e - __de, __em1, __e);
|
||||
*--__e = _VSTD::move(__tmp.get());
|
||||
}
|
||||
}
|
||||
return __base::begin() + __pos;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
typename deque<_Tp, _Allocator>::iterator
|
||||
deque<_Tp, _Allocator>::insert(const_iterator __p, size_type __n, const value_type& __v)
|
||||
|
@ -2246,7 +2223,11 @@ deque<_Tp, _Allocator>::__append(_InpIter __f, _InpIter __l,
|
|||
!__is_forward_iterator<_InpIter>::value>::type*)
|
||||
{
|
||||
for (; __f != __l; ++__f)
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
push_back(*__f);
|
||||
#else
|
||||
emplace_back(*__f);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
|
@ -2924,4 +2905,6 @@ swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_DEQUE
|
||||
|
|
|
@ -82,6 +82,10 @@ template <class E> void rethrow_if_nested(const E& e);
|
|||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_NO_VCRUNTIME)
|
||||
#include <vcruntime_exception.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
@ -89,6 +93,7 @@ template <class E> void rethrow_if_nested(const E& e);
|
|||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
#if !defined(_LIBCPP_ABI_MICROSOFT) || defined(_LIBCPP_NO_VCRUNTIME)
|
||||
class _LIBCPP_EXCEPTION_ABI exception
|
||||
{
|
||||
public:
|
||||
|
@ -105,11 +110,16 @@ public:
|
|||
virtual ~bad_exception() _NOEXCEPT;
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
};
|
||||
#endif // !_LIBCPP_ABI_MICROSOFT || _LIBCPP_NO_VCRUNTIME
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 \
|
||||
|| defined(_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS) \
|
||||
|| defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
typedef void (*unexpected_handler)();
|
||||
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected();
|
||||
#endif
|
||||
|
||||
typedef void (*terminate_handler)();
|
||||
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
|
||||
|
@ -117,30 +127,33 @@ _LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT;
|
|||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS int uncaught_exceptions() _NOEXCEPT;
|
||||
_LIBCPP_FUNC_VIS _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS int uncaught_exceptions() _NOEXCEPT;
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr;
|
||||
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
|
||||
|
||||
#ifndef _LIBCPP_ABI_MICROSOFT
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr
|
||||
{
|
||||
void* __ptr_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {}
|
||||
|
||||
exception_ptr(const exception_ptr&) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT
|
||||
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_EXPLICIT operator bool() const _NOEXCEPT
|
||||
{return __ptr_ != nullptr;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return __x.__ptr_ == __y.__ptr_;}
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
@ -168,6 +181,54 @@ make_exception_ptr(_Ep __e) _NOEXCEPT
|
|||
#endif
|
||||
}
|
||||
|
||||
#else // _LIBCPP_ABI_MICROSOFT
|
||||
|
||||
class _LIBCPP_TYPE_VIS exception_ptr
|
||||
{
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wunused-private-field"
|
||||
#endif
|
||||
void* __ptr1_;
|
||||
void* __ptr2_;
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic pop
|
||||
#endif
|
||||
public:
|
||||
exception_ptr() _NOEXCEPT;
|
||||
exception_ptr(nullptr_t) _NOEXCEPT;
|
||||
exception_ptr(const exception_ptr& __other) _NOEXCEPT;
|
||||
exception_ptr& operator=(const exception_ptr& __other) _NOEXCEPT;
|
||||
exception_ptr& operator=(nullptr_t) _NOEXCEPT;
|
||||
~exception_ptr() _NOEXCEPT;
|
||||
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT;
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
|
||||
{return !(__x == __y);}
|
||||
|
||||
_LIBCPP_FUNC_VIS void swap(exception_ptr&, exception_ptr&) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS exception_ptr __copy_exception_ptr(void *__except, const void* __ptr);
|
||||
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
|
||||
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr p);
|
||||
|
||||
// This is a built-in template function which automagically extracts the required
|
||||
// information.
|
||||
template <class _E> void *__GetExceptionInfo(_E);
|
||||
|
||||
template<class _Ep>
|
||||
exception_ptr
|
||||
make_exception_ptr(_Ep __e) _NOEXCEPT
|
||||
{
|
||||
return __copy_exception_ptr(_VSTD::addressof(__e), __GetExceptionInfo(__e));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_ABI_MICROSOFT
|
||||
// nested_exception
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI nested_exception
|
||||
|
@ -192,58 +253,71 @@ struct __nested
|
|||
_LIBCPP_INLINE_VISIBILITY explicit __nested(const _Tp& __t) : _Tp(__t) {}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
is_class<typename remove_reference<_Tp>::type>::value &&
|
||||
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
&& !__libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
is_class<_Tp>::value && !is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t));
|
||||
template <class _Tp, class _Up, bool>
|
||||
struct __throw_with_nested;
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, true> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
((void)__t);
|
||||
// FIXME: Make this abort.
|
||||
__do_throw (_Tp& __t)
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
{
|
||||
throw __nested<_Up>(_VSTD::forward<_Tp>(__t));
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __throw_with_nested<_Tp, _Up, false> {
|
||||
_LIBCPP_NORETURN static inline _LIBCPP_ALWAYS_INLINE void
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__do_throw(_Tp&& __t)
|
||||
#else
|
||||
__do_throw (_Tp& __t)
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
{
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NORETURN
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested(_Tp&& __t, typename enable_if<
|
||||
!is_class<typename remove_reference<_Tp>::type>::value ||
|
||||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
|
||||
|| __libcpp_is_final<typename remove_reference<_Tp>::type>::value
|
||||
>::type* = 0)
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
throw_with_nested (_Tp& __t, typename enable_if<
|
||||
!is_class<_Tp>::value || is_base_of<nested_exception, _Tp>::value
|
||||
>::type* = 0)
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
throw_with_nested(_Tp&& __t)
|
||||
#else
|
||||
throw_with_nested (_Tp& __t)
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
throw _VSTD::forward<_Tp>(__t);
|
||||
typedef typename decay<_Tp>::type _Up;
|
||||
static_assert( is_copy_constructible<_Up>::value, "type thrown must be CopyConstructible");
|
||||
__throw_with_nested<_Tp, _Up,
|
||||
is_class<_Up>::value &&
|
||||
!is_base_of<nested_exception, _Up>::value &&
|
||||
!__libcpp_is_final<_Up>::value>::
|
||||
__do_throw(_VSTD::forward<_Tp>(__t));
|
||||
#else
|
||||
((void)__t);
|
||||
// FIXME: Make this abort
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __can_dynamic_cast : public _LIBCPP_BOOL_CONSTANT(
|
||||
is_polymorphic<_From>::value &&
|
||||
(!is_base_of<_To, _From>::value ||
|
||||
is_convertible<const _From*, const _To*>::value)) {};
|
||||
|
||||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep& __e, typename enable_if<
|
||||
is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
rethrow_if_nested(const _Ep& __e,
|
||||
typename enable_if< __can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
|
||||
{
|
||||
const nested_exception* __nep = dynamic_cast<const nested_exception*>(_VSTD::addressof(__e));
|
||||
if (__nep)
|
||||
|
@ -253,9 +327,8 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
|
|||
template <class _Ep>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
rethrow_if_nested(const _Ep&, typename enable_if<
|
||||
!is_polymorphic<_Ep>::value
|
||||
>::type* = 0)
|
||||
rethrow_if_nested(const _Ep&,
|
||||
typename enable_if<!__can_dynamic_cast<_Ep, nested_exception>::value>::type* = 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -44,6 +44,13 @@
|
|||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_FILESYSTEM \
|
||||
} } _LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
||||
|
||||
#define _LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES \
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL inline namespace coroutines_v1 {
|
||||
|
||||
#define _LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES \
|
||||
} _LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
||||
|
||||
#define _VSTD_CORO _VSTD_EXPERIMENTAL::coroutines_v1
|
||||
|
||||
#define _VSTD_FS ::std::experimental::filesystem::v1
|
||||
|
||||
|
|
|
@ -39,17 +39,18 @@ SampleIterator sample(PopulationIterator first, PopulationIterator last,
|
|||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
template <class _ForwardIterator, class _Searcher>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ForwardIterator search(_ForwardIterator __f, _ForwardIterator __l, const _Searcher &__s)
|
||||
|
@ -60,11 +61,13 @@ template <class _PopulationIterator, class _SampleIterator, class _Distance,
|
|||
class _UniformRandomNumberGenerator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_SampleIterator sample(_PopulationIterator __first, _PopulationIterator __last,
|
||||
_SampleIterator __output, _Distance __n,
|
||||
_SampleIterator __output_iter, _Distance __n,
|
||||
_UniformRandomNumberGenerator &&__g) {
|
||||
return _VSTD::__sample(__first, __last, __output, __n, __g);
|
||||
return _VSTD::__sample(__first, __last, __output_iter, __n, __g);
|
||||
}
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_ALGORITHM */
|
||||
|
|
|
@ -89,7 +89,7 @@ inline namespace fundamentals_v1 {
|
|||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI bad_any_cast : public bad_cast
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_ANY_CAST bad_any_cast : public bad_cast
|
||||
{
|
||||
public:
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
|
@ -98,6 +98,7 @@ public:
|
|||
#if _LIBCPP_STD_VER > 11 // C++ > 11
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
void __throw_bad_any_cast()
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
|
@ -506,7 +507,7 @@ void swap(any & __lhs, any & __rhs) _NOEXCEPT
|
|||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any const & __v)
|
||||
{
|
||||
static_assert(
|
||||
|
@ -522,7 +523,7 @@ _ValueType any_cast(any const & __v)
|
|||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any & __v)
|
||||
{
|
||||
static_assert(
|
||||
|
@ -537,7 +538,7 @@ _ValueType any_cast(any & __v)
|
|||
}
|
||||
|
||||
template <class _ValueType>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
_ValueType any_cast(any && __v)
|
||||
{
|
||||
static_assert(
|
||||
|
|
|
@ -0,0 +1,296 @@
|
|||
// -*- C++ -*-
|
||||
//===----------------------------- coroutine -----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_COROUTINE
|
||||
#define _LIBCPP_EXPERIMENTAL_COROUTINE
|
||||
|
||||
/**
|
||||
experimental/coroutine synopsis
|
||||
|
||||
// C++next
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace coroutines_v1 {
|
||||
|
||||
// 18.11.1 coroutine traits
|
||||
template <typename R, typename... ArgTypes>
|
||||
class coroutine_traits;
|
||||
// 18.11.2 coroutine handle
|
||||
template <typename Promise = void>
|
||||
class coroutine_handle;
|
||||
// 18.11.2.7 comparison operators:
|
||||
bool operator==(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
bool operator!=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
bool operator<(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
bool operator<=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
bool operator>=(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
bool operator>(coroutine_handle<> x, coroutine_handle<> y) _NOEXCEPT;
|
||||
// 18.11.3 trivial awaitables
|
||||
struct suspend_never;
|
||||
struct suspend_always;
|
||||
// 18.11.2.8 hash support:
|
||||
template <class T> struct hash;
|
||||
template <class P> struct hash<coroutine_handle<P>>;
|
||||
|
||||
} // namespace coroutines_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
#include <functional>
|
||||
#include <memory> // for hash<T*>
|
||||
#include <cstddef>
|
||||
#include <cassert>
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_COROUTINES
|
||||
# if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("<experimental/coroutine> cannot be used with this compiler")
|
||||
# else
|
||||
# warning <experimental/coroutine> cannot be used with this compiler
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_COROUTINES
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_COROUTINES
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __coroutine_traits_sfinae {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __coroutine_traits_sfinae<
|
||||
_Tp, typename __void_t<typename _Tp::promise_type>::type>
|
||||
{
|
||||
using promise_type = typename _Tp::promise_type;
|
||||
};
|
||||
|
||||
template <typename _Ret, typename... _Args>
|
||||
struct _LIBCPP_TEMPLATE_VIS coroutine_traits
|
||||
: public __coroutine_traits_sfinae<_Ret>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename _Promise = void>
|
||||
class _LIBCPP_TEMPLATE_VIS coroutine_handle;
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TEMPLATE_VIS coroutine_handle<void> {
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR coroutine_handle() _NOEXCEPT : __handle_(nullptr) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR coroutine_handle(nullptr_t) _NOEXCEPT : __handle_(nullptr) {}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
|
||||
__handle_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR void* address() const _NOEXCEPT { return __handle_; }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
_LIBCPP_CONSTEXPR explicit operator bool() const _NOEXCEPT { return __handle_; }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void operator()() { resume(); }
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void resume() {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"resume() can only be called on suspended coroutines");
|
||||
_LIBCPP_ASSERT(!done(),
|
||||
"resume() has undefined behavior when the coroutine is done");
|
||||
__builtin_coro_resume(__handle_);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void destroy() {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"destroy() can only be called on suspended coroutines");
|
||||
__builtin_coro_destroy(__handle_);
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool done() const {
|
||||
_LIBCPP_ASSERT(__is_suspended(),
|
||||
"done() can only be called on suspended coroutines");
|
||||
return __builtin_coro_done(__handle_);
|
||||
}
|
||||
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
static coroutine_handle from_address(void* __addr) _NOEXCEPT {
|
||||
coroutine_handle __tmp;
|
||||
__tmp.__handle_ = __addr;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
// FIXME: Should from_address(nullptr) be allowed?
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
|
||||
return coroutine_handle(nullptr);
|
||||
}
|
||||
|
||||
template <class _Tp, bool _CallIsValid = false>
|
||||
static coroutine_handle from_address(_Tp*) {
|
||||
static_assert(_CallIsValid,
|
||||
"coroutine_handle<void>::from_address cannot be called with "
|
||||
"non-void pointers");
|
||||
}
|
||||
|
||||
private:
|
||||
bool __is_suspended() const _NOEXCEPT {
|
||||
// FIXME actually implement a check for if the coro is suspended.
|
||||
return __handle_;
|
||||
}
|
||||
|
||||
template <class _PromiseT> friend class coroutine_handle;
|
||||
void* __handle_;
|
||||
};
|
||||
|
||||
// 18.11.2.7 comparison operators:
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator==(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return __x.address() == __y.address();
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator!=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x == __y);
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator<(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return less<void*>()(__x.address(), __y.address());
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator>(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return __y < __x;
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator<=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x > __y);
|
||||
}
|
||||
inline _LIBCPP_ALWAYS_INLINE
|
||||
bool operator>=(coroutine_handle<> __x, coroutine_handle<> __y) _NOEXCEPT {
|
||||
return !(__x < __y);
|
||||
}
|
||||
|
||||
template <typename _Promise>
|
||||
class _LIBCPP_TEMPLATE_VIS coroutine_handle : public coroutine_handle<> {
|
||||
using _Base = coroutine_handle<>;
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
// 18.11.2.1 construct/reset
|
||||
using coroutine_handle<>::coroutine_handle;
|
||||
#else
|
||||
_LIBCPP_ALWAYS_INLINE coroutine_handle() _NOEXCEPT : _Base() {}
|
||||
_LIBCPP_ALWAYS_INLINE coroutine_handle(nullptr_t) _NOEXCEPT : _Base(nullptr) {}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
coroutine_handle& operator=(nullptr_t) _NOEXCEPT {
|
||||
_Base::operator=(nullptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Promise& promise() const {
|
||||
return *reinterpret_cast<_Promise*>(
|
||||
__builtin_coro_promise(this->__handle_, __alignof(_Promise), false));
|
||||
}
|
||||
|
||||
public:
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
static coroutine_handle from_address(void* __addr) _NOEXCEPT {
|
||||
coroutine_handle __tmp;
|
||||
__tmp.__handle_ = __addr;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
// NOTE: this overload isn't required by the standard but is needed so
|
||||
// the deleted _Promise* overload doesn't make from_address(nullptr)
|
||||
// ambiguous.
|
||||
// FIXME: should from_address work with nullptr?
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
static coroutine_handle from_address(nullptr_t) _NOEXCEPT {
|
||||
return coroutine_handle(nullptr);
|
||||
}
|
||||
|
||||
template <class _Tp, bool _CallIsValid = false>
|
||||
static coroutine_handle from_address(_Tp*) {
|
||||
static_assert(_CallIsValid,
|
||||
"coroutine_handle<promise_type>::from_address cannot be called with "
|
||||
"non-void pointers");
|
||||
}
|
||||
|
||||
template <bool _CallIsValid = false>
|
||||
static coroutine_handle from_address(_Promise*) {
|
||||
static_assert(_CallIsValid,
|
||||
"coroutine_handle<promise_type>::from_address cannot be used with "
|
||||
"pointers to the coroutine's promise type; use 'from_promise' instead");
|
||||
}
|
||||
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
static coroutine_handle from_promise(_Promise& __promise) _NOEXCEPT {
|
||||
typedef typename remove_cv<_Promise>::type _RawPromise;
|
||||
coroutine_handle __tmp;
|
||||
__tmp.__handle_ = __builtin_coro_promise(
|
||||
_VSTD::addressof(const_cast<_RawPromise&>(__promise)),
|
||||
__alignof(_Promise), true);
|
||||
return __tmp;
|
||||
}
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS suspend_never {
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool await_ready() const _NOEXCEPT { return true; }
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void await_resume() const _NOEXCEPT {}
|
||||
};
|
||||
|
||||
struct _LIBCPP_TYPE_VIS suspend_always {
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
bool await_ready() const _NOEXCEPT { return false; }
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void await_suspend(coroutine_handle<>) const _NOEXCEPT {}
|
||||
_LIBCPP_ALWAYS_INLINE
|
||||
void await_resume() const _NOEXCEPT {}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_EXPERIMENTAL_COROUTINES
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp>
|
||||
struct hash<_VSTD_CORO::coroutine_handle<_Tp> > {
|
||||
using __arg_type = _VSTD_CORO::coroutine_handle<_Tp>;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(__arg_type const& __v) const _NOEXCEPT
|
||||
{return hash<void*>()(__v.address());}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !defined(_LIBCPP_HAS_NO_COROUTINES)
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_COROUTINE */
|
|
@ -107,10 +107,13 @@ public:
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS dynarray
|
||||
struct _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_DYNARRAY dynarray
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
|
@ -295,5 +298,7 @@ template <class _Tp, class _Alloc>
|
|||
struct _LIBCPP_TEMPLATE_VIS uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // if _LIBCPP_STD_VER > 11
|
||||
#endif // _LIBCPP_DYNARRAY
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -89,21 +89,22 @@ inline namespace fundamentals_v1 {
|
|||
|
||||
#include <experimental/__config>
|
||||
#include <functional>
|
||||
|
||||
#include <algorithm>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
#include <array>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
@ -456,4 +457,6 @@ make_boyer_moore_horspool_searcher( _RandomAccessIterator __f, _RandomAccessIter
|
|||
|
||||
_LIBCPP_END_NAMESPACE_LFTS
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_FUNCTIONAL */
|
||||
|
|
|
@ -75,19 +75,19 @@ public:
|
|||
typedef void reference;
|
||||
|
||||
ostream_joiner(ostream_type& __os, _Delim&& __d)
|
||||
: __output(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
|
||||
: __output_iter(_VSTD::addressof(__os)), __delim(_VSTD::move(__d)), __first(true) {}
|
||||
|
||||
ostream_joiner(ostream_type& __os, const _Delim& __d)
|
||||
: __output(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
|
||||
: __output_iter(_VSTD::addressof(__os)), __delim(__d), __first(true) {}
|
||||
|
||||
|
||||
template<typename _Tp>
|
||||
ostream_joiner& operator=(const _Tp& __v)
|
||||
{
|
||||
if (!__first)
|
||||
*__output << __delim;
|
||||
*__output_iter << __delim;
|
||||
__first = false;
|
||||
*__output << __v;
|
||||
*__output_iter << __v;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public:
|
|||
ostream_joiner& operator++(int) _NOEXCEPT { return *this; }
|
||||
|
||||
private:
|
||||
ostream_type* __output;
|
||||
ostream_type* __output_iter;
|
||||
_Delim __delim;
|
||||
bool __first;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,427 @@
|
|||
// -*- C++ -*-
|
||||
//===------------------------ memory_resource -----------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE
|
||||
#define _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE
|
||||
|
||||
/**
|
||||
experimental/memory_resource synopsis
|
||||
|
||||
// C++1y
|
||||
|
||||
namespace std {
|
||||
namespace experimental {
|
||||
inline namespace fundamentals_v1 {
|
||||
namespace pmr {
|
||||
|
||||
class memory_resource;
|
||||
|
||||
bool operator==(const memory_resource& a,
|
||||
const memory_resource& b) noexcept;
|
||||
bool operator!=(const memory_resource& a,
|
||||
const memory_resource& b) noexcept;
|
||||
|
||||
template <class Tp> class polymorphic_allocator;
|
||||
|
||||
template <class T1, class T2>
|
||||
bool operator==(const polymorphic_allocator<T1>& a,
|
||||
const polymorphic_allocator<T2>& b) noexcept;
|
||||
template <class T1, class T2>
|
||||
bool operator!=(const polymorphic_allocator<T1>& a,
|
||||
const polymorphic_allocator<T2>& b) noexcept;
|
||||
|
||||
// The name resource_adaptor_imp is for exposition only.
|
||||
template <class Allocator> class resource_adaptor_imp;
|
||||
|
||||
template <class Allocator>
|
||||
using resource_adaptor = resource_adaptor_imp<
|
||||
allocator_traits<Allocator>::rebind_alloc<char>>;
|
||||
|
||||
// Global memory resources
|
||||
memory_resource* new_delete_resource() noexcept;
|
||||
memory_resource* null_memory_resource() noexcept;
|
||||
|
||||
// The default memory resource
|
||||
memory_resource* set_default_resource(memory_resource* r) noexcept;
|
||||
memory_resource* get_default_resource() noexcept;
|
||||
|
||||
// Standard memory resources
|
||||
struct pool_options;
|
||||
class synchronized_pool_resource;
|
||||
class unsynchronized_pool_resource;
|
||||
class monotonic_buffer_resource;
|
||||
|
||||
} // namespace pmr
|
||||
} // namespace fundamentals_v1
|
||||
} // namespace experimental
|
||||
} // namespace std
|
||||
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <experimental/__memory>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS_PMR
|
||||
|
||||
// Round __s up to next multiple of __a.
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t __aligned_allocation_size(size_t __s, size_t __a) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s + __a > __s, "aligned allocation size overflows");
|
||||
return (__s + __a - 1) & ~(__a - 1);
|
||||
}
|
||||
|
||||
// 8.5, memory.resource
|
||||
class _LIBCPP_TEMPLATE_VIS memory_resource
|
||||
{
|
||||
static const size_t __max_align = alignof(max_align_t);
|
||||
|
||||
// 8.5.2, memory.resource.public
|
||||
public:
|
||||
virtual ~memory_resource() = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void* allocate(size_t __bytes, size_t __align = __max_align)
|
||||
{ return do_allocate(__bytes, __align); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(void * __p, size_t __bytes, size_t __align = __max_align)
|
||||
{ do_deallocate(__p, __bytes, __align); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is_equal(memory_resource const & __other) const _NOEXCEPT
|
||||
{ return do_is_equal(__other); }
|
||||
|
||||
// 8.5.3, memory.resource.priv
|
||||
protected:
|
||||
virtual void* do_allocate(size_t, size_t) = 0;
|
||||
virtual void do_deallocate(void*, size_t, size_t) = 0;
|
||||
virtual bool do_is_equal(memory_resource const &) const _NOEXCEPT = 0;
|
||||
};
|
||||
|
||||
// 8.5.4, memory.resource.eq
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(memory_resource const & __lhs,
|
||||
memory_resource const & __rhs) _NOEXCEPT
|
||||
{
|
||||
return &__lhs == &__rhs || __lhs.is_equal(__rhs);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(memory_resource const & __lhs,
|
||||
memory_resource const & __rhs) _NOEXCEPT
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
memory_resource * new_delete_resource() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
memory_resource * null_memory_resource() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
memory_resource * get_default_resource() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
memory_resource * set_default_resource(memory_resource * __new_res) _NOEXCEPT;
|
||||
|
||||
// 8.6, memory.polymorphic.allocator.class
|
||||
|
||||
// 8.6.1, memory.polymorphic.allocator.overview
|
||||
template <class _ValueType>
|
||||
class _LIBCPP_TEMPLATE_VIS polymorphic_allocator
|
||||
{
|
||||
public:
|
||||
typedef _ValueType value_type;
|
||||
|
||||
// 8.6.2, memory.polymorphic.allocator.ctor
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
polymorphic_allocator() _NOEXCEPT
|
||||
: __res_(_VSTD_LFTS_PMR::get_default_resource())
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
polymorphic_allocator(memory_resource * __r) _NOEXCEPT
|
||||
: __res_(__r)
|
||||
{}
|
||||
|
||||
polymorphic_allocator(polymorphic_allocator const &) = default;
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
polymorphic_allocator(polymorphic_allocator<_Tp> const & __other) _NOEXCEPT
|
||||
: __res_(__other.resource())
|
||||
{}
|
||||
|
||||
polymorphic_allocator &
|
||||
operator=(polymorphic_allocator const &) = delete;
|
||||
|
||||
// 8.6.3, memory.polymorphic.allocator.mem
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_ValueType* allocate(size_t __n) {
|
||||
if (__n > __max_size()) {
|
||||
__throw_length_error(
|
||||
"std::experimental::pmr::polymorphic_allocator<T>::allocate(size_t n)"
|
||||
" 'n' exceeds maximum supported size");
|
||||
}
|
||||
return static_cast<_ValueType*>(
|
||||
__res_->allocate(__n * sizeof(_ValueType), alignof(_ValueType))
|
||||
);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void deallocate(_ValueType * __p, size_t __n) _NOEXCEPT {
|
||||
_LIBCPP_ASSERT(__n <= __max_size(),
|
||||
"deallocate called for size which exceeds max_size()");
|
||||
__res_->deallocate(__p, __n * sizeof(_ValueType), alignof(_ValueType));
|
||||
}
|
||||
|
||||
template <class _Tp, class ..._Ts>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(_Tp* __p, _Ts &&... __args)
|
||||
{
|
||||
_VSTD_LFTS::__lfts_user_alloc_construct(
|
||||
__p, resource(), _VSTD::forward<_Ts>(__args)...
|
||||
);
|
||||
}
|
||||
|
||||
template <class _T1, class _T2, class ..._Args1, class ..._Args2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(pair<_T1, _T2>* __p, piecewise_construct_t,
|
||||
tuple<_Args1...> __x, tuple<_Args2...> __y)
|
||||
{
|
||||
::new ((void*)__p) pair<_T1, _T2>(piecewise_construct
|
||||
, __transform_tuple(
|
||||
typename __lfts_uses_alloc_ctor<
|
||||
_T1, memory_resource*, _Args1...
|
||||
>::type()
|
||||
, _VSTD::move(__x)
|
||||
, typename __make_tuple_indices<sizeof...(_Args1)>::type{}
|
||||
)
|
||||
, __transform_tuple(
|
||||
typename __lfts_uses_alloc_ctor<
|
||||
_T2, memory_resource*, _Args2...
|
||||
>::type()
|
||||
, _VSTD::move(__y)
|
||||
, typename __make_tuple_indices<sizeof...(_Args2)>::type{}
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(pair<_T1, _T2>* __p) {
|
||||
construct(__p, piecewise_construct, tuple<>(), tuple<>());
|
||||
}
|
||||
|
||||
template <class _T1, class _T2, class _Up, class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(pair<_T1, _T2> * __p, _Up && __u, _Vp && __v) {
|
||||
construct(__p, piecewise_construct
|
||||
, _VSTD::forward_as_tuple(_VSTD::forward<_Up>(__u))
|
||||
, _VSTD::forward_as_tuple(_VSTD::forward<_Vp>(__v)));
|
||||
}
|
||||
|
||||
template <class _T1, class _T2, class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> const & __pr) {
|
||||
construct(__p, piecewise_construct
|
||||
, _VSTD::forward_as_tuple(__pr.first)
|
||||
, _VSTD::forward_as_tuple(__pr.second));
|
||||
}
|
||||
|
||||
template <class _T1, class _T2, class _U1, class _U2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void construct(pair<_T1, _T2> * __p, pair<_U1, _U2> && __pr){
|
||||
construct(__p, piecewise_construct
|
||||
, _VSTD::forward_as_tuple(_VSTD::forward<_U1>(__pr.first))
|
||||
, _VSTD::forward_as_tuple(_VSTD::forward<_U2>(__pr.second)));
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void destroy(_Tp * __p) _NOEXCEPT
|
||||
{ __p->~_Tp(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
polymorphic_allocator
|
||||
select_on_container_copy_construction() const _NOEXCEPT
|
||||
{ return polymorphic_allocator(); }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
memory_resource * resource() const _NOEXCEPT
|
||||
{ return __res_; }
|
||||
|
||||
private:
|
||||
template <class ..._Args, size_t ..._Idx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Args&&...>
|
||||
__transform_tuple(integral_constant<int, 0>, tuple<_Args...>&& __t,
|
||||
__tuple_indices<_Idx...>) const
|
||||
{
|
||||
return _VSTD::forward_as_tuple(_VSTD::get<_Idx>(_VSTD::move(__t))...);
|
||||
}
|
||||
|
||||
template <class ..._Args, size_t ..._Idx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple<allocator_arg_t const&, memory_resource*, _Args&&...>
|
||||
__transform_tuple(integral_constant<int, 1>, tuple<_Args...> && __t,
|
||||
__tuple_indices<_Idx...>) const
|
||||
{
|
||||
using _Tup = tuple<allocator_arg_t const&, memory_resource*, _Args&&...>;
|
||||
return _Tup(allocator_arg, resource(),
|
||||
_VSTD::get<_Idx>(_VSTD::move(__t))...);
|
||||
}
|
||||
|
||||
template <class ..._Args, size_t ..._Idx>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
tuple<_Args&&..., memory_resource*>
|
||||
__transform_tuple(integral_constant<int, 2>, tuple<_Args...> && __t,
|
||||
__tuple_indices<_Idx...>) const
|
||||
{
|
||||
using _Tup = tuple<_Args&&..., memory_resource*>;
|
||||
return _Tup(_VSTD::get<_Idx>(_VSTD::move(__t))..., resource());
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __max_size() const _NOEXCEPT
|
||||
{ return numeric_limits<size_t>::max() / sizeof(value_type); }
|
||||
|
||||
memory_resource * __res_;
|
||||
};
|
||||
|
||||
// 8.6.4, memory.polymorphic.allocator.eq
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator==(polymorphic_allocator<_Tp> const & __lhs,
|
||||
polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT
|
||||
{
|
||||
return *__lhs.resource() == *__rhs.resource();
|
||||
}
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool operator!=(polymorphic_allocator<_Tp> const & __lhs,
|
||||
polymorphic_allocator<_Up> const & __rhs) _NOEXCEPT
|
||||
{
|
||||
return !(__lhs == __rhs);
|
||||
}
|
||||
|
||||
// 8.7, memory.resource.adaptor
|
||||
|
||||
// 8.7.1, memory.resource.adaptor.overview
|
||||
template <class _CharAlloc>
|
||||
class _LIBCPP_TEMPLATE_VIS __resource_adaptor_imp
|
||||
: public memory_resource
|
||||
{
|
||||
using _CTraits = allocator_traits<_CharAlloc>;
|
||||
static_assert(is_same<typename _CTraits::value_type, char>::value
|
||||
&& is_same<typename _CTraits::pointer, char*>::value
|
||||
&& is_same<typename _CTraits::void_pointer, void*>::value, "");
|
||||
|
||||
static const size_t _MaxAlign = alignof(max_align_t);
|
||||
|
||||
using _Alloc = typename _CTraits::template rebind_alloc<
|
||||
typename aligned_storage<_MaxAlign, _MaxAlign>::type
|
||||
>;
|
||||
|
||||
using _ValueType = typename _Alloc::value_type;
|
||||
|
||||
_Alloc __alloc_;
|
||||
|
||||
public:
|
||||
typedef _CharAlloc allocator_type;
|
||||
|
||||
__resource_adaptor_imp() = default;
|
||||
__resource_adaptor_imp(__resource_adaptor_imp const &) = default;
|
||||
__resource_adaptor_imp(__resource_adaptor_imp &&) = default;
|
||||
|
||||
// 8.7.2, memory.resource.adaptor.ctor
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __resource_adaptor_imp(allocator_type const & __a)
|
||||
: __alloc_(__a)
|
||||
{}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __resource_adaptor_imp(allocator_type && __a)
|
||||
: __alloc_(_VSTD::move(__a))
|
||||
{}
|
||||
|
||||
__resource_adaptor_imp &
|
||||
operator=(__resource_adaptor_imp const &) = default;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const
|
||||
{ return __alloc_; }
|
||||
|
||||
// 8.7.3, memory.resource.adaptor.mem
|
||||
protected:
|
||||
virtual void * do_allocate(size_t __bytes, size_t)
|
||||
{
|
||||
if (__bytes > __max_size()) {
|
||||
__throw_length_error(
|
||||
"std::experimental::pmr::resource_adaptor<T>::do_allocate(size_t bytes, size_t align)"
|
||||
" 'bytes' exceeds maximum supported size");
|
||||
}
|
||||
size_t __s = __aligned_allocation_size(__bytes, _MaxAlign) / _MaxAlign;
|
||||
return __alloc_.allocate(__s);
|
||||
}
|
||||
|
||||
virtual void do_deallocate(void * __p, size_t __bytes, size_t)
|
||||
{
|
||||
_LIBCPP_ASSERT(__bytes <= __max_size(),
|
||||
"do_deallocate called for size which exceeds the maximum allocation size");
|
||||
size_t __s = __aligned_allocation_size(__bytes, _MaxAlign) / _MaxAlign;
|
||||
__alloc_.deallocate((_ValueType*)__p, __s);
|
||||
}
|
||||
|
||||
virtual bool do_is_equal(memory_resource const & __other) const _NOEXCEPT {
|
||||
__resource_adaptor_imp const * __p
|
||||
= dynamic_cast<__resource_adaptor_imp const *>(&__other);
|
||||
return __p ? __alloc_ == __p->__alloc_ : false;
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __max_size() const _NOEXCEPT {
|
||||
return numeric_limits<size_t>::max() - _MaxAlign;
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
using resource_adaptor = __resource_adaptor_imp<
|
||||
typename allocator_traits<_Alloc>::template rebind_alloc<char>
|
||||
>;
|
||||
|
||||
_LIBCPP_END_NAMESPACE_LFTS_PMR
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_MEMORY_RESOURCE */
|
|
@ -41,31 +41,39 @@ inline namespace fundamentals_v2 {
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS_V2
|
||||
|
||||
template <typename _Tp, bool _IsSigned = is_signed<_Tp>::value> struct __abs;
|
||||
template <typename _Result, typename _Source, bool _IsSigned = is_signed<_Source>::value> struct __abs;
|
||||
|
||||
template <typename _Tp>
|
||||
struct __abs<_Tp, true> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, true> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t >= 0 ? __t : -__t; }
|
||||
_Result operator()(_Source __t) const noexcept
|
||||
{
|
||||
if (__t >= 0) return __t;
|
||||
if (__t == numeric_limits<_Source>::min()) return -static_cast<_Result>(__t);
|
||||
return -__t;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename _Tp>
|
||||
struct __abs<_Tp, false> {
|
||||
template <typename _Result, typename _Source>
|
||||
struct __abs<_Result, _Source, false> {
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp operator()(_Tp __t) const noexcept { return __t; }
|
||||
_Result operator()(_Source __t) const noexcept { return __t; }
|
||||
};
|
||||
|
||||
|
||||
template<class _Tp>
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp __gcd(_Tp __m, _Tp __n)
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_HIDDEN
|
||||
inline _Tp __gcd(_Tp __m, _Tp __n)
|
||||
{
|
||||
static_assert((!is_signed<_Tp>::value), "" );
|
||||
return __n == 0 ? __m : __gcd<_Tp>(__n, __m % __n);
|
||||
return __n == 0 ? __m : _VSTD_LFTS_V2::__gcd<_Tp>(__n, __m % __n);
|
||||
}
|
||||
|
||||
|
||||
|
@ -75,10 +83,13 @@ common_type_t<_Tp,_Up>
|
|||
gcd(_Tp __m, _Up __n)
|
||||
{
|
||||
static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to gcd must be integer types");
|
||||
static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to gcd cannot be bool" );
|
||||
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to gcd cannot be bool" );
|
||||
using _Rp = common_type_t<_Tp,_Up>;
|
||||
using _Wp = make_unsigned_t<_Rp>;
|
||||
return static_cast<_Rp>(__gcd(static_cast<_Wp>(__abs<_Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Up>()(__n))));
|
||||
return static_cast<_Rp>(_VSTD_LFTS_V2::__gcd(
|
||||
static_cast<_Wp>(__abs<_Rp, _Tp>()(__m)),
|
||||
static_cast<_Wp>(__abs<_Rp, _Up>()(__n))));
|
||||
}
|
||||
|
||||
template<class _Tp, class _Up>
|
||||
|
@ -87,12 +98,14 @@ common_type_t<_Tp,_Up>
|
|||
lcm(_Tp __m, _Up __n)
|
||||
{
|
||||
static_assert((is_integral<_Tp>::value && is_integral<_Up>::value), "Arguments to lcm must be integer types");
|
||||
static_assert((!is_same<typename remove_cv<_Tp>::type, bool>::value), "First argument to lcm cannot be bool" );
|
||||
static_assert((!is_same<typename remove_cv<_Up>::type, bool>::value), "Second argument to lcm cannot be bool" );
|
||||
if (__m == 0 || __n == 0)
|
||||
return 0;
|
||||
|
||||
using _Rp = common_type_t<_Tp,_Up>;
|
||||
_Rp __val1 = __abs<_Tp>()(__m) / gcd(__m,__n);
|
||||
_Up __val2 = __abs<_Up>()(__n);
|
||||
_Rp __val1 = __abs<_Rp, _Tp>()(__m) / _VSTD_LFTS_V2::gcd(__m, __n);
|
||||
_Rp __val2 = __abs<_Rp, _Up>()(__n);
|
||||
_LIBCPP_ASSERT((numeric_limits<_Rp>::max() / __val1 > __val2), "Overflow in lcm");
|
||||
return __val1 * __val2;
|
||||
}
|
||||
|
@ -100,4 +113,7 @@ lcm(_Tp __m, _Up __n)
|
|||
_LIBCPP_END_NAMESPACE_LFTS_V2
|
||||
|
||||
#endif /* _LIBCPP_STD_VER > 11 */
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_NUMERIC */
|
||||
|
|
|
@ -143,9 +143,24 @@ namespace std { namespace experimental { inline namespace fundamentals_v1 {
|
|||
#include <experimental/__config>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
#include <__functional_base>
|
||||
#include <__debug>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL
|
||||
class _LIBCPP_EXCEPTION_ABI bad_optional_access
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS bad_optional_access
|
||||
: public std::logic_error
|
||||
{
|
||||
public:
|
||||
|
@ -160,17 +175,6 @@ _LIBCPP_END_NAMESPACE_EXPERIMENTAL
|
|||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
#include <initializer_list>
|
||||
#include <type_traits>
|
||||
#include <new>
|
||||
#include <__functional_base>
|
||||
#include <__undef_min_max>
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
struct in_place_t {};
|
||||
|
@ -523,6 +527,9 @@ public:
|
|||
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
|
||||
|
||||
_LIBCPP_NORETURN _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
#endif
|
||||
constexpr void __throw_bad_optional_access() const
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
|
@ -532,7 +539,7 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
constexpr value_type const& value() const
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
|
@ -540,7 +547,7 @@ public:
|
|||
return this->__val_;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
value_type& value()
|
||||
{
|
||||
if (!this->__engaged_)
|
||||
|
@ -910,4 +917,6 @@ _LIBCPP_END_NAMESPACE_STD
|
|||
|
||||
#endif // _LIBCPP_STD_VER > 11
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_EXPERIMENTAL_OPTIONAL
|
||||
|
|
|
@ -189,6 +189,9 @@ namespace std {
|
|||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_LFTS
|
||||
|
||||
template<class _CharT, class _Traits = _VSTD::char_traits<_CharT> >
|
||||
|
@ -810,4 +813,6 @@ quoted ( std::experimental::basic_string_view <_CharT, _Traits> __sv,
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_LFTS_STRING_VIEW
|
||||
|
|
|
@ -207,7 +207,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
|||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
|
||||
#else
|
||||
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
|
||||
|
@ -331,7 +331,7 @@ public:
|
|||
__second_constructed(false)
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(__hash_node_destructor<allocator_type>&& __x)
|
||||
: __na_(__x.__na_),
|
||||
|
@ -340,7 +340,7 @@ public:
|
|||
{
|
||||
__x.__value_constructed = false;
|
||||
}
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_map_node_destructor(const __hash_node_destructor<allocator_type>& __x)
|
||||
: __na_(__x.__na_),
|
||||
|
@ -349,7 +349,7 @@ public:
|
|||
{
|
||||
const_cast<bool&>(__x.__value_constructed) = false;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator()(pointer __p)
|
||||
|
|
|
@ -199,7 +199,7 @@ template <class Value, class Hash, class Pred, class Alloc>
|
|||
#include <ext/__hash>
|
||||
|
||||
#if __DEPRECATED
|
||||
#if defined(_MSC_VER) && ! defined(__clang__)
|
||||
#if defined(_LIBCPP_WARNING)
|
||||
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
|
||||
#else
|
||||
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
|
||||
|
|
|
@ -167,19 +167,20 @@ template <class T, class Allocator>
|
|||
*/
|
||||
|
||||
#include <__config>
|
||||
|
||||
#include <initializer_list>
|
||||
#include <memory>
|
||||
#include <limits>
|
||||
#include <iterator>
|
||||
#include <algorithm>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Tp, class _VoidPtr> struct __forward_list_node;
|
||||
|
@ -478,14 +479,14 @@ protected:
|
|||
__forward_list_base(const allocator_type& __a)
|
||||
: __before_begin_(__begin_node(), __node_allocator(__a)) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(__forward_list_base&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
private:
|
||||
__forward_list_base(const __forward_list_base&);
|
||||
|
@ -539,7 +540,7 @@ private:
|
|||
{__alloc() = _VSTD::move(__x.__alloc());}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
|
@ -563,7 +564,7 @@ __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x,
|
|||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
__forward_list_base<_Tp, _Alloc>::~__forward_list_base()
|
||||
|
@ -656,32 +657,33 @@ public:
|
|||
>::type* = nullptr);
|
||||
forward_list(const forward_list& __x);
|
||||
forward_list(const forward_list& __x, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
forward_list& operator=(const forward_list& __x);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list(forward_list&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
|
||||
: base(_VSTD::move(__x)) {}
|
||||
forward_list(forward_list&& __x, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
forward_list(initializer_list<value_type> __il);
|
||||
forward_list(initializer_list<value_type> __il, const allocator_type& __a);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
// ~forward_list() = default;
|
||||
|
||||
forward_list& operator=(const forward_list& __x);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list& operator=(forward_list&& __x)
|
||||
_NOEXCEPT_(
|
||||
__node_traits::propagate_on_container_move_assignment::value &&
|
||||
is_nothrow_move_assignable<allocator_type>::value);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
forward_list& operator=(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
// ~forward_list() = default;
|
||||
|
||||
template <class _InputIterator>
|
||||
typename enable_if
|
||||
|
@ -691,10 +693,6 @@ public:
|
|||
>::type
|
||||
assign(_InputIterator __f, _InputIterator __l);
|
||||
void assign(size_type __n, const value_type& __v);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void assign(initializer_list<value_type> __il);
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
allocator_type get_allocator() const _NOEXCEPT
|
||||
|
@ -730,7 +728,7 @@ public:
|
|||
const_iterator cbefore_begin() const _NOEXCEPT
|
||||
{return const_iterator(base::__before_begin());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
bool empty() const _NOEXCEPT
|
||||
{return base::__before_begin()->__next_ == nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -745,27 +743,26 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_reference front() const {return base::__before_begin()->__next_->__value_;}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class... _Args> reference emplace_front(_Args&&... __args);
|
||||
#else
|
||||
template <class... _Args> void emplace_front(_Args&&... __args);
|
||||
#endif
|
||||
#endif
|
||||
void push_front(value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
void push_front(const value_type& __v);
|
||||
|
||||
void pop_front();
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args>
|
||||
iterator emplace_after(const_iterator __p, _Args&&... __args);
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
iterator insert_after(const_iterator __p, value_type&& __v);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert_after(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
iterator insert_after(const_iterator __p, const value_type& __v);
|
||||
iterator insert_after(const_iterator __p, size_type __n, const value_type& __v);
|
||||
template <class _InputIterator>
|
||||
|
@ -776,10 +773,6 @@ public:
|
|||
iterator
|
||||
>::type
|
||||
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
|
||||
{return insert_after(__p, __il.begin(), __il.end());}
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
iterator erase_after(const_iterator __p);
|
||||
iterator erase_after(const_iterator __f, const_iterator __l);
|
||||
|
@ -799,7 +792,7 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT {base::clear();}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -807,7 +800,7 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
void splice_after(const_iterator __p, forward_list&& __x,
|
||||
const_iterator __f, const_iterator __l);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
void splice_after(const_iterator __p, forward_list& __x);
|
||||
void splice_after(const_iterator __p, forward_list& __x, const_iterator __i);
|
||||
void splice_after(const_iterator __p, forward_list& __x,
|
||||
|
@ -817,14 +810,14 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
void unique() {unique(__equal_to<value_type>());}
|
||||
template <class _BinaryPredicate> void unique(_BinaryPredicate __binary_pred);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list&& __x, _Compare __comp)
|
||||
{merge(__x, _VSTD::move(__comp));}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void merge(forward_list& __x) {merge(__x, __less<value_type>());}
|
||||
template <class _Compare> void merge(forward_list& __x, _Compare __comp);
|
||||
|
@ -835,11 +828,11 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void __move_assign(forward_list& __x, true_type)
|
||||
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
|
||||
void __move_assign(forward_list& __x, false_type);
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Compare>
|
||||
static
|
||||
|
@ -955,8 +948,19 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
|
|||
insert_after(cbefore_begin(), __x.begin(), __x.end());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||
{
|
||||
if (this != &__x)
|
||||
{
|
||||
base::__copy_assign_alloc(__x);
|
||||
assign(__x.begin(), __x.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
||||
const allocator_type& __a)
|
||||
|
@ -969,10 +973,6 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
|
|||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
|
||||
{
|
||||
|
@ -987,22 +987,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
|
|||
insert_after(cbefore_begin(), __il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
forward_list<_Tp, _Alloc>&
|
||||
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
|
||||
{
|
||||
if (this != &__x)
|
||||
{
|
||||
base::__copy_assign_alloc(__x);
|
||||
assign(__x.begin(), __x.end());
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
|
||||
|
@ -1040,10 +1024,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
forward_list<_Tp, _Alloc>&
|
||||
|
@ -1053,7 +1033,7 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
|
@ -1090,7 +1070,7 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
|
|||
erase_after(__i, __e);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline
|
||||
|
@ -1100,11 +1080,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
|
|||
assign(__il.begin(), __il.end());
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
@ -1126,8 +1101,6 @@ forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
|
|||
#endif
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
||||
|
@ -1140,7 +1113,7 @@ forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
|
|||
base::__before_begin()->__next_ = __h.release();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
|
@ -1165,8 +1138,7 @@ forward_list<_Tp, _Alloc>::pop_front()
|
|||
__node_traits::deallocate(__a, __p, 1);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
template <class... _Args>
|
||||
|
@ -1184,8 +1156,6 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
|
|||
return iterator(__r->__next_);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename forward_list<_Tp, _Alloc>::iterator
|
||||
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
||||
|
@ -1200,7 +1170,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
|
|||
return iterator(__r->__next_);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
typename forward_list<_Tp, _Alloc>::iterator
|
||||
|
@ -1468,7 +1438,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||
}
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -1499,7 +1469,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
|
|||
splice_after(__p, __x, __f, __l);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
void
|
||||
|
@ -1750,4 +1720,6 @@ swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_FORWARD_LIST
|
||||
|
|
|
@ -171,12 +171,14 @@ typedef basic_fstream<wchar_t> wfstream;
|
|||
#include <__locale>
|
||||
#include <cstdio>
|
||||
|
||||
#include <__undef_min_max>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
|
@ -193,13 +195,13 @@ public:
|
|||
|
||||
// 27.9.1.2 Constructors/destructor:
|
||||
basic_filebuf();
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
basic_filebuf(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
virtual ~basic_filebuf();
|
||||
|
||||
// 27.9.1.3 Assign/swap:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf& operator=(basic_filebuf&& __rhs);
|
||||
#endif
|
||||
|
@ -276,7 +278,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
|||
setbuf(0, 4096);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
|
@ -313,7 +315,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
|||
else
|
||||
this->setp((char_type*)__extbuf_,
|
||||
(char_type*)__extbuf_ + (__rhs. epptr() - __rhs.pbase()));
|
||||
this->pbump(__rhs. pptr() - __rhs.pbase());
|
||||
this->__pbump(__rhs. pptr() - __rhs.pbase());
|
||||
}
|
||||
else if (__rhs.eback())
|
||||
{
|
||||
|
@ -352,7 +354,7 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::~basic_filebuf()
|
||||
|
@ -432,7 +434,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
|||
ptrdiff_t __e = this->epptr() - this->pbase();
|
||||
this->setp((char_type*)__extbuf_min_,
|
||||
(char_type*)__extbuf_min_ + __e);
|
||||
this->pbump(__n);
|
||||
this->__pbump(__n);
|
||||
}
|
||||
if (__rhs.eback() == (char_type*)__extbuf_min_)
|
||||
{
|
||||
|
@ -448,7 +450,7 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
|
|||
ptrdiff_t __e = __rhs.epptr() - __rhs.pbase();
|
||||
__rhs.setp((char_type*)__rhs.__extbuf_min_,
|
||||
(char_type*)__rhs.__extbuf_min_ + __e);
|
||||
__rhs.pbump(__n);
|
||||
__rhs.__pbump(__n);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -615,7 +617,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
|||
static_cast<size_t>(__extbufend_ - __extbufnext_));
|
||||
codecvt_base::result __r;
|
||||
__st_last_ = __st_;
|
||||
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
|
||||
size_t __nr = fread((void*) const_cast<char *>(__extbufnext_), 1, __nmemb, __file_);
|
||||
if (__nr != 0)
|
||||
{
|
||||
if (!__cv_)
|
||||
|
@ -628,7 +630,8 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
|||
this->eback() + __ibs_, __inext);
|
||||
if (__r == codecvt_base::noconv)
|
||||
{
|
||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
|
||||
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_,
|
||||
(char_type*)const_cast<char *>(__extbufend_));
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
}
|
||||
else if (__inext != this->eback() + __unget_sz)
|
||||
|
@ -720,8 +723,8 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
|||
return traits_type::eof();
|
||||
if (__r == codecvt_base::partial)
|
||||
{
|
||||
this->setp((char_type*)__e, this->pptr());
|
||||
this->pbump(this->epptr() - this->pbase());
|
||||
this->setp(const_cast<char_type*>(__e), this->pptr());
|
||||
this->__pbump(this->epptr() - this->pbase());
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1017,12 +1020,10 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ifstream(const string& __s, ios_base::openmode __mode = ios_base::in);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ifstream& operator=(basic_ifstream&& __rhs);
|
||||
#endif
|
||||
|
@ -1071,7 +1072,7 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1092,7 +1093,7 @@ basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1177,12 +1178,10 @@ public:
|
|||
explicit basic_ofstream(const char* __s, ios_base::openmode __mode = ios_base::out);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ofstream(const string& __s, ios_base::openmode __mode = ios_base::out);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ofstream& operator=(basic_ofstream&& __rhs);
|
||||
#endif
|
||||
|
@ -1231,7 +1230,7 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1252,7 +1251,7 @@ basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1339,12 +1338,10 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_fstream(const string& __s, ios_base::openmode __mode = ios_base::in | ios_base::out);
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream(basic_fstream&& __rhs);
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_fstream& operator=(basic_fstream&& __rhs);
|
||||
#endif
|
||||
|
@ -1393,7 +1390,7 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1414,7 +1411,7 @@ basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
|
|||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
inline
|
||||
|
@ -1482,4 +1479,6 @@ basic_fstream<_CharT, _Traits>::close()
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_FSTREAM
|
||||
|
|
|
@ -213,9 +213,9 @@ template<class T> struct is_bind_expression;
|
|||
template<class T> struct is_placeholder;
|
||||
|
||||
// See C++14 20.9.9, Function object binders
|
||||
template <class T> constexpr bool is_bind_expression_v
|
||||
template <class T> inline constexpr bool is_bind_expression_v
|
||||
= is_bind_expression<T>::value; // C++17
|
||||
template <class T> constexpr int is_placeholder_v
|
||||
template <class T> inline constexpr int is_placeholder_v
|
||||
= is_placeholder<T>::value; // C++17
|
||||
|
||||
|
||||
|
@ -235,7 +235,7 @@ namespace placeholders {
|
|||
}
|
||||
|
||||
template <class Operation>
|
||||
class binder1st
|
||||
class binder1st // deprecated in C++11, removed in C++17
|
||||
: public unary_function<typename Operation::second_argument_type,
|
||||
typename Operation::result_type>
|
||||
{
|
||||
|
@ -249,10 +249,10 @@ public:
|
|||
};
|
||||
|
||||
template <class Operation, class T>
|
||||
binder1st<Operation> bind1st(const Operation& op, const T& x);
|
||||
binder1st<Operation> bind1st(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Operation>
|
||||
class binder2nd
|
||||
class binder2nd // deprecated in C++11, removed in C++17
|
||||
: public unary_function<typename Operation::first_argument_type,
|
||||
typename Operation::result_type>
|
||||
{
|
||||
|
@ -266,9 +266,9 @@ public:
|
|||
};
|
||||
|
||||
template <class Operation, class T>
|
||||
binder2nd<Operation> bind2nd(const Operation& op, const T& x);
|
||||
binder2nd<Operation> bind2nd(const Operation& op, const T& x); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Arg, class Result>
|
||||
template <class Arg, class Result> // deprecated in C++11, removed in C++17
|
||||
class pointer_to_unary_function : public unary_function<Arg, Result>
|
||||
{
|
||||
public:
|
||||
|
@ -277,9 +277,9 @@ public:
|
|||
};
|
||||
|
||||
template <class Arg, class Result>
|
||||
pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg));
|
||||
pointer_to_unary_function<Arg,Result> ptr_fun(Result (*f)(Arg)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
template <class Arg1, class Arg2, class Result> // deprecated in C++11, removed in C++17
|
||||
class pointer_to_binary_function : public binary_function<Arg1, Arg2, Result>
|
||||
{
|
||||
public:
|
||||
|
@ -288,9 +288,9 @@ public:
|
|||
};
|
||||
|
||||
template <class Arg1, class Arg2, class Result>
|
||||
pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2));
|
||||
pointer_to_binary_function<Arg1,Arg2,Result> ptr_fun(Result (*f)(Arg1,Arg2)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class S, class T>
|
||||
template<class S, class T> // deprecated in C++11, removed in C++17
|
||||
class mem_fun_t : public unary_function<T*, S>
|
||||
{
|
||||
public:
|
||||
|
@ -299,18 +299,18 @@ public:
|
|||
};
|
||||
|
||||
template<class S, class T, class A>
|
||||
class mem_fun1_t : public binary_function<T*, A, S>
|
||||
class mem_fun1_t : public binary_function<T*, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_t(S (T::*p)(A));
|
||||
S operator()(T* p, A x) const;
|
||||
};
|
||||
|
||||
template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)());
|
||||
template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A));
|
||||
template<class S, class T> mem_fun_t<S,T> mem_fun(S (T::*f)()); // deprecated in C++11, removed in C++17
|
||||
template<class S, class T, class A> mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class S, class T>
|
||||
class mem_fun_ref_t : public unary_function<T, S>
|
||||
class mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun_ref_t(S (T::*p)());
|
||||
|
@ -318,18 +318,18 @@ public:
|
|||
};
|
||||
|
||||
template<class S, class T, class A>
|
||||
class mem_fun1_ref_t : public binary_function<T, A, S>
|
||||
class mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit mem_fun1_ref_t(S (T::*p)(A));
|
||||
S operator()(T& p, A x) const;
|
||||
};
|
||||
|
||||
template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)());
|
||||
template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A));
|
||||
template<class S, class T> mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)()); // deprecated in C++11, removed in C++17
|
||||
template<class S, class T, class A> mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A)); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_t : public unary_function<const T*, S>
|
||||
class const_mem_fun_t : public unary_function<const T*, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_t(S (T::*p)() const);
|
||||
|
@ -337,18 +337,18 @@ public:
|
|||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_t : public binary_function<const T*, A, S>
|
||||
class const_mem_fun1_t : public binary_function<const T*, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_t(S (T::*p)(A) const);
|
||||
S operator()(const T* p, A x) const;
|
||||
};
|
||||
|
||||
template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const);
|
||||
template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const);
|
||||
template <class S, class T> const_mem_fun_t<S,T> mem_fun(S (T::*f)() const); // deprecated in C++11, removed in C++17
|
||||
template <class S, class T, class A> const_mem_fun1_t<S,T,A> mem_fun(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
|
||||
|
||||
template <class S, class T>
|
||||
class const_mem_fun_ref_t : public unary_function<T, S>
|
||||
class const_mem_fun_ref_t : public unary_function<T, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun_ref_t(S (T::*p)() const);
|
||||
|
@ -356,15 +356,15 @@ public:
|
|||
};
|
||||
|
||||
template <class S, class T, class A>
|
||||
class const_mem_fun1_ref_t : public binary_function<T, A, S>
|
||||
class const_mem_fun1_ref_t : public binary_function<T, A, S> // deprecated in C++11, removed in C++17
|
||||
{
|
||||
public:
|
||||
explicit const_mem_fun1_ref_t(S (T::*p)(A) const);
|
||||
S operator()(const T& p, A x) const;
|
||||
};
|
||||
|
||||
template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const);
|
||||
template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const);
|
||||
template <class S, class T> const_mem_fun_ref_t<S,T> mem_fun_ref(S (T::*f)() const); // deprecated in C++11, removed in C++17
|
||||
template <class S, class T, class A> const_mem_fun1_ref_t<S,T,A> mem_fun_ref(S (T::*f)(A) const); // deprecated in C++11, removed in C++17
|
||||
|
||||
template<class R, class T> unspecified mem_fn(R T::*);
|
||||
|
||||
|
@ -470,6 +470,7 @@ template <> struct hash<double>;
|
|||
template <> struct hash<long double>;
|
||||
|
||||
template<class T> struct hash<T*>;
|
||||
template <> struct hash<nullptr_t>; // C++17
|
||||
|
||||
} // std
|
||||
|
||||
|
@ -485,6 +486,7 @@ POLICY: For non-variadic implementations, the number of arguments is limited
|
|||
#include <exception>
|
||||
#include <memory>
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
|
||||
#include <__functional_base>
|
||||
|
||||
|
@ -1018,6 +1020,7 @@ inline _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
|
|||
binary_negate<_Predicate>
|
||||
not2(const _Predicate& __pred) {return binary_negate<_Predicate>(__pred);}
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)
|
||||
template <class __Operation>
|
||||
class _LIBCPP_TEMPLATE_VIS binder1st
|
||||
: public unary_function<typename __Operation::second_argument_type,
|
||||
|
@ -1242,6 +1245,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
|||
const_mem_fun1_ref_t<_Sp,_Tp,_Ap>
|
||||
mem_fun_ref(_Sp (_Tp::*__f)(_Ap) const)
|
||||
{return const_mem_fun1_ref_t<_Sp,_Tp,_Ap>(__f);}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// MEMFUN
|
||||
|
@ -1260,7 +1264,7 @@ private:
|
|||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY __mem_fn(type __f) _NOEXCEPT : __f_(__f) {}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
// invoke
|
||||
template <class... _ArgTypes>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -1387,6 +1391,12 @@ mem_fn(_Rp _Tp::* __pm) _NOEXCEPT
|
|||
class _LIBCPP_EXCEPTION_ABI bad_function_call
|
||||
: public exception
|
||||
{
|
||||
#ifdef _LIBCPP_ABI_BAD_FUNCTION_CALL_KEY_FUNCTION
|
||||
public:
|
||||
virtual ~bad_function_call() _NOEXCEPT;
|
||||
|
||||
virtual const char* what() const _NOEXCEPT;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
|
@ -1444,7 +1454,7 @@ bool __not_null(function<_Fp> const& __f) { return !!__f; }
|
|||
|
||||
} // namespace __function
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
namespace __function {
|
||||
|
||||
|
@ -1587,9 +1597,11 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
|
|||
return reinterpret_cast<__base*>(p);
|
||||
}
|
||||
|
||||
template <class _Fp, bool = !is_same<_Fp, function>::value &&
|
||||
__invokable<_Fp&, _ArgTypes...>::value>
|
||||
struct __callable;
|
||||
template <class _Fp, bool = __lazy_and<
|
||||
integral_constant<bool, !is_same<__uncvref_t<_Fp>, function>::value>,
|
||||
__invokable<_Fp&, _ArgTypes...>
|
||||
>::value>
|
||||
struct __callable;
|
||||
template <class _Fp>
|
||||
struct __callable<_Fp, true>
|
||||
{
|
||||
|
@ -1602,6 +1614,9 @@ class _LIBCPP_TEMPLATE_VIS function<_Rp(_ArgTypes...)>
|
|||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _Fp>
|
||||
using _EnableIfCallable = typename enable_if<__callable<_Fp>::value>::type;
|
||||
public:
|
||||
typedef _Rp result_type;
|
||||
|
||||
|
@ -1612,9 +1627,7 @@ public:
|
|||
function(nullptr_t) _NOEXCEPT : __f_(0) {}
|
||||
function(const function&);
|
||||
function(function&&) _NOEXCEPT;
|
||||
template<class _Fp, class = typename enable_if<
|
||||
__callable<_Fp>::value && !is_same<_Fp, function>::value
|
||||
>::type>
|
||||
template<class _Fp, class = _EnableIfCallable<_Fp>>
|
||||
function(_Fp);
|
||||
|
||||
#if _LIBCPP_STD_VER <= 14
|
||||
|
@ -1628,21 +1641,15 @@ public:
|
|||
function(allocator_arg_t, const _Alloc&, const function&);
|
||||
template<class _Alloc>
|
||||
function(allocator_arg_t, const _Alloc&, function&&);
|
||||
template<class _Fp, class _Alloc, class = typename enable_if<__callable<_Fp>::value>::type>
|
||||
template<class _Fp, class _Alloc, class = _EnableIfCallable<_Fp>>
|
||||
function(allocator_arg_t, const _Alloc& __a, _Fp __f);
|
||||
#endif
|
||||
|
||||
function& operator=(const function&);
|
||||
function& operator=(function&&) _NOEXCEPT;
|
||||
function& operator=(nullptr_t) _NOEXCEPT;
|
||||
template<class _Fp>
|
||||
typename enable_if
|
||||
<
|
||||
__callable<typename decay<_Fp>::type>::value &&
|
||||
!is_same<typename remove_reference<_Fp>::type, function>::value,
|
||||
function&
|
||||
>::type
|
||||
operator=(_Fp&&);
|
||||
template<class _Fp, class = _EnableIfCallable<_Fp>>
|
||||
function& operator=(_Fp&&);
|
||||
|
||||
~function();
|
||||
|
||||
|
@ -1844,13 +1851,8 @@ function<_Rp(_ArgTypes...)>::operator=(nullptr_t) _NOEXCEPT
|
|||
}
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
template <class _Fp>
|
||||
typename enable_if
|
||||
<
|
||||
function<_Rp(_ArgTypes...)>::template __callable<typename decay<_Fp>::type>::value &&
|
||||
!is_same<typename remove_reference<_Fp>::type, function<_Rp(_ArgTypes...)>>::value,
|
||||
function<_Rp(_ArgTypes...)>&
|
||||
>::type
|
||||
template <class _Fp, class>
|
||||
function<_Rp(_ArgTypes...)>&
|
||||
function<_Rp(_ArgTypes...)>::operator=(_Fp&& __f)
|
||||
{
|
||||
function(_VSTD::forward<_Fp>(__f)).swap(*this);
|
||||
|
@ -1931,8 +1933,8 @@ _Tp*
|
|||
function<_Rp(_ArgTypes...)>::target() _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return (_Tp*)0;
|
||||
return (_Tp*)__f_->target(typeid(_Tp));
|
||||
return nullptr;
|
||||
return (_Tp*) const_cast<void *>(__f_->target(typeid(_Tp)));
|
||||
}
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
|
@ -1941,7 +1943,7 @@ const _Tp*
|
|||
function<_Rp(_ArgTypes...)>::target() const _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return (const _Tp*)0;
|
||||
return nullptr;
|
||||
return (const _Tp*)__f_->target(typeid(_Tp));
|
||||
}
|
||||
|
||||
|
@ -1973,7 +1975,7 @@ void
|
|||
swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCEPT
|
||||
{return __x.swap(__y);}
|
||||
|
||||
#else // _LIBCPP_HAS_NO_VARIADICS
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
#include <__functional_03>
|
||||
|
||||
|
@ -1989,7 +1991,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_bind_expression
|
|||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp>
|
||||
constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t is_bind_expression_v = is_bind_expression<_Tp>::value;
|
||||
#endif
|
||||
|
||||
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
|
||||
|
@ -1998,7 +2000,7 @@ template<class _Tp> struct _LIBCPP_TEMPLATE_VIS is_placeholder
|
|||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp>
|
||||
constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value;
|
||||
_LIBCPP_INLINE_VAR constexpr size_t is_placeholder_v = is_placeholder<_Tp>::value;
|
||||
#endif
|
||||
|
||||
namespace placeholders
|
||||
|
@ -2018,16 +2020,16 @@ _LIBCPP_FUNC_VIS extern const __ph<8> _8;
|
|||
_LIBCPP_FUNC_VIS extern const __ph<9> _9;
|
||||
_LIBCPP_FUNC_VIS extern const __ph<10> _10;
|
||||
#else
|
||||
constexpr __ph<1> _1{};
|
||||
constexpr __ph<2> _2{};
|
||||
constexpr __ph<3> _3{};
|
||||
constexpr __ph<4> _4{};
|
||||
constexpr __ph<5> _5{};
|
||||
constexpr __ph<6> _6{};
|
||||
constexpr __ph<7> _7{};
|
||||
constexpr __ph<8> _8{};
|
||||
constexpr __ph<9> _9{};
|
||||
constexpr __ph<10> _10{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<1> _1{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<2> _2{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<3> _3{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<4> _4{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<5> _5{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<6> _6{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<7> _7{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<8> _8{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<9> _9{};
|
||||
/* _LIBCPP_INLINE_VAR */ constexpr __ph<10> _10{};
|
||||
#endif // defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_BIND)
|
||||
|
||||
} // placeholders
|
||||
|
@ -2037,7 +2039,7 @@ struct __is_placeholder<placeholders::__ph<_Np> >
|
|||
: public integral_constant<int, _Np> {};
|
||||
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Uj>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -2214,7 +2216,7 @@ typename __bind_return<_Fp, _BoundArgs, _Args>::type
|
|||
__apply_functor(_Fp& __f, _BoundArgs& __bound_args, __tuple_indices<_Indx...>,
|
||||
_Args&& __args)
|
||||
{
|
||||
return __invoke(__f, __mu(_VSTD::get<_Indx>(__bound_args), __args)...);
|
||||
return _VSTD::__invoke(__f, _VSTD::__mu(_VSTD::get<_Indx>(__bound_args), __args)...);
|
||||
}
|
||||
|
||||
template<class _Fp, class ..._BoundArgs>
|
||||
|
@ -2247,7 +2249,7 @@ public:
|
|||
typename __bind_return<_Fd, _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args)
|
||||
{
|
||||
return __apply_functor(__f_, __bound_args_, __indices(),
|
||||
return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
|
||||
|
@ -2256,7 +2258,7 @@ public:
|
|||
typename __bind_return<const _Fd, const _Td, tuple<_Args&&...> >::type
|
||||
operator()(_Args&& ...__args) const
|
||||
{
|
||||
return __apply_functor(__f_, __bound_args_, __indices(),
|
||||
return _VSTD::__apply_functor(__f_, __bound_args_, __indices(),
|
||||
tuple<_Args&&...>(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
};
|
||||
|
@ -2337,248 +2339,7 @@ bind(_Fp&& __f, _BoundArgs&&... __bound_args)
|
|||
return type(_VSTD::forward<_Fp>(__f), _VSTD::forward<_BoundArgs>(__bound_args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<bool>
|
||||
: public unary_function<bool, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(bool __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char>
|
||||
: public unary_function<char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<signed char>
|
||||
: public unary_function<signed char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(signed char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
|
||||
: public unary_function<unsigned char, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char16_t>
|
||||
: public unary_function<char16_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char16_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char32_t>
|
||||
: public unary_function<char32_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char32_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<wchar_t>
|
||||
: public unary_function<wchar_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(wchar_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<short>
|
||||
: public unary_function<short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned short>
|
||||
: public unary_function<unsigned short, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned short __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<int>
|
||||
: public unary_function<int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned int>
|
||||
: public unary_function<unsigned int, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned int __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long>
|
||||
: public unary_function<long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long>
|
||||
: public unary_function<unsigned long, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(unsigned long __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long long>
|
||||
: public __scalar_hash<long long>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<unsigned long long>
|
||||
: public __scalar_hash<unsigned long long>
|
||||
{
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_INT128
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__int128_t>
|
||||
: public __scalar_hash<__int128_t>
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<__uint128_t>
|
||||
: public __scalar_hash<__uint128_t>
|
||||
{
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<float>
|
||||
: public __scalar_hash<float>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(float __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<float>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<double>
|
||||
: public __scalar_hash<double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
return __scalar_hash<double>::operator()(__v);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<long double>
|
||||
: public __scalar_hash<long double>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(long double __v) const _NOEXCEPT
|
||||
{
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0)
|
||||
return 0;
|
||||
#if defined(__i386__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
size_t __c;
|
||||
size_t __d;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__s.__c = 0;
|
||||
__u.__s.__d = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b ^ __u.__s.__c ^ __u.__s.__d;
|
||||
#elif defined(__x86_64__)
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
long double __t;
|
||||
struct
|
||||
{
|
||||
size_t __a;
|
||||
size_t __b;
|
||||
} __s;
|
||||
} __u;
|
||||
__u.__s.__a = 0;
|
||||
__u.__s.__b = 0;
|
||||
__u.__t = __v;
|
||||
return __u.__s.__a ^ __u.__s.__b;
|
||||
#else
|
||||
return __scalar_hash<long double>::operator()(__v);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
||||
template <class _Tp, bool = is_enum<_Tp>::value>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash
|
||||
: public unary_function<_Tp, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(_Tp __v) const _NOEXCEPT
|
||||
{
|
||||
typedef typename underlying_type<_Tp>::type type;
|
||||
return hash<type>{}(static_cast<type>(__v));
|
||||
}
|
||||
};
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS __enum_hash<_Tp, false> {
|
||||
__enum_hash() = delete;
|
||||
__enum_hash(__enum_hash const&) = delete;
|
||||
__enum_hash& operator=(__enum_hash const&) = delete;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash : public __enum_hash<_Tp>
|
||||
{
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
|
|
|
@ -156,7 +156,7 @@ public:
|
|||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<R> share();
|
||||
shared_future<R> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
R get();
|
||||
|
@ -183,7 +183,7 @@ public:
|
|||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<R&> share();
|
||||
shared_future<R&> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
R& get();
|
||||
|
@ -210,7 +210,7 @@ public:
|
|||
~future();
|
||||
future& operator=(const future& rhs) = delete;
|
||||
future& operator=(future&&) noexcept;
|
||||
shared_future<void> share();
|
||||
shared_future<void> share() noexcept;
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
|
@ -499,7 +499,7 @@ make_error_condition(future_errc __e) _NOEXCEPT
|
|||
return error_condition(static_cast<int>(__e), future_category());
|
||||
}
|
||||
|
||||
class _LIBCPP_EXCEPTION_ABI future_error
|
||||
class _LIBCPP_EXCEPTION_ABI _LIBCPP_AVAILABILITY_FUTURE_ERROR future_error
|
||||
: public logic_error
|
||||
{
|
||||
error_code __ec_;
|
||||
|
@ -515,6 +515,9 @@ public:
|
|||
};
|
||||
|
||||
_LIBCPP_NORETURN inline _LIBCPP_ALWAYS_INLINE
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
_LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
#endif
|
||||
void __throw_future_error(future_errc _Ev)
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
|
@ -525,7 +528,7 @@ void __throw_future_error(future_errc _Ev)
|
|||
#endif
|
||||
}
|
||||
|
||||
class _LIBCPP_TYPE_VIS __assoc_sub_state
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state
|
||||
: public __shared_count
|
||||
{
|
||||
protected:
|
||||
|
@ -582,6 +585,7 @@ public:
|
|||
_LIBCPP_INLINE_VISIBILITY
|
||||
wait_for(const chrono::duration<_Rep, _Period>& __rel_time) const;
|
||||
template <class _Clock, class _Duration>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
future_status
|
||||
wait_until(const chrono::time_point<_Clock, _Duration>& __abs_time) const;
|
||||
|
||||
|
@ -611,7 +615,7 @@ __assoc_sub_state::wait_for(const chrono::duration<_Rep, _Period>& __rel_time) c
|
|||
}
|
||||
|
||||
template <class _Rp>
|
||||
class __assoc_state
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __assoc_state
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
@ -651,6 +655,7 @@ __assoc_state<_Rp>::__on_zero_shared() _NOEXCEPT
|
|||
|
||||
template <class _Rp>
|
||||
template <class _Arg>
|
||||
_LIBCPP_AVAILABILITY_FUTURE
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__assoc_state<_Rp>::set_value(_Arg&& __arg)
|
||||
|
@ -706,7 +711,7 @@ __assoc_state<_Rp>::copy()
|
|||
}
|
||||
|
||||
template <class _Rp>
|
||||
class __assoc_state<_Rp&>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __assoc_state<_Rp&>
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
@ -766,7 +771,7 @@ __assoc_state<_Rp&>::copy()
|
|||
}
|
||||
|
||||
template <class _Rp, class _Alloc>
|
||||
class __assoc_state_alloc
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc
|
||||
: public __assoc_state<_Rp>
|
||||
{
|
||||
typedef __assoc_state<_Rp> base;
|
||||
|
@ -794,7 +799,7 @@ __assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
|
|||
}
|
||||
|
||||
template <class _Rp, class _Alloc>
|
||||
class __assoc_state_alloc<_Rp&, _Alloc>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __assoc_state_alloc<_Rp&, _Alloc>
|
||||
: public __assoc_state<_Rp&>
|
||||
{
|
||||
typedef __assoc_state<_Rp&> base;
|
||||
|
@ -820,7 +825,7 @@ __assoc_state_alloc<_Rp&, _Alloc>::__on_zero_shared() _NOEXCEPT
|
|||
}
|
||||
|
||||
template <class _Alloc>
|
||||
class __assoc_sub_state_alloc
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __assoc_sub_state_alloc
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
@ -846,7 +851,7 @@ __assoc_sub_state_alloc<_Alloc>::__on_zero_shared() _NOEXCEPT
|
|||
}
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
class __deferred_assoc_state
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state
|
||||
: public __assoc_state<_Rp>
|
||||
{
|
||||
typedef __assoc_state<_Rp> base;
|
||||
|
@ -893,7 +898,7 @@ __deferred_assoc_state<_Rp, _Fp>::__execute()
|
|||
}
|
||||
|
||||
template <class _Fp>
|
||||
class __deferred_assoc_state<void, _Fp>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state<void, _Fp>
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
@ -941,7 +946,7 @@ __deferred_assoc_state<void, _Fp>::__execute()
|
|||
}
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
class __async_assoc_state
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state
|
||||
: public __assoc_state<_Rp>
|
||||
{
|
||||
typedef __assoc_state<_Rp> base;
|
||||
|
@ -996,7 +1001,7 @@ __async_assoc_state<_Rp, _Fp>::__on_zero_shared() _NOEXCEPT
|
|||
}
|
||||
|
||||
template <class _Fp>
|
||||
class __async_assoc_state<void, _Fp>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp>
|
||||
: public __assoc_sub_state
|
||||
{
|
||||
typedef __assoc_sub_state base;
|
||||
|
@ -1075,7 +1080,7 @@ __make_async_assoc_state(_Fp __f);
|
|||
#endif
|
||||
|
||||
template <class _Rp>
|
||||
class _LIBCPP_TEMPLATE_VIS future
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
|
||||
{
|
||||
__assoc_state<_Rp>* __state_;
|
||||
|
||||
|
@ -1119,7 +1124,7 @@ public:
|
|||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp> share();
|
||||
shared_future<_Rp> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
_Rp get();
|
||||
|
@ -1178,7 +1183,7 @@ future<_Rp>::get()
|
|||
}
|
||||
|
||||
template <class _Rp>
|
||||
class _LIBCPP_TEMPLATE_VIS future<_Rp&>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&>
|
||||
{
|
||||
__assoc_state<_Rp&>* __state_;
|
||||
|
||||
|
@ -1222,7 +1227,7 @@ public:
|
|||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp&> share();
|
||||
shared_future<_Rp&> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
_Rp& get();
|
||||
|
@ -1276,7 +1281,7 @@ future<_Rp&>::get()
|
|||
}
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS future<void>
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future<void>
|
||||
{
|
||||
__assoc_sub_state* __state_;
|
||||
|
||||
|
@ -1320,7 +1325,7 @@ public:
|
|||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<void> share();
|
||||
shared_future<void> share() _NOEXCEPT;
|
||||
|
||||
// retrieving the value
|
||||
void get();
|
||||
|
@ -1359,7 +1364,7 @@ swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
|
|||
template <class _Callable> class packaged_task;
|
||||
|
||||
template <class _Rp>
|
||||
class _LIBCPP_TEMPLATE_VIS promise
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise
|
||||
{
|
||||
__assoc_state<_Rp>* __state_;
|
||||
|
||||
|
@ -1526,7 +1531,7 @@ promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
|
|||
// promise<R&>
|
||||
|
||||
template <class _Rp>
|
||||
class _LIBCPP_TEMPLATE_VIS promise<_Rp&>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<_Rp&>
|
||||
{
|
||||
__assoc_state<_Rp&>* __state_;
|
||||
|
||||
|
@ -1662,7 +1667,7 @@ promise<_Rp&>::set_exception_at_thread_exit(exception_ptr __p)
|
|||
// promise<void>
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS promise<void>
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE promise<void>
|
||||
{
|
||||
__assoc_sub_state* __state_;
|
||||
|
||||
|
@ -1674,6 +1679,7 @@ class _LIBCPP_TYPE_VIS promise<void>
|
|||
public:
|
||||
promise();
|
||||
template <class _Allocator>
|
||||
_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS
|
||||
promise(allocator_arg_t, const _Allocator& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -1747,7 +1753,7 @@ template <class _Rp, class _Alloc>
|
|||
template<class _Fp> class __packaged_task_base;
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
class __packaged_task_base<_Rp(_ArgTypes...)>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_base<_Rp(_ArgTypes...)>
|
||||
{
|
||||
__packaged_task_base(const __packaged_task_base&);
|
||||
__packaged_task_base& operator=(const __packaged_task_base&);
|
||||
|
@ -1765,7 +1771,7 @@ public:
|
|||
template<class _FD, class _Alloc, class _FB> class __packaged_task_func;
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
class __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>
|
||||
: public __packaged_task_base<_Rp(_ArgTypes...)>
|
||||
{
|
||||
__compressed_pair<_Fp, _Alloc> __f_;
|
||||
|
@ -1823,7 +1829,7 @@ __packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::operator()(_ArgTypes&& ...
|
|||
template <class _Callable> class __packaged_task_function;
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
class __packaged_task_function<_Rp(_ArgTypes...)>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)>
|
||||
{
|
||||
typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
|
||||
typename aligned_storage<3*sizeof(void*)>::type __buf_;
|
||||
|
@ -1998,7 +2004,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) cons
|
|||
}
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
class _LIBCPP_TEMPLATE_VIS packaged_task<_Rp(_ArgTypes...)>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<_Rp(_ArgTypes...)>
|
||||
{
|
||||
public:
|
||||
typedef _Rp result_type; // extension
|
||||
|
@ -2127,7 +2133,7 @@ packaged_task<_Rp(_ArgTypes...)>::reset()
|
|||
}
|
||||
|
||||
template<class ..._ArgTypes>
|
||||
class _LIBCPP_TEMPLATE_VIS packaged_task<void(_ArgTypes...)>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE packaged_task<void(_ArgTypes...)>
|
||||
{
|
||||
public:
|
||||
typedef void result_type; // extension
|
||||
|
@ -2329,6 +2335,7 @@ inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, lau
|
|||
{ return (int(__policy) & int(__value)) != 0; }
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17
|
||||
future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
|
||||
async(launch __policy, _Fp&& __f, _Args&&... __args)
|
||||
{
|
||||
|
@ -2354,7 +2361,7 @@ async(launch __policy, _Fp&& __f, _Args&&... __args)
|
|||
}
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY
|
||||
future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
|
||||
async(_Fp&& __f, _Args&&... __args)
|
||||
{
|
||||
|
@ -2515,7 +2522,7 @@ shared_future<_Rp&>::operator=(const shared_future& __rhs)
|
|||
}
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS shared_future<void>
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE shared_future<void>
|
||||
{
|
||||
__assoc_sub_state* __state_;
|
||||
|
||||
|
@ -2580,7 +2587,7 @@ swap(shared_future<_Rp>& __x, shared_future<_Rp>& __y) _NOEXCEPT
|
|||
template <class _Rp>
|
||||
inline
|
||||
shared_future<_Rp>
|
||||
future<_Rp>::share()
|
||||
future<_Rp>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<_Rp>(_VSTD::move(*this));
|
||||
}
|
||||
|
@ -2588,7 +2595,7 @@ future<_Rp>::share()
|
|||
template <class _Rp>
|
||||
inline
|
||||
shared_future<_Rp&>
|
||||
future<_Rp&>::share()
|
||||
future<_Rp&>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<_Rp&>(_VSTD::move(*this));
|
||||
}
|
||||
|
@ -2597,7 +2604,7 @@ future<_Rp&>::share()
|
|||
|
||||
inline
|
||||
shared_future<void>
|
||||
future<void>::share()
|
||||
future<void>::share() _NOEXCEPT
|
||||
{
|
||||
return shared_future<void>(_VSTD::move(*this));
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче