mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
Update libcxx
llvm commit b2851aea80e5a8f0cfd6c3c5a56a6b00fb28c6b6
This commit is contained in:
parent
1e66ac5755
commit
f9a11fbfaf
206
lib/libcxx/include/__availability
Normal file
206
lib/libcxx/include/__availability
Normal file
@ -0,0 +1,206 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___AVAILABILITY
|
||||
#define _LIBCPP___AVAILABILITY
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// Libc++ is shipped by various vendors. In particular, it is used as a system
|
||||
// library on macOS, iOS and other Apple platforms. In order for users to be
|
||||
// able to compile a binary that is intended to be deployed to an older version
|
||||
// of a platform, Clang provides availability attributes [1]. These attributes
|
||||
// can be placed on declarations and are used to describe the life cycle of a
|
||||
// symbol in the library.
|
||||
//
|
||||
// The main goal is to ensure a compile-time error if a symbol that hasn't been
|
||||
// introduced in a previously released library is used in a program that targets
|
||||
// that previously released library. Normally, this would be a load-time error
|
||||
// when one tries to launch the program against the older library.
|
||||
//
|
||||
// For example, the filesystem library was introduced in the dylib in macOS 10.15.
|
||||
// If a user compiles on a macOS 10.15 host but targets macOS 10.13 with their
|
||||
// program, the compiler would normally not complain (because the required
|
||||
// declarations are in the headers), but the dynamic loader would fail to find
|
||||
// the symbols when actually trying to launch the program on macOS 10.13. To
|
||||
// turn this into a compile-time issue instead, declarations are annotated with
|
||||
// when they were introduced, and the compiler can produce a diagnostic if the
|
||||
// program references something that isn't available on the deployment target.
|
||||
//
|
||||
// This mechanism is general in nature, and any vendor can add their markup to
|
||||
// the library (see below). Whenever a new feature is added that requires support
|
||||
// in the shared library, a macro should be added below to mark this feature
|
||||
// as unavailable. When vendors decide to ship the feature as part of their
|
||||
// shared library, they can update the markup appropriately.
|
||||
//
|
||||
// Note that this mechanism is disabled by default in the "upstream" libc++.
|
||||
// Availability annotations are only meaningful when shipping libc++ inside
|
||||
// a platform (i.e. as a system library), and so vendors that want them should
|
||||
// turn those annotations on at CMake configuration time.
|
||||
//
|
||||
// [1]: https://clang.llvm.org/docs/AttributeReference.html#availability
|
||||
|
||||
|
||||
// For backwards compatibility, allow users to define _LIBCPP_DISABLE_AVAILABILITY
|
||||
// for a while.
|
||||
#if defined(_LIBCPP_DISABLE_AVAILABILITY)
|
||||
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Availability markup is disabled when building the library, or when the compiler
|
||||
// doesn't support the proper attributes.
|
||||
#if defined(_LIBCPP_BUILDING_LIBRARY) || \
|
||||
defined(_LIBCXXABI_BUILDING_LIBRARY) || \
|
||||
!__has_feature(attribute_availability_with_strict) || \
|
||||
!__has_feature(attribute_availability_in_templates) || \
|
||||
!__has_extension(pragma_clang_attribute_external_declaration)
|
||||
# if !defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
# define _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS)
|
||||
|
||||
// This controls the availability of std::shared_mutex and std::shared_timed_mutex,
|
||||
// which were added to the dylib later.
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
|
||||
|
||||
// These macros control the availability of std::bad_optional_access and
|
||||
// other exception types. These were put in the shared library to prevent
|
||||
// code bloat from every user program defining the vtable for these exception
|
||||
// types.
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
|
||||
// This controls the availability of std::uncaught_exceptions().
|
||||
# define _LIBCPP_AVAILABILITY_UNCAUGHT_EXCEPTIONS
|
||||
|
||||
// This controls the availability of the sized version of ::operator delete,
|
||||
// which was added to the dylib later.
|
||||
# define _LIBCPP_AVAILABILITY_SIZED_NEW_DELETE
|
||||
|
||||
// This controls the availability of the std::future_error exception.
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
|
||||
// This controls the availability of std::type_info's vtable.
|
||||
// I can't imagine how using std::type_info can work at all if
|
||||
// this isn't supported.
|
||||
# define _LIBCPP_AVAILABILITY_TYPEINFO_VTABLE
|
||||
|
||||
// This controls the availability of std::locale::category members
|
||||
// (e.g. std::locale::collate), which are defined in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_LOCALE_CATEGORY
|
||||
|
||||
// This controls the availability of atomic operations on std::shared_ptr
|
||||
// (e.g. `std::atomic_store(std::shared_ptr)`), which require a shared
|
||||
// lock table located in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_ATOMIC_SHARED_PTR
|
||||
|
||||
// These macros control the availability of all parts of <filesystem> that
|
||||
// depend on something in the dylib.
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
|
||||
// This controls the availability of std::to_chars.
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS
|
||||
|
||||
// This controls the availability of the C++20 synchronization library,
|
||||
// which requires shared library support for various operations
|
||||
// (see libcxx/src/atomic.cpp).
|
||||
# define _LIBCPP_AVAILABILITY_SYNC
|
||||
|
||||
#elif defined(__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__((availability(macosx,strict,introduced=10.13))) \
|
||||
__attribute__((availability(ios,strict,introduced=11.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=11.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=4.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# 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)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
|
||||
__attribute__((availability(macosx,strict,introduced=10.15))) \
|
||||
__attribute__((availability(ios,strict,introduced=13.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=13.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
|
||||
_Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop")
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS \
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_SYNC \
|
||||
__attribute__((unavailable))
|
||||
|
||||
#else
|
||||
|
||||
// ...New vendors can add availability markup here...
|
||||
|
||||
# error "It looks like you're trying to enable vendor availability markup, but you haven't defined the corresponding macros yet!"
|
||||
|
||||
#endif
|
||||
|
||||
// Define availability attributes that depend on _LIBCPP_NO_EXCEPTIONS.
|
||||
// Those are defined in terms of the availability attributes above, and
|
||||
// should not be vendor-specific.
|
||||
#if defined(_LIBCPP_NO_EXCEPTIONS)
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
#endif
|
||||
|
||||
#endif // _LIBCPP___AVAILABILITY
|
@ -32,13 +32,13 @@
|
||||
# define _GNUC_VER_NEW 0
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_VERSION 11000
|
||||
#define _LIBCPP_VERSION 12000
|
||||
|
||||
#ifndef _LIBCPP_ABI_VERSION
|
||||
# define _LIBCPP_ABI_VERSION 1
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_HOSTED__
|
||||
#if __STDC_HOSTED__ == 0
|
||||
# define _LIBCPP_FREESTANDING
|
||||
#endif
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
#elif defined(__wasm__)
|
||||
# define _LIBCPP_OBJECT_FORMAT_WASM 1
|
||||
#else
|
||||
# error Unknown object file format
|
||||
// ... add new file formats here ...
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
@ -105,6 +105,10 @@
|
||||
// Re-worked external template instantiations for std::string with a focus on
|
||||
// performance and fast-path inlining.
|
||||
# define _LIBCPP_ABI_STRING_OPTIMIZED_EXTERNAL_INSTANTIATION
|
||||
// Enable clang::trivial_abi on std::unique_ptr.
|
||||
# define _LIBCPP_ABI_ENABLE_UNIQUE_PTR_TRIVIAL_ABI
|
||||
// Enable clang::trivial_abi on std::shared_ptr and std::weak_ptr
|
||||
# define _LIBCPP_ABI_ENABLE_SHARED_PTR_TRIVIAL_ABI
|
||||
#elif _LIBCPP_ABI_VERSION == 1
|
||||
# if !defined(_LIBCPP_OBJECT_FORMAT_COFF)
|
||||
// Enable compiling copies of now inline methods into the dylib to support
|
||||
@ -121,9 +125,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
|
||||
#error "_LIBCPP_TRIVIAL_PAIR_COPY_CTOR" is no longer supported. \
|
||||
use _LIBCPP_DEPRECATED_ABI_DISABLE_PAIR_TRIVIAL_COPY_CTOR instead
|
||||
#if defined(_LIBCPP_BUILDING_LIBRARY) || defined(_LIBCPP_ABI_UNSTABLE) || _LIBCPP_ABI_VERSION >= 2
|
||||
// Enable additional explicit instantiations of iostreams components. This
|
||||
// reduces the number of weak definitions generated in programs that use
|
||||
// iostreams by providing a single strong definition in the shared library.
|
||||
# define _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_CONCAT1(_LIBCPP_X,_LIBCPP_Y) _LIBCPP_X##_LIBCPP_Y
|
||||
@ -344,13 +350,11 @@
|
||||
# if defined(__FreeBSD__)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# if __FreeBSD_version >= 1300064 || \
|
||||
(__FreeBSD_version >= 1201504 && __FreeBSD_version < 1300000)
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# elif defined(__BIONIC__)
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# if __ANDROID_API__ >= 21
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# endif
|
||||
@ -364,7 +368,6 @@
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# elif defined(__linux__)
|
||||
# if !defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 15) || defined(__BIONIC__)
|
||||
@ -372,16 +375,24 @@
|
||||
# endif
|
||||
# if _LIBCPP_GLIBC_PREREQ(2, 17)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# else // defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_QUICK_EXIT
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# define _LIBCPP_HAS_C11_FEATURES
|
||||
# endif
|
||||
# endif // __linux__
|
||||
# elif defined(__APPLE__)
|
||||
// timespec_get and aligned_alloc were introduced in macOS 10.15 and
|
||||
// aligned releases
|
||||
# if (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 101500 || \
|
||||
__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
|
||||
__ENVIRONMENT_TV_OS_VERSION_MIN_REQUIRED__ >= 130000 || \
|
||||
__ENVIRONMENT_WATCH_OS_VERSION_MIN_REQUIRED__ >= 60000)
|
||||
# define _LIBCPP_HAS_ALIGNED_ALLOC
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET
|
||||
# endif
|
||||
# endif // __APPLE__
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -389,9 +400,7 @@
|
||||
#elif defined(_LIBCPP_COMPILER_CLANG)
|
||||
# define _LIBCPP_ALIGNOF(_Tp) _Alignof(_Tp)
|
||||
#else
|
||||
// This definition is potentially buggy, but it's only taken with GCC in C++03,
|
||||
// which we barely support anyway. See llvm.org/PR39713
|
||||
# define _LIBCPP_ALIGNOF(_Tp) __alignof(_Tp)
|
||||
# error "We don't know a correct way to implement alignof(T) in C++03 outside of Clang"
|
||||
#endif
|
||||
|
||||
#define _LIBCPP_PREFERRED_ALIGNOF(_Tp) __alignof(_Tp)
|
||||
@ -433,10 +442,6 @@ typedef __char32_t char32_t;
|
||||
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_lambdas))
|
||||
#define _LIBCPP_HAS_NO_LAMBDAS
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_nullptr))
|
||||
# if (__has_extension(cxx_nullptr) || __has_keyword(__nullptr)) && defined(_LIBCPP_ABI_ALWAYS_USE_CXX11_NULLPTR)
|
||||
# define nullptr __nullptr
|
||||
@ -445,18 +450,6 @@ typedef __char32_t char32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_rvalue_references))
|
||||
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_auto_type))
|
||||
#define _LIBCPP_HAS_NO_AUTO_TYPE
|
||||
#endif
|
||||
|
||||
#if !(__has_feature(cxx_variadic_templates))
|
||||
#define _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif
|
||||
|
||||
// Objective-C++ features (opt-in)
|
||||
#if __has_feature(objc_arc)
|
||||
#define _LIBCPP_HAS_OBJC_ARC
|
||||
@ -754,16 +747,6 @@ typedef __char32_t char32_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
# ifdef _LIBCPP_OBJECT_FORMAT_COFF // Windows binaries can't merge typeinfos.
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
|
||||
# else
|
||||
// TODO: This isn't strictly correct on ELF platforms due to llvm.org/PR37398
|
||||
// And we should consider defaulting to OFF.
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HIDE_FROM_ABI
|
||||
# if _LIBCPP_HIDE_FROM_ABI_PER_TU
|
||||
# define _LIBCPP_HIDE_FROM_ABI _LIBCPP_HIDDEN _LIBCPP_INTERNAL_LINKAGE
|
||||
@ -838,6 +821,12 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_CONSTEXPR constexpr
|
||||
#endif
|
||||
|
||||
#ifndef __cpp_consteval
|
||||
# define _LIBCPP_CONSTEVAL _LIBCPP_CONSTEXPR
|
||||
#else
|
||||
# define _LIBCPP_CONSTEVAL consteval
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
# define _LIBCPP_DEFAULT {}
|
||||
#else
|
||||
@ -863,10 +852,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_EXPLICIT
|
||||
#endif
|
||||
|
||||
#if !__has_builtin(__builtin_operator_new) || !__has_builtin(__builtin_operator_delete)
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
|
||||
@ -880,36 +865,33 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
|
||||
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
|
||||
|
||||
#ifdef _LIBCPP_DEBUG
|
||||
# if _LIBCPP_DEBUG == 0
|
||||
// _LIBCPP_DEBUG potential values:
|
||||
// - undefined: No assertions. This is the default.
|
||||
// - 0: Basic assertions
|
||||
// - 1: Basic assertions + iterator validity checks.
|
||||
#if !defined(_LIBCPP_DEBUG)
|
||||
# define _LIBCPP_DEBUG_LEVEL 0
|
||||
#elif _LIBCPP_DEBUG == 0
|
||||
# define _LIBCPP_DEBUG_LEVEL 1
|
||||
#elif _LIBCPP_DEBUG == 1
|
||||
# define _LIBCPP_DEBUG_LEVEL 2
|
||||
#else
|
||||
# error Supported values for _LIBCPP_DEBUG are 0 and 1
|
||||
#endif
|
||||
# if !defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
# define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_DEBUG_LEVEL
|
||||
# define _LIBCPP_DEBUG_LEVEL 0
|
||||
// _LIBCPP_DEBUG_LEVEL is always defined to one of [0, 1, 2] at this point
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1
|
||||
# define _LIBCPP_DISABLE_EXTERN_TEMPLATE
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_DISABLE_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...)
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE2
|
||||
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_EXTERN_TEMPLATE_DEFINE
|
||||
#define _LIBCPP_EXTERN_TEMPLATE_DEFINE(...) template __VA_ARGS__;
|
||||
#endif
|
||||
@ -938,6 +920,8 @@ typedef unsigned int char32_t;
|
||||
// We're deferring to Microsoft's STL to provide aligned new et al. We don't
|
||||
// have it unless the language feature test macro is defined.
|
||||
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
|
||||
#elif defined(__MVS__)
|
||||
# define _LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__)
|
||||
@ -999,6 +983,18 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX17
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_DEPRECATED
|
||||
#else
|
||||
# define _LIBCPP_DEPRECATED_IN_CXX20
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_NO_HAS_CHAR8_T)
|
||||
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T _LIBCPP_DEPRECATED
|
||||
#else
|
||||
# define _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
#endif
|
||||
|
||||
// Macros to enter and leave a state where deprecation warnings are suppressed.
|
||||
#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \
|
||||
(defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC))
|
||||
@ -1037,14 +1033,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && \
|
||||
!defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR) && \
|
||||
!defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED constexpr
|
||||
#else
|
||||
# define _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
#endif
|
||||
|
||||
// The _LIBCPP_NODISCARD_ATTRIBUTE should only be used to define other
|
||||
// NODISCARD macros to the correct attribute.
|
||||
#if __has_cpp_attribute(nodiscard) || defined(_LIBCPP_COMPILER_MSVC)
|
||||
@ -1079,12 +1067,6 @@ typedef unsigned int char32_t;
|
||||
# define _LIBCPP_INLINE_VAR
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
# define _LIBCPP_EXPLICIT_MOVE(x) _VSTD::move(x)
|
||||
#else
|
||||
# define _LIBCPP_EXPLICIT_MOVE(x) (x)
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
#if defined(_LIBCPP_DEBUG) || defined(_LIBCPP_HAS_NO_CXX14_CONSTEXPR)
|
||||
#define _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
@ -1125,11 +1107,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# if defined(__FreeBSD__) || \
|
||||
defined(__wasi__) || \
|
||||
defined(__NetBSD__) || \
|
||||
defined(__NuttX__) || \
|
||||
defined(__linux__) || \
|
||||
defined(__GNU__) || \
|
||||
defined(__APPLE__) || \
|
||||
defined(__CloudABI__) || \
|
||||
defined(__sun__) || \
|
||||
defined(__MVS__) || \
|
||||
(defined(__MINGW32__) && __has_include(<pthread.h>))
|
||||
# define _LIBCPP_HAS_THREAD_API_PTHREAD
|
||||
# elif defined(__Fuchsia__)
|
||||
@ -1167,10 +1151,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
_LIBCPP_HAS_NO_THREADS is defined.
|
||||
#endif
|
||||
|
||||
#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS)
|
||||
#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set.
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__)
|
||||
#define __STDCPP_THREADS__ 1
|
||||
#endif
|
||||
@ -1227,8 +1207,9 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || \
|
||||
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || defined(__NuttX__) || \
|
||||
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) || \
|
||||
defined(__MVS__)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
#endif
|
||||
|
||||
@ -1337,6 +1318,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#endif
|
||||
#endif // !defined(_LIBCPP_NODEBUG_TYPE)
|
||||
|
||||
#if __has_attribute(__preferred_name__)
|
||||
#define _LIBCPP_PREFERRED_NAME(x) __attribute__((__preferred_name__(x)))
|
||||
#else
|
||||
#define _LIBCPP_PREFERRED_NAME(x)
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_MICROSOFT) && \
|
||||
(defined(_LIBCPP_COMPILER_MSVC) || __has_declspec_attribute(empty_bases))
|
||||
# define _LIBCPP_DECLSPEC_EMPTY_BASES __declspec(empty_bases)
|
||||
@ -1367,120 +1354,6 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_SPACESHIP_OPERATOR
|
||||
#endif
|
||||
|
||||
// Decide whether to use availability macros.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCXXABI_BUILDING_LIBRARY) && \
|
||||
!defined(_LIBCPP_DISABLE_AVAILABILITY) && \
|
||||
__has_feature(attribute_availability_with_strict) && \
|
||||
__has_feature(attribute_availability_in_templates) && \
|
||||
__has_extension(pragma_clang_attribute_external_declaration)
|
||||
# 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__((availability(macosx,strict,introduced=10.13))) \
|
||||
__attribute__((availability(ios,strict,introduced=11.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=11.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=4.0)))
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_ANY_CAST \
|
||||
_LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# 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)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM \
|
||||
__attribute__((availability(macosx,strict,introduced=10.15))) \
|
||||
__attribute__((availability(ios,strict,introduced=13.0))) \
|
||||
__attribute__((availability(tvos,strict,introduced=13.0))) \
|
||||
__attribute__((availability(watchos,strict,introduced=6.0)))
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH \
|
||||
_Pragma("clang attribute push(__attribute__((availability(macosx,strict,introduced=10.15))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(ios,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(tvos,strict,introduced=13.0))), apply_to=any(function,record))") \
|
||||
_Pragma("clang attribute push(__attribute__((availability(watchos,strict,introduced=6.0))), apply_to=any(function,record))")
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop") \
|
||||
_Pragma("clang attribute pop")
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS \
|
||||
_LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_SYNC \
|
||||
__attribute__((unavailable))
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_SHARED_MUTEX
|
||||
# define _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# 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
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_PUSH
|
||||
# define _LIBCPP_AVAILABILITY_FILESYSTEM_POP
|
||||
# define _LIBCPP_AVAILABILITY_TO_CHARS
|
||||
# define _LIBCPP_AVAILABILITY_SYNC
|
||||
#endif
|
||||
|
||||
// Define availability that depends on _LIBCPP_NO_EXCEPTIONS.
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS
|
||||
#else
|
||||
# define _LIBCPP_AVAILABILITY_FUTURE _LIBCPP_AVAILABILITY_FUTURE_ERROR
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_ANY_CAST _LIBCPP_AVAILABILITY_BAD_ANY_CAST
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_OPTIONAL_ACCESS _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS
|
||||
# define _LIBCPP_AVAILABILITY_THROW_BAD_VARIANT_ACCESS _LIBCPP_AVAILABILITY_BAD_VARIANT_ACCESS
|
||||
#endif
|
||||
|
||||
// The stream API was dropped and re-added in the dylib shipped on macOS
|
||||
// and iOS. We can only assume the dylib to provide these definitions for
|
||||
// macosx >= 10.9 and ios >= 7.0. Otherwise, the definitions are available
|
||||
// from the headers, but not from the dylib. Explicit instantiation
|
||||
// declarations for streams exist conditionally to this; if we provide
|
||||
// an explicit instantiation declaration and we try to deploy to a dylib
|
||||
// that does not provide those symbols, we'll get a load-time error.
|
||||
#if !defined(_LIBCPP_BUILDING_LIBRARY) && \
|
||||
((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_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_IBM)
|
||||
#define _LIBCPP_HAS_NO_PRAGMA_PUSH_POP_MACRO
|
||||
#endif
|
||||
@ -1547,6 +1420,12 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_FGETPOS_FSETPOS
|
||||
#endif
|
||||
|
||||
#if __has_attribute(init_priority)
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
|
||||
#else
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX
|
||||
#endif
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif // _LIBCPP_CONFIG
|
||||
|
@ -26,12 +26,13 @@
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
|
||||
#cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
|
||||
#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_HAS_NO_VENDOR_AVAILABILITY_ANNOTATIONS
|
||||
#cmakedefine _LIBCPP_NO_VCRUNTIME
|
||||
#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
#cmakedefine _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION @_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION@
|
||||
#endif
|
||||
#cmakedefine _LIBCPP_ABI_NAMESPACE @_LIBCPP_ABI_NAMESPACE@
|
||||
#cmakedefine _LIBCPP_HAS_PARALLEL_ALGORITHMS
|
||||
#cmakedefine _LIBCPP_HAS_NO_RANDOM_DEVICE
|
||||
#cmakedefine _LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
@_LIBCPP_ABI_DEFINES@
|
||||
|
||||
|
@ -27,26 +27,21 @@
|
||||
# include <cstddef>
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)
|
||||
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : \
|
||||
_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#ifndef _LIBCPP_DEBUG_ASSERT
|
||||
#define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
|
||||
#endif
|
||||
#define _LIBCPP_DEBUG_MODE(...) __VA_ARGS__
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_ASSERT
|
||||
# define _LIBCPP_ASSERT(x, m) ((void)0)
|
||||
#endif
|
||||
#ifndef _LIBCPP_DEBUG_ASSERT
|
||||
#if _LIBCPP_DEBUG_LEVEL == 0
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((void)0)
|
||||
#elif _LIBCPP_DEBUG_LEVEL == 1
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) ((void)0)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#elif _LIBCPP_DEBUG_LEVEL == 2
|
||||
# define _LIBCPP_DEBUG_ASSERT(x, m) _LIBCPP_ASSERT(x, m)
|
||||
# define _LIBCPP_ASSERT_IMPL(x, m) ((x) ? (void)0 : _VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, #x, m)))
|
||||
#else
|
||||
# error _LIBCPP_DEBUG_LEVEL must be one of 0, 1, 2
|
||||
#endif
|
||||
#ifndef _LIBCPP_DEBUG_MODE
|
||||
#define _LIBCPP_DEBUG_MODE(...) ((void)0)
|
||||
|
||||
#if !defined(_LIBCPP_ASSERT)
|
||||
# define _LIBCPP_ASSERT(x, m) _LIBCPP_ASSERT_IMPL(x, m)
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@ -59,7 +54,7 @@ struct _LIBCPP_TEMPLATE_VIS __libcpp_debug_info {
|
||||
__libcpp_debug_info(const char* __f, int __l, const char* __p, const char* __m)
|
||||
: __file_(__f), __line_(__l), __pred_(__p), __msg_(__m) {}
|
||||
|
||||
_LIBCPP_FUNC_VIS std::string what() const;
|
||||
_LIBCPP_FUNC_VIS string what() const;
|
||||
|
||||
const char* __file_;
|
||||
int __line_;
|
||||
@ -83,7 +78,7 @@ void __libcpp_abort_debug_function(__libcpp_debug_info const&);
|
||||
_LIBCPP_FUNC_VIS
|
||||
bool __libcpp_set_debug_function(__libcpp_debug_function_type __func);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __c_node;
|
||||
|
||||
@ -271,7 +266,7 @@ _LIBCPP_FUNC_VIS __libcpp_db* __get_db();
|
||||
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db();
|
||||
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2 || defined(_LIBCPP_BUILDING_LIBRARY)
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -126,7 +126,7 @@ __func<_Fp, _Alloc, _Rp()>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@ -134,7 +134,7 @@ template<class _Fp, class _Alloc, class _Rp>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp()>::__clone(__base<_Rp()>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp>
|
||||
@ -212,7 +212,7 @@ __func<_Fp, _Alloc, _Rp(_A0)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0)>::__clone(__base<_Rp(_A0)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0>
|
||||
@ -298,7 +298,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@ -306,7 +306,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1)>::__clone(__base<_Rp(_A0, _A1)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1>
|
||||
@ -384,7 +384,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone() const
|
||||
_Ap __a(__f_.second());
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__func, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
::new ((void*)__hold.get()) __func(__f_.first(), _Alloc(__a));
|
||||
return __hold.release();
|
||||
}
|
||||
|
||||
@ -392,7 +392,7 @@ template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::__clone(__base<_Rp(_A0, _A1, _A2)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.first(), __f_.second());
|
||||
::new ((void*)__p) __func(__f_.first(), __f_.second());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class _A0, class _A1, class _A2>
|
||||
@ -554,7 +554,7 @@ function<_Rp()>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -562,7 +562,7 @@ function<_Rp()>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -581,7 +581,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -589,7 +589,7 @@ function<_Rp()>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -834,7 +834,7 @@ function<_Rp(_A0)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -842,7 +842,7 @@ function<_Rp(_A0)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -861,7 +861,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -869,7 +869,7 @@ function<_Rp(_A0)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -1114,7 +1114,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1122,7 +1122,7 @@ function<_Rp(_A0, _A1)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -1141,7 +1141,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1149,7 +1149,7 @@ function<_Rp(_A0, _A1)>::function(allocator_arg_t, const _Alloc& __a0, _Fp __f,
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -1394,7 +1394,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f);
|
||||
::new ((void*)__f_) _FF(__f);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1402,7 +1402,7 @@ function<_Rp(_A0, _A1, _A2)>::function(_Fp __f,
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, allocator<_Fp>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -1421,7 +1421,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(__f, __a0);
|
||||
::new ((void*)__f_) _FF(__f, __a0);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1429,7 +1429,7 @@ function<_Rp(_A0, _A1, _A2)>::function(allocator_arg_t, const _Alloc& __a0, _Fp
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(__f, _Alloc(__a));
|
||||
::new ((void*)__hold.get()) _FF(__f, _Alloc(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
|
@ -298,7 +298,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
|
||||
template <class _Tp, class ..._Args>
|
||||
struct __invoke_return
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp>(), declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
#else // defined(_LIBCPP_CXX03_LANG)
|
||||
@ -314,27 +314,27 @@ struct __invoke_void_return_wrapper
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static _Ret __call(_Args&&... __args) {
|
||||
return __invoke(_VSTD::forward<_Args>(__args)...);
|
||||
return _VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
template <class _Fn>
|
||||
static _Ret __call(_Fn __f) {
|
||||
return __invoke(__f);
|
||||
return _VSTD::__invoke(__f);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
static _Ret __call(_Fn __f, _A0& __a0) {
|
||||
return __invoke(__f, __a0);
|
||||
return _VSTD::__invoke(__f, __a0);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||
return __invoke(__f, __a0, __a1);
|
||||
return _VSTD::__invoke(__f, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
static _Ret __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2){
|
||||
return __invoke(__f, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f, __a0, __a1, __a2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@ -345,27 +345,27 @@ struct __invoke_void_return_wrapper<void>
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
static void __call(_Args&&... __args) {
|
||||
__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
_VSTD::__invoke(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
template <class _Fn>
|
||||
static void __call(_Fn __f) {
|
||||
__invoke(__f);
|
||||
_VSTD::__invoke(__f);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
static void __call(_Fn __f, _A0& __a0) {
|
||||
__invoke(__f, __a0);
|
||||
_VSTD::__invoke(__f, __a0);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1) {
|
||||
__invoke(__f, __a0, __a1);
|
||||
_VSTD::__invoke(__f, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
static void __call(_Fn __f, _A0& __a0, _A1& __a1, _A2& __a2) {
|
||||
__invoke(__f, __a0, __a1, __a2);
|
||||
_VSTD::__invoke(__f, __a0, __a1, __a2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@ -398,112 +398,112 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_of<type&, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const {
|
||||
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
return _VSTD::__invoke(get(), _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
#else
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type>::type
|
||||
operator() () const {
|
||||
return __invoke(get());
|
||||
return _VSTD::__invoke(get());
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0>::type
|
||||
operator() (_A0& __a0) const {
|
||||
return __invoke(get(), __a0);
|
||||
return _VSTD::__invoke(get(), __a0);
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0 const>::type
|
||||
operator() (_A0 const& __a0) const {
|
||||
return __invoke(get(), __a0);
|
||||
return _VSTD::__invoke(get(), __a0);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1>::type
|
||||
operator() (_A0& __a0, _A1& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1) const {
|
||||
return __invoke(get(), __a0, __a1);
|
||||
return _VSTD::__invoke(get(), __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(get(), __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(get(), __a0, __a1, __a2);
|
||||
}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
};
|
||||
|
@ -40,7 +40,7 @@ struct __enable_invoke_imp<_Ret, _T1, false, true> {
|
||||
template <class _Ret, class _T1>
|
||||
struct __enable_invoke_imp<_Ret, _T1, false, false> {
|
||||
typedef typename add_lvalue_reference<
|
||||
typename __apply_cv<decltype(*_VSTD::declval<_T1>()), _Ret>::type
|
||||
typename __apply_cv<decltype(*declval<_T1>()), _Ret>::type
|
||||
>::type _Bullet4;
|
||||
typedef _Bullet4 type;
|
||||
};
|
||||
@ -142,7 +142,7 @@ __invoke(_Fn __f, _T1& __t1) {
|
||||
|
||||
template <class _Fp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()())
|
||||
decltype(declval<_Fp&>()())
|
||||
__invoke(_Fp& __f)
|
||||
{
|
||||
return __f();
|
||||
@ -150,7 +150,7 @@ __invoke(_Fp& __f)
|
||||
|
||||
template <class _Fp, class _A0>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0)
|
||||
{
|
||||
return __f(__a0);
|
||||
@ -158,7 +158,7 @@ __invoke(_Fp& __f, _A0& __a0)
|
||||
|
||||
template <class _Fp, class _A0, class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0, _A1& __a1)
|
||||
{
|
||||
return __f(__a0, __a1);
|
||||
@ -166,7 +166,7 @@ __invoke(_Fp& __f, _A0& __a0, _A1& __a1)
|
||||
|
||||
template <class _Fp, class _A0, class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
decltype(_VSTD::declval<_Fp&>()(_VSTD::declval<_A0&>(), _VSTD::declval<_A1&>(), _VSTD::declval<_A2&>()))
|
||||
decltype(declval<_Fp&>()(declval<_A0&>(), declval<_A1&>(), declval<_A2&>()))
|
||||
__invoke(_Fp& __f, _A0& __a0, _A1& __a1, _A2& __a2)
|
||||
{
|
||||
return __f(__a0, __a1, __a2);
|
||||
@ -181,13 +181,13 @@ struct __invoke_return
|
||||
template <class _Fp>
|
||||
struct __invoke_return<_Fp, false>
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Fp&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Fp&>())) type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _A0>
|
||||
struct __invoke_return0
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>())) type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Tp, class _A0>
|
||||
@ -199,8 +199,8 @@ struct __invoke_return0<_Rp _Tp::*, _A0>
|
||||
template <class _Tp, class _A0, class _A1>
|
||||
struct __invoke_return1
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
||||
_VSTD::declval<_A1&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
|
||||
declval<_A1&>())) type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _A0, class _A1>
|
||||
@ -211,9 +211,9 @@ struct __invoke_return1<_Rp _Class::*, _A0, _A1> {
|
||||
template <class _Tp, class _A0, class _A1, class _A2>
|
||||
struct __invoke_return2
|
||||
{
|
||||
typedef decltype(__invoke(_VSTD::declval<_Tp&>(), _VSTD::declval<_A0&>(),
|
||||
_VSTD::declval<_A1&>(),
|
||||
_VSTD::declval<_A2&>())) type;
|
||||
typedef decltype(_VSTD::__invoke(declval<_Tp&>(), declval<_A0&>(),
|
||||
declval<_A1&>(),
|
||||
declval<_A2&>())) type;
|
||||
};
|
||||
|
||||
template <class _Ret, class _Class, class _A0, class _A1, class _A2>
|
||||
|
@ -34,7 +34,6 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
template <class _Key, class _Tp>
|
||||
struct __hash_value_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_hash_value_type_imp : false_type {};
|
||||
|
||||
@ -46,7 +45,6 @@ struct __is_hash_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_hash_value_type<_One> : __is_hash_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
#endif
|
||||
|
||||
_LIBCPP_FUNC_VIS
|
||||
size_t __next_prime(size_t __n);
|
||||
@ -122,7 +120,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
size_t
|
||||
__next_hash_pow2(size_t __n)
|
||||
{
|
||||
return __n < 2 ? __n : (size_t(1) << (std::numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
|
||||
return __n < 2 ? __n : (size_t(1) << (numeric_limits<size_t>::digits - __libcpp_clz(__n-1)));
|
||||
}
|
||||
|
||||
|
||||
@ -155,12 +153,10 @@ struct __hash_key_value_types {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n);
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
@ -197,13 +193,10 @@ struct __hash_key_value_types<__hash_value_type<_Key, _Tp> > {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
template <class _Tp, class _AllocPtr, class _KVTypes = __hash_key_value_types<_Tp>,
|
||||
@ -295,10 +288,12 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(const __hash_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
@ -322,7 +317,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@ -364,7 +359,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
@ -405,17 +400,21 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __non_const_iterator& __x) _NOEXCEPT
|
||||
: __node_(__x.__node_)
|
||||
{
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(const __hash_const_iterator& __i)
|
||||
: __node_(__i.__node_)
|
||||
@ -439,7 +438,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@ -480,7 +479,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_iterator(__next_pointer __node, const void* __c) _NOEXCEPT
|
||||
: __node_(__node)
|
||||
@ -518,10 +517,12 @@ public:
|
||||
typedef typename _NodeTypes::__node_value_type_pointer pointer;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(const __hash_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
@ -549,7 +550,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@ -593,7 +594,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_local_iterator(__next_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
@ -650,7 +651,9 @@ public:
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY __hash_const_local_iterator() _NOEXCEPT : __node_(nullptr) {
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__insert_i(this));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -659,10 +662,12 @@ public:
|
||||
__bucket_(__x.__bucket_),
|
||||
__bucket_count_(__x.__bucket_count_)
|
||||
{
|
||||
_LIBCPP_DEBUG_MODE(__get_db()->__iterator_copy(this, &__x));
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__x);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(const __hash_const_local_iterator& __i)
|
||||
: __node_(__i.__node_),
|
||||
@ -690,7 +695,7 @@ public:
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const {
|
||||
@ -734,7 +739,7 @@ public:
|
||||
{return !(__x == __y);}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_const_local_iterator(__next_pointer __node, size_t __bucket,
|
||||
size_t __bucket_count, const void* __c) _NOEXCEPT
|
||||
@ -783,7 +788,6 @@ public:
|
||||
_NOEXCEPT_(is_nothrow_copy_constructible<allocator_type>::value)
|
||||
: __data_(__size, __a) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__bucket_list_deallocator(__bucket_list_deallocator&& __x)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
@ -791,7 +795,6 @@ public:
|
||||
{
|
||||
__x.size() = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type& size() _NOEXCEPT {return __data_.first();}
|
||||
@ -1007,7 +1010,6 @@ public:
|
||||
explicit __hash_table(const allocator_type& __a);
|
||||
__hash_table(const __hash_table& __u);
|
||||
__hash_table(const __hash_table& __u, const allocator_type& __a);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__hash_table(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__bucket_list>::value &&
|
||||
@ -1016,11 +1018,9 @@ public:
|
||||
is_nothrow_move_constructible<hasher>::value &&
|
||||
is_nothrow_move_constructible<key_equal>::value);
|
||||
__hash_table(__hash_table&& __u, const allocator_type& __a);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
~__hash_table();
|
||||
|
||||
__hash_table& operator=(const __hash_table& __u);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__hash_table& operator=(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
@ -1028,7 +1028,6 @@ public:
|
||||
is_nothrow_move_assignable<__node_allocator>::value &&
|
||||
is_nothrow_move_assignable<hasher>::value &&
|
||||
is_nothrow_move_assignable<key_equal>::value);
|
||||
#endif
|
||||
template <class _InputIterator>
|
||||
void __assign_unique(_InputIterator __first, _InputIterator __last);
|
||||
template <class _InputIterator>
|
||||
@ -1037,7 +1036,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{
|
||||
return std::min<size_type>(
|
||||
return _VSTD::min<size_type>(
|
||||
__node_traits::max_size(__node_alloc()),
|
||||
numeric_limits<difference_type >::max()
|
||||
);
|
||||
@ -1066,7 +1065,6 @@ public:
|
||||
iterator __node_insert_multi(const_iterator __p,
|
||||
__node_pointer __nd);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const& __k, _Args&&... __args);
|
||||
@ -1151,15 +1149,6 @@ public:
|
||||
return __emplace_hint_multi(__p, _VSTD::forward<_Pp>(__x));
|
||||
}
|
||||
|
||||
#else // !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args);
|
||||
|
||||
iterator __insert_multi(const __container_value_type& __x);
|
||||
iterator __insert_multi(const_iterator __p, const __container_value_type& __x);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(const __container_value_type& __x) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__x), __x);
|
||||
@ -1295,7 +1284,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::begin(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
#else
|
||||
return local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
@ -1308,7 +1297,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::end(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return local_iterator(nullptr, __n, bucket_count(), this);
|
||||
#else
|
||||
return local_iterator(nullptr, __n, bucket_count());
|
||||
@ -1321,7 +1310,7 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::cbegin(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count(), this);
|
||||
#else
|
||||
return const_local_iterator(__bucket_list_[__n], __n, bucket_count());
|
||||
@ -1334,35 +1323,30 @@ public:
|
||||
{
|
||||
_LIBCPP_ASSERT(__n < bucket_count(),
|
||||
"unordered container::cend(n) called with n >= bucket_count()");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_local_iterator(nullptr, __n, bucket_count(), this);
|
||||
#else
|
||||
return const_local_iterator(nullptr, __n, bucket_count());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
void __rehash(size_type __n);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
__node_holder __construct_node(_Args&& ...__args);
|
||||
|
||||
template <class _First, class ..._Rest>
|
||||
__node_holder __construct_node_hash(size_t __hash, _First&& __f, _Rest&&... __rest);
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
__node_holder __construct_node(const __container_value_type& __v);
|
||||
__node_holder __construct_node_hash(size_t __hash, const __container_value_type& __v);
|
||||
#endif
|
||||
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1373,7 +1357,6 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __copy_assign_alloc(const __hash_table&, false_type) {}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void __move_assign(__hash_table& __u, false_type);
|
||||
void __move_assign(__hash_table& __u, true_type)
|
||||
_NOEXCEPT_(
|
||||
@ -1400,7 +1383,6 @@ private:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void __deallocate_node(__next_pointer __np) _NOEXCEPT;
|
||||
__next_pointer __detach() _NOEXCEPT;
|
||||
@ -1477,8 +1459,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(const __hash_table& __u,
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
|
||||
_NOEXCEPT_(
|
||||
@ -1526,8 +1506,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
|
||||
}
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
{
|
||||
@ -1539,7 +1517,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::~__hash_table()
|
||||
#endif
|
||||
|
||||
__deallocate_node(__p1_.first().__next_);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1583,7 +1561,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
while (__np != nullptr)
|
||||
{
|
||||
__next_pointer __next = __np->__next_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
@ -1593,7 +1571,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__deallocate_node(__next_pointer __np)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -1618,8 +1596,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__detach() _NOEXCEPT
|
||||
return __cache;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
@ -1646,7 +1622,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
|
||||
__u.__p1_.first().__next_ = nullptr;
|
||||
__u.size() = 0;
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
}
|
||||
@ -1714,8 +1690,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::operator=(__hash_table&& __u)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _InputIterator>
|
||||
void
|
||||
@ -1800,7 +1774,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__p1_.first().__next_, this);
|
||||
#else
|
||||
return iterator(__p1_.first().__next_);
|
||||
@ -1812,7 +1786,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(nullptr, this);
|
||||
#else
|
||||
return iterator(nullptr);
|
||||
@ -1824,7 +1798,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::begin() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__p1_.first().__next_, this);
|
||||
#else
|
||||
return const_iterator(__p1_.first().__next_);
|
||||
@ -1836,7 +1810,7 @@ inline
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::const_iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::end() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(nullptr, this);
|
||||
#else
|
||||
return const_iterator(nullptr);
|
||||
@ -1945,7 +1919,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
__existing_node = __nd->__ptr();
|
||||
__inserted = true;
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return pair<iterator, bool>(iterator(__existing_node, this), __inserted);
|
||||
#else
|
||||
return pair<iterator, bool>(iterator(__existing_node), __inserted);
|
||||
@ -1955,7 +1929,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
|
||||
// Prepare the container for an insertion of the value __cp_val with the hash
|
||||
// __cp_hash. This does a lookup into the container to see if __cp_value is
|
||||
// already present, and performs a rehash if necessary. Returns a pointer to the
|
||||
// last occurance of __cp_val in the map.
|
||||
// last occurrence of __cp_val in the map.
|
||||
//
|
||||
// Note that this function does forward exceptions if key_eq() throws, and never
|
||||
// mutates __value or actually inserts into the map.
|
||||
@ -2043,7 +2017,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
|
||||
__next_pointer __pn = __node_insert_multi_prepare(__cp->__hash(), __cp->__value_);
|
||||
__node_insert_multi_perform(__cp, __pn);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__cp->__ptr(), this);
|
||||
#else
|
||||
return iterator(__cp->__ptr());
|
||||
@ -2055,7 +2029,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
const_iterator __p, __node_pointer __cp)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
@ -2078,7 +2052,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
__cp->__next_ = __np;
|
||||
__pp->__next_ = static_cast<__next_pointer>(__cp);
|
||||
++size();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(static_cast<__next_pointer>(__cp), this);
|
||||
#else
|
||||
return iterator(static_cast<__next_pointer>(__cp));
|
||||
@ -2089,17 +2063,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
|
||||
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _Key, class ..._Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _Key, class _Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
|
||||
size_t __hash = hash_function()(__k);
|
||||
@ -2123,11 +2090,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
|
||||
}
|
||||
}
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node_hash(__hash, _VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node_hash(__hash, __args);
|
||||
#endif
|
||||
if (size()+1 > __bc * max_load_factor() || __bc == 0)
|
||||
{
|
||||
rehash(_VSTD::max<size_type>(2 * __bc + !__is_hash_power2(__bc),
|
||||
@ -2159,15 +2122,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_unique_key_args(_Key const&
|
||||
__inserted = true;
|
||||
}
|
||||
__done:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return pair<iterator, bool>(iterator(__nd, this), __inserted);
|
||||
#else
|
||||
return pair<iterator, bool>(iterator(__nd), __inserted);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class... _Args>
|
||||
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
|
||||
@ -2197,7 +2158,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
@ -2208,36 +2169,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
|
||||
return __r;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const __container_value_type& __x)
|
||||
{
|
||||
__node_holder __h = __construct_node(__x);
|
||||
iterator __r = __node_insert_multi(__h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
|
||||
const __container_value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container::insert(const_iterator, lvalue) called with an iterator not"
|
||||
" referring to this unordered container");
|
||||
#endif
|
||||
__node_holder __h = __construct_node(__x);
|
||||
iterator __r = __node_insert_multi(__p, __h.get());
|
||||
__h.release();
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class _NodeHandle, class _InsertReturnType>
|
||||
@ -2399,9 +2330,9 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
void
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif
|
||||
__pointer_allocator& __npa = __bucket_list_.get_deleter().__alloc();
|
||||
__bucket_list_.reset(__nbc > 0 ?
|
||||
__pointer_alloc_traits::allocate(__npa, __nbc) : nullptr);
|
||||
@ -2470,7 +2401,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__nd, this);
|
||||
#else
|
||||
return iterator(__nd);
|
||||
@ -2501,7 +2432,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
{
|
||||
if ((__nd->__hash() == __hash)
|
||||
&& key_eq()(__nd->__upcast()->__value_, __k))
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__nd, this);
|
||||
#else
|
||||
return const_iterator(__nd);
|
||||
@ -2513,8 +2444,6 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
|
||||
return end();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
template <class ..._Args>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
@ -2550,43 +2479,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(
|
||||
return __h;
|
||||
}
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = hash_function()(__h->__value_);
|
||||
__h->__next_ = nullptr;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node_hash(size_t __hash,
|
||||
const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
__h->__hash_ = __hash;
|
||||
__h->__next_ = nullptr;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
__next_pointer __np = __p.__node_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered container erase(iterator) called with an iterator not"
|
||||
" referring to this container");
|
||||
@ -2606,7 +2504,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
|
||||
__hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
|
||||
const_iterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
|
||||
"unodered container::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this unodered container");
|
||||
@ -2620,7 +2518,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::erase(const_iterator __first,
|
||||
erase(__p);
|
||||
}
|
||||
__next_pointer __np = __last.__node_;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator (__np, this);
|
||||
#else
|
||||
return iterator (__np);
|
||||
@ -2691,7 +2589,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
__pn->__next_ = __cn->__next_;
|
||||
__cn->__next_ = nullptr;
|
||||
--size();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __dp = __c->end_; __dp != __c->beg_; )
|
||||
{
|
||||
@ -2701,7 +2599,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
|
||||
{
|
||||
(*__dp)->__c_ = nullptr;
|
||||
if (--__c->end_ != __dp)
|
||||
memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__dp, __dp+1, (__c->end_ - __dp)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -2830,9 +2728,9 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
__u.__bucket_list_.reset(__npp);
|
||||
}
|
||||
_VSTD::swap(__bucket_list_.get_deleter().size(), __u.__bucket_list_.get_deleter().size());
|
||||
__swap_allocator(__bucket_list_.get_deleter().__alloc(),
|
||||
_VSTD::__swap_allocator(__bucket_list_.get_deleter().__alloc(),
|
||||
__u.__bucket_list_.get_deleter().__alloc());
|
||||
__swap_allocator(__node_alloc(), __u.__node_alloc());
|
||||
_VSTD::__swap_allocator(__node_alloc(), __u.__node_alloc());
|
||||
_VSTD::swap(__p1_.first().__next_, __u.__p1_.first().__next_);
|
||||
__p2_.swap(__u.__p2_);
|
||||
__p3_.swap(__u.__p3_);
|
||||
@ -2842,7 +2740,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
|
||||
if (__u.size() > 0)
|
||||
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash(), __u.bucket_count())] =
|
||||
__u.__p1_.first().__ptr();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
}
|
||||
@ -2876,7 +2774,7 @@ swap(__hash_table<_Tp, _Hash, _Equal, _Alloc>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Hash, class _Equal, class _Alloc>
|
||||
bool
|
||||
@ -2906,7 +2804,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__subscriptable(const const_iterator*,
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -1 +1 @@
|
||||
11000
|
||||
12000
|
||||
|
@ -11,6 +11,7 @@
|
||||
#define _LIBCPP___LOCALE
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
@ -21,7 +22,9 @@
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
# include <cstring>
|
||||
# include <support/win32/locale_win32.h>
|
||||
#elif defined(_AIX)
|
||||
#elif defined(__NuttX__)
|
||||
# include <support/nuttx/xlocale.h>
|
||||
#elif defined(_AIX) || defined(__MVS__)
|
||||
# include <support/ibm/xlocale.h>
|
||||
#elif defined(__ANDROID__)
|
||||
# include <support/android/locale_bionic.h>
|
||||
@ -76,7 +79,7 @@ struct __libcpp_locale_guard {
|
||||
// locale name, otherwise it will be a semicolon-separated string listing
|
||||
// each category. In the second case, we know at least one category won't
|
||||
// be what we want, so we only have to check the first case.
|
||||
if (strcmp(__l.__get_locale(), __lc) != 0) {
|
||||
if (_VSTD::strcmp(__l.__get_locale(), __lc) != 0) {
|
||||
__locale_all = _strdup(__lc);
|
||||
if (__locale_all == nullptr)
|
||||
__throw_bad_alloc();
|
||||
@ -105,7 +108,6 @@ struct __libcpp_locale_guard {
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
class _LIBCPP_TYPE_VIS locale;
|
||||
|
||||
template <class _Facet>
|
||||
@ -335,8 +337,8 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
|
||||
return static_cast<long>(__h);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS collate<wchar_t>)
|
||||
|
||||
// template <class CharT> class collate_byname;
|
||||
|
||||
@ -396,7 +398,26 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
|
||||
class _LIBCPP_TYPE_VIS ctype_base
|
||||
{
|
||||
public:
|
||||
#if defined(__GLIBC__)
|
||||
#if defined(_LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE)
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#if defined(__BIONIC__)
|
||||
// Historically this was a part of regex_traits rather than ctype_base. The
|
||||
// historical value of the constant is preserved for ABI compatibility.
|
||||
static const mask __regex_word = 0x8000;
|
||||
#else
|
||||
static const mask __regex_word = 1<<10;
|
||||
#endif // defined(__BIONIC__)
|
||||
#elif defined(__GLIBC__)
|
||||
typedef unsigned short mask;
|
||||
static const mask space = _ISspace;
|
||||
static const mask print = _ISprint;
|
||||
@ -485,24 +506,7 @@ public:
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_ALPHA
|
||||
# define _LIBCPP_CTYPE_MASK_IS_COMPOSITE_XDIGIT
|
||||
#else
|
||||
typedef unsigned long mask;
|
||||
static const mask space = 1<<0;
|
||||
static const mask print = 1<<1;
|
||||
static const mask cntrl = 1<<2;
|
||||
static const mask upper = 1<<3;
|
||||
static const mask lower = 1<<4;
|
||||
static const mask alpha = 1<<5;
|
||||
static const mask digit = 1<<6;
|
||||
static const mask punct = 1<<7;
|
||||
static const mask xdigit = 1<<8;
|
||||
static const mask blank = 1<<9;
|
||||
#if defined(__BIONIC__)
|
||||
// Historically this was a part of regex_traits rather than ctype_base. The
|
||||
// historical value of the constant is preserved for ABI compatibility.
|
||||
static const mask __regex_word = 0x8000;
|
||||
#else
|
||||
static const mask __regex_word = 1<<10;
|
||||
#endif // defined(__BIONIC__)
|
||||
# error unknown rune table for this platform -- do you mean to define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE?
|
||||
#endif
|
||||
static const mask alnum = alpha | digit;
|
||||
static const mask graph = alnum | punct;
|
||||
@ -623,7 +627,7 @@ class _LIBCPP_TYPE_VIS ctype<char>
|
||||
public:
|
||||
typedef char char_type;
|
||||
|
||||
explicit ctype(const mask* __tab = 0, bool __del = false, size_t __refs = 0);
|
||||
explicit ctype(const mask* __tab = nullptr, bool __del = false, size_t __refs = 0);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool is(mask __m, char_type __c) const
|
||||
@ -1069,10 +1073,10 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char16_t, char, mbstate_t>
|
||||
// template <> class codecvt<char16_t, char, mbstate_t> // deprecated in C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char16_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@ -1155,10 +1159,100 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char16_t, char8_t, mbstate_t> // C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char16_t, char8_t, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
typedef char16_t intern_type;
|
||||
typedef char8_t extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_unshift(__st, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
|
||||
{
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
~codecvt();
|
||||
|
||||
virtual result do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t> // deprecated in C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt<char32_t, char, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
@ -1241,6 +1335,96 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char32_t, char8_t, mbstate_t> // C++20
|
||||
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS codecvt<char32_t, char8_t, mbstate_t>
|
||||
: public locale::facet,
|
||||
public codecvt_base
|
||||
{
|
||||
public:
|
||||
typedef char32_t intern_type;
|
||||
typedef char8_t extern_type;
|
||||
typedef mbstate_t state_type;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_out(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const
|
||||
{
|
||||
return do_unshift(__st, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
result in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const
|
||||
{
|
||||
return do_in(__st, __frm, __frm_end, __frm_nxt, __to, __to_end, __to_nxt);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int encoding() const _NOEXCEPT
|
||||
{
|
||||
return do_encoding();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return do_always_noconv();
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const
|
||||
{
|
||||
return do_length(__st, __frm, __end, __mx);
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
int max_length() const _NOEXCEPT
|
||||
{
|
||||
return do_max_length();
|
||||
}
|
||||
|
||||
static locale::id id;
|
||||
|
||||
protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit codecvt(const char*, size_t __refs = 0)
|
||||
: locale::facet(__refs) {}
|
||||
|
||||
~codecvt();
|
||||
|
||||
virtual result do_out(state_type& __st,
|
||||
const intern_type* __frm, const intern_type* __frm_end, const intern_type*& __frm_nxt,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual result do_in(state_type& __st,
|
||||
const extern_type* __frm, const extern_type* __frm_end, const extern_type*& __frm_nxt,
|
||||
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
|
||||
virtual result do_unshift(state_type& __st,
|
||||
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
|
||||
virtual int do_encoding() const _NOEXCEPT;
|
||||
virtual bool do_always_noconv() const _NOEXCEPT;
|
||||
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
|
||||
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
@ -1258,15 +1442,21 @@ protected:
|
||||
~codecvt_byname();
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _InternT, class _ExternT, class _StateT>
|
||||
codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
|
||||
{
|
||||
}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char16_t, char, mbstate_t>) // deprecated in C++20
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char32_t, char, mbstate_t>) // deprecated in C++20
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char16_t, char8_t, mbstate_t>) // C++20
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS codecvt_byname<char32_t, char8_t, mbstate_t>) // C++20
|
||||
#endif
|
||||
|
||||
template <size_t _Np>
|
||||
struct __narrow_to_utf8
|
||||
@ -1290,12 +1480,14 @@ struct __narrow_to_utf8<8>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
|
||||
|
||||
@ -1324,12 +1516,14 @@ struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<16>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __narrow_to_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__narrow_to_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__narrow_to_utf8();
|
||||
|
||||
@ -1380,12 +1574,14 @@ struct __widen_from_utf8<8>
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char16_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
|
||||
|
||||
@ -1407,19 +1603,21 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<16>
|
||||
if (__r == codecvt_base::error || __nn == __nb)
|
||||
__throw_runtime_error("locale not supported");
|
||||
for (const char16_t* __p = __buf; __p < __bn; ++__p, ++__s)
|
||||
*__s = (wchar_t)*__p;
|
||||
*__s = *__p;
|
||||
__nb = __nn;
|
||||
}
|
||||
return __s;
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__widen_from_utf8() : codecvt<char32_t, char, mbstate_t>(1) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
_LIBCPP_EXPORTED_FROM_ABI ~__widen_from_utf8();
|
||||
|
||||
@ -1441,7 +1639,7 @@ struct _LIBCPP_TEMPLATE_VIS __widen_from_utf8<32>
|
||||
if (__r == codecvt_base::error || __nn == __nb)
|
||||
__throw_runtime_error("locale not supported");
|
||||
for (const char32_t* __p = __buf; __p < __bn; ++__p, ++__s)
|
||||
*__s = (wchar_t)*__p;
|
||||
*__s = *__p;
|
||||
__nb = __nn;
|
||||
}
|
||||
return __s;
|
||||
|
589
lib/libcxx/include/__memory/allocator_traits.h
Normal file
589
lib/libcxx/include/__memory/allocator_traits.h
Normal file
@ -0,0 +1,589 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
||||
#define _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
||||
|
||||
#include <__config>
|
||||
#include <__memory/base.h>
|
||||
#include <__memory/pointer_traits.h>
|
||||
#include <type_traits>
|
||||
|
||||
#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 = void>
|
||||
struct __has_pointer_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_pointer_type<_Tp,
|
||||
typename __void_t<typename _Tp::pointer>::type> : true_type {};
|
||||
|
||||
namespace __pointer_type_imp
|
||||
{
|
||||
|
||||
template <class _Tp, class _Dp, bool = __has_pointer_type<_Dp>::value>
|
||||
struct __pointer_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Dp::pointer type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Dp>
|
||||
struct __pointer_type<_Tp, _Dp, false>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE _Tp* type;
|
||||
};
|
||||
|
||||
} // __pointer_type_imp
|
||||
|
||||
template <class _Tp, class _Dp>
|
||||
struct __pointer_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename __pointer_type_imp::__pointer_type<_Tp, typename remove_reference<_Dp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_const_pointer : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_const_pointer<_Tp,
|
||||
typename __void_t<typename _Tp::const_pointer>::type> : true_type {};
|
||||
|
||||
template <class _Tp, class _Ptr, class _Alloc, bool = __has_const_pointer<_Alloc>::value>
|
||||
struct __const_pointer
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_pointer type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Ptr, class _Alloc>
|
||||
struct __const_pointer<_Tp, _Ptr, _Alloc, false>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const _Tp> type;
|
||||
#else
|
||||
typedef typename pointer_traits<_Ptr>::template rebind<const _Tp>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_void_pointer : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_void_pointer<_Tp,
|
||||
typename __void_t<typename _Tp::void_pointer>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, class _Alloc, bool = __has_void_pointer<_Alloc>::value>
|
||||
struct __void_pointer
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::void_pointer type;
|
||||
};
|
||||
|
||||
template <class _Ptr, class _Alloc>
|
||||
struct __void_pointer<_Ptr, _Alloc, false>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<void>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_const_void_pointer : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_const_void_pointer<_Tp,
|
||||
typename __void_t<typename _Tp::const_void_pointer>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, class _Alloc, bool = __has_const_void_pointer<_Alloc>::value>
|
||||
struct __const_void_pointer
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::const_void_pointer type;
|
||||
};
|
||||
|
||||
template <class _Ptr, class _Alloc>
|
||||
struct __const_void_pointer<_Ptr, _Alloc, false>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::template rebind<const void>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_size_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_size_type<_Tp,
|
||||
typename __void_t<typename _Tp::size_type>::type> : true_type {};
|
||||
|
||||
template <class _Alloc, class _DiffType, bool = __has_size_type<_Alloc>::value>
|
||||
struct __size_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename make_unsigned<_DiffType>::type type;
|
||||
};
|
||||
|
||||
template <class _Alloc, class _DiffType>
|
||||
struct __size_type<_Alloc, _DiffType, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::size_type type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_propagate_on_container_copy_assignment : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_propagate_on_container_copy_assignment<_Tp,
|
||||
typename __void_t<typename _Tp::propagate_on_container_copy_assignment>::type>
|
||||
: true_type {};
|
||||
|
||||
template <class _Alloc, bool = __has_propagate_on_container_copy_assignment<_Alloc>::value>
|
||||
struct __propagate_on_container_copy_assignment
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE false_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_copy_assignment<_Alloc, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_copy_assignment type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_propagate_on_container_move_assignment : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_propagate_on_container_move_assignment<_Tp,
|
||||
typename __void_t<typename _Tp::propagate_on_container_move_assignment>::type>
|
||||
: true_type {};
|
||||
|
||||
template <class _Alloc, bool = __has_propagate_on_container_move_assignment<_Alloc>::value>
|
||||
struct __propagate_on_container_move_assignment
|
||||
{
|
||||
typedef false_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_move_assignment<_Alloc, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_move_assignment type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_propagate_on_container_swap : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_propagate_on_container_swap<_Tp,
|
||||
typename __void_t<typename _Tp::propagate_on_container_swap>::type>
|
||||
: true_type {};
|
||||
|
||||
template <class _Alloc, bool = __has_propagate_on_container_swap<_Alloc>::value>
|
||||
struct __propagate_on_container_swap
|
||||
{
|
||||
typedef false_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __propagate_on_container_swap<_Alloc, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::propagate_on_container_swap type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_is_always_equal : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_is_always_equal<_Tp,
|
||||
typename __void_t<typename _Tp::is_always_equal>::type>
|
||||
: true_type {};
|
||||
|
||||
template <class _Alloc, bool = __has_is_always_equal<_Alloc>::value>
|
||||
struct __is_always_equal
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _VSTD::is_empty<_Alloc>::type type;
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __is_always_equal<_Alloc, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::is_always_equal type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
|
||||
struct __has_rebind_other
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Xp> static __two __test(...);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Xp> static char __test(typename _Xp::template rebind<_Up>::other* = 0);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __has_rebind_other<_Tp, _Up, false>
|
||||
{
|
||||
static const bool value = false;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind_other<_Tp, _Up>::value>
|
||||
struct __allocator_traits_rebind
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
|
||||
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, true>
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc<_Tp, _Args...>::template rebind<_Up>::other type;
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Alloc, class _Tp, class ..._Args, class _Up>
|
||||
struct __allocator_traits_rebind<_Alloc<_Tp, _Args...>, _Up, false>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE _Alloc<_Up, _Args...> type;
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
|
||||
auto
|
||||
__has_allocate_hint_test(_Alloc&& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
|
||||
-> decltype((void)__a.allocate(__sz, __p), true_type());
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
|
||||
auto
|
||||
__has_allocate_hint_test(const _Alloc& __a, _SizeType&& __sz, _ConstVoidPtr&& __p)
|
||||
-> false_type;
|
||||
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
|
||||
struct __has_allocate_hint
|
||||
: decltype(_VSTD::__has_allocate_hint_test(declval<_Alloc>(),
|
||||
declval<_SizeType>(),
|
||||
declval<_ConstVoidPtr>()))
|
||||
{
|
||||
};
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Alloc, class _SizeType, class _ConstVoidPtr>
|
||||
struct __has_allocate_hint
|
||||
: true_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Alloc, class ..._Args,
|
||||
class = decltype(_VSTD::declval<_Alloc>().construct(_VSTD::declval<_Args>()...))>
|
||||
static true_type __test_has_construct(int);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Alloc, class...>
|
||||
static false_type __test_has_construct(...);
|
||||
|
||||
template <class _Alloc, class ..._Args>
|
||||
struct __has_construct : decltype(__test_has_construct<_Alloc, _Args...>(0)) {};
|
||||
|
||||
#if !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Alloc, class _Pointer>
|
||||
auto
|
||||
__has_destroy_test(_Alloc&& __a, _Pointer&& __p)
|
||||
-> decltype(__a.destroy(__p), true_type());
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Alloc, class _Pointer>
|
||||
auto
|
||||
__has_destroy_test(const _Alloc& __a, _Pointer&& __p)
|
||||
-> false_type;
|
||||
|
||||
template <class _Alloc, class _Pointer>
|
||||
struct __has_destroy
|
||||
: decltype(_VSTD::__has_destroy_test(declval<_Alloc>(),
|
||||
declval<_Pointer>()))
|
||||
{
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Alloc>
|
||||
auto
|
||||
__has_max_size_test(_Alloc&& __a)
|
||||
-> decltype(__a.max_size(), true_type());
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
template <class _Alloc>
|
||||
auto
|
||||
__has_max_size_test(const volatile _Alloc& __a)
|
||||
-> false_type;
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_max_size
|
||||
: decltype(_VSTD::__has_max_size_test(declval<_Alloc&>()))
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
auto
|
||||
__has_select_on_container_copy_construction_test(_Alloc&& __a)
|
||||
-> decltype(__a.select_on_container_copy_construction(), true_type());
|
||||
|
||||
template <class _Alloc>
|
||||
auto
|
||||
__has_select_on_container_copy_construction_test(const volatile _Alloc& __a)
|
||||
-> false_type;
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_select_on_container_copy_construction
|
||||
: decltype(_VSTD::__has_select_on_container_copy_construction_test(declval<_Alloc&>()))
|
||||
{
|
||||
};
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Alloc, class _Pointer, class = void>
|
||||
struct __has_destroy : false_type {};
|
||||
|
||||
template <class _Alloc, class _Pointer>
|
||||
struct __has_destroy<_Alloc, _Pointer, typename __void_t<
|
||||
decltype(_VSTD::declval<_Alloc>().destroy(_VSTD::declval<_Pointer>()))
|
||||
>::type> : true_type {};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_max_size
|
||||
: true_type
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Alloc>
|
||||
struct __has_select_on_container_copy_construction
|
||||
: false_type
|
||||
{
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Alloc, class _Ptr, bool = __has_difference_type<_Alloc>::value>
|
||||
struct __alloc_traits_difference_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename pointer_traits<_Ptr>::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Alloc, class _Ptr>
|
||||
struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Alloc::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_default_allocator : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __is_default_allocator<_VSTD::allocator<_Tp> > : true_type {};
|
||||
|
||||
|
||||
|
||||
template <class _Alloc,
|
||||
bool = __has_construct<_Alloc, typename _Alloc::value_type*, typename _Alloc::value_type&&>::value && !__is_default_allocator<_Alloc>::value
|
||||
>
|
||||
struct __is_cpp17_move_insertable;
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_move_insertable<_Alloc, true> : true_type {};
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_move_insertable<_Alloc, false> : is_move_constructible<typename _Alloc::value_type> {};
|
||||
|
||||
template <class _Alloc,
|
||||
bool = __has_construct<_Alloc, typename _Alloc::value_type*, const typename _Alloc::value_type&>::value && !__is_default_allocator<_Alloc>::value
|
||||
>
|
||||
struct __is_cpp17_copy_insertable;
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_copy_insertable<_Alloc, true> : __is_cpp17_move_insertable<_Alloc> {};
|
||||
template <class _Alloc>
|
||||
struct __is_cpp17_copy_insertable<_Alloc, false> : integral_constant<bool,
|
||||
is_copy_constructible<typename _Alloc::value_type>::value &&
|
||||
__is_cpp17_move_insertable<_Alloc>::value>
|
||||
{};
|
||||
|
||||
|
||||
|
||||
template <class _Alloc>
|
||||
struct _LIBCPP_TEMPLATE_VIS allocator_traits
|
||||
{
|
||||
typedef _Alloc allocator_type;
|
||||
typedef typename allocator_type::value_type value_type;
|
||||
|
||||
typedef typename __pointer_type<value_type, allocator_type>::type pointer;
|
||||
typedef typename __const_pointer<value_type, pointer, allocator_type>::type const_pointer;
|
||||
typedef typename __void_pointer<pointer, allocator_type>::type void_pointer;
|
||||
typedef typename __const_void_pointer<pointer, allocator_type>::type const_void_pointer;
|
||||
|
||||
typedef typename __alloc_traits_difference_type<allocator_type, pointer>::type difference_type;
|
||||
typedef typename __size_type<allocator_type, difference_type>::type size_type;
|
||||
|
||||
typedef typename __propagate_on_container_copy_assignment<allocator_type>::type
|
||||
propagate_on_container_copy_assignment;
|
||||
typedef typename __propagate_on_container_move_assignment<allocator_type>::type
|
||||
propagate_on_container_move_assignment;
|
||||
typedef typename __propagate_on_container_swap<allocator_type>::type
|
||||
propagate_on_container_swap;
|
||||
typedef typename __is_always_equal<allocator_type>::type
|
||||
is_always_equal;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp> using rebind_alloc =
|
||||
typename __allocator_traits_rebind<allocator_type, _Tp>::type;
|
||||
template <class _Tp> using rebind_traits = allocator_traits<rebind_alloc<_Tp> >;
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
template <class _Tp> struct rebind_alloc
|
||||
{typedef typename __allocator_traits_rebind<allocator_type, _Tp>::type other;};
|
||||
template <class _Tp> struct rebind_traits
|
||||
{typedef allocator_traits<typename rebind_alloc<_Tp>::other> other;};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer allocate(allocator_type& __a, size_type __n)
|
||||
{return __a.allocate(__n);}
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer allocate(allocator_type& __a, size_type __n, const_void_pointer __hint)
|
||||
{return __allocate(__a, __n, __hint,
|
||||
__has_allocate_hint<allocator_type, size_type, const_void_pointer>());}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void deallocate(allocator_type& __a, pointer __p, size_type __n) _NOEXCEPT
|
||||
{__a.deallocate(__p, __n);}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void construct(allocator_type& __a, _Tp* __p, _Args&&... __args)
|
||||
{__construct(__has_construct<allocator_type, _Tp*, _Args...>(),
|
||||
__a, __p, _VSTD::forward<_Args>(__args)...);}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void destroy(allocator_type& __a, _Tp* __p)
|
||||
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static size_type max_size(const allocator_type& __a) _NOEXCEPT
|
||||
{return __max_size(__has_max_size<const allocator_type>(), __a);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static allocator_type
|
||||
select_on_container_copy_construction(const allocator_type& __a)
|
||||
{return __select_on_container_copy_construction(
|
||||
__has_select_on_container_copy_construction<const allocator_type>(),
|
||||
__a);}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer __allocate(allocator_type& __a, size_type __n,
|
||||
const_void_pointer __hint, true_type)
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
return __a.allocate(__n, __hint);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer __allocate(allocator_type& __a, size_type __n,
|
||||
const_void_pointer, false_type)
|
||||
{return __a.allocate(__n);}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void __construct(true_type, allocator_type& __a, _Tp* __p, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
__a.construct(__p, _VSTD::forward<_Args>(__args)...);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void __construct(false_type, allocator_type&, _Tp* __p, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
::new ((void*)__p) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void __destroy(true_type, allocator_type& __a, _Tp* __p)
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
__a.destroy(__p);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static void __destroy(false_type, allocator_type&, _Tp* __p)
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_VSTD::destroy_at(__p);
|
||||
#else
|
||||
__p->~_Tp();
|
||||
#endif
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static size_type __max_size(true_type, const allocator_type& __a) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
return __a.max_size();
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static size_type __max_size(false_type, const allocator_type&) _NOEXCEPT
|
||||
{return numeric_limits<size_type>::max() / sizeof(value_type);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static allocator_type
|
||||
__select_on_container_copy_construction(true_type, const allocator_type& __a)
|
||||
{return __a.select_on_container_copy_construction();}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static allocator_type
|
||||
__select_on_container_copy_construction(false_type, const allocator_type& __a)
|
||||
{return __a;}
|
||||
};
|
||||
|
||||
template <class _Traits, class _Tp>
|
||||
struct __rebind_alloc_helper
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Traits::template rebind_alloc<_Tp> type;
|
||||
#else
|
||||
typedef typename _Traits::template rebind_alloc<_Tp>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_ALLOCATOR_TRAITS_H
|
127
lib/libcxx/include/__memory/base.h
Normal file
127
lib/libcxx/include/__memory/base.h
Normal file
@ -0,0 +1,127 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_BASE_H
|
||||
#define _LIBCPP___MEMORY_BASE_H
|
||||
|
||||
#include <__config>
|
||||
#include <__debug>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// addressof
|
||||
#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return __builtin_addressof(__x);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<_Tp *>(
|
||||
const_cast<char *>(&reinterpret_cast<const volatile char &>(__x)));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
|
||||
// Objective-C++ Automatic Reference Counting uses qualified pointers
|
||||
// that require special addressof() signatures. When
|
||||
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
|
||||
// itself is providing these definitions. Otherwise, we provide them.
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__strong _Tp*
|
||||
addressof(__strong _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__weak _Tp*
|
||||
addressof(__weak _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__autoreleasing _Tp*
|
||||
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__unsafe_unretained _Tp*
|
||||
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
|
||||
#endif
|
||||
|
||||
// construct_at
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
template<class _Tp, class ..._Args, class = decltype(
|
||||
::new (_VSTD::declval<void*>()) _Tp(_VSTD::declval<_Args>()...)
|
||||
)>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
constexpr _Tp* construct_at(_Tp* __location, _Args&& ...__args) {
|
||||
_LIBCPP_ASSERT(__location, "null pointer given to construct_at");
|
||||
return ::new ((void*)__location) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// destroy_at
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void destroy_at(_Tp* __loc) {
|
||||
_LIBCPP_ASSERT(__loc, "null pointer given to destroy_at");
|
||||
__loc->~_Tp();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_BASE_H
|
169
lib/libcxx/include/__memory/pointer_traits.h
Normal file
169
lib/libcxx/include/__memory/pointer_traits.h
Normal file
@ -0,0 +1,169 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_POINTER_TRAITS_H
|
||||
#define _LIBCPP___MEMORY_POINTER_TRAITS_H
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
|
||||
#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 = void>
|
||||
struct __has_element_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_element_type<_Tp,
|
||||
typename __void_t<typename _Tp::element_type>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, bool = __has_element_type<_Ptr>::value>
|
||||
struct __pointer_traits_element_type;
|
||||
|
||||
template <class _Ptr>
|
||||
struct __pointer_traits_element_type<_Ptr, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::element_type type;
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args>
|
||||
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::element_type type;
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args>
|
||||
struct __pointer_traits_element_type<_Sp<_Tp, _Args...>, false>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE _Tp type;
|
||||
};
|
||||
|
||||
template <class _Tp, class = void>
|
||||
struct __has_difference_type : false_type {};
|
||||
|
||||
template <class _Tp>
|
||||
struct __has_difference_type<_Tp,
|
||||
typename __void_t<typename _Tp::difference_type>::type> : true_type {};
|
||||
|
||||
template <class _Ptr, bool = __has_difference_type<_Ptr>::value>
|
||||
struct __pointer_traits_difference_type
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE ptrdiff_t type;
|
||||
};
|
||||
|
||||
template <class _Ptr>
|
||||
struct __pointer_traits_difference_type<_Ptr, true>
|
||||
{
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Ptr::difference_type type;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up>
|
||||
struct __has_rebind
|
||||
{
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Xp> static __two __test(...);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <class _Xp> static char __test(typename _Xp::template rebind<_Up>* = 0);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Tp, class _Up, bool = __has_rebind<_Tp, _Up>::value>
|
||||
struct __pointer_traits_rebind
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Tp::template rebind<_Up>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
|
||||
struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, true>
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up> type;
|
||||
#else
|
||||
typedef _LIBCPP_NODEBUG_TYPE typename _Sp<_Tp, _Args...>::template rebind<_Up>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
template <template <class, class...> class _Sp, class _Tp, class ..._Args, class _Up>
|
||||
struct __pointer_traits_rebind<_Sp<_Tp, _Args...>, _Up, false>
|
||||
{
|
||||
typedef _Sp<_Up, _Args...> type;
|
||||
};
|
||||
|
||||
template <class _Ptr>
|
||||
struct _LIBCPP_TEMPLATE_VIS pointer_traits
|
||||
{
|
||||
typedef _Ptr pointer;
|
||||
typedef typename __pointer_traits_element_type<pointer>::type element_type;
|
||||
typedef typename __pointer_traits_difference_type<pointer>::type difference_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Up> using rebind = typename __pointer_traits_rebind<pointer, _Up>::type;
|
||||
#else
|
||||
template <class _Up> struct rebind
|
||||
{typedef typename __pointer_traits_rebind<pointer, _Up>::type other;};
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
private:
|
||||
struct __nat {};
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pointer pointer_to(typename conditional<is_void<element_type>::value,
|
||||
__nat, element_type>::type& __r)
|
||||
{return pointer::pointer_to(__r);}
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct _LIBCPP_TEMPLATE_VIS pointer_traits<_Tp*>
|
||||
{
|
||||
typedef _Tp* pointer;
|
||||
typedef _Tp element_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Up> using rebind = _Up*;
|
||||
#else
|
||||
template <class _Up> struct rebind {typedef _Up* other;};
|
||||
#endif
|
||||
|
||||
private:
|
||||
struct __nat {};
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
static pointer pointer_to(typename conditional<is_void<element_type>::value,
|
||||
__nat, element_type>::type& __r) _NOEXCEPT
|
||||
{return _VSTD::addressof(__r);}
|
||||
};
|
||||
|
||||
template <class _From, class _To>
|
||||
struct __rebind_pointer {
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
typedef typename pointer_traits<_From>::template rebind<_To> type;
|
||||
#else
|
||||
typedef typename pointer_traits<_From>::template rebind<_To>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_POINTER_TRAITS_H
|
88
lib/libcxx/include/__memory/utilities.h
Normal file
88
lib/libcxx/include/__memory/utilities.h
Normal file
@ -0,0 +1,88 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP___MEMORY_UTILITIES_H
|
||||
#define _LIBCPP___MEMORY_UTILITIES_H
|
||||
|
||||
#include <__config>
|
||||
#include <__memory/allocator_traits.h>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// Helper class to allocate memory using an Allocator in an exception safe
|
||||
// manner.
|
||||
//
|
||||
// The intended usage of this class is as follows:
|
||||
//
|
||||
// 0
|
||||
// 1 __allocation_guard<SomeAllocator> guard(alloc, 10);
|
||||
// 2 do_some_initialization_that_may_throw(guard.__get());
|
||||
// 3 save_allocated_pointer_in_a_noexcept_operation(guard.__release_ptr());
|
||||
// 4
|
||||
//
|
||||
// If line (2) throws an exception during initialization of the memory, the
|
||||
// guard's destructor will be called, and the memory will be released using
|
||||
// Allocator deallocation. Otherwise, we release the memory from the guard on
|
||||
// line (3) in an operation that can't throw -- after that, the guard is not
|
||||
// responsible for the memory anymore.
|
||||
//
|
||||
// This is similar to a unique_ptr, except it's easier to use with a
|
||||
// custom allocator.
|
||||
template<class _Alloc>
|
||||
struct __allocation_guard {
|
||||
using _Pointer = typename allocator_traits<_Alloc>::pointer;
|
||||
using _Size = typename allocator_traits<_Alloc>::size_type;
|
||||
|
||||
template<class _AllocT> // we perform the allocator conversion inside the constructor
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
explicit __allocation_guard(_AllocT __alloc, _Size __n)
|
||||
: __alloc_(_VSTD::move(__alloc))
|
||||
, __n_(__n)
|
||||
, __ptr_(allocator_traits<_Alloc>::allocate(__alloc_, __n_)) // initialization order is important
|
||||
{ }
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
~__allocation_guard() _NOEXCEPT {
|
||||
if (__ptr_ != nullptr) {
|
||||
allocator_traits<_Alloc>::deallocate(__alloc_, __ptr_, __n_);
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_Pointer __release_ptr() _NOEXCEPT { // not called __release() because it's a keyword in objective-c++
|
||||
_Pointer __tmp = __ptr_;
|
||||
__ptr_ = nullptr;
|
||||
return __tmp;
|
||||
}
|
||||
|
||||
_LIBCPP_HIDE_FROM_ABI
|
||||
_Pointer __get() const _NOEXCEPT {
|
||||
return __ptr_;
|
||||
}
|
||||
|
||||
private:
|
||||
_Alloc __alloc_;
|
||||
_Size __n_;
|
||||
_Pointer __ptr_;
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___MEMORY_UTILITIES_H
|
@ -146,7 +146,6 @@ private:
|
||||
unique_lock& operator=(unique_lock const&); // = delete;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unique_lock(unique_lock&& __u) _NOEXCEPT
|
||||
: __m_(__u.__m_), __owns_(__u.__owns_)
|
||||
@ -163,8 +162,6 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
void lock();
|
||||
bool try_lock();
|
||||
|
||||
@ -382,12 +379,12 @@ __safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d)
|
||||
|
||||
using __ratio = ratio_divide<_Period, nano>;
|
||||
using __ns_rep = nanoseconds::rep;
|
||||
__ns_rep __result_max = std::numeric_limits<__ns_rep>::max();
|
||||
__ns_rep __result_max = numeric_limits<__ns_rep>::max();
|
||||
if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) {
|
||||
return nanoseconds::max();
|
||||
}
|
||||
|
||||
__ns_rep __result_min = std::numeric_limits<__ns_rep>::min();
|
||||
__ns_rep __result_min = numeric_limits<__ns_rep>::min();
|
||||
if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) {
|
||||
return nanoseconds::min();
|
||||
}
|
||||
|
@ -68,7 +68,6 @@ public:
|
||||
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
|
||||
~__split_buffer();
|
||||
|
||||
#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);
|
||||
@ -76,7 +75,6 @@ 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_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;}
|
||||
@ -101,12 +99,10 @@ public:
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
void push_front(const_reference __x);
|
||||
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
void push_front(value_type&& __x);
|
||||
void push_back(value_type&& __x);
|
||||
template <class... _Args>
|
||||
void emplace_back(_Args&&... __args);
|
||||
#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);}
|
||||
@ -270,7 +266,7 @@ typename enable_if
|
||||
>::type
|
||||
__split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
_ConstructTransaction __tx(&this->__end_, std::distance(__first, __last));
|
||||
_ConstructTransaction __tx(&this->__end_, _VSTD::distance(__first, __last));
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) {
|
||||
__alloc_traits::construct(this->__alloc(),
|
||||
_VSTD::__to_address(__tx.__pos_), *__first);
|
||||
@ -283,7 +279,7 @@ void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
|
||||
{
|
||||
while (__begin_ != __new_begin)
|
||||
__alloc_traits::destroy(__alloc(), __to_address(__begin_++));
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_address(__begin_++));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -300,7 +296,7 @@ void
|
||||
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
|
||||
{
|
||||
while (__new_last != __end_)
|
||||
__alloc_traits::destroy(__alloc(), __to_address(--__end_));
|
||||
__alloc_traits::destroy(__alloc(), _VSTD::__to_address(--__end_));
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -350,8 +346,6 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
|
||||
__alloc_traits::deallocate(__alloc(), __first_, capacity());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
|
||||
@ -412,8 +406,6 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
@ -424,7 +416,7 @@ __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
|
||||
_VSTD::swap(__begin_, __x.__begin_);
|
||||
_VSTD::swap(__end_, __x.__end_);
|
||||
_VSTD::swap(__end_cap(), __x.__end_cap());
|
||||
__swap_allocator(__alloc(), __x.__alloc());
|
||||
_VSTD::__swap_allocator(__alloc(), __x.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -499,8 +491,6 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
@ -531,8 +521,6 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
|
||||
--__begin_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@ -563,8 +551,6 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
void
|
||||
__split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
|
||||
@ -626,8 +612,6 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
|
||||
++__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
|
@ -11,8 +11,9 @@
|
||||
#define _LIBCPP___SSO_ALLOCATOR
|
||||
|
||||
#include <__config>
|
||||
#include <type_traits>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <type_traits>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -47,21 +48,21 @@ public:
|
||||
private:
|
||||
__sso_allocator& operator=(const __sso_allocator&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = 0)
|
||||
_LIBCPP_INLINE_VISIBILITY pointer allocate(size_type __n, typename __sso_allocator<void, _Np>::const_pointer = nullptr)
|
||||
{
|
||||
if (!__allocated_ && __n <= _Np)
|
||||
{
|
||||
__allocated_ = true;
|
||||
return (pointer)&buf_;
|
||||
}
|
||||
return static_cast<pointer>(_VSTD::__libcpp_allocate(__n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp)));
|
||||
return allocator<_Tp>().allocate(__n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY void deallocate(pointer __p, size_type __n)
|
||||
{
|
||||
if (__p == (pointer)&buf_)
|
||||
__allocated_ = false;
|
||||
else
|
||||
_VSTD::__libcpp_deallocate(__p, __n * sizeof(_Tp), _LIBCPP_ALIGNOF(_Tp));
|
||||
allocator<_Tp>().deallocate(__p, __n);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY size_type max_size() const throw() {return size_type(~0) / sizeof(_Tp);}
|
||||
|
||||
|
@ -55,7 +55,9 @@ template <> struct char_traits<char8_t>; // c++20
|
||||
|
||||
#include <__config>
|
||||
#include <algorithm> // for search and min
|
||||
#include <cstdio> // For EOF.
|
||||
#include <cstdio> // for EOF
|
||||
#include <cstring> // for memcpy
|
||||
#include <cwchar> // for wmemcpy
|
||||
#include <memory> // for __murmur2_or_cityhash
|
||||
|
||||
#include <__debug>
|
||||
@ -92,7 +94,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(value_type const*, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::replace(size_type, size_type, value_type const*)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_last_not_of(value_type const*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::~basic_string()) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find_first_not_of(value_type const*, size_type, size_type) const) \
|
||||
@ -108,7 +110,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \
|
||||
@ -158,7 +160,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::append(value_type const*, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::assign(basic_string const&, size_type, size_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::copy(value_type*, size_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, std::allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::basic_string(basic_string const&, size_type, size_type, allocator<_CharType> const&)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>::size_type basic_string<_CharType>::find(value_type, size_type) const) \
|
||||
_Func(_LIBCPP_FUNC_VIS void basic_string<_CharType>::__init(size_type, value_type)) \
|
||||
_Func(_LIBCPP_FUNC_VIS basic_string<_CharType>& basic_string<_CharType>::insert(size_type, value_type const*)) \
|
||||
@ -268,7 +270,7 @@ char_traits<_CharT>::find(const char_type* __s, size_t __n, const char_type& __a
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
@ -318,7 +320,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
|
||||
// constexpr versions of move/copy/assign.
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
if (__n == 0) return __s1;
|
||||
@ -331,7 +333,7 @@ _CharT* __move_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_VSTD::copy_n(__s2, __n, __s1);
|
||||
@ -339,7 +341,7 @@ _CharT* __copy_constexpr(_CharT* __s1, const _CharT* __s2, size_t __n) _NOEXCEPT
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_CharT* __assign_constexpr(_CharT* __s, size_t __n, _CharT __a) _NOEXCEPT
|
||||
{
|
||||
_VSTD::fill_n(__s, __n, __a);
|
||||
@ -370,27 +372,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char>
|
||||
length(const char_type* __s) _NOEXCEPT {return __builtin_strlen(__s);}
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n);
|
||||
}
|
||||
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
@ -414,7 +416,7 @@ char_traits<char>::compare(const char_type* __s1, const char_type* __s2, size_t
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_memcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return memcmp(__s1, __s2, __n);
|
||||
return _VSTD::memcmp(__s1, __s2, __n);
|
||||
#else
|
||||
for (; __n; --__n, ++__s1, ++__s2)
|
||||
{
|
||||
@ -436,7 +438,7 @@ char_traits<char>::find(const char_type* __s, size_t __n, const char_type& __a)
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_char_memchr(__s, to_int_type(__a), __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return (const char_type*) memchr(__s, to_int_type(__a), __n);
|
||||
return (const char_type*) _VSTD::memchr(__s, to_int_type(__a), __n);
|
||||
#else
|
||||
for (; __n; --__n)
|
||||
{
|
||||
@ -473,27 +475,27 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<wchar_t>
|
||||
size_t length(const char_type* __s) _NOEXCEPT;
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : wmemmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : _VSTD::wmemmove(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : wmemcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : _VSTD::wmemcpy(__s1, __s2, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : wmemset(__s, __a, __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : _VSTD::wmemset(__s, __a, __n);
|
||||
}
|
||||
static inline _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
|
||||
{return eq_int_type(__c, eof()) ? ~eof() : __c;}
|
||||
@ -516,7 +518,7 @@ char_traits<wchar_t>::compare(const char_type* __s1, const char_type* __s2, size
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemcmp(__s1, __s2, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemcmp(__s1, __s2, __n);
|
||||
return _VSTD::wmemcmp(__s1, __s2, __n);
|
||||
#else
|
||||
for (; __n; --__n, ++__s1, ++__s2)
|
||||
{
|
||||
@ -548,7 +550,7 @@ char_traits<wchar_t>::length(const char_type* __s) _NOEXCEPT
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wcslen(__s);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wcslen(__s);
|
||||
return _VSTD::wcslen(__s);
|
||||
#else
|
||||
size_t __len = 0;
|
||||
for (; !eq(*__s, char_type(0)); ++__s)
|
||||
@ -566,7 +568,7 @@ char_traits<wchar_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
#if __has_feature(cxx_constexpr_string_builtins)
|
||||
return __builtin_wmemchr(__s, __a, __n);
|
||||
#elif _LIBCPP_STD_VER <= 14
|
||||
return wmemchr(__s, __a, __n);
|
||||
return _VSTD::wmemchr(__s, __a, __n);
|
||||
#else
|
||||
for (; __n; --__n)
|
||||
{
|
||||
@ -606,29 +608,29 @@ struct _LIBCPP_TEMPLATE_VIS char_traits<char8_t>
|
||||
_LIBCPP_INLINE_VISIBILITY static constexpr
|
||||
const char_type* find(const char_type* __s, size_t __n, const char_type& __a) _NOEXCEPT;
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* move(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memmove(__s1, __s2, __n);
|
||||
? _VSTD::__move_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memmove(__s1, __s2, __n);
|
||||
}
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* copy(char_type* __s1, const char_type* __s2, size_t __n) _NOEXCEPT
|
||||
{
|
||||
_LIBCPP_ASSERT(__s2 < __s1 || __s2 >= __s1+__n, "char_traits::copy overlapped range");
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)memcpy(__s1, __s2, __n);
|
||||
? _VSTD::__copy_constexpr(__s1, __s2, __n)
|
||||
: __n == 0 ? __s1 : (char_type*)_VSTD::memcpy(__s1, __s2, __n);
|
||||
}
|
||||
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17_WITH_IS_CONSTANT_EVALUATED
|
||||
static _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
char_type* assign(char_type* __s, size_t __n, char_type __a) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_is_constant_evaluated()
|
||||
? __assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)memset(__s, to_int_type(__a), __n);
|
||||
? _VSTD::__assign_constexpr(__s, __n, __a)
|
||||
: __n == 0 ? __s : (char_type*)_VSTD::memset(__s, to_int_type(__a), __n);
|
||||
}
|
||||
|
||||
static inline constexpr int_type not_eof(int_type __c) noexcept
|
||||
@ -683,7 +685,7 @@ char_traits<char8_t>::find(const char_type* __s, size_t __n, const char_type& __
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#endif // #_LIBCPP_NO_HAS_CHAR8_T
|
||||
@ -765,7 +767,7 @@ char_traits<char16_t>::find(const char_type* __s, size_t __n, const char_type& _
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
@ -885,7 +887,7 @@ char_traits<char32_t>::find(const char_type* __s, size_t __n, const char_type& _
|
||||
return __s;
|
||||
++__s;
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
@ -943,7 +945,7 @@ __str_find(const _CharT *__p, _SizeT __sz,
|
||||
if (__pos >= __sz)
|
||||
return __npos;
|
||||
const _CharT* __r = _Traits::find(__p + __pos, __sz - __pos, __c);
|
||||
if (__r == 0)
|
||||
if (__r == nullptr)
|
||||
return __npos;
|
||||
return static_cast<_SizeT>(__r - __p);
|
||||
}
|
||||
@ -972,7 +974,7 @@ __search_substring(const _CharT *__first1, const _CharT *__last1,
|
||||
|
||||
// Find __f2 the first byte matching in __first1.
|
||||
__first1 = _Traits::find(__first1, __len1 - __len2 + 1, __f2);
|
||||
if (__first1 == 0)
|
||||
if (__first1 == nullptr)
|
||||
return __last1;
|
||||
|
||||
// It is faster to compare from the first byte of __first1 even if we
|
||||
@ -1095,7 +1097,7 @@ __str_find_first_not_of(const _CharT *__p, _SizeT __sz,
|
||||
{
|
||||
const _CharT* __pe = __p + __sz;
|
||||
for (const _CharT* __ps = __p + __pos; __ps != __pe; ++__ps)
|
||||
if (_Traits::find(__s, __n, *__ps) == 0)
|
||||
if (_Traits::find(__s, __n, *__ps) == nullptr)
|
||||
return static_cast<_SizeT>(__ps - __p);
|
||||
}
|
||||
return __npos;
|
||||
@ -1129,7 +1131,7 @@ __str_find_last_not_of(const _CharT *__p, _SizeT __sz,
|
||||
else
|
||||
__pos = __sz;
|
||||
for (const _CharT* __ps = __p + __pos; __ps != __p;)
|
||||
if (_Traits::find(__s, __n, *--__ps) == 0)
|
||||
if (_Traits::find(__s, __n, *--__ps) == nullptr)
|
||||
return static_cast<_SizeT>(__ps - __p);
|
||||
return __npos;
|
||||
}
|
||||
|
@ -11,10 +11,15 @@
|
||||
#define _LIBCPP_THREADING_SUPPORT
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <chrono>
|
||||
#include <iosfwd>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef __MVS__
|
||||
# include <support/ibm/nanosleep.h>
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -26,7 +31,7 @@
|
||||
#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
# ifdef __APPLE__
|
||||
# if defined(__APPLE__) || defined(__MVS__)
|
||||
# define _LIBCPP_NO_NATIVE_SEMAPHORES
|
||||
# endif
|
||||
# ifndef _LIBCPP_NO_NATIVE_SEMAPHORES
|
||||
@ -82,11 +87,14 @@ typedef pthread_once_t __libcpp_exec_once_flag;
|
||||
#define _LIBCPP_EXEC_ONCE_INITIALIZER PTHREAD_ONCE_INIT
|
||||
|
||||
// Thread id
|
||||
#if defined(__MVS__)
|
||||
typedef unsigned long long __libcpp_thread_id;
|
||||
#else
|
||||
typedef pthread_t __libcpp_thread_id;
|
||||
#endif
|
||||
|
||||
// Thread
|
||||
#define _LIBCPP_NULL_THREAD 0U
|
||||
|
||||
#define _LIBCPP_NULL_THREAD ((__libcpp_thread_t()))
|
||||
typedef pthread_t __libcpp_thread_t;
|
||||
|
||||
// Thread Local Storage
|
||||
@ -278,12 +286,8 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p);
|
||||
#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL)
|
||||
|
||||
struct __libcpp_timed_backoff_policy {
|
||||
_LIBCPP_THREAD_ABI_VISIBILITY
|
||||
bool operator()(chrono::nanoseconds __elapsed) const;
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) const
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(chrono::nanoseconds __elapsed) const
|
||||
{
|
||||
if(__elapsed > chrono::milliseconds(128))
|
||||
__libcpp_thread_sleep_for(chrono::milliseconds(8));
|
||||
@ -292,9 +296,10 @@ bool __libcpp_timed_backoff_policy::operator()(chrono::nanoseconds __elapsed) co
|
||||
else if(__elapsed > chrono::microseconds(4))
|
||||
__libcpp_thread_yield();
|
||||
else
|
||||
; // poll
|
||||
{} // poll
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
static _LIBCPP_CONSTEXPR const int __libcpp_polling_count = 64;
|
||||
|
||||
@ -484,7 +489,7 @@ int __libcpp_execute_once(__libcpp_exec_once_flag *flag,
|
||||
// Returns non-zero if the thread ids are equal, otherwise 0
|
||||
bool __libcpp_thread_id_equal(__libcpp_thread_id t1, __libcpp_thread_id t2)
|
||||
{
|
||||
return pthread_equal(t1, t2) != 0;
|
||||
return t1 == t2;
|
||||
}
|
||||
|
||||
// Returns non-zero if t1 < t2, otherwise 0
|
||||
@ -495,28 +500,33 @@ 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;
|
||||
return *__t == __libcpp_thread_t();
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
void *__arg)
|
||||
{
|
||||
return pthread_create(__t, 0, __func, __arg);
|
||||
return pthread_create(__t, nullptr, __func, __arg);
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_current_id()
|
||||
{
|
||||
return pthread_self();
|
||||
const __libcpp_thread_t thread = pthread_self();
|
||||
return __libcpp_thread_get_id(&thread);
|
||||
}
|
||||
|
||||
__libcpp_thread_id __libcpp_thread_get_id(const __libcpp_thread_t *__t)
|
||||
{
|
||||
#if defined(__MVS__)
|
||||
return __t->__;
|
||||
#else
|
||||
return *__t;
|
||||
#endif
|
||||
}
|
||||
|
||||
int __libcpp_thread_join(__libcpp_thread_t *__t)
|
||||
{
|
||||
return pthread_join(*__t, 0);
|
||||
return pthread_join(*__t, nullptr);
|
||||
}
|
||||
|
||||
int __libcpp_thread_detach(__libcpp_thread_t *__t)
|
||||
@ -651,7 +661,7 @@ 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;
|
||||
return __libcpp_thread_get_id(__t) == 0;
|
||||
}
|
||||
|
||||
int __libcpp_thread_create(__libcpp_thread_t *__t, void *(*__func)(void *),
|
||||
|
@ -533,7 +533,6 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
|
||||
// node traits
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp>
|
||||
struct __is_tree_value_type_imp : false_type {};
|
||||
|
||||
@ -545,7 +544,6 @@ struct __is_tree_value_type : false_type {};
|
||||
|
||||
template <class _One>
|
||||
struct __is_tree_value_type<_One> : __is_tree_value_type_imp<typename __uncvref<_One>::type> {};
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
struct __tree_key_value_types {
|
||||
@ -566,12 +564,10 @@ struct __tree_key_value_types {
|
||||
static __container_value_type* __get_ptr(__node_value_type& __n) {
|
||||
return _VSTD::addressof(__n);
|
||||
}
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static __container_value_type&& __move(__node_value_type& __v) {
|
||||
return _VSTD::move(__v);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _Key, class _Tp>
|
||||
@ -616,12 +612,10 @@ struct __tree_key_value_types<__value_type<_Key, _Tp> > {
|
||||
return _VSTD::addressof(__n.__get_value());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static pair<key_type&&, mapped_type&&> __move(__node_value_type& __v) {
|
||||
return __v.__move();
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
template <class _VoidPtr>
|
||||
@ -973,7 +967,7 @@ private:
|
||||
|
||||
template<class _Tp, class _Compare>
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_DIAGNOSE_WARNING(!std::__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
_LIBCPP_DIAGNOSE_WARNING(!__invokable<_Compare const&, _Tp const&, _Tp const&>::value,
|
||||
"the specified comparator type does not provide a viable const call operator")
|
||||
#endif
|
||||
int __diagnose_non_const_comparator();
|
||||
@ -1103,7 +1097,6 @@ public:
|
||||
void __assign_unique(_ForwardIterator __first, _ForwardIterator __last);
|
||||
template <class _InputIterator>
|
||||
void __assign_multi(_InputIterator __first, _InputIterator __last);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
is_nothrow_move_constructible<__node_allocator>::value &&
|
||||
@ -1114,8 +1107,6 @@ 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_CXX03_LANG
|
||||
|
||||
~__tree();
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1129,7 +1120,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return std::min<size_type>(
|
||||
{return _VSTD::min<size_type>(
|
||||
__node_traits::max_size(__node_alloc()),
|
||||
numeric_limits<difference_type >::max());}
|
||||
|
||||
@ -1146,12 +1137,11 @@ public:
|
||||
_NOEXCEPT_(__is_nothrow_swappable<value_compare>::value);
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Key, class ..._Args>
|
||||
pair<iterator, bool>
|
||||
__emplace_unique_key_args(_Key const&, _Args&&... __args);
|
||||
template <class _Key, class ..._Args>
|
||||
iterator
|
||||
pair<iterator, bool>
|
||||
__emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&&...);
|
||||
|
||||
template <class... _Args>
|
||||
@ -1225,7 +1215,7 @@ public:
|
||||
>::type __emplace_hint_unique(const_iterator __p, _First&& __f, _Second&& __s) {
|
||||
return __emplace_hint_unique_key_args(__p, __f,
|
||||
_VSTD::forward<_First>(__f),
|
||||
_VSTD::forward<_Second>(__s));
|
||||
_VSTD::forward<_Second>(__s)).first;
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
@ -1245,25 +1235,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
__emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_self_tag) {
|
||||
return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x));
|
||||
return __emplace_hint_unique_key_args(__p, __x, _VSTD::forward<_Pp>(__x)).first;
|
||||
}
|
||||
|
||||
template <class _Pp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator
|
||||
__emplace_hint_unique_extract_key(const_iterator __p, _Pp&& __x, __extract_key_first_tag) {
|
||||
return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x));
|
||||
return __emplace_hint_unique_key_args(__p, __x.first, _VSTD::forward<_Pp>(__x)).first;
|
||||
}
|
||||
|
||||
#else
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __emplace_unique_key_args(_Key const&, _Args& __args);
|
||||
template <class _Key, class _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __emplace_hint_unique_key_args(const_iterator, _Key const&, _Args&);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(const __container_value_type& __v) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__v), __v);
|
||||
@ -1271,15 +1252,9 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_unique(const_iterator __p, const __container_value_type& __v) {
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v);
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), __v).first;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_multi(const __container_value_type& __v);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_multi(const_iterator __p, const __container_value_type& __v);
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __insert_unique(__container_value_type&& __v) {
|
||||
return __emplace_unique_key_args(_NodeTypes::__get_key(__v), _VSTD::move(__v));
|
||||
@ -1287,7 +1262,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator __insert_unique(const_iterator __p, __container_value_type&& __v) {
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v));
|
||||
return __emplace_hint_unique_key_args(__p, _NodeTypes::__get_key(__v), _VSTD::move(__v)).first;
|
||||
}
|
||||
|
||||
template <class _Vp, class = typename enable_if<
|
||||
@ -1332,8 +1307,6 @@ public:
|
||||
return __emplace_hint_multi(__p, _VSTD::forward<_Vp>(__v));
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> __node_assign_unique(const __container_value_type& __v, __node_pointer __dest);
|
||||
|
||||
@ -1455,7 +1428,7 @@ private:
|
||||
__node_base_pointer&
|
||||
__find_leaf(const_iterator __hint,
|
||||
__parent_pointer& __parent, const key_type& __v);
|
||||
// FIXME: Make this function const qualified. Unfortunetly doing so
|
||||
// FIXME: Make this function const qualified. Unfortunately doing so
|
||||
// breaks existing code which uses non-const callable comparators.
|
||||
template <class _Key>
|
||||
__node_base_pointer&
|
||||
@ -1471,12 +1444,8 @@ private:
|
||||
__node_base_pointer& __dummy,
|
||||
const _Key& __v);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class ..._Args>
|
||||
__node_holder __construct_node(_Args&& ...__args);
|
||||
#else
|
||||
__node_holder __construct_node(const __container_value_type& __v);
|
||||
#endif
|
||||
|
||||
void destroy(__node_pointer __nd) _NOEXCEPT;
|
||||
|
||||
@ -1706,8 +1675,6 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
|
||||
__begin_node() = __end_node();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
|
||||
_NOEXCEPT_(
|
||||
@ -1814,8 +1781,6 @@ __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
__tree<_Tp, _Compare, _Allocator>::~__tree()
|
||||
{
|
||||
@ -1854,7 +1819,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
|
||||
using _VSTD::swap;
|
||||
swap(__begin_node_, __t.__begin_node_);
|
||||
swap(__pair1_.first(), __t.__pair1_.first());
|
||||
__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||
_VSTD::__swap_allocator(__node_alloc(), __t.__node_alloc());
|
||||
__pair3_.swap(__t.__pair3_);
|
||||
if (size() == 0)
|
||||
__begin_node() = __end_node();
|
||||
@ -2117,17 +2082,10 @@ void __tree<_Tp, _Compare, _Allocator>::__insert_node_at(
|
||||
++size();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class... _Args>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class _Args>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_equal(__parent, __k);
|
||||
@ -2135,11 +2093,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node(__args);
|
||||
#endif
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
@ -2147,41 +2101,27 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique_key_args(_Key const& __k, _A
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class... _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
|
||||
const_iterator __p, _Key const& __k, _Args&&... __args)
|
||||
#else
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class _Key, class _Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique_key_args(
|
||||
const_iterator __p, _Key const& __k, _Args& __args)
|
||||
#endif
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer __dummy;
|
||||
__node_base_pointer& __child = __find_equal(__p, __parent, __dummy, __k);
|
||||
__node_pointer __r = static_cast<__node_pointer>(__child);
|
||||
bool __inserted = false;
|
||||
if (__child == nullptr)
|
||||
{
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
|
||||
#else
|
||||
__node_holder __h = __construct_node(__args);
|
||||
#endif
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
__r = __h.release();
|
||||
__inserted = true;
|
||||
}
|
||||
return iterator(__r);
|
||||
return pair<iterator, bool>(iterator(__r), __inserted);
|
||||
}
|
||||
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
template <class ..._Args>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
@ -2259,46 +2199,6 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
|
||||
return iterator(static_cast<__node_pointer>(__h.release()));
|
||||
}
|
||||
|
||||
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
|
||||
__tree<_Tp, _Compare, _Allocator>::__construct_node(const __container_value_type& __v)
|
||||
{
|
||||
__node_allocator& __na = __node_alloc();
|
||||
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
|
||||
__node_traits::construct(__na, _NodeTypes::__get_ptr(__h->__value_), __v);
|
||||
__h.get_deleter().__value_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
#ifdef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const __container_value_type& __v)
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf_high(__parent, _NodeTypes::__get_key(__v));
|
||||
__node_holder __h = __construct_node(__v);
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
return iterator(__h.release());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
typename __tree<_Tp, _Compare, _Allocator>::iterator
|
||||
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const __container_value_type& __v)
|
||||
{
|
||||
__parent_pointer __parent;
|
||||
__node_base_pointer& __child = __find_leaf(__p, __parent, _NodeTypes::__get_key(__v));
|
||||
__node_holder __h = __construct_node(__v);
|
||||
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
|
||||
return iterator(__h.release());
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Compare, class _Allocator>
|
||||
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
|
||||
__tree<_Tp, _Compare, _Allocator>::__node_assign_unique(const __container_value_type& __v, __node_pointer __nd)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -81,8 +81,8 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <experimental/__config>
|
||||
#include <__availability>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
#include <typeinfo>
|
||||
#include <type_traits>
|
||||
#include <cstdlib>
|
||||
@ -157,7 +157,7 @@ namespace __any_imp
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
constexpr const void* __get_fallback_typeid() {
|
||||
return &__unique_typeinfo<decay_t<_Tp>>::__id;
|
||||
return &__unique_typeinfo<remove_cv_t<remove_reference_t<_Tp>>>::__id;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
@ -368,7 +368,11 @@ namespace __any_imp
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
_Tp* __ret = ::new (static_cast<void*>(&__dest.__s.__buf)) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __ret = static_cast<_Tp*>(static_cast<void*>(&__dest.__s.__buf));
|
||||
_ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...);
|
||||
__dest.__h = &_SmallHandler::__handle;
|
||||
return *__ret;
|
||||
}
|
||||
@ -376,8 +380,11 @@ namespace __any_imp
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this) {
|
||||
_Tp & __value = *static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||
__value.~_Tp();
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __p = static_cast<_Tp *>(static_cast<void*>(&__this.__s.__buf));
|
||||
_ATraits::destroy(__a, __p);
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
@ -445,10 +452,12 @@ namespace __any_imp
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static _Tp& __create(any & __dest, _Args&&... __args) {
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
typedef __allocator_destructor<_Alloc> _Dp;
|
||||
_Alloc __a;
|
||||
unique_ptr<_Tp, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
_Tp* __ret = ::new ((void*)__hold.get()) _Tp(_VSTD::forward<_Args>(__args)...);
|
||||
unique_ptr<_Tp, _Dp> __hold(_ATraits::allocate(__a, 1), _Dp(__a, 1));
|
||||
_Tp * __ret = __hold.get();
|
||||
_ATraits::construct(__a, __ret, _VSTD::forward<_Args>(__args)...);
|
||||
__dest.__s.__ptr = __hold.release();
|
||||
__dest.__h = &_LargeHandler::__handle;
|
||||
return *__ret;
|
||||
@ -458,7 +467,12 @@ namespace __any_imp
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
static void __destroy(any & __this){
|
||||
delete static_cast<_Tp*>(__this.__s.__ptr);
|
||||
typedef allocator<_Tp> _Alloc;
|
||||
typedef allocator_traits<_Alloc> _ATraits;
|
||||
_Alloc __a;
|
||||
_Tp * __p = static_cast<_Tp *>(__this.__s.__ptr);
|
||||
_ATraits::destroy(__a, __p);
|
||||
_ATraits::deallocate(__a, __p, 1);
|
||||
__this.__h = nullptr;
|
||||
}
|
||||
|
||||
|
@ -142,8 +142,8 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
_Tp __elems_[_Size];
|
||||
|
||||
@ -155,7 +155,7 @@ struct _LIBCPP_TEMPLATE_VIS array
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {
|
||||
std::swap_ranges(data(), data() + _Size, __a.data());
|
||||
_VSTD::swap_ranges(data(), data() + _Size, __a.data());
|
||||
}
|
||||
|
||||
// iterators:
|
||||
@ -245,8 +245,8 @@ struct _LIBCPP_TEMPLATE_VIS array<_Tp, 0>
|
||||
typedef const value_type* const_pointer;
|
||||
typedef size_t size_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef std::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
|
||||
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
|
||||
typedef typename conditional<is_const<_Tp>::value, const char,
|
||||
char>::type _CharType;
|
||||
@ -459,8 +459,6 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
|
||||
return __a.__elems_[_Ip];
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <size_t _Ip, class _Tp, size_t _Size>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
_Tp&&
|
||||
@ -479,8 +477,6 @@ get(const array<_Tp, _Size>&& __a) _NOEXCEPT
|
||||
return _VSTD::move(__a.__elems_[_Ip]);
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_CXX03_LANG
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
template <typename _Tp, size_t _Size, size_t... _Index>
|
||||
|
@ -16,9 +16,12 @@
|
||||
namespace std
|
||||
{
|
||||
|
||||
// feature test macro
|
||||
// feature test macro [version.syn]
|
||||
|
||||
#define __cpp_lib_atomic_is_always_lock_free // as specified by SG10
|
||||
#define __cpp_lib_atomic_is_always_lock_free
|
||||
#define __cpp_lib_atomic_flag_test
|
||||
#define __cpp_lib_atomic_lock_free_type_aliases
|
||||
#define __cpp_lib_atomic_wait
|
||||
|
||||
// order and consistency
|
||||
|
||||
@ -45,6 +48,7 @@ template <class T> T kill_dependency(T y) noexcept;
|
||||
|
||||
#define ATOMIC_BOOL_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR8_T_LOCK_FREE unspecified // C++20
|
||||
#define ATOMIC_CHAR16_T_LOCK_FREE unspecified
|
||||
#define ATOMIC_CHAR32_T_LOCK_FREE unspecified
|
||||
#define ATOMIC_WCHAR_T_LOCK_FREE unspecified
|
||||
@ -108,6 +112,7 @@ template <>
|
||||
struct atomic<integral>
|
||||
{
|
||||
using value_type = integral;
|
||||
using difference_type = value_type;
|
||||
|
||||
static constexpr bool is_always_lock_free;
|
||||
bool is_lock_free() const volatile noexcept;
|
||||
@ -190,6 +195,7 @@ template <class T>
|
||||
struct atomic<T*>
|
||||
{
|
||||
using value_type = T*;
|
||||
using difference_type = ptrdiff_t;
|
||||
|
||||
static constexpr bool is_always_lock_free;
|
||||
bool is_lock_free() const volatile noexcept;
|
||||
@ -460,6 +466,7 @@ typedef atomic<long> atomic_long;
|
||||
typedef atomic<unsigned long> atomic_ulong;
|
||||
typedef atomic<long long> atomic_llong;
|
||||
typedef atomic<unsigned long long> atomic_ullong;
|
||||
typedef atomic<char8_t> atomic_char8_t; // C++20
|
||||
typedef atomic<char16_t> atomic_char16_t;
|
||||
typedef atomic<char32_t> atomic_char32_t;
|
||||
typedef atomic<wchar_t> atomic_wchar_t;
|
||||
@ -568,6 +575,7 @@ template <class T>
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__threading_support>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -654,7 +662,7 @@ typedef enum memory_order {
|
||||
|
||||
template <typename _Tp> _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_nonatomic_compare_equal(_Tp const& __lhs, _Tp const& __rhs) {
|
||||
return memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0;
|
||||
return _VSTD::memcmp(&__lhs, &__rhs, sizeof(_Tp)) == 0;
|
||||
}
|
||||
|
||||
static_assert((is_same<underlying_type<memory_order>::type, __memory_order_underlying_t>::value),
|
||||
@ -1119,6 +1127,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
|
||||
#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
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
# define ATOMIC_CHAR8_T_LOCK_FREE __CLANG_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#endif
|
||||
# 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
|
||||
@ -1130,6 +1141,9 @@ _Tp kill_dependency(_Tp __y) _NOEXCEPT
|
||||
#elif defined(__GCC_ATOMIC_BOOL_LOCK_FREE)
|
||||
# define ATOMIC_BOOL_LOCK_FREE __GCC_ATOMIC_BOOL_LOCK_FREE
|
||||
# define ATOMIC_CHAR_LOCK_FREE __GCC_ATOMIC_CHAR_LOCK_FREE
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
# define ATOMIC_CHAR8_T_LOCK_FREE __GCC_ATOMIC_CHAR8_T_LOCK_FREE
|
||||
#endif
|
||||
# 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
|
||||
@ -1245,10 +1259,10 @@ template <typename _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_strong(volatile __cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
_Tp __temp;
|
||||
__a->__lock();
|
||||
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
|
||||
bool __ret = __temp == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__cxx_atomic_assign_volatile(__a->__a_value, __value);
|
||||
else
|
||||
@ -1261,11 +1275,11 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_strong(__cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
bool __ret = __a->__a_value == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__a->__a_value = __value;
|
||||
_VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
|
||||
else
|
||||
*__expected = __a->__a_value;
|
||||
_VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
|
||||
__a->__unlock();
|
||||
return __ret;
|
||||
}
|
||||
@ -1274,10 +1288,10 @@ template <typename _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_weak(volatile __cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
_Tp __temp;
|
||||
__a->__lock();
|
||||
__cxx_atomic_assign_volatile(__temp, __a->__a_value);
|
||||
bool __ret = __temp == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__temp, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__cxx_atomic_assign_volatile(__a->__a_value, __value);
|
||||
else
|
||||
@ -1290,11 +1304,11 @@ _LIBCPP_INLINE_VISIBILITY
|
||||
bool __cxx_atomic_compare_exchange_weak(__cxx_atomic_lock_impl<_Tp>* __a,
|
||||
_Tp* __expected, _Tp __value, memory_order, memory_order) {
|
||||
__a->__lock();
|
||||
bool __ret = __a->__a_value == *__expected;
|
||||
bool __ret = (_VSTD::memcmp(&__a->__a_value, __expected, sizeof(_Tp)) == 0);
|
||||
if(__ret)
|
||||
__a->__a_value = __value;
|
||||
_VSTD::memcpy(&__a->__a_value, &__value, sizeof(_Tp));
|
||||
else
|
||||
*__expected = __a->__a_value;
|
||||
_VSTD::memcpy(__expected, &__a->__a_value, sizeof(_Tp));
|
||||
__a->__unlock();
|
||||
return __ret;
|
||||
}
|
||||
@ -1444,6 +1458,9 @@ template<> struct __cxx_is_always_lock_free<bool> { enum { __value = 2 == ATOMIC
|
||||
template<> struct __cxx_is_always_lock_free<char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<signed char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<unsigned char> { enum { __value = 2 == ATOMIC_CHAR_LOCK_FREE }; };
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
template<> struct __cxx_is_always_lock_free<char8_t> { enum { __value = 2 == ATOMIC_CHAR8_T_LOCK_FREE }; };
|
||||
#endif
|
||||
template<> struct __cxx_is_always_lock_free<char16_t> { enum { __value = 2 == ATOMIC_CHAR16_T_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<char32_t> { enum { __value = 2 == ATOMIC_CHAR32_T_LOCK_FREE }; };
|
||||
template<> struct __cxx_is_always_lock_free<wchar_t> { enum { __value = 2 == ATOMIC_WCHAR_T_LOCK_FREE }; };
|
||||
@ -1486,8 +1503,6 @@ struct __cxx_atomic_impl : public _Base {
|
||||
using __cxx_contention_t = int64_t;
|
||||
#endif //__linux__
|
||||
|
||||
#if _LIBCPP_STD_VER >= 11
|
||||
|
||||
using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_PLATFORM_WAIT
|
||||
@ -1519,7 +1534,7 @@ struct __libcpp_atomic_wait_backoff_impl {
|
||||
else if(__elapsed > chrono::microseconds(4))
|
||||
__libcpp_thread_yield();
|
||||
else
|
||||
; // poll
|
||||
{} // poll
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@ -1565,8 +1580,6 @@ _LIBCPP_INLINE_VISIBILITY bool __cxx_atomic_wait(_Atp* __a, _Tp const __val, mem
|
||||
return __cxx_atomic_wait(__a, __test_fn);
|
||||
}
|
||||
|
||||
#endif //_LIBCPP_STD_VER >= 11
|
||||
|
||||
// general atomic<T>
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value && !is_same<_Tp, bool>::value>
|
||||
@ -1775,6 +1788,7 @@ struct atomic
|
||||
{
|
||||
typedef __atomic_base<_Tp> __base;
|
||||
typedef _Tp value_type;
|
||||
typedef value_type difference_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic() _NOEXCEPT _LIBCPP_DEFAULT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1796,6 +1810,7 @@ struct atomic<_Tp*>
|
||||
{
|
||||
typedef __atomic_base<_Tp*> __base;
|
||||
typedef _Tp* value_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
atomic() _NOEXCEPT _LIBCPP_DEFAULT
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1872,7 +1887,7 @@ atomic_is_lock_free(const atomic<_Tp>* __o) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_init(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__cxx_atomic_init(&__o->__a_, __d);
|
||||
}
|
||||
@ -1880,7 +1895,7 @@ atomic_init(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_init(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__cxx_atomic_init(&__o->__a_, __d);
|
||||
}
|
||||
@ -1890,7 +1905,7 @@ atomic_init(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_store(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__o->store(__d);
|
||||
}
|
||||
@ -1898,7 +1913,7 @@ atomic_store(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_store(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
__o->store(__d);
|
||||
}
|
||||
@ -1908,7 +1923,7 @@ atomic_store(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_store_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
@ -1917,7 +1932,7 @@ atomic_store_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOE
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
atomic_store_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_store_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
_LIBCPP_CHECK_STORE_MEMORY_ORDER(__m)
|
||||
{
|
||||
__o->store(__d, __m);
|
||||
@ -1966,7 +1981,7 @@ atomic_load_explicit(const atomic<_Tp>* __o, memory_order __m) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_exchange(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d);
|
||||
}
|
||||
@ -1974,7 +1989,7 @@ atomic_exchange(volatile atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
atomic_exchange(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d);
|
||||
}
|
||||
@ -1984,7 +1999,7 @@ atomic_exchange(atomic<_Tp>* __o, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_exchange_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d, __m);
|
||||
}
|
||||
@ -1992,7 +2007,7 @@ atomic_exchange_explicit(volatile atomic<_Tp>* __o, _Tp __d, memory_order __m) _
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp
|
||||
atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
atomic_exchange_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __d, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->exchange(__d, __m);
|
||||
}
|
||||
@ -2002,7 +2017,7 @@ atomic_exchange_explicit(atomic<_Tp>* __o, _Tp __d, memory_order __m) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d);
|
||||
}
|
||||
@ -2010,7 +2025,7 @@ atomic_compare_exchange_weak(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEX
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_weak(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_weak(*__e, __d);
|
||||
}
|
||||
@ -2020,7 +2035,7 @@ atomic_compare_exchange_weak(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d);
|
||||
}
|
||||
@ -2028,7 +2043,7 @@ atomic_compare_exchange_strong(volatile atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NO
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
atomic_compare_exchange_strong(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d) _NOEXCEPT
|
||||
{
|
||||
return __o->compare_exchange_strong(*__e, __d);
|
||||
}
|
||||
@ -2038,8 +2053,8 @@ atomic_compare_exchange_strong(atomic<_Tp>* __o, _Tp* __e, _Tp __d) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
|
||||
typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@ -2049,7 +2064,7 @@ atomic_compare_exchange_weak_explicit(volatile atomic<_Tp>* __o, _Tp* __e,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, _Tp* __e, _Tp __d,
|
||||
atomic_compare_exchange_weak_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@ -2062,7 +2077,7 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
_Tp* __e, _Tp __d,
|
||||
typename atomic<_Tp>::value_type* __e, typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@ -2072,8 +2087,8 @@ atomic_compare_exchange_strong_explicit(volatile atomic<_Tp>* __o,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, _Tp* __e,
|
||||
_Tp __d,
|
||||
atomic_compare_exchange_strong_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type* __e,
|
||||
typename atomic<_Tp>::value_type __d,
|
||||
memory_order __s, memory_order __f) _NOEXCEPT
|
||||
_LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__s, __f)
|
||||
{
|
||||
@ -2156,10 +2171,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_add(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@ -2168,10 +2183,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_add(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@ -2179,7 +2194,7 @@ atomic_fetch_add(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_add(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@ -2187,7 +2202,7 @@ atomic_fetch_add(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_add(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op);
|
||||
}
|
||||
@ -2198,10 +2213,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@ -2210,10 +2225,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@ -2221,8 +2236,7 @@ atomic_fetch_add_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@ -2230,7 +2244,7 @@ atomic_fetch_add_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_add_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_add_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_add(__op, __m);
|
||||
}
|
||||
@ -2241,10 +2255,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_sub(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@ -2253,10 +2267,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_sub(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@ -2264,7 +2278,7 @@ atomic_fetch_sub(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_sub(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@ -2272,7 +2286,7 @@ atomic_fetch_sub(volatile atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub(atomic<_Tp*>* __o, ptrdiff_t __op) _NOEXCEPT
|
||||
atomic_fetch_sub(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op);
|
||||
}
|
||||
@ -2283,10 +2297,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@ -2295,10 +2309,10 @@ template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value && !is_const<_Tp>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@ -2306,8 +2320,7 @@ atomic_fetch_sub_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEP
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@ -2315,7 +2328,7 @@ atomic_fetch_sub_explicit(volatile atomic<_Tp*>* __o, ptrdiff_t __op,
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, ptrdiff_t __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_sub_explicit(atomic<_Tp*>* __o, typename atomic<_Tp*>::difference_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_sub(__op, __m);
|
||||
}
|
||||
@ -2329,7 +2342,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_and(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op);
|
||||
}
|
||||
@ -2341,7 +2354,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_and(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op);
|
||||
}
|
||||
@ -2355,7 +2368,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_and_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op, __m);
|
||||
}
|
||||
@ -2367,7 +2380,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_and_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_and_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_and(__op, __m);
|
||||
}
|
||||
@ -2381,7 +2394,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_or(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op);
|
||||
}
|
||||
@ -2393,7 +2406,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_or(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op);
|
||||
}
|
||||
@ -2407,7 +2420,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_or_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op, __m);
|
||||
}
|
||||
@ -2419,7 +2432,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_or_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_or_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_or(__op, __m);
|
||||
}
|
||||
@ -2433,7 +2446,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor(volatile atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_xor(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op);
|
||||
}
|
||||
@ -2445,7 +2458,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor(atomic<_Tp>* __o, _Tp __op) _NOEXCEPT
|
||||
atomic_fetch_xor(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op);
|
||||
}
|
||||
@ -2459,7 +2472,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_xor_explicit(volatile atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op, __m);
|
||||
}
|
||||
@ -2471,7 +2484,7 @@ typename enable_if
|
||||
is_integral<_Tp>::value && !is_same<_Tp, bool>::value,
|
||||
_Tp
|
||||
>::type
|
||||
atomic_fetch_xor_explicit(atomic<_Tp>* __o, _Tp __op, memory_order __m) _NOEXCEPT
|
||||
atomic_fetch_xor_explicit(atomic<_Tp>* __o, typename atomic<_Tp>::value_type __op, memory_order __m) _NOEXCEPT
|
||||
{
|
||||
return __o->fetch_xor(__op, __m);
|
||||
}
|
||||
@ -2715,6 +2728,9 @@ typedef atomic<long> atomic_long;
|
||||
typedef atomic<unsigned long> atomic_ulong;
|
||||
typedef atomic<long long> atomic_llong;
|
||||
typedef atomic<unsigned long long> atomic_ullong;
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef atomic<char8_t> atomic_char8_t;
|
||||
#endif
|
||||
typedef atomic<char16_t> atomic_char16_t;
|
||||
typedef atomic<char32_t> atomic_char32_t;
|
||||
typedef atomic<wchar_t> atomic_wchar_t;
|
||||
|
@ -22,6 +22,8 @@ namespace std
|
||||
public:
|
||||
using arrival_token = see below;
|
||||
|
||||
static constexpr ptrdiff_t max() noexcept;
|
||||
|
||||
constexpr explicit barrier(ptrdiff_t phase_count,
|
||||
CompletionFunction f = CompletionFunction());
|
||||
~barrier();
|
||||
@ -44,6 +46,7 @@ namespace std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <atomic>
|
||||
#ifndef _LIBCPP_HAS_NO_TREE_BARRIER
|
||||
# include <memory>
|
||||
@ -57,6 +60,9 @@ namespace std
|
||||
# error <barrier> is not supported on this single threaded system
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@ -287,7 +293,7 @@ public:
|
||||
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
barrier(ptrdiff_t __count, _CompletionF __completion = _CompletionF())
|
||||
: __b(__count, std::move(__completion)) {
|
||||
: __b(__count, _VSTD::move(__completion)) {
|
||||
}
|
||||
|
||||
barrier(barrier const&) = delete;
|
||||
@ -301,7 +307,7 @@ public:
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
void wait(arrival_token&& __phase) const
|
||||
{
|
||||
__b.wait(std::move(__phase));
|
||||
__b.wait(_VSTD::move(__phase));
|
||||
}
|
||||
_LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
|
||||
void arrive_and_wait()
|
||||
@ -319,4 +325,6 @@ _LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif //_LIBCPP_BARRIER
|
||||
|
@ -17,13 +17,13 @@ namespace std {
|
||||
|
||||
// [bit.pow.two], integral powers of 2
|
||||
template <class T>
|
||||
constexpr bool ispow2(T x) noexcept; // C++20
|
||||
constexpr bool has_single_bit(T x) noexcept; // C++20
|
||||
template <class T>
|
||||
constexpr T ceil2(T x); // C++20
|
||||
constexpr T bit_ceil(T x); // C++20
|
||||
template <class T>
|
||||
constexpr T floor2(T x) noexcept; // C++20
|
||||
constexpr T bit_floor(T x) noexcept; // C++20
|
||||
template <class T>
|
||||
constexpr T log2p1(T x) noexcept; // C++20
|
||||
constexpr T bit_width(T x) noexcept; // C++20
|
||||
|
||||
// [bit.rotate], rotating
|
||||
template<class T>
|
||||
@ -343,14 +343,14 @@ _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
|
||||
unsigned __bit_log2(_Tp __t) _NOEXCEPT
|
||||
{
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__bit_log2 requires unsigned");
|
||||
return std::numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
|
||||
return numeric_limits<_Tp>::digits - 1 - __countl_zero(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool __ispow2(_Tp __t) _NOEXCEPT
|
||||
bool __has_single_bit(_Tp __t) _NOEXCEPT
|
||||
{
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__ispow2 requires unsigned");
|
||||
static_assert(__bitop_unsigned_integer<_Tp>::value, "__has_single_bit requires unsigned");
|
||||
return __t != 0 && (((__t & (__t - 1)) == 0));
|
||||
}
|
||||
|
||||
@ -424,15 +424,15 @@ popcount(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, bool>
|
||||
ispow2(_Tp __t) noexcept
|
||||
has_single_bit(_Tp __t) noexcept
|
||||
{
|
||||
return __ispow2(__t);
|
||||
return __has_single_bit(__t);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
floor2(_Tp __t) noexcept
|
||||
bit_floor(_Tp __t) noexcept
|
||||
{
|
||||
return __t == 0 ? 0 : _Tp{1} << __bit_log2(__t);
|
||||
}
|
||||
@ -440,11 +440,11 @@ floor2(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
ceil2(_Tp __t) noexcept
|
||||
bit_ceil(_Tp __t) noexcept
|
||||
{
|
||||
if (__t < 2) return 1;
|
||||
const unsigned __n = numeric_limits<_Tp>::digits - countl_zero((_Tp)(__t - 1u));
|
||||
_LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to ceil2");
|
||||
_LIBCPP_DEBUG_ASSERT(__libcpp_is_constant_evaluated() || __n != numeric_limits<_Tp>::digits, "Bad input to bit_ceil");
|
||||
|
||||
if constexpr (sizeof(_Tp) >= sizeof(unsigned))
|
||||
return _Tp{1} << __n;
|
||||
@ -459,12 +459,11 @@ ceil2(_Tp __t) noexcept
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr
|
||||
enable_if_t<__bitop_unsigned_integer<_Tp>::value, _Tp>
|
||||
log2p1(_Tp __t) noexcept
|
||||
bit_width(_Tp __t) noexcept
|
||||
{
|
||||
return __t == 0 ? 0 : __bit_log2(__t) + 1;
|
||||
}
|
||||
|
||||
|
||||
enum class endian
|
||||
{
|
||||
little = 0xDEAD,
|
||||
|
@ -380,7 +380,7 @@ unsigned long long
|
||||
__bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
|
||||
{
|
||||
unsigned long long __r = __first_[0];
|
||||
for (std::size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
|
||||
for (size_t __i = 1; __i < sizeof(unsigned long long) / sizeof(__storage_type); ++__i)
|
||||
__r |= static_cast<unsigned long long>(__first_[__i]) << (sizeof(__storage_type) * CHAR_BIT);
|
||||
return __r;
|
||||
}
|
||||
@ -625,13 +625,13 @@ protected:
|
||||
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
|
||||
{return reference(0, 1);}
|
||||
{return reference(nullptr, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT
|
||||
{return const_reference(0, 1);}
|
||||
{return const_reference(nullptr, 1);}
|
||||
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT
|
||||
{return iterator(0, 0);}
|
||||
{return iterator(nullptr, 0);}
|
||||
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT
|
||||
{return const_iterator(0, 0);}
|
||||
{return const_iterator(nullptr, 0);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
|
||||
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {}
|
||||
|
@ -74,12 +74,13 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__errc>
|
||||
#include <type_traits>
|
||||
#include <cmath> // for log2f
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <type_traits>
|
||||
|
||||
#include <__debug>
|
||||
|
||||
@ -206,7 +207,7 @@ __mul_overflowed(unsigned char __a, _Tp __b, unsigned char& __r)
|
||||
{
|
||||
auto __c = __a * __b;
|
||||
__r = __c;
|
||||
return __c > (numeric_limits<unsigned char>::max)();
|
||||
return __c > numeric_limits<unsigned char>::max();
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -215,7 +216,7 @@ __mul_overflowed(unsigned short __a, _Tp __b, unsigned short& __r)
|
||||
{
|
||||
auto __c = __a * __b;
|
||||
__r = __c;
|
||||
return __c > (numeric_limits<unsigned short>::max)();
|
||||
return __c > numeric_limits<unsigned short>::max();
|
||||
}
|
||||
|
||||
template <typename _Tp>
|
||||
@ -226,7 +227,7 @@ __mul_overflowed(_Tp __a, _Tp __b, _Tp& __r)
|
||||
#if !defined(_LIBCPP_COMPILER_MSVC)
|
||||
return __builtin_mul_overflow(__a, __b, &__r);
|
||||
#else
|
||||
bool __did = __b && ((numeric_limits<_Tp>::max)() / __b) < __a;
|
||||
bool __did = __b && (numeric_limits<_Tp>::max() / __b) < __a;
|
||||
__r = __a * __b;
|
||||
return __did;
|
||||
#endif
|
||||
@ -332,7 +333,7 @@ __to_chars_itoa(char* __first, char* __last, _Tp __value, false_type)
|
||||
auto __len = __p - __buf;
|
||||
if (__len <= __diff)
|
||||
{
|
||||
memcpy(__first, __buf, __len);
|
||||
_VSTD::memcpy(__first, __buf, __len);
|
||||
return {__first + __len, {}};
|
||||
}
|
||||
else
|
||||
@ -381,7 +382,7 @@ __to_chars_integral(char* __first, char* __last, _Tp __value, int __base,
|
||||
return {__last, errc::value_too_large};
|
||||
else
|
||||
{
|
||||
memmove(__first, __p, __len);
|
||||
_VSTD::memmove(__first, __p, __len);
|
||||
return {__first + __len, {}};
|
||||
}
|
||||
}
|
||||
@ -428,13 +429,13 @@ __sign_combinator(_It __first, _It __last, _Tp& __value, _Fn __f, _Ts... __args)
|
||||
if (__x <= __complement(__to_unsigned(__tl::min())))
|
||||
{
|
||||
__x = __complement(__x);
|
||||
memcpy(&__value, &__x, sizeof(__x));
|
||||
_VSTD::memcpy(&__value, &__x, sizeof(__x));
|
||||
return __r;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__x <= (__tl::max)())
|
||||
if (__x <= __tl::max())
|
||||
{
|
||||
__value = __x;
|
||||
return __r;
|
||||
@ -525,7 +526,7 @@ __from_chars_atoi(const char* __first, const char* __last, _Tp& __value)
|
||||
auto __p = __tx::__read(__first, __last, __a, __b);
|
||||
if (__p == __last || !__in_pattern(*__p))
|
||||
{
|
||||
__output_type __m = (numeric_limits<_Tp>::max)();
|
||||
__output_type __m = numeric_limits<_Tp>::max();
|
||||
if (__m >= __a && __m - __a >= __b)
|
||||
{
|
||||
__value = __a + __b;
|
||||
@ -580,7 +581,7 @@ __from_chars_integral(const char* __first, const char* __last, _Tp& __value,
|
||||
|
||||
if (__p == __last || !__in_pattern(*__p, __base))
|
||||
{
|
||||
if ((__tl::max)() - __a >= __b)
|
||||
if (__tl::max() - __a >= __b)
|
||||
{
|
||||
__value = __a + __b;
|
||||
return {__p, {}};
|
||||
|
@ -824,6 +824,7 @@ constexpr chrono::year operator ""y(unsigned lo
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <ctime>
|
||||
#include <type_traits>
|
||||
#include <ratio>
|
||||
@ -1076,7 +1077,7 @@ public:
|
||||
is_convertible<_Rep2, rep>::value &&
|
||||
(treat_as_floating_point<rep>::value ||
|
||||
!treat_as_floating_point<_Rep2>::value)
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __rep_(__r) {}
|
||||
|
||||
// conversions
|
||||
@ -1089,7 +1090,7 @@ public:
|
||||
treat_as_floating_point<rep>::value ||
|
||||
(__no_overflow<_Period2, period>::type::den == 1 &&
|
||||
!treat_as_floating_point<_Rep2>::value))
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
|
||||
|
||||
// observer
|
||||
@ -1375,7 +1376,7 @@ public:
|
||||
typename enable_if
|
||||
<
|
||||
is_convertible<_Duration2, duration>::value
|
||||
>::type* = 0)
|
||||
>::type* = nullptr)
|
||||
: __d_(t.time_since_epoch()) {}
|
||||
|
||||
// observer
|
||||
|
@ -660,8 +660,8 @@ _LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
|
||||
template <class _IntT, class _RealT>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
|
||||
using _Lim = std::numeric_limits<_IntT>;
|
||||
const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, _RealT>();
|
||||
using _Lim = numeric_limits<_IntT>;
|
||||
const _IntT _MaxVal = __max_representable_int_for_float<_IntT, _RealT>();
|
||||
if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
|
||||
return _Lim::max();
|
||||
} else if (__r <= _Lim::lowest()) {
|
||||
|
@ -109,6 +109,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@ -125,6 +126,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -144,6 +147,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@ -160,6 +164,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -267,6 +273,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@ -283,6 +290,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -302,6 +311,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@ -318,6 +328,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -337,6 +349,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@ -353,6 +366,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -372,6 +387,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@ -388,6 +404,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -460,6 +478,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
|
||||
: public codecvt<char32_t, char, mbstate_t>
|
||||
@ -476,6 +495,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char32_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
@ -495,6 +516,7 @@ protected:
|
||||
virtual int do_max_length() const _NOEXCEPT;
|
||||
};
|
||||
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
template <>
|
||||
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
|
||||
: public codecvt<char16_t, char, mbstate_t>
|
||||
@ -511,6 +533,8 @@ public:
|
||||
codecvt_mode _Mode)
|
||||
: codecvt<char16_t, char, mbstate_t>(__refs), _Maxcode_(_Maxcode),
|
||||
_Mode_(_Mode) {}
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
|
||||
protected:
|
||||
virtual result
|
||||
do_out(state_type& __st,
|
||||
|
@ -154,8 +154,13 @@ enum class _LIBCPP_ENUM_VIS _NCmpResult : signed char {
|
||||
__unordered = -127
|
||||
};
|
||||
|
||||
struct _CmpUnspecifiedType;
|
||||
using _CmpUnspecifiedParam = void (_CmpUnspecifiedType::*)();
|
||||
struct _CmpUnspecifiedParam {
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEVAL
|
||||
_CmpUnspecifiedParam(int _CmpUnspecifiedParam::*) noexcept {}
|
||||
|
||||
template<typename _Tp, typename = _VSTD::enable_if_t<!_VSTD::is_same_v<_Tp, int>>>
|
||||
_CmpUnspecifiedParam(_Tp) = delete;
|
||||
};
|
||||
|
||||
class weak_equality {
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -696,8 +701,8 @@ constexpr _ClassifyCompCategory __type_to_enum() noexcept {
|
||||
|
||||
template <size_t _Size>
|
||||
constexpr _ClassifyCompCategory
|
||||
__compute_comp_type(std::array<_ClassifyCompCategory, _Size> __types) {
|
||||
std::array<int, _CCC_Size> __seen = {};
|
||||
__compute_comp_type(array<_ClassifyCompCategory, _Size> __types) {
|
||||
array<int, _CCC_Size> __seen = {};
|
||||
for (auto __type : __types)
|
||||
++__seen[__type];
|
||||
if (__seen[_None])
|
||||
|
@ -227,14 +227,6 @@ template<class T> complex<T> sqrt (const complex<T>&);
|
||||
template<class T> complex<T> tan (const complex<T>&);
|
||||
template<class T> complex<T> tanh (const complex<T>&);
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>& is, complex<T>& x);
|
||||
|
||||
template<class T, class charT, class traits>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>& o, const complex<T>& x);
|
||||
|
||||
} // std
|
||||
|
||||
*/
|
||||
@ -244,9 +236,12 @@ template<class T, class charT, class traits>
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
#include <iosfwd>
|
||||
#include <sstream>
|
||||
#include <version>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# include <sstream> // for std::basic_ostringstream
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -955,7 +950,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
complex<_Tp>
|
||||
proj(const complex<_Tp>& __c)
|
||||
{
|
||||
std::complex<_Tp> __r = __c;
|
||||
complex<_Tp> __r = __c;
|
||||
if (__libcpp_isinf_or_builtin(__c.real()) || __libcpp_isinf_or_builtin(__c.imag()))
|
||||
__r = complex<_Tp>(INFINITY, copysign(_Tp(0), __c.imag()));
|
||||
return __r;
|
||||
@ -1438,6 +1433,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is, complex<_Tp>& __x)
|
||||
return __is;
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template<class _Tp, class _CharT, class _Traits>
|
||||
basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
@ -1449,6 +1445,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
|
||||
__s << '(' << __x.real() << ',' << __x.imag() << ')';
|
||||
return __os << __s.str();
|
||||
}
|
||||
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
// Literal suffix for complex number literals [complex.literals]
|
||||
|
@ -52,6 +52,20 @@ int timespec_get( struct timespec *ts, int base); // C++17
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
// FIXME:
|
||||
// Apple SDKs don't define ::timespec_get unconditionally in C++ mode. This
|
||||
// should be fixed in future SDKs, but for the time being we need to avoid
|
||||
// trying to use that declaration when the SDK doesn't provide it. Note that
|
||||
// we're detecting this here instead of in <__config> because we can't include
|
||||
// system headers from <__config>, since it leads to circular module dependencies.
|
||||
// This is also meant to be a very temporary workaround until the SDKs are fixed.
|
||||
#if defined(__APPLE__)
|
||||
# include <sys/cdefs.h>
|
||||
# if defined(_LIBCPP_HAS_TIMESPEC_GET) && (__DARWIN_C_LEVEL < __DARWIN_C_FULL)
|
||||
# define _LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED
|
||||
# endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
using ::clock_t;
|
||||
@ -72,7 +86,7 @@ using ::gmtime;
|
||||
using ::localtime;
|
||||
#endif
|
||||
using ::strftime;
|
||||
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET)
|
||||
#if _LIBCPP_STD_VER > 14 && defined(_LIBCPP_HAS_TIMESPEC_GET) && !defined(_LIBCPP_HAS_TIMESPEC_GET_NOT_ACTUALLY_PROVIDED)
|
||||
using ::timespec_get;
|
||||
#endif
|
||||
|
||||
|
@ -1237,7 +1237,7 @@ __deque_base<_Tp, _Allocator>::swap(__deque_base& __c)
|
||||
__map_.swap(__c.__map_);
|
||||
_VSTD::swap(__start_, __c.__start_);
|
||||
_VSTD::swap(size(), __c.size());
|
||||
__swap_allocator(__alloc(), __c.__alloc());
|
||||
_VSTD::__swap_allocator(__alloc(), __c.__alloc());
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -1393,7 +1393,7 @@ public:
|
||||
size_type size() const _NOEXCEPT {return __base::size();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{return std::min<size_type>(
|
||||
{return _VSTD::min<size_type>(
|
||||
__alloc_traits::max_size(__base::__alloc()),
|
||||
numeric_limits<difference_type>::max());}
|
||||
void resize(size_type __n);
|
||||
@ -1586,7 +1586,7 @@ public:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
deque(_InputIterator, _InputIterator)
|
||||
@ -2376,7 +2376,7 @@ deque<_Tp, _Allocator>::__append(_ForIter __f, _ForIter __l,
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, (void)++__f) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_), *__f);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), *__f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2393,7 +2393,7 @@ deque<_Tp, _Allocator>::__append(size_type __n)
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_));
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2410,7 +2410,7 @@ deque<_Tp, _Allocator>::__append(size_type __n, const value_type& __v)
|
||||
for (__deque_block_range __br : __deque_range(__base::end(), __base::end() + __n)) {
|
||||
_ConstructTransaction __tx(this, __br);
|
||||
for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) {
|
||||
__alloc_traits::construct(__a, std::__to_address(__tx.__pos_), __v);
|
||||
__alloc_traits::construct(__a, _VSTD::__to_address(__tx.__pos_), __v);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2708,7 +2708,7 @@ void
|
||||
deque<_Tp, _Allocator>::pop_front()
|
||||
{
|
||||
allocator_type& __a = __base::__alloc();
|
||||
__alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
|
||||
__alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() +
|
||||
__base::__start_ / __base::__block_size) +
|
||||
__base::__start_ % __base::__block_size));
|
||||
--__base::size();
|
||||
@ -2723,7 +2723,7 @@ deque<_Tp, _Allocator>::pop_back()
|
||||
_LIBCPP_ASSERT(!empty(), "deque::pop_back called for empty deque");
|
||||
allocator_type& __a = __base::__alloc();
|
||||
size_type __p = __base::size() + __base::__start_ - 1;
|
||||
__alloc_traits::destroy(__a, __to_address(*(__base::__map_.begin() +
|
||||
__alloc_traits::destroy(__a, _VSTD::__to_address(*(__base::__map_.begin() +
|
||||
__p / __base::__block_size) +
|
||||
__p % __base::__block_size));
|
||||
--__base::size();
|
||||
|
@ -77,6 +77,8 @@ template <class E> void rethrow_if_nested(const E& e);
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__memory/base.h>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <type_traits>
|
||||
|
@ -116,7 +116,7 @@ public:
|
||||
{ return do_is_equal(__other); }
|
||||
|
||||
// 8.5.3, memory.resource.priv
|
||||
protected:
|
||||
private:
|
||||
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;
|
||||
@ -381,7 +381,7 @@ public:
|
||||
{ return __alloc_; }
|
||||
|
||||
// 8.7.3, memory.resource.adaptor.mem
|
||||
protected:
|
||||
private:
|
||||
virtual void * do_allocate(size_t __bytes, size_t)
|
||||
{
|
||||
if (__bytes > __max_size()) {
|
||||
@ -407,7 +407,6 @@ protected:
|
||||
return __p ? __alloc_ == __p->__alloc_ : false;
|
||||
}
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t __max_size() const _NOEXCEPT {
|
||||
return numeric_limits<size_t>::max() - _MaxAlign;
|
||||
|
@ -659,6 +659,9 @@ public:
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_EXPERIMENTAL_SIMD
|
||||
|
||||
#if _LIBCPP_STD_VER >= 17
|
||||
@ -1566,4 +1569,6 @@ public:
|
||||
|
||||
_LIBCPP_END_NAMESPACE_EXPERIMENTAL_SIMD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif /* _LIBCPP_EXPERIMENTAL_SIMD */
|
||||
|
@ -671,7 +671,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
|
@ -230,21 +230,25 @@
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <chrono>
|
||||
#include <iterator>
|
||||
#include <iosfwd>
|
||||
#include <locale>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <system_error>
|
||||
#include <utility>
|
||||
#include <iomanip> // for quoted
|
||||
#include <string_view>
|
||||
#include <version>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# include <locale>
|
||||
# include <iomanip> // for quoted
|
||||
#endif
|
||||
|
||||
#include <__debug>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@ -543,6 +547,13 @@ struct __can_convert_char<wchar_t> {
|
||||
static const bool value = true;
|
||||
using __char_type = wchar_t;
|
||||
};
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
template <>
|
||||
struct __can_convert_char<char8_t> {
|
||||
static const bool value = true;
|
||||
using __char_type = char8_t;
|
||||
};
|
||||
#endif
|
||||
template <>
|
||||
struct __can_convert_char<char16_t> {
|
||||
static const bool value = true;
|
||||
@ -560,7 +571,7 @@ __is_separator(_ECharT __e) {
|
||||
return __e == _ECharT('/');
|
||||
}
|
||||
|
||||
struct _NullSentinal {};
|
||||
struct _NullSentinel {};
|
||||
|
||||
template <class _Tp>
|
||||
using _Void = void;
|
||||
@ -615,9 +626,9 @@ struct __is_pathable_char_array<_Source, _ECharT*, _UPtr, true>
|
||||
static _ECharT const* __range_begin(const _ECharT* __b) { return __b; }
|
||||
static _ECharT const* __range_end(const _ECharT* __b) {
|
||||
using _Iter = const _ECharT*;
|
||||
const _ECharT __sentinal = _ECharT{};
|
||||
const _ECharT __sentinel = _ECharT{};
|
||||
_Iter __e = __b;
|
||||
for (; *__e != __sentinal; ++__e)
|
||||
for (; *__e != __sentinel; ++__e)
|
||||
;
|
||||
return __e;
|
||||
}
|
||||
@ -639,7 +650,7 @@ struct __is_pathable_iter<
|
||||
using _Base = __can_convert_char<_ECharT>;
|
||||
|
||||
static _Iter __range_begin(_Iter __b) { return __b; }
|
||||
static _NullSentinal __range_end(_Iter) { return _NullSentinal{}; }
|
||||
static _NullSentinel __range_end(_Iter) { return _NullSentinel{}; }
|
||||
|
||||
static _ECharT __first_or_null(_Iter __b) { return *__b; }
|
||||
};
|
||||
@ -661,6 +672,10 @@ struct __is_pathable<_Tp, false, true, false> : __is_pathable_char_array<_Tp> {
|
||||
template <class _Tp>
|
||||
struct __is_pathable<_Tp, false, false, true> : __is_pathable_iter<_Tp> {};
|
||||
|
||||
template <class _ECharT>
|
||||
struct _PathCVT;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template <class _ECharT>
|
||||
struct _PathCVT {
|
||||
static_assert(__can_convert_char<_ECharT>::value,
|
||||
@ -684,13 +699,13 @@ struct _PathCVT {
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
static void __append_range(string& __dest, _Iter __b, _NullSentinal) {
|
||||
static void __append_range(string& __dest, _Iter __b, _NullSentinel) {
|
||||
static_assert(!is_same<_Iter, _ECharT*>::value, "Call const overload");
|
||||
const _ECharT __sentinal = _ECharT{};
|
||||
if (*__b == __sentinal)
|
||||
const _ECharT __sentinel = _ECharT{};
|
||||
if (*__b == __sentinel)
|
||||
return;
|
||||
basic_string<_ECharT> __tmp;
|
||||
for (; *__b != __sentinal; ++__b)
|
||||
for (; *__b != __sentinel; ++__b)
|
||||
__tmp.push_back(*__b);
|
||||
_Narrower()(back_inserter(__dest), __tmp.data(),
|
||||
__tmp.data() + __tmp.length());
|
||||
@ -703,6 +718,7 @@ struct _PathCVT {
|
||||
_Traits::__range_end(__s));
|
||||
}
|
||||
};
|
||||
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
template <>
|
||||
struct _PathCVT<char> {
|
||||
@ -721,9 +737,9 @@ struct _PathCVT<char> {
|
||||
}
|
||||
|
||||
template <class _Iter>
|
||||
static void __append_range(string& __dest, _Iter __b, _NullSentinal) {
|
||||
const char __sentinal = char{};
|
||||
for (; *__b != __sentinal; ++__b)
|
||||
static void __append_range(string& __dest, _Iter __b, _NullSentinel) {
|
||||
const char __sentinel = char{};
|
||||
for (; *__b != __sentinel; ++__b)
|
||||
__dest.push_back(*__b);
|
||||
}
|
||||
|
||||
@ -779,12 +795,14 @@ public:
|
||||
_PathCVT<_ItVal>::__append_range(__pn_, __first, __last);
|
||||
}
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
// TODO Implement locale conversions.
|
||||
template <class _Source, class = _EnableIfPathable<_Source, void> >
|
||||
path(const _Source& __src, const locale& __loc, format = format::auto_format);
|
||||
template <class _InputIt>
|
||||
path(_InputIt __first, _InputIt _last, const locale& __loc,
|
||||
format = format::auto_format);
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~path() = default;
|
||||
@ -922,9 +940,8 @@ public:
|
||||
template <class _ECharT>
|
||||
typename enable_if<__can_convert_char<_ECharT>::value, path&>::type
|
||||
operator+=(_ECharT __x) {
|
||||
basic_string<_ECharT> __tmp;
|
||||
__tmp += __x;
|
||||
_PathCVT<_ECharT>::__append_source(__pn_, __tmp);
|
||||
_PathCVT<_ECharT>::__append_source(__pn_,
|
||||
basic_string_view<_ECharT>(&__x, 1));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -983,6 +1000,14 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY operator string_type() const { return __pn_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::string string() const { return __pn_; }
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::u8string u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); }
|
||||
#else
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::string u8string() const { return __pn_; }
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template <class _ECharT, class _Traits = char_traits<_ECharT>,
|
||||
class _Allocator = allocator<_ECharT> >
|
||||
basic_string<_ECharT, _Traits, _Allocator>
|
||||
@ -995,19 +1020,26 @@ public:
|
||||
return __s;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY std::string string() const { return __pn_; }
|
||||
_LIBCPP_INLINE_VISIBILITY std::wstring wstring() const {
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::wstring wstring() const {
|
||||
return string<wchar_t>();
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY std::string u8string() const { return __pn_; }
|
||||
_LIBCPP_INLINE_VISIBILITY std::u16string u16string() const {
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::u16string u16string() const {
|
||||
return string<char16_t>();
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY std::u32string u32string() const {
|
||||
_LIBCPP_INLINE_VISIBILITY _VSTD::u32string u32string() const {
|
||||
return string<char32_t>();
|
||||
}
|
||||
#endif
|
||||
|
||||
// generic format observers
|
||||
_VSTD::string generic_string() const { return __pn_; }
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_VSTD::u8string generic_u8string() const { return _VSTD::u8string(__pn_.begin(), __pn_.end()); }
|
||||
#else
|
||||
_VSTD::string generic_u8string() const { return __pn_; }
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template <class _ECharT, class _Traits = char_traits<_ECharT>,
|
||||
class _Allocator = allocator<_ECharT> >
|
||||
basic_string<_ECharT, _Traits, _Allocator>
|
||||
@ -1015,11 +1047,10 @@ public:
|
||||
return string<_ECharT, _Traits, _Allocator>(__a);
|
||||
}
|
||||
|
||||
std::string generic_string() const { return __pn_; }
|
||||
std::wstring generic_wstring() const { return string<wchar_t>(); }
|
||||
std::string generic_u8string() const { return __pn_; }
|
||||
std::u16string generic_u16string() const { return string<char16_t>(); }
|
||||
std::u32string generic_u32string() const { return string<char32_t>(); }
|
||||
_VSTD::wstring generic_wstring() const { return string<wchar_t>(); }
|
||||
_VSTD::u16string generic_u16string() const { return string<char16_t>(); }
|
||||
_VSTD::u32string generic_u32string() const { return string<char32_t>(); }
|
||||
#endif
|
||||
|
||||
private:
|
||||
int __compare(__string_view) const;
|
||||
@ -1123,13 +1154,14 @@ public:
|
||||
iterator begin() const;
|
||||
iterator end() const;
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY friend
|
||||
typename enable_if<is_same<_CharT, char>::value &&
|
||||
is_same<_Traits, char_traits<char> >::value,
|
||||
basic_ostream<_CharT, _Traits>&>::type
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
|
||||
__os << std::__quoted(__p.native());
|
||||
__os << _VSTD::__quoted(__p.native());
|
||||
return __os;
|
||||
}
|
||||
|
||||
@ -1139,7 +1171,7 @@ public:
|
||||
!is_same<_Traits, char_traits<char> >::value,
|
||||
basic_ostream<_CharT, _Traits>&>::type
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const path& __p) {
|
||||
__os << std::__quoted(__p.string<_CharT, _Traits>());
|
||||
__os << _VSTD::__quoted(__p.string<_CharT, _Traits>());
|
||||
return __os;
|
||||
}
|
||||
|
||||
@ -1151,6 +1183,7 @@ public:
|
||||
__p = __tmp;
|
||||
return __is;
|
||||
}
|
||||
#endif // !_LIBCPP_HAS_NO_LOCALIZATION
|
||||
|
||||
friend _LIBCPP_INLINE_VISIBILITY bool operator==(const path& __lhs, const path& __rhs) noexcept {
|
||||
return __lhs.compare(__rhs) == 0;
|
||||
@ -1194,23 +1227,37 @@ _LIBCPP_FUNC_VIS
|
||||
size_t hash_value(const path& __p) noexcept;
|
||||
|
||||
template <class _Source>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_Source>::value, path>::type
|
||||
u8path(const _Source& __s) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_Source>::__char_type, char>::value,
|
||||
"u8path(Source const&) requires Source have a character type of type "
|
||||
"'char'");
|
||||
"'char'"
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
" or 'char8_t'"
|
||||
#endif
|
||||
);
|
||||
return path(__s);
|
||||
}
|
||||
|
||||
template <class _InputIt>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_DEPRECATED_WITH_CHAR8_T
|
||||
typename enable_if<__is_pathable<_InputIt>::value, path>::type
|
||||
u8path(_InputIt __f, _InputIt __l) {
|
||||
static_assert(
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char8_t>::value ||
|
||||
#endif
|
||||
is_same<typename __is_pathable<_InputIt>::__char_type, char>::value,
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'");
|
||||
"u8path(Iter, Iter) requires Iter have a value_type of type 'char'"
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
" or 'char8_t'"
|
||||
#endif
|
||||
);
|
||||
return path(__f, __l);
|
||||
}
|
||||
|
||||
@ -1230,7 +1277,7 @@ public:
|
||||
typedef bidirectional_iterator_tag iterator_category;
|
||||
|
||||
typedef path value_type;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef ptrdiff_t difference_type;
|
||||
typedef const path* pointer;
|
||||
typedef const path& reference;
|
||||
|
||||
@ -1374,7 +1421,7 @@ template <class... _Args>
|
||||
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
void __throw_filesystem_error(_Args&&... __args) {
|
||||
throw filesystem_error(std::forward<_Args>(__args)...);
|
||||
throw filesystem_error(_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
#else
|
||||
void __throw_filesystem_error(_Args&&...) {
|
||||
@ -2204,7 +2251,7 @@ private:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __assign_iter_entry(_Path&& __p, __cached_data __dt) {
|
||||
__p_ = std::move(__p);
|
||||
__p_ = _VSTD::move(__p);
|
||||
__data_ = __dt;
|
||||
}
|
||||
|
||||
@ -2505,10 +2552,10 @@ end(const directory_iterator&) noexcept {
|
||||
class recursive_directory_iterator {
|
||||
public:
|
||||
using value_type = directory_entry;
|
||||
using difference_type = std::ptrdiff_t;
|
||||
using difference_type = ptrdiff_t;
|
||||
using pointer = directory_entry const*;
|
||||
using reference = directory_entry const&;
|
||||
using iterator_category = std::input_iterator_tag;
|
||||
using iterator_category = input_iterator_tag;
|
||||
|
||||
public:
|
||||
// constructors and destructor
|
||||
|
@ -603,7 +603,7 @@ __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
|
||||
__is_nothrow_swappable<__node_allocator>::value)
|
||||
#endif
|
||||
{
|
||||
__swap_allocator(__alloc(), __x.__alloc(),
|
||||
_VSTD::__swap_allocator(__alloc(), __x.__alloc(),
|
||||
integral_constant<bool, __node_traits::propagate_on_container_swap::value>());
|
||||
using _VSTD::swap;
|
||||
swap(__before_begin()->__next_, __x.__before_begin()->__next_);
|
||||
@ -758,7 +758,7 @@ public:
|
||||
{return base::__before_begin()->__next_ == nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT {
|
||||
return std::min<size_type>(
|
||||
return _VSTD::min<size_type>(
|
||||
__node_traits::max_size(base::__alloc()),
|
||||
numeric_limits<difference_type>::max());
|
||||
}
|
||||
@ -871,7 +871,7 @@ private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
forward_list(_InputIterator, _InputIterator)
|
||||
|
@ -180,6 +180,7 @@ typedef basic_fstream<wchar_t> wfstream;
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <ostream>
|
||||
#include <istream>
|
||||
#include <__locale>
|
||||
@ -240,7 +241,7 @@ public:
|
||||
return open(__p.c_str(), __mode);
|
||||
}
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf* __open(int __fd, ios_base::openmode __mode);
|
||||
#endif
|
||||
basic_filebuf* close();
|
||||
@ -286,13 +287,13 @@ private:
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
||||
: __extbuf_(0),
|
||||
__extbufnext_(0),
|
||||
__extbufend_(0),
|
||||
: __extbuf_(nullptr),
|
||||
__extbufnext_(nullptr),
|
||||
__extbufend_(nullptr),
|
||||
__ebs_(0),
|
||||
__intbuf_(0),
|
||||
__intbuf_(nullptr),
|
||||
__ibs_(0),
|
||||
__file_(0),
|
||||
__file_(nullptr),
|
||||
__cv_(nullptr),
|
||||
__st_(),
|
||||
__st_last_(),
|
||||
@ -307,7 +308,7 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
|
||||
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
}
|
||||
setbuf(0, 4096);
|
||||
setbuf(nullptr, 4096);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -359,13 +360,13 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
|
||||
(char_type*)__extbuf_ + (__rhs.gptr() - __rhs.eback()),
|
||||
(char_type*)__extbuf_ + (__rhs.egptr() - __rhs.eback()));
|
||||
}
|
||||
__rhs.__extbuf_ = 0;
|
||||
__rhs.__extbufnext_ = 0;
|
||||
__rhs.__extbufend_ = 0;
|
||||
__rhs.__extbuf_ = nullptr;
|
||||
__rhs.__extbufnext_ = nullptr;
|
||||
__rhs.__extbufend_ = nullptr;
|
||||
__rhs.__ebs_ = 0;
|
||||
__rhs.__intbuf_ = 0;
|
||||
__rhs.__ibs_ = 0;
|
||||
__rhs.__file_ = 0;
|
||||
__rhs.__file_ = nullptr;
|
||||
__rhs.__st_ = state_type();
|
||||
__rhs.__st_last_ = state_type();
|
||||
__rhs.__om_ = 0;
|
||||
@ -499,7 +500,7 @@ inline
|
||||
bool
|
||||
basic_filebuf<_CharT, _Traits>::is_open() const
|
||||
{
|
||||
return __file_ != 0;
|
||||
return __file_ != nullptr;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
@ -547,8 +548,8 @@ template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
{
|
||||
basic_filebuf<_CharT, _Traits>* __rt = 0;
|
||||
if (__file_ == 0)
|
||||
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
|
||||
if (__file_ == nullptr)
|
||||
{
|
||||
if (const char* __mdstr = __make_mdstring(__mode)) {
|
||||
__rt = this;
|
||||
@ -558,22 +559,23 @@ basic_filebuf<_CharT, _Traits>::open(const char* __s, ios_base::openmode __mode)
|
||||
if (__mode & ios_base::ate) {
|
||||
if (fseek(__file_, 0, SEEK_END)) {
|
||||
fclose(__file_);
|
||||
__file_ = 0;
|
||||
__rt = 0;
|
||||
__file_ = nullptr;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
} else
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
return __rt;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
_LIBCPP_INLINE_VISIBILITY basic_filebuf<_CharT, _Traits>*
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
|
||||
basic_filebuf<_CharT, _Traits>* __rt = 0;
|
||||
if (__file_ == 0) {
|
||||
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
|
||||
if (__file_ == nullptr) {
|
||||
if (const char* __mdstr = __make_mdstring(__mode)) {
|
||||
__rt = this;
|
||||
__file_ = fdopen(__fd, __mdstr);
|
||||
@ -582,12 +584,12 @@ basic_filebuf<_CharT, _Traits>::__open(int __fd, ios_base::openmode __mode) {
|
||||
if (__mode & ios_base::ate) {
|
||||
if (fseek(__file_, 0, SEEK_END)) {
|
||||
fclose(__file_);
|
||||
__file_ = 0;
|
||||
__rt = 0;
|
||||
__file_ = nullptr;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
} else
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
return __rt;
|
||||
@ -600,8 +602,8 @@ template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mode)
|
||||
{
|
||||
basic_filebuf<_CharT, _Traits>* __rt = 0;
|
||||
if (__file_ == 0)
|
||||
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
|
||||
if (__file_ == nullptr)
|
||||
{
|
||||
__rt = this;
|
||||
const wchar_t* __mdstr;
|
||||
@ -650,7 +652,7 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
|
||||
__mdstr = L"a+b";
|
||||
break;
|
||||
default:
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
break;
|
||||
}
|
||||
if (__rt)
|
||||
@ -664,13 +666,13 @@ basic_filebuf<_CharT, _Traits>::open(const wchar_t* __s, ios_base::openmode __mo
|
||||
if (fseek(__file_, 0, SEEK_END))
|
||||
{
|
||||
fclose(__file_);
|
||||
__file_ = 0;
|
||||
__rt = 0;
|
||||
__file_ = nullptr;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
}
|
||||
}
|
||||
return __rt;
|
||||
@ -690,16 +692,16 @@ template <class _CharT, class _Traits>
|
||||
basic_filebuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::close()
|
||||
{
|
||||
basic_filebuf<_CharT, _Traits>* __rt = 0;
|
||||
basic_filebuf<_CharT, _Traits>* __rt = nullptr;
|
||||
if (__file_)
|
||||
{
|
||||
__rt = this;
|
||||
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
|
||||
if (sync())
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
if (fclose(__h.release()))
|
||||
__rt = 0;
|
||||
__file_ = 0;
|
||||
__rt = nullptr;
|
||||
__file_ = nullptr;
|
||||
setbuf(0, 0);
|
||||
}
|
||||
return __rt;
|
||||
@ -709,17 +711,17 @@ template <class _CharT, class _Traits>
|
||||
typename basic_filebuf<_CharT, _Traits>::int_type
|
||||
basic_filebuf<_CharT, _Traits>::underflow()
|
||||
{
|
||||
if (__file_ == 0)
|
||||
if (__file_ == nullptr)
|
||||
return traits_type::eof();
|
||||
bool __initial = __read_mode();
|
||||
char_type __1buf;
|
||||
if (this->gptr() == 0)
|
||||
if (this->gptr() == nullptr)
|
||||
this->setg(&__1buf, &__1buf+1, &__1buf+1);
|
||||
const size_t __unget_sz = __initial ? 0 : min<size_t>((this->egptr() - this->eback()) / 2, 4);
|
||||
int_type __c = traits_type::eof();
|
||||
if (this->gptr() == this->egptr())
|
||||
{
|
||||
memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
|
||||
_VSTD::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
|
||||
if (__always_noconv_)
|
||||
{
|
||||
size_t __nmemb = static_cast<size_t>(this->egptr() - this->eback() - __unget_sz);
|
||||
@ -736,7 +738,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
{
|
||||
_LIBCPP_ASSERT ( !(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
|
||||
if (__extbufend_ != __extbufnext_)
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
_VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz),
|
||||
@ -771,7 +773,7 @@ basic_filebuf<_CharT, _Traits>::underflow()
|
||||
else
|
||||
__c = traits_type::to_int_type(*this->gptr());
|
||||
if (this->eback() == &__1buf)
|
||||
this->setg(0, 0, 0);
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
return __c;
|
||||
}
|
||||
|
||||
@ -801,7 +803,7 @@ template <class _CharT, class _Traits>
|
||||
typename basic_filebuf<_CharT, _Traits>::int_type
|
||||
basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
||||
{
|
||||
if (__file_ == 0)
|
||||
if (__file_ == nullptr)
|
||||
return traits_type::eof();
|
||||
__write_mode();
|
||||
char_type __1buf;
|
||||
@ -809,7 +811,7 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
|
||||
char_type* __epb_save = this->epptr();
|
||||
if (!traits_type::eq_int_type(__c, traits_type::eof()))
|
||||
{
|
||||
if (this->pptr() == 0)
|
||||
if (this->pptr() == nullptr)
|
||||
this->setp(&__1buf, &__1buf+1);
|
||||
*this->pptr() = traits_type::to_char_type(__c);
|
||||
this->pbump(1);
|
||||
@ -866,8 +868,8 @@ template <class _CharT, class _Traits>
|
||||
basic_streambuf<_CharT, _Traits>*
|
||||
basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
|
||||
{
|
||||
this->setg(0, 0, 0);
|
||||
this->setp(0, 0);
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
this->setp(nullptr, nullptr);
|
||||
if (__owns_eb_)
|
||||
delete [] __extbuf_;
|
||||
if (__owns_ib_)
|
||||
@ -909,7 +911,7 @@ basic_filebuf<_CharT, _Traits>::setbuf(char_type* __s, streamsize __n)
|
||||
else
|
||||
{
|
||||
__ibs_ = 0;
|
||||
__intbuf_ = 0;
|
||||
__intbuf_ = nullptr;
|
||||
__owns_ib_ = false;
|
||||
}
|
||||
return this;
|
||||
@ -924,7 +926,7 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
|
||||
__throw_bad_cast();
|
||||
|
||||
int __width = __cv_->encoding();
|
||||
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
|
||||
if (__file_ == nullptr || (__width <= 0 && __off != 0) || sync())
|
||||
return pos_type(off_type(-1));
|
||||
// __width > 0 || __off == 0
|
||||
int __whence;
|
||||
@ -959,7 +961,7 @@ template <class _CharT, class _Traits>
|
||||
typename basic_filebuf<_CharT, _Traits>::pos_type
|
||||
basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
|
||||
{
|
||||
if (__file_ == 0 || sync())
|
||||
if (__file_ == nullptr || sync())
|
||||
return pos_type(off_type(-1));
|
||||
#if defined(_LIBCPP_HAS_NO_OFF_T_FUNCTIONS)
|
||||
if (fseek(__file_, __sp, SEEK_SET))
|
||||
@ -976,7 +978,7 @@ template <class _CharT, class _Traits>
|
||||
int
|
||||
basic_filebuf<_CharT, _Traits>::sync()
|
||||
{
|
||||
if (__file_ == 0)
|
||||
if (__file_ == nullptr)
|
||||
return 0;
|
||||
if (!__cv_)
|
||||
__throw_bad_cast();
|
||||
@ -1035,7 +1037,7 @@ basic_filebuf<_CharT, _Traits>::sync()
|
||||
if (__update_st)
|
||||
__st_ = __state;
|
||||
__extbufnext_ = __extbufend_ = __extbuf_;
|
||||
this->setg(0, 0, 0);
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
__cm_ = 0;
|
||||
}
|
||||
return 0;
|
||||
@ -1051,8 +1053,8 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
|
||||
__always_noconv_ = __cv_->always_noconv();
|
||||
if (__old_anc != __always_noconv_)
|
||||
{
|
||||
this->setg(0, 0, 0);
|
||||
this->setp(0, 0);
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
this->setp(nullptr, nullptr);
|
||||
// invariant, char_type is char, else we couldn't get here
|
||||
if (__always_noconv_) // need to dump __intbuf_
|
||||
{
|
||||
@ -1062,7 +1064,7 @@ basic_filebuf<_CharT, _Traits>::imbue(const locale& __loc)
|
||||
__ebs_ = __ibs_;
|
||||
__extbuf_ = (char*)__intbuf_;
|
||||
__ibs_ = 0;
|
||||
__intbuf_ = 0;
|
||||
__intbuf_ = nullptr;
|
||||
__owns_ib_ = false;
|
||||
}
|
||||
else // need to obtain an __intbuf_.
|
||||
@ -1091,7 +1093,7 @@ basic_filebuf<_CharT, _Traits>::__read_mode()
|
||||
{
|
||||
if (!(__cm_ & ios_base::in))
|
||||
{
|
||||
this->setp(0, 0);
|
||||
this->setp(nullptr, nullptr);
|
||||
if (__always_noconv_)
|
||||
this->setg((char_type*)__extbuf_,
|
||||
(char_type*)__extbuf_ + __ebs_,
|
||||
@ -1110,7 +1112,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
||||
{
|
||||
if (!(__cm_ & ios_base::out))
|
||||
{
|
||||
this->setg(0, 0, 0);
|
||||
this->setg(nullptr, nullptr, nullptr);
|
||||
if (__ebs_ > sizeof(__extbuf_min_))
|
||||
{
|
||||
if (__always_noconv_)
|
||||
@ -1120,7 +1122,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
|
||||
this->setp(__intbuf_, __intbuf_ + (__ibs_ - 1));
|
||||
}
|
||||
else
|
||||
this->setp(0, 0);
|
||||
this->setp(nullptr, nullptr);
|
||||
__cm_ = ios_base::out;
|
||||
}
|
||||
}
|
||||
@ -1206,7 +1208,7 @@ inline
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const char* __s, ios_base::openmode __mode)
|
||||
: basic_istream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
@ -1216,7 +1218,7 @@ inline
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const wchar_t* __s, ios_base::openmode __mode)
|
||||
: basic_istream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1226,7 +1228,7 @@ inline
|
||||
basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::openmode __mode)
|
||||
: basic_istream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::in) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1419,7 +1421,7 @@ inline
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const char* __s, ios_base::openmode __mode)
|
||||
: basic_ostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
@ -1429,7 +1431,7 @@ inline
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const wchar_t* __s, ios_base::openmode __mode)
|
||||
: basic_ostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1439,7 +1441,7 @@ inline
|
||||
basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::openmode __mode)
|
||||
: basic_ostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == 0)
|
||||
if (__sb_.open(__s, __mode | ios_base::out) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1548,7 +1550,7 @@ inline
|
||||
void
|
||||
basic_ofstream<_CharT, _Traits>::close()
|
||||
{
|
||||
if (__sb_.close() == 0)
|
||||
if (__sb_.close() == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
@ -1632,7 +1634,7 @@ inline
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(const char* __s, ios_base::openmode __mode)
|
||||
: basic_iostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode) == 0)
|
||||
if (__sb_.open(__s, __mode) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
@ -1642,7 +1644,7 @@ inline
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(const wchar_t* __s, ios_base::openmode __mode)
|
||||
: basic_iostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode) == 0)
|
||||
if (__sb_.open(__s, __mode) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1652,7 +1654,7 @@ inline
|
||||
basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openmode __mode)
|
||||
: basic_iostream<char_type, traits_type>(&__sb_)
|
||||
{
|
||||
if (__sb_.open(__s, __mode) == 0)
|
||||
if (__sb_.open(__s, __mode) == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
#endif
|
||||
@ -1752,10 +1754,16 @@ inline
|
||||
void
|
||||
basic_fstream<_CharT, _Traits>::close()
|
||||
{
|
||||
if (__sb_.close() == 0)
|
||||
if (__sb_.close() == nullptr)
|
||||
this->setstate(ios_base::failbit);
|
||||
}
|
||||
|
||||
#if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ifstream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ofstream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_filebuf<char>)
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
@ -470,6 +470,7 @@ template <> struct hash<bool>;
|
||||
template <> struct hash<char>;
|
||||
template <> struct hash<signed char>;
|
||||
template <> struct hash<unsigned char>;
|
||||
template <> struct hash<char8_t>; // since C++20
|
||||
template <> struct hash<char16_t>;
|
||||
template <> struct hash<char32_t>;
|
||||
template <> struct hash<wchar_t>;
|
||||
@ -508,10 +509,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
|
||||
|
||||
#include <__functional_base>
|
||||
|
||||
#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
|
||||
#include <Block.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
@ -1299,7 +1296,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return<type, _ArgTypes...>::type
|
||||
operator() (_ArgTypes&&... __args) const {
|
||||
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
|
||||
return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
#else
|
||||
|
||||
@ -1307,98 +1304,98 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0>::type
|
||||
operator() (_A0& __a0) const {
|
||||
return __invoke(__f_, __a0);
|
||||
return _VSTD::__invoke(__f_, __a0);
|
||||
}
|
||||
|
||||
template <class _A0>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return0<type, _A0 const>::type
|
||||
operator() (_A0 const& __a0) const {
|
||||
return __invoke(__f_, __a0);
|
||||
return _VSTD::__invoke(__f_, __a0);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1>::type
|
||||
operator() (_A0& __a0, _A1& __a1) const {
|
||||
return __invoke(__f_, __a0, __a1);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1) const {
|
||||
return __invoke(__f_, __a0, __a1);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0, _A1 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1) const {
|
||||
return __invoke(__f_, __a0, __a1);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return1<type, _A0 const, _A1 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1) const {
|
||||
return __invoke(__f_, __a0, __a1);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1& __a1, _A2 const& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0, _A1 const, _A2 const>::type
|
||||
operator() (_A0& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
|
||||
template <class _A0, class _A1, class _A2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
typename __invoke_return2<type, _A0 const, _A1 const, _A2 const>::type
|
||||
operator() (_A0 const& __a0, _A1 const& __a1, _A2 const& __a2) const {
|
||||
return __invoke(__f_, __a0, __a1, __a2);
|
||||
return _VSTD::__invoke(__f_, __a0, __a1, __a2);
|
||||
}
|
||||
#endif
|
||||
};
|
||||
@ -1596,7 +1593,7 @@ public:
|
||||
const _Target& __target() const { return __f_; }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __default_alloc_func(_Target&& __f) : __f_(std::move(__f)) {}
|
||||
explicit __default_alloc_func(_Target&& __f) : __f_(_VSTD::move(__f)) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __default_alloc_func(const _Target& __f) : __f_(__f) {}
|
||||
@ -1612,7 +1609,7 @@ public:
|
||||
__builtin_new_allocator::__holder_t __hold =
|
||||
__builtin_new_allocator::__allocate_type<__default_alloc_func>(1);
|
||||
__default_alloc_func* __res =
|
||||
::new (__hold.get()) __default_alloc_func(__f_);
|
||||
::new ((void*)__hold.get()) __default_alloc_func(__f_);
|
||||
(void)__hold.release();
|
||||
return __res;
|
||||
}
|
||||
@ -1703,7 +1700,7 @@ template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
void
|
||||
__func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__clone(__base<_Rp(_ArgTypes...)>* __p) const
|
||||
{
|
||||
::new (__p) __func(__f_.__target(), __f_.__get_allocator());
|
||||
::new ((void*)__p) __func(__f_.__target(), __f_.__get_allocator());
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
@ -1739,7 +1736,7 @@ __func<_Fp, _Alloc, _Rp(_ArgTypes...)>::target(const type_info& __ti) const _NOE
|
||||
{
|
||||
if (__ti == typeid(_Fp))
|
||||
return &__f_.__target();
|
||||
return (const void*)0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
@ -1769,11 +1766,11 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_func() _NOEXCEPT : __f_(0) {}
|
||||
__value_func() _NOEXCEPT : __f_(nullptr) {}
|
||||
|
||||
template <class _Fp, class _Alloc>
|
||||
_LIBCPP_INLINE_VISIBILITY __value_func(_Fp&& __f, const _Alloc& __a)
|
||||
: __f_(0)
|
||||
: __f_(nullptr)
|
||||
{
|
||||
typedef allocator_traits<_Alloc> __alloc_traits;
|
||||
typedef __function::__func<_Fp, _Alloc, _Rp(_ArgTypes...)> _Fun;
|
||||
@ -1803,13 +1800,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
template <class _Fp,
|
||||
class = typename enable_if<!is_same<typename decay<_Fp>::type, __value_func>::value>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY explicit __value_func(_Fp&& __f)
|
||||
: __value_func(std::forward<_Fp>(__f), allocator<_Fp>()) {}
|
||||
: __value_func(_VSTD::forward<_Fp>(__f), allocator<_Fp>()) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_func(const __value_func& __f)
|
||||
{
|
||||
if (__f.__f_ == 0)
|
||||
__f_ = 0;
|
||||
if (__f.__f_ == nullptr)
|
||||
__f_ = nullptr;
|
||||
else if ((void*)__f.__f_ == &__f.__buf_)
|
||||
{
|
||||
__f_ = __as_base(&__buf_);
|
||||
@ -1822,8 +1819,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__value_func(__value_func&& __f) _NOEXCEPT
|
||||
{
|
||||
if (__f.__f_ == 0)
|
||||
__f_ = 0;
|
||||
if (__f.__f_ == nullptr)
|
||||
__f_ = nullptr;
|
||||
else if ((void*)__f.__f_ == &__f.__buf_)
|
||||
{
|
||||
__f_ = __as_base(&__buf_);
|
||||
@ -1832,7 +1829,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
else
|
||||
{
|
||||
__f_ = __f.__f_;
|
||||
__f.__f_ = 0;
|
||||
__f.__f_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1849,8 +1846,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
__value_func& operator=(__value_func&& __f)
|
||||
{
|
||||
*this = nullptr;
|
||||
if (__f.__f_ == 0)
|
||||
__f_ = 0;
|
||||
if (__f.__f_ == nullptr)
|
||||
__f_ = nullptr;
|
||||
else if ((void*)__f.__f_ == &__f.__buf_)
|
||||
{
|
||||
__f_ = __as_base(&__buf_);
|
||||
@ -1859,7 +1856,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
else
|
||||
{
|
||||
__f_ = __f.__f_;
|
||||
__f.__f_ = 0;
|
||||
__f.__f_ = nullptr;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@ -1868,7 +1865,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
__value_func& operator=(nullptr_t)
|
||||
{
|
||||
__func* __f = __f_;
|
||||
__f_ = 0;
|
||||
__f_ = nullptr;
|
||||
if ((void*)__f == &__buf_)
|
||||
__f->destroy();
|
||||
else if (__f)
|
||||
@ -1879,7 +1876,7 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Rp operator()(_ArgTypes&&... __args) const
|
||||
{
|
||||
if (__f_ == 0)
|
||||
if (__f_ == nullptr)
|
||||
__throw_bad_function_call();
|
||||
return (*__f_)(_VSTD::forward<_ArgTypes>(__args)...);
|
||||
}
|
||||
@ -1895,10 +1892,10 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
__func* __t = __as_base(&__tempbuf);
|
||||
__f_->__clone(__t);
|
||||
__f_->destroy();
|
||||
__f_ = 0;
|
||||
__f_ = nullptr;
|
||||
__f.__f_->__clone(__as_base(&__buf_));
|
||||
__f.__f_->destroy();
|
||||
__f.__f_ = 0;
|
||||
__f.__f_ = nullptr;
|
||||
__f_ = __as_base(&__buf_);
|
||||
__t->__clone(__as_base(&__f.__buf_));
|
||||
__t->destroy();
|
||||
@ -1923,13 +1920,13 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != 0; }
|
||||
_LIBCPP_EXPLICIT operator bool() const _NOEXCEPT { return __f_ != nullptr; }
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const std::type_info& target_type() const _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
if (__f_ == nullptr)
|
||||
return typeid(void);
|
||||
return __f_->target_type();
|
||||
}
|
||||
@ -1937,8 +1934,8 @@ template <class _Rp, class... _ArgTypes> class __value_func<_Rp(_ArgTypes...)>
|
||||
template <typename _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY const _Tp* target() const _NOEXCEPT
|
||||
{
|
||||
if (__f_ == 0)
|
||||
return 0;
|
||||
if (__f_ == nullptr)
|
||||
return nullptr;
|
||||
return (const _Tp*)__f_->target(typeid(_Tp));
|
||||
}
|
||||
#endif // _LIBCPP_NO_RTTI
|
||||
@ -2157,7 +2154,7 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
|
||||
} else {
|
||||
__builtin_new_allocator::__holder_t __hold =
|
||||
__builtin_new_allocator::__allocate_type<_Fun>(1);
|
||||
__buf_.__large = ::new (__hold.get()) _Fun(_VSTD::move(__f));
|
||||
__buf_.__large = ::new ((void*)__hold.get()) _Fun(_VSTD::move(__f));
|
||||
(void)__hold.release();
|
||||
}
|
||||
}
|
||||
@ -2257,6 +2254,9 @@ template <class _Rp, class... _ArgTypes> class __policy_func<_Rp(_ArgTypes...)>
|
||||
|
||||
#if defined(_LIBCPP_HAS_BLOCKS_RUNTIME) && !defined(_LIBCPP_HAS_OBJC_ARC)
|
||||
|
||||
extern "C" void *_Block_copy(const void *);
|
||||
extern "C" void _Block_release(const void *);
|
||||
|
||||
template<class _Rp1, class ..._ArgTypes1, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
|
||||
: public __base<_Rp(_ArgTypes...)>
|
||||
@ -2267,14 +2267,14 @@ class __func<_Rp1(^)(_ArgTypes1...), _Alloc, _Rp(_ArgTypes...)>
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __func(__block_type const& __f)
|
||||
: __f_(__f ? Block_copy(__f) : (__block_type)0)
|
||||
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
|
||||
{ }
|
||||
|
||||
// [TODO] add && to save on a retain
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __func(__block_type __f, const _Alloc& /* unused */)
|
||||
: __f_(__f ? Block_copy(__f) : (__block_type)0)
|
||||
: __f_(reinterpret_cast<__block_type>(__f ? _Block_copy(__f) : nullptr))
|
||||
{ }
|
||||
|
||||
virtual __base<_Rp(_ArgTypes...)>* __clone() const {
|
||||
@ -2286,12 +2286,12 @@ public:
|
||||
}
|
||||
|
||||
virtual void __clone(__base<_Rp(_ArgTypes...)>* __p) const {
|
||||
::new (__p) __func(__f_);
|
||||
::new ((void*)__p) __func(__f_);
|
||||
}
|
||||
|
||||
virtual void destroy() _NOEXCEPT {
|
||||
if (__f_)
|
||||
Block_release(__f_);
|
||||
_Block_release(__f_);
|
||||
__f_ = 0;
|
||||
}
|
||||
|
||||
@ -2303,7 +2303,7 @@ public:
|
||||
}
|
||||
|
||||
virtual _Rp operator()(_ArgTypes&& ... __arg) {
|
||||
return __invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
return _VSTD::__invoke(__f_, _VSTD::forward<_ArgTypes>(__arg)...);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_RTTI
|
||||
@ -2518,7 +2518,7 @@ template<class _Rp, class ..._ArgTypes>
|
||||
function<_Rp(_ArgTypes...)>&
|
||||
function<_Rp(_ArgTypes...)>::operator=(function&& __f) _NOEXCEPT
|
||||
{
|
||||
__f_ = std::move(__f.__f_);
|
||||
__f_ = _VSTD::move(__f.__f_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@ -362,6 +362,7 @@ template <class R, class Alloc> struct uses_allocator<packaged_task<R>, Alloc>;
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <system_error>
|
||||
#include <memory>
|
||||
#include <chrono>
|
||||
@ -624,18 +625,10 @@ protected:
|
||||
public:
|
||||
|
||||
template <class _Arg>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void set_value(_Arg&& __arg);
|
||||
#else
|
||||
void set_value(_Arg& __arg);
|
||||
#endif
|
||||
|
||||
template <class _Arg>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void set_value_at_thread_exit(_Arg&& __arg);
|
||||
#else
|
||||
void set_value_at_thread_exit(_Arg& __arg);
|
||||
#endif
|
||||
|
||||
_Rp move();
|
||||
typename add_lvalue_reference<_Rp>::type copy();
|
||||
@ -654,16 +647,12 @@ template <class _Rp>
|
||||
template <class _Arg>
|
||||
_LIBCPP_AVAILABILITY_FUTURE
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__assoc_state<_Rp>::set_value(_Arg&& __arg)
|
||||
#else
|
||||
__assoc_state<_Rp>::set_value(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
if (this->__has_value())
|
||||
__throw_future_error(future_errc::promise_already_satisfied);
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed | base::ready;
|
||||
__cv_.notify_all();
|
||||
}
|
||||
@ -671,16 +660,12 @@ __assoc_state<_Rp>::set_value(_Arg& __arg)
|
||||
template <class _Rp>
|
||||
template <class _Arg>
|
||||
void
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__assoc_state<_Rp>::set_value_at_thread_exit(_Arg&& __arg)
|
||||
#else
|
||||
__assoc_state<_Rp>::set_value_at_thread_exit(_Arg& __arg)
|
||||
#endif
|
||||
{
|
||||
unique_lock<mutex> __lk(this->__mut_);
|
||||
if (this->__has_value())
|
||||
__throw_future_error(future_errc::promise_already_satisfied);
|
||||
::new(&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
::new ((void*)&__value_) _Rp(_VSTD::forward<_Arg>(__arg));
|
||||
this->__state_ |= base::__constructed;
|
||||
__thread_local_data()->__make_ready_at_thread_exit(this);
|
||||
}
|
||||
@ -856,16 +841,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state
|
||||
_Fp __func_;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __deferred_assoc_state(_Fp&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
inline
|
||||
__deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
||||
@ -874,8 +855,6 @@ __deferred_assoc_state<_Rp, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
||||
this->__set_deferred();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
void
|
||||
__deferred_assoc_state<_Rp, _Fp>::__execute()
|
||||
@ -903,16 +882,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __deferred_assoc_state<void, _Fp>
|
||||
_Fp __func_;
|
||||
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __deferred_assoc_state(_Fp&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Fp>
|
||||
inline
|
||||
__deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
||||
@ -921,8 +896,6 @@ __deferred_assoc_state<void, _Fp>::__deferred_assoc_state(_Fp&& __f)
|
||||
this->__set_deferred();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Fp>
|
||||
void
|
||||
__deferred_assoc_state<void, _Fp>::__execute()
|
||||
@ -952,16 +925,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state
|
||||
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __async_assoc_state(_Fp&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
inline
|
||||
__async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
|
||||
@ -969,8 +938,6 @@ __async_assoc_state<_Rp, _Fp>::__async_assoc_state(_Fp&& __f)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
void
|
||||
__async_assoc_state<_Rp, _Fp>::__execute()
|
||||
@ -1007,16 +974,12 @@ class _LIBCPP_AVAILABILITY_FUTURE __async_assoc_state<void, _Fp>
|
||||
|
||||
virtual void __on_zero_shared() _NOEXCEPT;
|
||||
public:
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __async_assoc_state(_Fp&& __f);
|
||||
#endif
|
||||
|
||||
virtual void __execute();
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Fp>
|
||||
inline
|
||||
__async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
|
||||
@ -1024,8 +987,6 @@ __async_assoc_state<void, _Fp>::__async_assoc_state(_Fp&& __f)
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Fp>
|
||||
void
|
||||
__async_assoc_state<void, _Fp>::__execute()
|
||||
@ -1062,19 +1023,11 @@ template <class _Rp> class _LIBCPP_TEMPLATE_VIS future;
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
_LIBCPP_INLINE_VISIBILITY future<_Rp>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_deferred_assoc_state(_Fp&& __f);
|
||||
#else
|
||||
__make_deferred_assoc_state(_Fp __f);
|
||||
#endif
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
_LIBCPP_INLINE_VISIBILITY future<_Rp>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_async_assoc_state(_Fp&& __f);
|
||||
#else
|
||||
__make_async_assoc_state(_Fp __f);
|
||||
#endif
|
||||
|
||||
template <class _Rp>
|
||||
class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
|
||||
@ -1086,22 +1039,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
||||
#else
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future() _NOEXCEPT : __state_(nullptr) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future(future&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
@ -1110,15 +1055,10 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future& operator=(future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
future(std::move(__rhs)).swap(*this);
|
||||
future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
future(const future&);
|
||||
future& operator=(const future&);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp> share() _NOEXCEPT;
|
||||
@ -1186,22 +1126,14 @@ class _LIBCPP_TEMPLATE_VIS _LIBCPP_AVAILABILITY_FUTURE future<_Rp&>
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
||||
#else
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future() _NOEXCEPT : __state_(nullptr) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future(future&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
@ -1210,15 +1142,10 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future& operator=(future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
future(std::move(__rhs)).swap(*this);
|
||||
future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
future(const future&);
|
||||
future& operator=(const future&);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<_Rp&> share() _NOEXCEPT;
|
||||
@ -1281,22 +1208,14 @@ class _LIBCPP_TYPE_VIS _LIBCPP_AVAILABILITY_FUTURE future<void>
|
||||
template <class> friend class promise;
|
||||
template <class> friend class shared_future;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp&& __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp&& __f);
|
||||
#else
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_deferred_assoc_state(_Fp __f);
|
||||
template <class _R1, class _Fp>
|
||||
friend future<_R1> __make_async_assoc_state(_Fp __f);
|
||||
#endif
|
||||
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future() _NOEXCEPT : __state_(nullptr) {}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future(future&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
@ -1305,15 +1224,10 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
future& operator=(future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
future(std::move(__rhs)).swap(*this);
|
||||
future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
future(const future&);
|
||||
future& operator=(const future&);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
~future();
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future<void> share() _NOEXCEPT;
|
||||
@ -1367,32 +1281,21 @@ public:
|
||||
promise();
|
||||
template <class _Alloc>
|
||||
promise(allocator_arg_t, const _Alloc& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
promise(promise&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
promise(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~promise();
|
||||
|
||||
// assignment
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
promise& operator=(promise&& __rhs) _NOEXCEPT
|
||||
{
|
||||
promise(std::move(__rhs)).swap(*this);
|
||||
promise(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
promise& operator=(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise& operator=(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
@ -1401,16 +1304,12 @@ public:
|
||||
|
||||
// setting the result
|
||||
void set_value(const _Rp& __r);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void set_value(_Rp&& __r);
|
||||
#endif
|
||||
void set_exception(exception_ptr __p);
|
||||
|
||||
// setting the result with deferred notification
|
||||
void set_value_at_thread_exit(const _Rp& __r);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
void set_value_at_thread_exit(_Rp&& __r);
|
||||
#endif
|
||||
void set_exception_at_thread_exit(exception_ptr __p);
|
||||
};
|
||||
|
||||
@ -1429,7 +1328,7 @@ promise<_Rp>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
@ -1464,8 +1363,6 @@ promise<_Rp>::set_value(const _Rp& __r)
|
||||
__state_->set_value(__r);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp>
|
||||
void
|
||||
promise<_Rp>::set_value(_Rp&& __r)
|
||||
@ -1475,8 +1372,6 @@ promise<_Rp>::set_value(_Rp&& __r)
|
||||
__state_->set_value(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp>
|
||||
void
|
||||
promise<_Rp>::set_exception(exception_ptr __p)
|
||||
@ -1496,8 +1391,6 @@ promise<_Rp>::set_value_at_thread_exit(const _Rp& __r)
|
||||
__state_->set_value_at_thread_exit(__r);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp>
|
||||
void
|
||||
promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
|
||||
@ -1507,8 +1400,6 @@ promise<_Rp>::set_value_at_thread_exit(_Rp&& __r)
|
||||
__state_->set_value_at_thread_exit(_VSTD::move(__r));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
template <class _Rp>
|
||||
void
|
||||
promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
|
||||
@ -1535,32 +1426,21 @@ public:
|
||||
promise();
|
||||
template <class _Allocator>
|
||||
promise(allocator_arg_t, const _Allocator& __a);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
promise(promise&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
promise(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~promise();
|
||||
|
||||
// assignment
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
promise& operator=(promise&& __rhs) _NOEXCEPT
|
||||
{
|
||||
promise(std::move(__rhs)).swap(*this);
|
||||
promise(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
promise& operator=(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise& operator=(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
@ -1591,7 +1471,7 @@ promise<_Rp&>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
@ -1672,32 +1552,21 @@ public:
|
||||
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
|
||||
promise(promise&& __rhs) _NOEXCEPT
|
||||
: __state_(__rhs.__state_) {__rhs.__state_ = nullptr;}
|
||||
promise(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~promise();
|
||||
|
||||
// assignment
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
promise& operator=(promise&& __rhs) _NOEXCEPT
|
||||
{
|
||||
promise(std::move(__rhs)).swap(*this);
|
||||
promise(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
promise& operator=(const promise& __rhs) = delete;
|
||||
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
private:
|
||||
promise& operator=(const promise& __rhs);
|
||||
public:
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(promise& __rhs) _NOEXCEPT {_VSTD::swap(__state_, __rhs.__state_);}
|
||||
|
||||
@ -1721,7 +1590,7 @@ promise<void>::promise(allocator_arg_t, const _Alloc& __a0)
|
||||
typedef __allocator_destructor<_A2> _D2;
|
||||
_A2 __a(__a0);
|
||||
unique_ptr<_State, _D2> __hold(__a.allocate(1), _D2(__a, 1));
|
||||
::new(static_cast<void*>(_VSTD::addressof(*__hold.get()))) _State(__a0);
|
||||
::new ((void*)_VSTD::addressof(*__hold.get())) _State(__a0);
|
||||
__state_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
|
||||
@ -1737,8 +1606,6 @@ template <class _Rp, class _Alloc>
|
||||
struct _LIBCPP_TEMPLATE_VIS uses_allocator<promise<_Rp>, _Alloc>
|
||||
: public true_type {};
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// packaged_task
|
||||
|
||||
template<class _Fp> class __packaged_task_base;
|
||||
@ -1788,7 +1655,7 @@ void
|
||||
__packaged_task_func<_Fp, _Alloc, _Rp(_ArgTypes...)>::__move_to(
|
||||
__packaged_task_base<_Rp(_ArgTypes...)>* __p) _NOEXCEPT
|
||||
{
|
||||
::new (__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
|
||||
::new ((void*)__p) __packaged_task_func(_VSTD::move(__f_.first()), _VSTD::move(__f_.second()));
|
||||
}
|
||||
|
||||
template<class _Fp, class _Alloc, class _Rp, class ..._ArgTypes>
|
||||
@ -1823,6 +1690,10 @@ template<class _Rp, class ..._ArgTypes>
|
||||
class _LIBCPP_AVAILABILITY_FUTURE __packaged_task_function<_Rp(_ArgTypes...)>
|
||||
{
|
||||
typedef __packaged_task_base<_Rp(_ArgTypes...)> __base;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_NO_CFI
|
||||
__base* __get_buf() { return (__base*)&__buf_; }
|
||||
|
||||
typename aligned_storage<3*sizeof(void*)>::type __buf_;
|
||||
__base* __f_;
|
||||
|
||||
@ -1856,10 +1727,10 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(__packaged
|
||||
{
|
||||
if (__f.__f_ == nullptr)
|
||||
__f_ = nullptr;
|
||||
else if (__f.__f_ == (__base*)&__f.__buf_)
|
||||
else if (__f.__f_ == __f.__get_buf())
|
||||
{
|
||||
__f.__f_->__move_to(__get_buf());
|
||||
__f_ = (__base*)&__buf_;
|
||||
__f.__f_->__move_to(__f_);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1877,8 +1748,8 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
|
||||
typedef __packaged_task_func<_FR, allocator<_FR>, _Rp(_ArgTypes...)> _FF;
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
::new ((void*)&__buf_) _FF(_VSTD::forward<_Fp>(__f));
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1886,7 +1757,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(_Fp&& __f)
|
||||
_Ap __a;
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a));
|
||||
::new ((void*)__hold.get()) _FF(_VSTD::forward<_Fp>(__f), allocator<_FR>(__a));
|
||||
__f_ = __hold.release();
|
||||
}
|
||||
}
|
||||
@ -1902,7 +1773,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
|
||||
if (sizeof(_FF) <= sizeof(__buf_))
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
::new (__f_) _FF(_VSTD::forward<_Fp>(__f));
|
||||
::new ((void*)__f_) _FF(_VSTD::forward<_Fp>(__f));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1910,7 +1781,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::__packaged_task_function(
|
||||
_Ap __a(__a0);
|
||||
typedef __allocator_destructor<_Ap> _Dp;
|
||||
unique_ptr<__base, _Dp> __hold(__a.allocate(1), _Dp(__a, 1));
|
||||
::new (static_cast<void*>(_VSTD::addressof(*__hold.get())))
|
||||
::new ((void*)_VSTD::addressof(*__hold.get()))
|
||||
_FF(_VSTD::forward<_Fp>(__f), _Alloc(__a));
|
||||
__f_ = _VSTD::addressof(*__hold.release());
|
||||
}
|
||||
@ -1920,17 +1791,17 @@ template<class _Rp, class ..._ArgTypes>
|
||||
__packaged_task_function<_Rp(_ArgTypes...)>&
|
||||
__packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&& __f) _NOEXCEPT
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
if (__f_ == __get_buf())
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
__f_ = nullptr;
|
||||
if (__f.__f_ == nullptr)
|
||||
__f_ = nullptr;
|
||||
else if (__f.__f_ == (__base*)&__f.__buf_)
|
||||
else if (__f.__f_ == __f.__get_buf())
|
||||
{
|
||||
__f_ = (__base*)&__buf_;
|
||||
__f.__f_->__move_to(__f_);
|
||||
__f.__f_->__move_to(__get_buf());
|
||||
__f_ = __get_buf();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1943,13 +1814,14 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator=(__packaged_task_function&
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
__packaged_task_function<_Rp(_ArgTypes...)>::~__packaged_task_function()
|
||||
{
|
||||
if (__f_ == (__base*)&__buf_)
|
||||
if (__f_ == __get_buf())
|
||||
__f_->destroy();
|
||||
else if (__f_)
|
||||
__f_->destroy_deallocate();
|
||||
}
|
||||
|
||||
template<class _Rp, class ..._ArgTypes>
|
||||
_LIBCPP_NO_CFI
|
||||
void
|
||||
__packaged_task_function<_Rp(_ArgTypes...)>::swap(__packaged_task_function& __f) _NOEXCEPT
|
||||
{
|
||||
@ -2268,11 +2140,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
_LIBCPP_INLINE_VISIBILITY future<_Rp>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_deferred_assoc_state(_Fp&& __f)
|
||||
#else
|
||||
__make_deferred_assoc_state(_Fp __f)
|
||||
#endif
|
||||
{
|
||||
unique_ptr<__deferred_assoc_state<_Rp, _Fp>, __release_shared_count>
|
||||
__h(new __deferred_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
|
||||
@ -2281,11 +2149,7 @@ __make_deferred_assoc_state(_Fp __f)
|
||||
|
||||
template <class _Rp, class _Fp>
|
||||
_LIBCPP_INLINE_VISIBILITY future<_Rp>
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
__make_async_assoc_state(_Fp&& __f)
|
||||
#else
|
||||
__make_async_assoc_state(_Fp __f)
|
||||
#endif
|
||||
{
|
||||
unique_ptr<__async_assoc_state<_Rp, _Fp>, __release_shared_count>
|
||||
__h(new __async_assoc_state<_Rp, _Fp>(_VSTD::forward<_Fp>(__f)));
|
||||
@ -2293,6 +2157,8 @@ __make_async_assoc_state(_Fp __f)
|
||||
return future<_Rp>(__h.get());
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Fp, class... _Args>
|
||||
class _LIBCPP_HIDDEN __async_func
|
||||
{
|
||||
@ -2360,7 +2226,7 @@ async(_Fp&& __f, _Args&&... __args)
|
||||
_VSTD::forward<_Args>(__args)...);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
#endif // C++03
|
||||
|
||||
// shared_future
|
||||
|
||||
@ -2375,24 +2241,20 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(const shared_future& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(future<_Rp>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
||||
{__rhs.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~shared_future();
|
||||
shared_future& operator=(const shared_future& __rhs) _NOEXCEPT;
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
shared_future(std::move(__rhs)).swap(*this);
|
||||
shared_future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2449,24 +2311,20 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(future<_Rp&>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
||||
{__rhs.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~shared_future();
|
||||
shared_future& operator=(const shared_future& __rhs);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
shared_future(std::move(__rhs)).swap(*this);
|
||||
shared_future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2523,24 +2381,20 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(const shared_future& __rhs) : __state_(__rhs.__state_)
|
||||
{if (__state_) __state_->__add_shared();}
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(future<void>&& __f) _NOEXCEPT : __state_(__f.__state_)
|
||||
{__f.__state_ = nullptr;}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future(shared_future&& __rhs) _NOEXCEPT : __state_(__rhs.__state_)
|
||||
{__rhs.__state_ = nullptr;}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
~shared_future();
|
||||
shared_future& operator=(const shared_future& __rhs);
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
shared_future& operator=(shared_future&& __rhs) _NOEXCEPT
|
||||
{
|
||||
shared_future(std::move(__rhs)).swap(*this);
|
||||
shared_future(_VSTD::move(__rhs)).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
// retrieving the value
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -2591,8 +2445,6 @@ future<_Rp&>::share() _NOEXCEPT
|
||||
return shared_future<_Rp&>(_VSTD::move(*this));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
inline
|
||||
shared_future<void>
|
||||
future<void>::share() _NOEXCEPT
|
||||
@ -2600,8 +2452,6 @@ future<void>::share() _NOEXCEPT
|
||||
return shared_future<void>(_VSTD::move(*this));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_THREADS
|
||||
|
@ -514,7 +514,7 @@ put_time(const tm* __tm, const _CharT* __fmt)
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _ForwardIterator>
|
||||
std::basic_ostream<_CharT, _Traits> &
|
||||
basic_ostream<_CharT, _Traits> &
|
||||
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
|
||||
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ void
|
||||
basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
|
||||
{
|
||||
ios_base::init(__sb);
|
||||
__tie_ = 0;
|
||||
__tie_ = nullptr;
|
||||
__fill_ = traits_type::eof();
|
||||
}
|
||||
|
||||
@ -821,7 +821,7 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
|
||||
{
|
||||
ios_base::move(__rhs);
|
||||
__tie_ = __rhs.__tie_;
|
||||
__rhs.__tie_ = 0;
|
||||
__rhs.__tie_ = nullptr;
|
||||
__fill_ = __rhs.__fill_;
|
||||
}
|
||||
|
||||
@ -1035,33 +1035,6 @@ defaultfloat(ios_base& __str)
|
||||
return __str;
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class __save_flags
|
||||
{
|
||||
typedef basic_ios<_CharT, _Traits> __stream_type;
|
||||
typedef typename __stream_type::fmtflags fmtflags;
|
||||
|
||||
__stream_type& __stream_;
|
||||
fmtflags __fmtflags_;
|
||||
_CharT __fill_;
|
||||
|
||||
__save_flags(const __save_flags&);
|
||||
__save_flags& operator=(const __save_flags&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __save_flags(__stream_type& __stream)
|
||||
: __stream_(__stream),
|
||||
__fmtflags_(__stream.flags()),
|
||||
__fill_(__stream.fill())
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__save_flags()
|
||||
{
|
||||
__stream_.flags(__fmtflags_);
|
||||
__stream_.fill(__fill_);
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOS
|
||||
|
@ -185,6 +185,36 @@ typedef basic_ifstream<wchar_t> wifstream;
|
||||
typedef basic_ofstream<wchar_t> wofstream;
|
||||
typedef basic_fstream<wchar_t> wfstream;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(ios) _LIBCPP_PREFERRED_NAME(wios) basic_ios;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(streambuf) _LIBCPP_PREFERRED_NAME(wstreambuf) basic_streambuf;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(istream) _LIBCPP_PREFERRED_NAME(wistream) basic_istream;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(ostream) _LIBCPP_PREFERRED_NAME(wostream) basic_ostream;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(iostream) _LIBCPP_PREFERRED_NAME(wiostream) basic_iostream;
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_PREFERRED_NAME(stringbuf) _LIBCPP_PREFERRED_NAME(wstringbuf) basic_stringbuf;
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_PREFERRED_NAME(istringstream) _LIBCPP_PREFERRED_NAME(wistringstream) basic_istringstream;
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_PREFERRED_NAME(ostringstream) _LIBCPP_PREFERRED_NAME(wostringstream) basic_ostringstream;
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_PREFERRED_NAME(stringstream) _LIBCPP_PREFERRED_NAME(wstringstream) basic_stringstream;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(filebuf) _LIBCPP_PREFERRED_NAME(wfilebuf) basic_filebuf;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(ifstream) _LIBCPP_PREFERRED_NAME(wifstream) basic_ifstream;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(ofstream) _LIBCPP_PREFERRED_NAME(wofstream) basic_ofstream;
|
||||
template <class _CharT, class _Traits>
|
||||
class _LIBCPP_PREFERRED_NAME(fstream) _LIBCPP_PREFERRED_NAME(wfstream) basic_fstream;
|
||||
|
||||
template <class _State> class _LIBCPP_TEMPLATE_VIS fpos;
|
||||
typedef fpos<mbstate_t> streampos;
|
||||
typedef fpos<mbstate_t> wstreampos;
|
||||
@ -210,11 +240,40 @@ template <class _CharT, // for <stdexcept>
|
||||
typedef basic_string<char, char_traits<char>, allocator<char> > string;
|
||||
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_PREFERRED_NAME(string) _LIBCPP_PREFERRED_NAME(wstring) basic_string;
|
||||
|
||||
// Include other forward declarations here
|
||||
template <class _Tp, class _Alloc = allocator<_Tp> >
|
||||
class _LIBCPP_TEMPLATE_VIS vector;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class __save_flags
|
||||
{
|
||||
typedef basic_ios<_CharT, _Traits> __stream_type;
|
||||
typedef typename __stream_type::fmtflags fmtflags;
|
||||
|
||||
__stream_type& __stream_;
|
||||
fmtflags __fmtflags_;
|
||||
_CharT __fill_;
|
||||
|
||||
__save_flags(const __save_flags&);
|
||||
__save_flags& operator=(const __save_flags&);
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __save_flags(__stream_type& __stream)
|
||||
: __stream_(__stream),
|
||||
__fmtflags_(__stream.flags()),
|
||||
__fill_(__stream.fill())
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
~__save_flags()
|
||||
{
|
||||
__stream_.flags(__fmtflags_);
|
||||
__stream_.fill(__fill_);
|
||||
}
|
||||
};
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_IOSFWD
|
||||
|
@ -150,9 +150,9 @@ template <class charT, class traits>
|
||||
basic_istream<charT,traits>&
|
||||
ws(basic_istream<charT,traits>& is);
|
||||
|
||||
template <class charT, class traits, class T>
|
||||
basic_istream<charT, traits>&
|
||||
operator>>(basic_istream<charT, traits>&& is, T& x);
|
||||
// rvalue stream extraction
|
||||
template <class Stream, class T>
|
||||
Stream&& operator>>(Stream&& is, T&& x);
|
||||
|
||||
} // std
|
||||
|
||||
@ -1142,7 +1142,7 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->rdbuf() == 0 || this->rdbuf()->sputbackc(__c) == traits_type::eof())
|
||||
if (this->rdbuf() == nullptr || this->rdbuf()->sputbackc(__c) == traits_type::eof())
|
||||
__state |= ios_base::badbit;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ basic_istream<_CharT, _Traits>::unget()
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->rdbuf() == 0 || this->rdbuf()->sungetc() == traits_type::eof())
|
||||
if (this->rdbuf() == nullptr || this->rdbuf()->sungetc() == traits_type::eof())
|
||||
__state |= ios_base::badbit;
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
@ -1215,7 +1215,7 @@ basic_istream<_CharT, _Traits>::sync()
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
if (this->rdbuf() == 0)
|
||||
if (this->rdbuf() == nullptr)
|
||||
return -1;
|
||||
if (this->rdbuf()->pubsync() == -1)
|
||||
{
|
||||
@ -1378,13 +1378,23 @@ ws(basic_istream<_CharT, _Traits>& __is)
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istream<_CharT, _Traits>&
|
||||
operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp&& __x)
|
||||
template <class _Stream, class _Tp, class = void>
|
||||
struct __is_istreamable : false_type { };
|
||||
|
||||
template <class _Stream, class _Tp>
|
||||
struct __is_istreamable<_Stream, _Tp, decltype(
|
||||
_VSTD::declval<_Stream>() >> _VSTD::declval<_Tp>(), void()
|
||||
)> : true_type { };
|
||||
|
||||
template <class _Stream, class _Tp, class = typename enable_if<
|
||||
_And<is_base_of<ios_base, _Stream>,
|
||||
__is_istreamable<_Stream&, _Tp&&>>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Stream&& operator>>(_Stream&& __is, _Tp&& __x)
|
||||
{
|
||||
__is >> _VSTD::forward<_Tp>(__x);
|
||||
return __is;
|
||||
return _VSTD::move(__is);
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
@ -1638,11 +1648,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
|
||||
return __is;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istream<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_iostream<char>)
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -420,10 +420,8 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <initializer_list>
|
||||
#include <__memory/base.h>
|
||||
#include <version>
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
#endif
|
||||
|
||||
#include <__debug>
|
||||
|
||||
@ -498,12 +496,11 @@ struct __has_iterator_typedefs
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename std::__void_t<typename _Up::iterator_category>::type* = 0,
|
||||
typename std::__void_t<typename _Up::difference_type>::type* = 0,
|
||||
typename std::__void_t<typename _Up::value_type>::type* = 0,
|
||||
typename std::__void_t<typename _Up::reference>::type* = 0,
|
||||
typename std::__void_t<typename _Up::pointer>::type* = 0
|
||||
);
|
||||
template <class _Up> static char __test(typename __void_t<typename _Up::iterator_category>::type* = 0,
|
||||
typename __void_t<typename _Up::difference_type>::type* = 0,
|
||||
typename __void_t<typename _Up::value_type>::type* = 0,
|
||||
typename __void_t<typename _Up::reference>::type* = 0,
|
||||
typename __void_t<typename _Up::pointer>::type* = 0);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0,0,0,0,0)) == 1;
|
||||
};
|
||||
@ -515,9 +512,9 @@ struct __has_iterator_category
|
||||
private:
|
||||
struct __two {char __lx; char __lxx;};
|
||||
template <class _Up> static __two __test(...);
|
||||
template <class _Up> static char __test(typename _Up::iterator_category* = 0);
|
||||
template <class _Up> static char __test(typename _Up::iterator_category* = nullptr);
|
||||
public:
|
||||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
static const bool value = sizeof(__test<_Tp>(nullptr)) == 1;
|
||||
};
|
||||
|
||||
template <class _Iter, bool> struct __iterator_traits_impl {};
|
||||
@ -667,9 +664,9 @@ void advance(_InputIter& __i, _Distance __orig_n)
|
||||
{
|
||||
_LIBCPP_ASSERT(__orig_n >= 0 || __is_cpp17_bidirectional_iterator<_InputIter>::value,
|
||||
"Attempt to advance(it, n) with negative n on a non-bidirectional iterator");
|
||||
typedef decltype(__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
typedef decltype(_VSTD::__convert_to_integral(__orig_n)) _IntegralSize;
|
||||
_IntegralSize __n = __orig_n;
|
||||
__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
|
||||
_VSTD::__advance(__i, __n, typename iterator_traits<_InputIter>::iterator_category());
|
||||
}
|
||||
|
||||
template <class _InputIter>
|
||||
@ -696,7 +693,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
typename iterator_traits<_InputIter>::difference_type
|
||||
distance(_InputIter __first, _InputIter __last)
|
||||
{
|
||||
return __distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
|
||||
return _VSTD::__distance(__first, __last, typename iterator_traits<_InputIter>::iterator_category());
|
||||
}
|
||||
|
||||
template <class _InputIter>
|
||||
@ -998,11 +995,11 @@ private:
|
||||
istream_type* __in_stream_;
|
||||
_Tp __value_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(0), __value_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istream_iterator() : __in_stream_(nullptr), __value_() {}
|
||||
_LIBCPP_INLINE_VISIBILITY istream_iterator(istream_type& __s) : __in_stream_(_VSTD::addressof(__s))
|
||||
{
|
||||
if (!(*__in_stream_ >> __value_))
|
||||
__in_stream_ = 0;
|
||||
__in_stream_ = nullptr;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY const _Tp& operator*() const {return __value_;}
|
||||
@ -1010,7 +1007,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY istream_iterator& operator++()
|
||||
{
|
||||
if (!(*__in_stream_ >> __value_))
|
||||
__in_stream_ = 0;
|
||||
__in_stream_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY istream_iterator operator++(int)
|
||||
@ -1052,15 +1049,25 @@ class _LIBCPP_TEMPLATE_VIS ostream_iterator
|
||||
: public iterator<output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
typedef output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
#else
|
||||
typedef void difference_type;
|
||||
#endif
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef basic_ostream<_CharT, _Traits> ostream_type;
|
||||
|
||||
private:
|
||||
ostream_type* __out_stream_;
|
||||
const char_type* __delim_;
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s) _NOEXCEPT
|
||||
: __out_stream_(_VSTD::addressof(__s)), __delim_(0) {}
|
||||
: __out_stream_(_VSTD::addressof(__s)), __delim_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _NOEXCEPT
|
||||
: __out_stream_(_VSTD::addressof(__s)), __delim_(__delimiter) {}
|
||||
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_)
|
||||
@ -1106,11 +1113,11 @@ private:
|
||||
bool __test_for_eof() const
|
||||
{
|
||||
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
|
||||
__sbuf_ = 0;
|
||||
return __sbuf_ == 0;
|
||||
__sbuf_ = nullptr;
|
||||
return __sbuf_ == nullptr;
|
||||
}
|
||||
public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(nullptr) {}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT
|
||||
: __sbuf_(__s.rdbuf()) {}
|
||||
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT
|
||||
@ -1151,10 +1158,20 @@ class _LIBCPP_TEMPLATE_VIS ostreambuf_iterator
|
||||
: public iterator<output_iterator_tag, void, void, void, void>
|
||||
{
|
||||
public:
|
||||
typedef output_iterator_tag iterator_category;
|
||||
typedef void value_type;
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
#else
|
||||
typedef void difference_type;
|
||||
#endif
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
typedef _CharT char_type;
|
||||
typedef _Traits traits_type;
|
||||
typedef basic_streambuf<_CharT, _Traits> streambuf_type;
|
||||
typedef basic_ostream<_CharT, _Traits> ostream_type;
|
||||
|
||||
private:
|
||||
streambuf_type* __sbuf_;
|
||||
public:
|
||||
@ -1165,13 +1182,13 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
|
||||
{
|
||||
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sputc(__c), traits_type::eof()))
|
||||
__sbuf_ = 0;
|
||||
__sbuf_ = nullptr;
|
||||
return *this;
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;}
|
||||
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == nullptr;}
|
||||
|
||||
template <class _Ch, class _Tr>
|
||||
friend
|
||||
@ -1373,13 +1390,13 @@ operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOE
|
||||
|
||||
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 copy_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17 move_backward(_B1, _B1, _B2);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL < 2
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1390,7 +1407,7 @@ __unwrap_iter(__wrap_iter<_Tp*>);
|
||||
#else
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1418,20 +1435,20 @@ public:
|
||||
: __i{}
|
||||
#endif
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
template <class _Up> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter(const __wrap_iter<_Up>& __u,
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0) _NOEXCEPT
|
||||
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = nullptr) _NOEXCEPT
|
||||
: __i(__u.base())
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__u);
|
||||
#endif
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
__wrap_iter(const __wrap_iter& __x)
|
||||
: __i(__x.base())
|
||||
@ -1456,7 +1473,7 @@ public:
|
||||
#endif
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator*() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable iterator");
|
||||
#endif
|
||||
@ -1464,7 +1481,7 @@ public:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG pointer operator->() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable iterator");
|
||||
#endif
|
||||
@ -1472,7 +1489,7 @@ public:
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator++() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment non-incrementable iterator");
|
||||
#endif
|
||||
@ -1484,7 +1501,7 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator--() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement non-decrementable iterator");
|
||||
#endif
|
||||
@ -1497,7 +1514,7 @@ public:
|
||||
{__wrap_iter __w(*this); __w += __n; return __w;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
|
||||
"Attempted to add/subtract iterator outside of valid range");
|
||||
#endif
|
||||
@ -1510,7 +1527,7 @@ public:
|
||||
{*this += -__n; return *this;}
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG reference operator[](difference_type __n) const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
|
||||
"Attempted to subscript iterator outside of valid range");
|
||||
#endif
|
||||
@ -1520,7 +1537,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG iterator_type base() const _NOEXCEPT {return __i;}
|
||||
|
||||
private:
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
|
||||
{
|
||||
__get_db()->__insert_ic(this, __p);
|
||||
@ -1584,12 +1601,12 @@ private:
|
||||
|
||||
template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op copy(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 copy_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
|
||||
template <class _Ip, class _Op> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _Op move(_Ip, _Ip, _Op);
|
||||
template <class _B1, class _B2> friend _LIBCPP_CONSTEXPR_AFTER_CXX17 _B2 move_backward(_B1, _B1, _B2);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL < 2
|
||||
template <class _Tp>
|
||||
_LIBCPP_CONSTEXPR_IF_NODEBUG friend
|
||||
_LIBCPP_CONSTEXPR friend
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1598,7 +1615,7 @@ private:
|
||||
__unwrap_iter(__wrap_iter<_Tp*>);
|
||||
#else
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR friend
|
||||
typename enable_if
|
||||
<
|
||||
is_trivially_copy_assignable<_Tp>::value,
|
||||
@ -1621,7 +1638,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
bool
|
||||
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
|
||||
"Attempted to compare incomparable iterators");
|
||||
#endif
|
||||
@ -1699,7 +1716,7 @@ auto
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
-> decltype(__x.base() - __y.base())
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
|
||||
"Attempted to subtract incompatible iterators");
|
||||
#endif
|
||||
@ -1711,7 +1728,7 @@ inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_IF_NODEBUG
|
||||
typename __wrap_iter<_Iter1>::difference_type
|
||||
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
|
||||
"Attempted to subtract incompatible iterators");
|
||||
#endif
|
||||
|
@ -19,6 +19,8 @@ namespace std
|
||||
class latch
|
||||
{
|
||||
public:
|
||||
static constexpr ptrdiff_t max() noexcept;
|
||||
|
||||
constexpr explicit latch(ptrdiff_t __expected);
|
||||
~latch();
|
||||
|
||||
@ -39,6 +41,7 @@ namespace std
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <atomic>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
@ -49,6 +52,9 @@ namespace std
|
||||
# error <latch> is not supported on this single threaded system
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@ -101,4 +107,6 @@ _LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif //_LIBCPP_LATCH
|
||||
|
@ -293,7 +293,7 @@ class _LIBCPP_TEMPLATE_VIS __list_iterator
|
||||
|
||||
__link_pointer __ptr_;
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
|
||||
: __ptr_(__p)
|
||||
@ -320,12 +320,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator(const __list_iterator& __p)
|
||||
@ -351,12 +351,12 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||
#endif
|
||||
@ -365,7 +365,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::iterator");
|
||||
#endif
|
||||
@ -375,7 +375,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator& operator++()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment non-incrementable list::iterator");
|
||||
#endif
|
||||
@ -388,7 +388,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_iterator& operator--()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement non-decrementable list::iterator");
|
||||
#endif
|
||||
@ -416,7 +416,7 @@ class _LIBCPP_TEMPLATE_VIS __list_const_iterator
|
||||
|
||||
__link_pointer __ptr_;
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit __list_const_iterator(__link_pointer __p, const void* __c) _NOEXCEPT
|
||||
: __ptr_(__p)
|
||||
@ -440,7 +440,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_i(this);
|
||||
#endif
|
||||
}
|
||||
@ -448,12 +448,12 @@ public:
|
||||
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT
|
||||
: __ptr_(__p.__ptr_)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__iterator_copy(this, &__p);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator(const __list_const_iterator& __p)
|
||||
@ -479,11 +479,11 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reference operator*() const
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::const_iterator");
|
||||
#endif
|
||||
@ -492,7 +492,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pointer operator->() const
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to dereference a non-dereferenceable list::const_iterator");
|
||||
#endif
|
||||
@ -502,7 +502,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator& operator++()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
|
||||
"Attempted to increment non-incrementable list::const_iterator");
|
||||
#endif
|
||||
@ -515,7 +515,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__list_const_iterator& operator--()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
|
||||
"Attempted to decrement non-decrementable list::const_iterator");
|
||||
#endif
|
||||
@ -614,7 +614,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__end_.__next_, this);
|
||||
#else
|
||||
return iterator(__end_.__next_);
|
||||
@ -623,7 +623,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator begin() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__end_.__next_, this);
|
||||
#else
|
||||
return const_iterator(__end_.__next_);
|
||||
@ -632,7 +632,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator end() _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__end_as_link(), this);
|
||||
#else
|
||||
return iterator(__end_as_link());
|
||||
@ -641,7 +641,7 @@ protected:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(__end_as_link(), this);
|
||||
#else
|
||||
return const_iterator(__end_as_link());
|
||||
@ -696,7 +696,7 @@ private:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __invalidate_all_iterators() {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif
|
||||
}
|
||||
@ -735,13 +735,13 @@ inline __list_imp<_Tp, _Alloc>::__list_imp(const __node_allocator& __a)
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class _Tp, class _Alloc>
|
||||
inline __list_imp<_Tp, _Alloc>::__list_imp(__node_allocator&& __a) _NOEXCEPT
|
||||
: __size_alloc_(0, std::move(__a)) {}
|
||||
: __size_alloc_(0, _VSTD::move(__a)) {}
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
__list_imp<_Tp, _Alloc>::~__list_imp() {
|
||||
clear();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -783,7 +783,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
"list::swap: Either propagate_on_container_swap must be true"
|
||||
" or the allocators must compare equal");
|
||||
using _VSTD::swap;
|
||||
__swap_allocator(__node_alloc(), __c.__node_alloc());
|
||||
_VSTD::__swap_allocator(__node_alloc(), __c.__node_alloc());
|
||||
swap(__sz(), __c.__sz());
|
||||
swap(__end_, __c.__end_);
|
||||
if (__sz() == 0)
|
||||
@ -795,13 +795,13 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
else
|
||||
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_ = __c.__end_as_link();
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(&__c);
|
||||
std::swap(__cn1->beg_, __cn2->beg_);
|
||||
std::swap(__cn1->end_, __cn2->end_);
|
||||
std::swap(__cn1->cap_, __cn2->cap_);
|
||||
_VSTD::swap(__cn1->beg_, __cn2->beg_);
|
||||
_VSTD::swap(__cn1->end_, __cn2->end_);
|
||||
_VSTD::swap(__cn1->cap_, __cn2->cap_);
|
||||
for (__i_node** __p = __cn1->end_; __p != __cn1->beg_;)
|
||||
{
|
||||
--__p;
|
||||
@ -810,7 +810,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
{
|
||||
__cn2->__add(*__p);
|
||||
if (--__cn1->end_ != __p)
|
||||
memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__cn1->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
else
|
||||
(*__p)->__c_ = __cn1;
|
||||
@ -823,7 +823,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
|
||||
{
|
||||
__cn1->__add(*__p);
|
||||
if (--__cn2->end_ != __p)
|
||||
memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
else
|
||||
(*__p)->__c_ = __cn2;
|
||||
@ -870,14 +870,14 @@ public:
|
||||
list()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit list(const allocator_type& __a) : base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -937,7 +937,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type max_size() const _NOEXCEPT
|
||||
{
|
||||
return std::min<size_type>(
|
||||
return _VSTD::min<size_type>(
|
||||
base::__node_alloc_max_size(),
|
||||
numeric_limits<difference_type >::max());
|
||||
}
|
||||
@ -1117,14 +1117,14 @@ public:
|
||||
return __hold_pointer(__p, __node_destructor(__na, 1));
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1144,7 +1144,7 @@ private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
list(_InputIterator, _InputIterator)
|
||||
@ -1207,7 +1207,7 @@ list<_Tp, _Alloc>::__iterator(size_type __n)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
@ -1222,7 +1222,7 @@ list<_Tp, _Alloc>::list(size_type __n)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
@ -1233,7 +1233,7 @@ list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
@ -1244,7 +1244,7 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x, const allocator_type& __a)
|
||||
: base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __n > 0; --__n)
|
||||
@ -1256,7 +1256,7 @@ template <class _InpIter>
|
||||
list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l,
|
||||
typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __f != __l; ++__f)
|
||||
@ -1269,7 +1269,7 @@ list<_Tp, _Alloc>::list(_InpIter __f, _InpIter __l, const allocator_type& __a,
|
||||
typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
|
||||
: base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __f != __l; ++__f)
|
||||
@ -1280,7 +1280,7 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(const list& __c)
|
||||
: base(__node_alloc_traits::select_on_container_copy_construction(
|
||||
__c.__node_alloc())) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
|
||||
@ -1291,7 +1291,7 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(const list& __c, const allocator_type& __a)
|
||||
: base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (const_iterator __i = __c.begin(), __e = __c.end(); __i != __e; ++__i)
|
||||
@ -1304,7 +1304,7 @@ template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
: base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
|
||||
@ -1315,7 +1315,7 @@ list<_Tp, _Alloc>::list(initializer_list<value_type> __il, const allocator_type&
|
||||
template <class _Tp, class _Alloc>
|
||||
list<_Tp, _Alloc>::list(initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (typename initializer_list<value_type>::const_iterator __i = __il.begin(),
|
||||
@ -1327,7 +1327,7 @@ template <class _Tp, class _Alloc>
|
||||
inline list<_Tp, _Alloc>::list(list&& __c)
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value)
|
||||
: base(_VSTD::move(__c.__node_alloc())) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
splice(end(), __c);
|
||||
@ -1338,7 +1338,7 @@ inline
|
||||
list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
|
||||
: base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a == __c.get_allocator())
|
||||
@ -1415,7 +1415,7 @@ list<_Tp, _Alloc>::assign(_InpIter __f, _InpIter __l,
|
||||
insert(__e, __f, __l);
|
||||
else
|
||||
erase(__i, __e);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif
|
||||
}
|
||||
@ -1432,7 +1432,7 @@ list<_Tp, _Alloc>::assign(size_type __n, const value_type& __x)
|
||||
insert(__e, __n, __x);
|
||||
else
|
||||
erase(__i, __e);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif
|
||||
}
|
||||
@ -1449,7 +1449,7 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::insert(iterator, x) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1459,7 +1459,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
__link_nodes(__p.__ptr_, __hold->__as_link(), __hold->__as_link());
|
||||
++base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__hold.release()->__as_link(), this);
|
||||
#else
|
||||
return iterator(__hold.release()->__as_link());
|
||||
@ -1470,7 +1470,7 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::insert(iterator, n, x) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1485,7 +1485,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__r = iterator(__hold->__as_link(), this);
|
||||
#else
|
||||
__r = iterator(__hold->__as_link());
|
||||
@ -1515,7 +1515,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__e = iterator(__prev, this);
|
||||
#else
|
||||
__e = iterator(__prev);
|
||||
@ -1536,7 +1536,7 @@ typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
typename enable_if<__is_cpp17_input_iterator<_InpIter>::value>::type*)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::insert(iterator, range) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1551,7 +1551,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
|
||||
++__ds;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__r = iterator(__hold.get()->__as_link(), this);
|
||||
#else
|
||||
__r = iterator(__hold.get()->__as_link());
|
||||
@ -1581,7 +1581,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__e = iterator(__prev, this);
|
||||
#else
|
||||
__e = iterator(__prev);
|
||||
@ -1695,7 +1695,7 @@ template <class... _Args>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::emplace(iterator, args...) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1707,7 +1707,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
|
||||
__link_nodes(__p.__ptr_, __nl, __nl);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__nl, this);
|
||||
#else
|
||||
return iterator(__nl);
|
||||
@ -1718,7 +1718,7 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::insert(iterator, x) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1730,7 +1730,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
|
||||
__link_nodes(__p.__ptr_, __nl, __nl);
|
||||
++base::__sz();
|
||||
__hold.release();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__nl, this);
|
||||
#else
|
||||
return iterator(__nl);
|
||||
@ -1748,7 +1748,7 @@ list<_Tp, _Alloc>::pop_front()
|
||||
__link_pointer __n = base::__end_.__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
@ -1758,7 +1758,7 @@ list<_Tp, _Alloc>::pop_front()
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -1777,7 +1777,7 @@ list<_Tp, _Alloc>::pop_back()
|
||||
__link_pointer __n = base::__end_.__prev_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
@ -1787,7 +1787,7 @@ list<_Tp, _Alloc>::pop_back()
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -1801,7 +1801,7 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::erase(iterator) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1813,7 +1813,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
__link_pointer __r = __n->__next_;
|
||||
base::__unlink_nodes(__n, __n);
|
||||
--base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __ip = __c->end_; __ip != __c->beg_; )
|
||||
{
|
||||
@ -1823,7 +1823,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
{
|
||||
(*__ip)->__c_ = nullptr;
|
||||
if (--__c->end_ != __ip)
|
||||
memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__ip, __ip+1, (__c->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -1831,7 +1831,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
|
||||
__node_pointer __np = __n->__as_node();
|
||||
__node_alloc_traits::destroy(__na, _VSTD::addressof(__np->__value_));
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__r, this);
|
||||
#else
|
||||
return iterator(__r);
|
||||
@ -1842,7 +1842,7 @@ template <class _Tp, class _Alloc>
|
||||
typename list<_Tp, _Alloc>::iterator
|
||||
list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__f) == this,
|
||||
"list::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -1859,7 +1859,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
__link_pointer __n = __f.__ptr_;
|
||||
++__f;
|
||||
--base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; )
|
||||
{
|
||||
@ -1869,7 +1869,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -1879,7 +1879,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
|
||||
__node_alloc_traits::deallocate(__na, __np, 1);
|
||||
}
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(__l.__ptr_, this);
|
||||
#else
|
||||
return iterator(__l.__ptr_);
|
||||
@ -1900,7 +1900,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__hold_pointer __hold = __allocate_node(__na);
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
|
||||
++__ds;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
iterator __r = iterator(__hold.release()->__as_link(), this);
|
||||
#else
|
||||
iterator __r = iterator(__hold.release()->__as_link());
|
||||
@ -1929,7 +1929,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__e = iterator(__prev, this);
|
||||
#else
|
||||
__e = iterator(__prev);
|
||||
@ -1958,7 +1958,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
|
||||
++__ds;
|
||||
__link_pointer __nl = __hold.release()->__as_link();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
iterator __r = iterator(__nl, this);
|
||||
#else
|
||||
iterator __r = iterator(__nl);
|
||||
@ -1987,7 +1987,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
|
||||
__node_alloc_traits::deallocate(__na, __e.__ptr_->__as_node(), 1);
|
||||
if (__prev == 0)
|
||||
break;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__e = iterator(__prev, this);
|
||||
#else
|
||||
__e = iterator(__prev);
|
||||
@ -2007,7 +2007,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
||||
{
|
||||
_LIBCPP_ASSERT(this != &__c,
|
||||
"list::splice(iterator, list) called with this == &list");
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::splice(iterator, list) called with an iterator not"
|
||||
" referring to this list");
|
||||
@ -2020,7 +2020,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
||||
__link_nodes(__p.__ptr_, __f, __l);
|
||||
base::__sz() += __c.__sz();
|
||||
__c.__sz() = 0;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
if (&__c != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
@ -2034,7 +2034,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
@ -2047,7 +2047,7 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::splice(iterator, list, iterator) called with first iterator not"
|
||||
" referring to this list");
|
||||
@ -2056,7 +2056,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
" referring to list argument");
|
||||
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(&__i),
|
||||
"list::splice(iterator, list, iterator) called with second iterator not"
|
||||
" derefereceable");
|
||||
" dereferenceable");
|
||||
#endif
|
||||
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
|
||||
{
|
||||
@ -2065,7 +2065,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
__link_nodes(__p.__ptr_, __f, __f);
|
||||
--__c.__sz();
|
||||
++base::__sz();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
if (&__c != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
@ -2079,7 +2079,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
@ -2092,7 +2092,7 @@ template <class _Tp, class _Alloc>
|
||||
void
|
||||
list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, const_iterator __l)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"list::splice(iterator, list, iterator, iterator) called with first iterator not"
|
||||
" referring to this list");
|
||||
@ -2121,7 +2121,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
||||
}
|
||||
base::__unlink_nodes(__first, __last);
|
||||
__link_nodes(__p.__ptr_, __first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
if (&__c != this) {
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
@ -2138,7 +2138,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
|
||||
__cn1->__add(*__ip);
|
||||
(*__ip)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __ip)
|
||||
memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__ip, __ip+1, (__cn2->end_ - __ip)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2258,7 +2258,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
++__f1;
|
||||
}
|
||||
splice(__e1, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__libcpp_db* __db = __get_db();
|
||||
__c_node* __cn1 = __db->__find_c_and_lock(this);
|
||||
__c_node* __cn2 = __db->__find_c(&__c);
|
||||
@ -2271,7 +2271,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
|
||||
__cn1->__add(*__p);
|
||||
(*__p)->__c_ = __cn1;
|
||||
if (--__cn2->end_ != __p)
|
||||
memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__cn2->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__db->unlock();
|
||||
@ -2382,7 +2382,7 @@ list<_Tp, _Alloc>::__invariants() const
|
||||
return size() == _VSTD::distance(begin(), end());
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
bool
|
||||
@ -2412,7 +2412,7 @@ list<_Tp, _Alloc>::__subscriptable(const const_iterator*, ptrdiff_t) const
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Alloc>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -197,10 +197,6 @@ template <class charT> class messages_byname;
|
||||
#include <nl_types.h>
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <Availability.h>
|
||||
#endif
|
||||
|
||||
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
|
||||
#include <__bsd_locale_defaults.h>
|
||||
#else
|
||||
@ -261,11 +257,11 @@ __scan_keyword(_InputIterator& __b, _InputIterator __e,
|
||||
const unsigned char __does_match = '\2';
|
||||
unsigned char __statbuf[100];
|
||||
unsigned char* __status = __statbuf;
|
||||
unique_ptr<unsigned char, void(*)(void*)> __stat_hold(0, free);
|
||||
unique_ptr<unsigned char, void(*)(void*)> __stat_hold(nullptr, free);
|
||||
if (__nkw > sizeof(__statbuf))
|
||||
{
|
||||
__status = (unsigned char*)malloc(__nkw);
|
||||
if (__status == 0)
|
||||
if (__status == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__stat_hold.reset(__status);
|
||||
}
|
||||
@ -561,8 +557,8 @@ __num_get<_CharT>::__stage2_float_loop(_CharT __ct, bool& __in_units, char& __ex
|
||||
return 0;
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_get<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS num_get
|
||||
@ -877,7 +873,7 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
const numpunct<_CharT>& __np = use_facet<numpunct<_CharT> >(__iob.getloc());
|
||||
typedef typename numpunct<_CharT>::string_type string_type;
|
||||
const string_type __names[2] = {__np.truename(), __np.falsename()};
|
||||
const string_type* __i = __scan_keyword(__b, __e, __names, __names+2,
|
||||
const string_type* __i = _VSTD::__scan_keyword(__b, __e, __names, __names+2,
|
||||
__ct, __err);
|
||||
__v = __i == __names;
|
||||
return __b;
|
||||
@ -1099,8 +1095,8 @@ num_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_get<wchar_t>)
|
||||
|
||||
struct _LIBCPP_TYPE_VIS __num_put_base
|
||||
{
|
||||
@ -1249,8 +1245,8 @@ __num_put<_CharT>::__widen_and_group_float(char* __nb, char* __np, char* __ne,
|
||||
__op = __ob + (__np - __nb);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(struct _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __num_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS num_put
|
||||
@ -1427,7 +1423,7 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
return do_put(__s, __iob, __fl, (unsigned long)__v);
|
||||
const numpunct<char_type>& __np = use_facet<numpunct<char_type> >(__iob.getloc());
|
||||
typedef typename numpunct<char_type>::string_type string_type;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
string_type __tmp(__v ? __np.truename() : __np.falsename());
|
||||
string_type __nm = _VSTD::move(__tmp);
|
||||
#else
|
||||
@ -1564,14 +1560,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
(int)__iob.precision(), __v);
|
||||
else
|
||||
__nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
else
|
||||
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
if (__nb == 0)
|
||||
if (__nb == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
}
|
||||
@ -1615,14 +1611,14 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
(int)__iob.precision(), __v);
|
||||
else
|
||||
__nc = __libcpp_snprintf_l(__nb, __nbuf, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
unique_ptr<char, void(*)(void*)> __nbh(0, free);
|
||||
unique_ptr<char, void(*)(void*)> __nbh(nullptr, free);
|
||||
if (__nc > static_cast<int>(__nbuf-1))
|
||||
{
|
||||
if (__specify_precision)
|
||||
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, (int)__iob.precision(), __v);
|
||||
else
|
||||
__nc = __libcpp_asprintf_l(&__nb, _LIBCPP_GET_C_LOCALE, __fmt, __v);
|
||||
if (__nb == 0)
|
||||
if (__nb == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__nbh.reset(__nb);
|
||||
}
|
||||
@ -1676,8 +1672,8 @@ num_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base& __iob,
|
||||
return __pad_and_output(__s, __o, __op, __oe, __iob, __fl);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS num_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator>
|
||||
_LIBCPP_HIDDEN
|
||||
@ -1916,7 +1912,7 @@ time_get<_CharT, _InputIterator>::__get_weekdayname(int& __w,
|
||||
{
|
||||
// Note: ignoring case comes from the POSIX strptime spec
|
||||
const string_type* __wk = this->__weeks();
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
|
||||
ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __wk, __wk+14, __ct, __err, false) - __wk;
|
||||
if (__i < 14)
|
||||
__w = __i % 7;
|
||||
}
|
||||
@ -1930,7 +1926,7 @@ time_get<_CharT, _InputIterator>::__get_monthname(int& __m,
|
||||
{
|
||||
// Note: ignoring case comes from the POSIX strptime spec
|
||||
const string_type* __month = this->__months();
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
|
||||
ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __month, __month+24, __ct, __err, false) - __month;
|
||||
if (__i < 24)
|
||||
__m = __i % 12;
|
||||
}
|
||||
@ -1942,7 +1938,7 @@ time_get<_CharT, _InputIterator>::__get_day(int& __d,
|
||||
ios_base::iostate& __err,
|
||||
const ctype<char_type>& __ct) const
|
||||
{
|
||||
int __t = __get_up_to_n_digits(__b, __e, __err, __ct, 2);
|
||||
int __t = _VSTD::__get_up_to_n_digits(__b, __e, __err, __ct, 2);
|
||||
if (!(__err & ios_base::failbit) && 1 <= __t && __t <= 31)
|
||||
__d = __t;
|
||||
else
|
||||
@ -2102,7 +2098,7 @@ time_get<_CharT, _InputIterator>::__get_am_pm(int& __h,
|
||||
__err |= ios_base::failbit;
|
||||
return;
|
||||
}
|
||||
ptrdiff_t __i = __scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
|
||||
ptrdiff_t __i = _VSTD::__scan_keyword(__b, __e, __ap, __ap+2, __ct, __err, false) - __ap;
|
||||
if (__i == 0 && __h == 12)
|
||||
__h = 0;
|
||||
else if (__i == 1 && __h < 12)
|
||||
@ -2362,8 +2358,8 @@ time_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get<wchar_t>)
|
||||
|
||||
class _LIBCPP_TYPE_VIS __time_get
|
||||
{
|
||||
@ -2462,8 +2458,8 @@ private:
|
||||
virtual const string_type& __X() const {return this->__X_;}
|
||||
};
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_get_byname<wchar_t>)
|
||||
|
||||
class _LIBCPP_TYPE_VIS __time_put
|
||||
{
|
||||
@ -2575,8 +2571,8 @@ time_put<_CharT, _OutputIterator>::do_put(iter_type __s, ios_base&,
|
||||
return _VSTD::copy(__nb, __ne, __s);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS time_put_byname
|
||||
@ -2596,8 +2592,8 @@ protected:
|
||||
~time_put_byname() {}
|
||||
};
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS time_put_byname<wchar_t>)
|
||||
|
||||
// money_base
|
||||
|
||||
@ -2663,10 +2659,10 @@ template <class _CharT, bool _International>
|
||||
const bool
|
||||
moneypunct<_CharT, _International>::intl;
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct<wchar_t, true>)
|
||||
|
||||
// moneypunct_byname
|
||||
|
||||
@ -2720,10 +2716,10 @@ template<> _LIBCPP_FUNC_VIS void moneypunct_byname<char, true>::init(const char*
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, false>::init(const char*);
|
||||
template<> _LIBCPP_FUNC_VIS void moneypunct_byname<wchar_t, true>::init(const char*);
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<char, true>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, false>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS moneypunct_byname<wchar_t, true>)
|
||||
|
||||
// money_get
|
||||
|
||||
@ -2779,8 +2775,8 @@ __money_get<_CharT>::__gather_info(bool __intl, const locale& __loc,
|
||||
}
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_get<wchar_t>)
|
||||
|
||||
template <class _CharT, class _InputIterator = istreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS money_get
|
||||
@ -3108,11 +3104,11 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
__ct.widen(__src, __src + (sizeof(__src)-1), __atoms);
|
||||
char __nbuf[__bz];
|
||||
char* __nc = __nbuf;
|
||||
unique_ptr<char, void(*)(void*)> __h(0, free);
|
||||
unique_ptr<char, void(*)(void*)> __h(nullptr, free);
|
||||
if (__wn - __wb.get() > __bz-2)
|
||||
{
|
||||
__h.reset((char*)malloc(static_cast<size_t>(__wn - __wb.get() + 2)));
|
||||
if (__h.get() == 0)
|
||||
if (__h.get() == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__nc = __h.get();
|
||||
}
|
||||
@ -3162,8 +3158,8 @@ money_get<_CharT, _InputIterator>::do_get(iter_type __b, iter_type __e,
|
||||
return __b;
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_get<wchar_t>)
|
||||
|
||||
// money_put
|
||||
|
||||
@ -3337,8 +3333,8 @@ __money_put<_CharT>::__format(char_type* __mb, char_type*& __mi, char_type*& __m
|
||||
__mi = __mb;
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __money_put<wchar_t>)
|
||||
|
||||
template <class _CharT, class _OutputIterator = ostreambuf_iterator<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS money_put
|
||||
@ -3397,13 +3393,13 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
char_type __digits[__bs];
|
||||
char_type* __db = __digits;
|
||||
size_t __n = static_cast<size_t>(snprintf(__bb, __bs, "%.0Lf", __units));
|
||||
unique_ptr<char, void(*)(void*)> __hn(0, free);
|
||||
unique_ptr<char, void(*)(void*)> __hn(nullptr, free);
|
||||
unique_ptr<char_type, void(*)(void*)> __hd(0, free);
|
||||
// secure memory for digit storage
|
||||
if (__n > __bs-1)
|
||||
{
|
||||
__n = static_cast<size_t>(__libcpp_asprintf_l(&__bb, _LIBCPP_GET_C_LOCALE, "%.0Lf", __units));
|
||||
if (__bb == 0)
|
||||
if (__bb == nullptr)
|
||||
__throw_bad_alloc();
|
||||
__hn.reset(__bb);
|
||||
__hd.reset((char_type*)malloc(__n * sizeof(char_type)));
|
||||
@ -3490,8 +3486,8 @@ money_put<_CharT, _OutputIterator>::do_put(iter_type __s, bool __intl,
|
||||
return __pad_and_output(__s, __mb, __mi, __me, __iob, __fl);
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS money_put<wchar_t>)
|
||||
|
||||
// messages
|
||||
|
||||
@ -3582,7 +3578,7 @@ messages<_CharT>::do_get(catalog __c, int __set, int __msgid,
|
||||
char* __n = catgets(__cat, __set, __msgid, __ndflt.c_str());
|
||||
string_type __w;
|
||||
__widen_from_utf8<sizeof(char_type)*__CHAR_BIT__>()(back_inserter(__w),
|
||||
__n, __n + strlen(__n));
|
||||
__n, __n + _VSTD::strlen(__n));
|
||||
return __w;
|
||||
#else // !_LIBCPP_HAS_CATOPEN
|
||||
_LIBCPP_UNUSED_VAR(__c);
|
||||
@ -3606,8 +3602,8 @@ messages<_CharT>::do_close(catalog __c) const
|
||||
#endif // _LIBCPP_HAS_CATOPEN
|
||||
}
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages<wchar_t>)
|
||||
|
||||
template <class _CharT>
|
||||
class _LIBCPP_TEMPLATE_VIS messages_byname
|
||||
@ -3630,8 +3626,8 @@ protected:
|
||||
~messages_byname() {}
|
||||
};
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS messages_byname<wchar_t>)
|
||||
|
||||
template<class _Codecvt, class _Elem = wchar_t,
|
||||
class _Wide_alloc = allocator<_Elem>,
|
||||
@ -3923,7 +3919,7 @@ private:
|
||||
wbuffer_convert(const wbuffer_convert&);
|
||||
wbuffer_convert& operator=(const wbuffer_convert&);
|
||||
public:
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = 0,
|
||||
_LIBCPP_EXPLICIT_AFTER_CXX11 wbuffer_convert(streambuf* __bytebuf = nullptr,
|
||||
_Codecvt* __pcvt = new _Codecvt, state_type __state = state_type());
|
||||
~wbuffer_convert();
|
||||
|
||||
@ -3961,9 +3957,9 @@ private:
|
||||
template <class _Codecvt, class _Elem, class _Tr>
|
||||
wbuffer_convert<_Codecvt, _Elem, _Tr>::
|
||||
wbuffer_convert(streambuf* __bytebuf, _Codecvt* __pcvt, state_type __state)
|
||||
: __extbuf_(0),
|
||||
__extbufnext_(0),
|
||||
__extbufend_(0),
|
||||
: __extbuf_(nullptr),
|
||||
__extbufnext_(nullptr),
|
||||
__extbufend_(nullptr),
|
||||
__ebs_(0),
|
||||
__intbuf_(0),
|
||||
__ibs_(0),
|
||||
@ -4003,7 +3999,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
|
||||
int_type __c = traits_type::eof();
|
||||
if (this->gptr() == this->egptr())
|
||||
{
|
||||
memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
|
||||
_VSTD::memmove(this->eback(), this->egptr() - __unget_sz, __unget_sz * sizeof(char_type));
|
||||
if (__always_noconv_)
|
||||
{
|
||||
streamsize __nmemb = static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz);
|
||||
@ -4020,7 +4016,7 @@ wbuffer_convert<_Codecvt, _Elem, _Tr>::underflow()
|
||||
{
|
||||
_LIBCPP_ASSERT(!(__extbufnext_ == NULL && (__extbufend_ != __extbufnext_)), "underflow moving from NULL" );
|
||||
if (__extbufend_ != __extbufnext_)
|
||||
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
_VSTD::memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
|
||||
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
|
||||
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
|
||||
streamsize __nmemb = _VSTD::min(static_cast<streamsize>(this->egptr() - this->eback() - __unget_sz),
|
||||
@ -4336,12 +4332,12 @@ template <class _Codecvt, class _Elem, class _Tr>
|
||||
wbuffer_convert<_Codecvt, _Elem, _Tr>*
|
||||
wbuffer_convert<_Codecvt, _Elem, _Tr>::__close()
|
||||
{
|
||||
wbuffer_convert* __rt = 0;
|
||||
if (__cv_ != 0 && __bufptr_ != 0)
|
||||
wbuffer_convert* __rt = nullptr;
|
||||
if (__cv_ != nullptr && __bufptr_ != nullptr)
|
||||
{
|
||||
__rt = this;
|
||||
if ((__cm_ & ios_base::out) && sync())
|
||||
__rt = 0;
|
||||
__rt = nullptr;
|
||||
}
|
||||
return __rt;
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ Functions:
|
||||
|
||||
#include <__config>
|
||||
|
||||
#if defined(_LIBCPP_HAS_NO_LOCALIZATION)
|
||||
# error "Localization is not supported by this configuration of libc++"
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
# pragma GCC system_header
|
||||
#endif
|
||||
|
@ -1230,7 +1230,7 @@ public:
|
||||
return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
|
||||
_VSTD::piecewise_construct,
|
||||
_VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)).first;
|
||||
}
|
||||
|
||||
template <class... _Args>
|
||||
@ -1240,7 +1240,7 @@ public:
|
||||
return __tree_.__emplace_hint_unique_key_args(__h.__i_, __k,
|
||||
_VSTD::piecewise_construct,
|
||||
_VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...)).first;
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
@ -1270,29 +1270,29 @@ public:
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, const key_type& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, __k, _VSTD::forward<_Vp>(__v));
|
||||
_LIBCPP_INLINE_VISIBILITY iterator insert_or_assign(const_iterator __h,
|
||||
const key_type& __k,
|
||||
_Vp&& __v) {
|
||||
auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
|
||||
__h.__i_, __k, __k, _VSTD::forward<_Vp>(__v));
|
||||
|
||||
if (!__inserted)
|
||||
__r->__get_value().second = _VSTD::forward<_Vp>(__v);
|
||||
|
||||
return __r;
|
||||
}
|
||||
|
||||
template <class _Vp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert_or_assign(const_iterator __h, key_type&& __k, _Vp&& __v)
|
||||
{
|
||||
iterator __p = lower_bound(__k);
|
||||
if ( __p != end() && !key_comp()(__k, __p->first))
|
||||
{
|
||||
__p->second = _VSTD::forward<_Vp>(__v);
|
||||
return __p;
|
||||
}
|
||||
return emplace_hint(__h, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
|
||||
_LIBCPP_INLINE_VISIBILITY iterator insert_or_assign(const_iterator __h,
|
||||
key_type&& __k,
|
||||
_Vp&& __v) {
|
||||
auto [__r, __inserted] = __tree_.__emplace_hint_unique_key_args(
|
||||
__h.__i_, __k, _VSTD::move(__k), _VSTD::forward<_Vp>(__v));
|
||||
|
||||
if (!__inserted)
|
||||
__r->__get_value().second = _VSTD::forward<_Vp>(__v);
|
||||
|
||||
return __r;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
@ -1546,7 +1546,7 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node_with_key(const key_type&
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Compare, class _Allocator>
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -87,13 +87,12 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <type_traits>
|
||||
#include <cstddef>
|
||||
#include <version>
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_ABI_VCRUNTIME)
|
||||
#include <new.h>
|
||||
@ -117,11 +116,6 @@ void operator delete[](void* ptr, void*) noexcept;
|
||||
# define _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
||||
#endif
|
||||
|
||||
#if !__has_builtin(__builtin_operator_new) || \
|
||||
__has_builtin(__builtin_operator_new) < 201802L
|
||||
#define _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE
|
||||
#endif
|
||||
|
||||
namespace std // purposefully not using versioning namespace
|
||||
{
|
||||
|
||||
@ -234,31 +228,54 @@ _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY bool __is_overaligned_for_new
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void *__libcpp_allocate(size_t __size, size_t __align) {
|
||||
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
const align_val_t __align_val = static_cast<align_val_t>(__align);
|
||||
# ifdef _LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE
|
||||
return ::operator new(__size, __align_val);
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void* __libcpp_operator_new(_Args ...__args) {
|
||||
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
|
||||
return __builtin_operator_new(__args...);
|
||||
#else
|
||||
return __builtin_operator_new(__size, __align_val);
|
||||
# endif
|
||||
}
|
||||
#else
|
||||
((void)__align);
|
||||
#endif
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
return ::operator new(__size);
|
||||
#else
|
||||
return __builtin_operator_new(__size);
|
||||
return ::operator new(__args...);
|
||||
#endif
|
||||
}
|
||||
|
||||
struct _DeallocateCaller {
|
||||
static inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __do_deallocate_handle_size_align(void *__ptr, size_t __size, size_t __align) {
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __libcpp_operator_delete(_Args ...__args) {
|
||||
#if __has_builtin(__builtin_operator_new) && __has_builtin(__builtin_operator_delete)
|
||||
__builtin_operator_delete(__args...);
|
||||
#else
|
||||
::operator delete(__args...);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void *__libcpp_allocate(size_t __size, size_t __align) {
|
||||
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
const align_val_t __align_val = static_cast<align_val_t>(__align);
|
||||
return __libcpp_operator_new(__size, __align_val);
|
||||
}
|
||||
#endif
|
||||
|
||||
(void)__align;
|
||||
return __libcpp_operator_new(__size);
|
||||
}
|
||||
|
||||
template <class ..._Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void __do_deallocate_handle_size(void *__ptr, size_t __size, _Args ...__args) {
|
||||
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
||||
(void)__size;
|
||||
return __libcpp_operator_delete(__ptr, __args...);
|
||||
#else
|
||||
return __libcpp_operator_delete(__ptr, __size, __args...);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
|
||||
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||
((void)__align);
|
||||
(void)__align;
|
||||
return __do_deallocate_handle_size(__ptr, __size);
|
||||
#else
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
@ -270,79 +287,49 @@ struct _DeallocateCaller {
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __do_deallocate_handle_align(void *__ptr, size_t __align) {
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
|
||||
#if defined(_LIBCPP_HAS_NO_ALIGNED_ALLOCATION)
|
||||
((void)__align);
|
||||
return __do_call(__ptr);
|
||||
(void)__align;
|
||||
return __libcpp_operator_delete(__ptr);
|
||||
#else
|
||||
if (__is_overaligned_for_new(__align)) {
|
||||
const align_val_t __align_val = static_cast<align_val_t>(__align);
|
||||
return __do_call(__ptr, __align_val);
|
||||
return __libcpp_operator_delete(__ptr, __align_val);
|
||||
} else {
|
||||
return __do_call(__ptr);
|
||||
return __libcpp_operator_delete(__ptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
static inline void __do_deallocate_handle_size(void *__ptr, size_t __size) {
|
||||
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
||||
((void)__size);
|
||||
return __do_call(__ptr);
|
||||
#if !defined(_LIBCPP_HAS_NO_LIBRARY_ALIGNED_ALLOCATION)
|
||||
// Low-level helpers to call the aligned allocation and deallocation functions
|
||||
// on the target platform. This is used to implement libc++'s own memory
|
||||
// allocation routines -- if you need to allocate memory inside the library,
|
||||
// chances are that you want to use `__libcpp_allocate` instead.
|
||||
//
|
||||
// Returns the allocated memory, or `nullptr` on failure.
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void* __libcpp_aligned_alloc(std::size_t __alignment, std::size_t __size) {
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
return ::_aligned_malloc(__size, __alignment);
|
||||
#else
|
||||
return __do_call(__ptr, __size);
|
||||
void* __result = nullptr;
|
||||
::posix_memalign(&__result, __alignment, __size);
|
||||
// If posix_memalign fails, __result is unmodified so we still return `nullptr`.
|
||||
return __result;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
static inline void __do_deallocate_handle_size(void *__ptr, size_t __size, align_val_t __align) {
|
||||
#ifdef _LIBCPP_HAS_NO_SIZED_DEALLOCATION
|
||||
((void)__size);
|
||||
return __do_call(__ptr, __align);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void __libcpp_aligned_free(void* __ptr) {
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
::_aligned_free(__ptr);
|
||||
#else
|
||||
return __do_call(__ptr, __size, __align);
|
||||
::free(__ptr);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif // !_LIBCPP_HAS_NO_ALIGNED_ALLOCATION
|
||||
|
||||
private:
|
||||
template <class _A1, class _A2>
|
||||
static inline void __do_call(void *__ptr, _A1 __a1, _A2 __a2) {
|
||||
#if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \
|
||||
defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE)
|
||||
return ::operator delete(__ptr, __a1, __a2);
|
||||
#else
|
||||
return __builtin_operator_delete(__ptr, __a1, __a2);
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _A1>
|
||||
static inline void __do_call(void *__ptr, _A1 __a1) {
|
||||
#if defined(_LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE) || \
|
||||
defined(_LIBCPP_HAS_NO_BUILTIN_OVERLOADED_OPERATOR_NEW_DELETE)
|
||||
return ::operator delete(__ptr, __a1);
|
||||
#else
|
||||
return __builtin_operator_delete(__ptr, __a1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void __do_call(void *__ptr) {
|
||||
#ifdef _LIBCPP_HAS_NO_BUILTIN_OPERATOR_NEW_DELETE
|
||||
return ::operator delete(__ptr);
|
||||
#else
|
||||
return __builtin_operator_delete(__ptr);
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate(void* __ptr, size_t __size, size_t __align) {
|
||||
_DeallocateCaller::__do_deallocate_handle_size_align(__ptr, __size, __align);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY void __libcpp_deallocate_unsized(void* __ptr, size_t __align) {
|
||||
_DeallocateCaller::__do_deallocate_handle_align(__ptr, __align);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 inline
|
||||
|
@ -100,7 +100,7 @@ template <class T> inline constexpr T egamma_v = __illformed<T>{};
|
||||
template <class T> inline constexpr T phi_v = __illformed<T>{};
|
||||
|
||||
template <class T>
|
||||
concept __floating_point = std::is_floating_point_v<T>;
|
||||
concept __floating_point = is_floating_point_v<T>;
|
||||
|
||||
template <__floating_point T> inline constexpr T e_v<T> = 2.718281828459045235360287471352662;
|
||||
template <__floating_point T> inline constexpr T log2e_v<T> = 1.442695040888963407359924681001892;
|
||||
|
@ -17,115 +17,116 @@ namespace std
|
||||
{
|
||||
|
||||
template <class InputIterator, class T>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
accumulate(InputIterator first, InputIterator last, T init);
|
||||
|
||||
template <class InputIterator, class T, class BinaryOperation>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
accumulate(InputIterator first, InputIterator last, T init, BinaryOperation binary_op);
|
||||
|
||||
template<class InputIterator>
|
||||
typename iterator_traits<InputIterator>::value_type
|
||||
constexpr typename iterator_traits<InputIterator>::value_type // constexpr since C++20
|
||||
reduce(InputIterator first, InputIterator last); // C++17
|
||||
|
||||
template<class InputIterator, class T>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
reduce(InputIterator first, InputIterator last, T init); // C++17
|
||||
|
||||
template<class InputIterator, class T, class BinaryOperation>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
reduce(InputIterator first, InputIterator last, T init, BinaryOperation binary_op); // C++17
|
||||
|
||||
template <class InputIterator1, class InputIterator2, class T>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, T init);
|
||||
|
||||
template <class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
inner_product(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2,
|
||||
T init, BinaryOperation1 binary_op1, BinaryOperation2 binary_op2);
|
||||
|
||||
|
||||
template<class InputIterator1, class InputIterator2, class T>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
transform_reduce(InputIterator1 first1, InputIterator1 last1,
|
||||
InputIterator2 first2, T init); // C++17
|
||||
|
||||
template<class InputIterator1, class InputIterator2, class T, class BinaryOperation1, class BinaryOperation2>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
transform_reduce(InputIterator1 first1, InputIterator1 last1,
|
||||
InputIterator2 first2, T init,
|
||||
BinaryOperation1 binary_op1, BinaryOperation2 binary_op2); // C++17
|
||||
|
||||
template<class InputIterator, class T, class BinaryOperation, class UnaryOperation>
|
||||
T
|
||||
constexpr T // constexpr since C++20
|
||||
transform_reduce(InputIterator first, InputIterator last, T init,
|
||||
BinaryOperation binary_op, UnaryOperation unary_op); // C++17
|
||||
|
||||
template <class InputIterator, class OutputIterator>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
partial_sum(InputIterator first, InputIterator last, OutputIterator result);
|
||||
|
||||
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
partial_sum(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
|
||||
|
||||
template<class InputIterator, class OutputIterator, class T>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
exclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result, T init); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator, class T, class BinaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
exclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result, T init, BinaryOperation binary_op); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
inclusive_scan(InputIterator first, InputIterator last, OutputIterator result); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator, class BinaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
inclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result, BinaryOperation binary_op); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator, class BinaryOperation, class T>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
inclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result, BinaryOperation binary_op, T init); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator, class T,
|
||||
class BinaryOperation, class UnaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
transform_exclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result, T init,
|
||||
BinaryOperation binary_op, UnaryOperation unary_op); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator,
|
||||
class BinaryOperation, class UnaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result,
|
||||
BinaryOperation binary_op, UnaryOperation unary_op); // C++17
|
||||
|
||||
template<class InputIterator, class OutputIterator,
|
||||
class BinaryOperation, class UnaryOperation, class T>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
transform_inclusive_scan(InputIterator first, InputIterator last,
|
||||
OutputIterator result,
|
||||
BinaryOperation binary_op, UnaryOperation unary_op,
|
||||
T init); // C++17
|
||||
|
||||
template <class InputIterator, class OutputIterator>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
adjacent_difference(InputIterator first, InputIterator last, OutputIterator result);
|
||||
|
||||
template <class InputIterator, class OutputIterator, class BinaryOperation>
|
||||
OutputIterator
|
||||
constexpr OutputIterator // constexpr since C++20
|
||||
adjacent_difference(InputIterator first, InputIterator last, OutputIterator result, BinaryOperation binary_op);
|
||||
|
||||
template <class ForwardIterator, class T>
|
||||
void iota(ForwardIterator first, ForwardIterator last, T value);
|
||||
constexpr void // constexpr since C++20
|
||||
iota(ForwardIterator first, ForwardIterator last, T value);
|
||||
|
||||
template <class M, class N>
|
||||
constexpr common_type_t<M,N> gcd(M m, N n); // C++17
|
||||
@ -133,9 +134,11 @@ template <class M, class N>
|
||||
template <class M, class N>
|
||||
constexpr common_type_t<M,N> lcm(M m, N n); // C++17
|
||||
|
||||
integer midpoint(integer a, integer b); // C++20
|
||||
pointer midpoint(pointer a, pointer b); // C++20
|
||||
floating_point midpoint(floating_point a, floating_point b); // C++20
|
||||
template<class T>
|
||||
constexpr T midpoint(T a, T b) noexcept; // C++20
|
||||
|
||||
template<class T>
|
||||
constexpr T* midpoint(T* a, T* b); // C++20
|
||||
|
||||
} // std
|
||||
|
||||
@ -158,28 +161,36 @@ _LIBCPP_PUSH_MACROS
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
accumulate(_InputIterator __first, _InputIterator __last, _Tp __init)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__init = _VSTD::move(__init) + *__first;
|
||||
#else
|
||||
__init = __init + *__first;
|
||||
#endif
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _Tp, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
accumulate(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOperation __binary_op)
|
||||
{
|
||||
for (; __first != __last; ++__first)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__init = __binary_op(_VSTD::move(__init), *__first);
|
||||
#else
|
||||
__init = __binary_op(__init, *__first);
|
||||
#endif
|
||||
return __init;
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _InputIterator, class _Tp, class _BinaryOp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b)
|
||||
{
|
||||
@ -189,7 +200,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init, _BinaryOp __b)
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
reduce(_InputIterator __first, _InputIterator __last, _Tp __init)
|
||||
{
|
||||
@ -197,7 +208,7 @@ reduce(_InputIterator __first, _InputIterator __last, _Tp __init)
|
||||
}
|
||||
|
||||
template <class _InputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
typename iterator_traits<_InputIterator>::value_type
|
||||
reduce(_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
@ -207,29 +218,37 @@ reduce(_InputIterator __first, _InputIterator __last)
|
||||
#endif
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _Tp __init)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__init = _VSTD::move(__init) + *__first1 * *__first2;
|
||||
#else
|
||||
__init = __init + *__first1 * *__first2;
|
||||
#endif
|
||||
return __init;
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Tp, class _BinaryOperation1, class _BinaryOperation2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
inner_product(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2,
|
||||
_Tp __init, _BinaryOperation1 __binary_op1, _BinaryOperation2 __binary_op2)
|
||||
{
|
||||
for (; __first1 != __last1; ++__first1, (void) ++__first2)
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__init = __binary_op1(_VSTD::move(__init), __binary_op2(*__first1, *__first2));
|
||||
#else
|
||||
__init = __binary_op1(__init, __binary_op2(*__first1, *__first2));
|
||||
#endif
|
||||
return __init;
|
||||
}
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _InputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
transform_reduce(_InputIterator __first, _InputIterator __last,
|
||||
_Tp __init, _BinaryOp __b, _UnaryOp __u)
|
||||
@ -241,7 +260,7 @@ transform_reduce(_InputIterator __first, _InputIterator __last,
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2,
|
||||
class _Tp, class _BinaryOp1, class _BinaryOp2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _Tp __init, _BinaryOp1 __b1, _BinaryOp2 __b2)
|
||||
@ -252,7 +271,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
}
|
||||
|
||||
template <class _InputIterator1, class _InputIterator2, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_Tp
|
||||
transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
_InputIterator2 __first2, _Tp __init)
|
||||
@ -263,7 +282,7 @@ transform_reduce(_InputIterator1 __first1, _InputIterator1 __last1,
|
||||
#endif
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
@ -273,7 +292,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
*__result = __t;
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__t = _VSTD::move(__t) + *__first;
|
||||
#else
|
||||
__t = __t + *__first;
|
||||
#endif
|
||||
*__result = __t;
|
||||
}
|
||||
}
|
||||
@ -281,7 +304,7 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
_BinaryOperation __binary_op)
|
||||
@ -292,7 +315,11 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
*__result = __t;
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
__t = __binary_op(_VSTD::move(__t), *__first);
|
||||
#else
|
||||
__t = __binary_op(__t, *__first);
|
||||
#endif
|
||||
*__result = __t;
|
||||
}
|
||||
}
|
||||
@ -301,27 +328,30 @@ partial_sum(_InputIterator __first, _InputIterator __last, _OutputIterator __res
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
exclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _Tp __init, _BinaryOp __b)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
_Tp __saved = __init;
|
||||
do
|
||||
_Tp __tmp(__b(__init, *__first));
|
||||
while (true)
|
||||
{
|
||||
__init = __b(__init, *__first);
|
||||
*__result = __saved;
|
||||
__saved = __init;
|
||||
*__result = _VSTD::move(__init);
|
||||
++__result;
|
||||
} while (++__first != __last);
|
||||
++__first;
|
||||
if (__first == __last)
|
||||
break;
|
||||
__init = _VSTD::move(__tmp);
|
||||
__tmp = __b(__init, *__first);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
exclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _Tp __init)
|
||||
@ -330,6 +360,7 @@ exclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _BinaryOp __b, _Tp __init)
|
||||
{
|
||||
@ -341,11 +372,12 @@ _OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOp>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _BinaryOp __b)
|
||||
{
|
||||
if (__first != __last) {
|
||||
typename std::iterator_traits<_InputIterator>::value_type __init = *__first;
|
||||
typename iterator_traits<_InputIterator>::value_type __init = *__first;
|
||||
*__result++ = __init;
|
||||
if (++__first != __last)
|
||||
return _VSTD::inclusive_scan(__first, __last, __result, __b, __init);
|
||||
@ -355,15 +387,16 @@ _OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result)
|
||||
{
|
||||
return _VSTD::inclusive_scan(__first, __last, __result, std::plus<>());
|
||||
return _VSTD::inclusive_scan(__first, __last, __result, _VSTD::plus<>());
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp,
|
||||
class _BinaryOp, class _UnaryOp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _Tp __init,
|
||||
@ -384,7 +417,9 @@ transform_exclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _Tp, class _BinaryOp, class _UnaryOp>
|
||||
_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _BinaryOp __b, _UnaryOp __u, _Tp __init)
|
||||
{
|
||||
for (; __first != __last; ++__first, (void) ++__result) {
|
||||
@ -396,11 +431,13 @@ _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOp, class _UnaryOp>
|
||||
_OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
transform_inclusive_scan(_InputIterator __first, _InputIterator __last,
|
||||
_OutputIterator __result, _BinaryOp __b, _UnaryOp __u)
|
||||
{
|
||||
if (__first != __last) {
|
||||
typename std::iterator_traits<_InputIterator>::value_type __init = __u(*__first);
|
||||
typename iterator_traits<_InputIterator>::value_type __init = __u(*__first);
|
||||
*__result++ = __init;
|
||||
if (++__first != __last)
|
||||
return _VSTD::transform_inclusive_scan(__first, __last, __result, __b, __u, __init);
|
||||
@ -411,46 +448,54 @@ _OutputIterator transform_inclusive_scan(_InputIterator __first, _InputIterator
|
||||
#endif
|
||||
|
||||
template <class _InputIterator, class _OutputIterator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
typename iterator_traits<_InputIterator>::value_type __acc(*__first);
|
||||
*__result = __acc;
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __t2 - __t1;
|
||||
__t1 = _VSTD::move(__t2);
|
||||
typename iterator_traits<_InputIterator>::value_type __val(*__first);
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
*__result = __val - _VSTD::move(__acc);
|
||||
#else
|
||||
*__result = __val - __acc;
|
||||
#endif
|
||||
__acc = _VSTD::move(__val);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _InputIterator, class _OutputIterator, class _BinaryOperation>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
_OutputIterator
|
||||
adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterator __result,
|
||||
_BinaryOperation __binary_op)
|
||||
{
|
||||
if (__first != __last)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t1(*__first);
|
||||
*__result = __t1;
|
||||
typename iterator_traits<_InputIterator>::value_type __acc(*__first);
|
||||
*__result = __acc;
|
||||
for (++__first, (void) ++__result; __first != __last; ++__first, (void) ++__result)
|
||||
{
|
||||
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
|
||||
*__result = __binary_op(__t2, __t1);
|
||||
__t1 = _VSTD::move(__t2);
|
||||
typename iterator_traits<_InputIterator>::value_type __val(*__first);
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
*__result = __binary_op(__val, _VSTD::move(__acc));
|
||||
#else
|
||||
*__result = __binary_op(__val, __acc);
|
||||
#endif
|
||||
__acc = _VSTD::move(__val);
|
||||
}
|
||||
}
|
||||
return __result;
|
||||
}
|
||||
|
||||
template <class _ForwardIterator, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void
|
||||
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_)
|
||||
{
|
||||
@ -531,8 +576,8 @@ enable_if_t<is_integral_v<_Tp> && !is_same_v<bool, _Tp> && !is_null_pointer_v<_T
|
||||
midpoint(_Tp __a, _Tp __b) noexcept
|
||||
_LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
{
|
||||
using _Up = std::make_unsigned_t<_Tp>;
|
||||
constexpr _Up __bitshift = std::numeric_limits<_Up>::digits - 1;
|
||||
using _Up = make_unsigned_t<_Tp>;
|
||||
constexpr _Up __bitshift = numeric_limits<_Up>::digits - 1;
|
||||
|
||||
_Up __diff = _Up(__b) - _Up(__a);
|
||||
_Up __sign_bit = __b < __a;
|
||||
|
@ -147,6 +147,7 @@ template<class T>
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__debug>
|
||||
#include <__functional_base>
|
||||
#include <functional>
|
||||
@ -656,7 +657,7 @@ private:
|
||||
}
|
||||
template <class _Up, class _QUp = _QualUp>
|
||||
static constexpr bool __enable_assign() {
|
||||
// Construction and assignability of _Qup to _Tp has already been
|
||||
// Construction and assignability of _QUp to _Tp has already been
|
||||
// checked.
|
||||
return !__check_constructible_from_opt<_Up>::value &&
|
||||
!__check_assignable_from_opt<_Up>::value;
|
||||
|
@ -126,9 +126,8 @@ template <class charT, class traits>
|
||||
basic_ostream<charT,traits>& flush(basic_ostream<charT,traits>& os);
|
||||
|
||||
// rvalue stream insertion
|
||||
template <class charT, class traits, class T>
|
||||
basic_ostream<charT, traits>&
|
||||
operator<<(basic_ostream<charT, traits>&& os, const T& x);
|
||||
template <class Stream, class T>
|
||||
Stream&& operator<<(Stream&& os, const T& x);
|
||||
|
||||
} // std
|
||||
|
||||
@ -1028,15 +1027,20 @@ flush(basic_ostream<_CharT, _Traits>& __os)
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Stream, class _Tp, class = void>
|
||||
struct __is_ostreamable : false_type { };
|
||||
|
||||
template <class _Stream, class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename enable_if
|
||||
<
|
||||
!is_lvalue_reference<_Stream>::value &&
|
||||
is_base_of<ios_base, _Stream>::value,
|
||||
_Stream&&
|
||||
>::type
|
||||
operator<<(_Stream&& __os, const _Tp& __x)
|
||||
struct __is_ostreamable<_Stream, _Tp, decltype(
|
||||
_VSTD::declval<_Stream>() << _VSTD::declval<_Tp>(), void()
|
||||
)> : true_type { };
|
||||
|
||||
template <class _Stream, class _Tp, class = typename enable_if<
|
||||
_And<is_base_of<ios_base, _Stream>,
|
||||
__is_ostreamable<_Stream&, const _Tp&>>::value
|
||||
>::type>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_Stream&& operator<<(_Stream&& __os, const _Tp& __x)
|
||||
{
|
||||
__os << __x;
|
||||
return _VSTD::move(__os);
|
||||
@ -1097,10 +1101,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
|
||||
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostream<wchar_t>)
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -1642,8 +1642,7 @@ class piecewise_linear_distribution
|
||||
#include <numeric>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <istream>
|
||||
#include <ostream>
|
||||
#include <iosfwd>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -1669,7 +1668,23 @@ struct __is_seed_sequence
|
||||
|
||||
template <unsigned long long __a, unsigned long long __c,
|
||||
unsigned long long __m, unsigned long long _Mp,
|
||||
bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a)>
|
||||
bool _MightOverflow = (__a != 0 && __m != 0 && __m-1 > (_Mp-__c)/__a),
|
||||
bool _OverflowOK = ((__m|__m-1) > __m), // m = 2^n
|
||||
bool _SchrageOK = (__a != 0 && __m != 0 && __m % __a <= __m / __a)> // r <= q
|
||||
struct __lce_alg_picker
|
||||
{
|
||||
static_assert(__a != 0 || __m != 0 || !_MightOverflow || _OverflowOK || _SchrageOK,
|
||||
"The current values of a, c, and m cannot generate a number "
|
||||
"within bounds of linear_congruential_engine.");
|
||||
|
||||
static _LIBCPP_CONSTEXPR const bool __use_schrage = _MightOverflow &&
|
||||
!_OverflowOK &&
|
||||
_SchrageOK;
|
||||
};
|
||||
|
||||
template <unsigned long long __a, unsigned long long __c,
|
||||
unsigned long long __m, unsigned long long _Mp,
|
||||
bool _UseSchrage = __lce_alg_picker<__a, __c, __m, _Mp>::__use_schrage>
|
||||
struct __lce_ta;
|
||||
|
||||
// 64
|
||||
@ -1843,6 +1858,7 @@ private:
|
||||
|
||||
static_assert(__m == 0 || __a < __m, "linear_congruential_engine invalid parameters");
|
||||
static_assert(__m == 0 || __c < __m, "linear_congruential_engine invalid parameters");
|
||||
static_assert(_VSTD::is_unsigned<_UIntType>::value, "_UIntType must be unsigned type");
|
||||
public:
|
||||
static _LIBCPP_CONSTEXPR const result_type _Min = __c == 0u ? 1u: 0u;
|
||||
static _LIBCPP_CONSTEXPR const result_type _Max = __m - 1u;
|
||||
@ -1982,7 +1998,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
__os.fill(__os.widen(' '));
|
||||
return __os << __x.__x_;
|
||||
}
|
||||
@ -1994,7 +2011,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
linear_congruential_engine<_UIntType, __a, __c, __m>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
_UIntType __t;
|
||||
__is >> __t;
|
||||
if (!__is.fail())
|
||||
@ -2453,7 +2471,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.__x_[__x.__i_];
|
||||
@ -2474,7 +2493,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
_Bp, _Tp, _Cp, _Lp, _Fp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
_UInt __t[_Np];
|
||||
for (size_t __i = 0; __i < _Np; ++__i)
|
||||
__is >> __t[__i];
|
||||
@ -2773,7 +2793,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.__x_[__x.__i_];
|
||||
@ -2792,7 +2813,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
subtract_with_carry_engine<_UInt, _Wp, _Sp, _Rp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
_UInt __t[_Rp+1];
|
||||
for (size_t __i = 0; __i < _Rp+1; ++__i)
|
||||
__is >> __t[__i];
|
||||
@ -2955,7 +2977,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const discard_block_engine<_Eng, _Pp, _Rp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.__e_ << __sp << __x.__n_;
|
||||
@ -2968,7 +2991,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
discard_block_engine<_Eng, _Pp, _Rp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
_Eng __e;
|
||||
int __n;
|
||||
__is >> __e >> __n;
|
||||
@ -3440,7 +3464,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const shuffle_order_engine<_Eng, _Kp>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.__e_ << __sp << __x._V_[0];
|
||||
@ -3457,7 +3482,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
{
|
||||
typedef typename shuffle_order_engine<_Eng, _Kp>::result_type result_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
_Eng __e;
|
||||
result_type _Vp[_Kp+1];
|
||||
__is >> __e;
|
||||
@ -3477,6 +3503,8 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
|
||||
|
||||
// random_device
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_RANDOM_DEVICE)
|
||||
|
||||
class _LIBCPP_TYPE_VIS random_device
|
||||
{
|
||||
#ifdef _LIBCPP_USING_DEV_RANDOM
|
||||
@ -3511,6 +3539,8 @@ private:
|
||||
random_device& operator=(const random_device&); // = delete;
|
||||
};
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_RANDOM_DEVICE
|
||||
|
||||
// seed_seq
|
||||
|
||||
class _LIBCPP_TEMPLATE_VIS seed_seq
|
||||
@ -3663,7 +3693,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const uniform_int_distribution<_IT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left);
|
||||
typedef basic_ostream<_CharT, _Traits> _Ostream;
|
||||
__os.flags(_Ostream::dec | _Ostream::left);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.a() << __sp << __x.b();
|
||||
@ -3678,7 +3709,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __a;
|
||||
result_type __b;
|
||||
__is >> __a >> __b;
|
||||
@ -3784,8 +3816,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const uniform_real_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.a() << __sp << __x.b();
|
||||
@ -3800,7 +3833,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __a;
|
||||
result_type __b;
|
||||
__is >> __a >> __b;
|
||||
@ -3895,8 +3929,9 @@ basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os, const bernoulli_distribution& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.p();
|
||||
@ -3909,7 +3944,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
|
||||
typedef bernoulli_distribution _Eng;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
double __p;
|
||||
__is >> __p;
|
||||
if (!__is.fail())
|
||||
@ -3999,12 +4035,12 @@ public:
|
||||
{return !(__x == __y);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_MSVCRT
|
||||
#ifndef _LIBCPP_MSVCRT_LIKE
|
||||
extern "C" double lgamma_r(double, int *);
|
||||
#endif
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY double __libcpp_lgamma(double __d) {
|
||||
#if defined(_LIBCPP_MSVCRT)
|
||||
#if defined(_LIBCPP_MSVCRT_LIKE)
|
||||
return lgamma(__d);
|
||||
#else
|
||||
int __sign;
|
||||
@ -4079,8 +4115,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const binomial_distribution<_IntType>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.t() << __sp << __x.p();
|
||||
@ -4095,7 +4132,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __t;
|
||||
double __p;
|
||||
__is >> __t >> __p;
|
||||
@ -4197,8 +4235,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const exponential_distribution<_RealType>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
return __os << __x.lambda();
|
||||
}
|
||||
|
||||
@ -4211,7 +4250,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __lambda;
|
||||
__is >> __lambda;
|
||||
if (!__is.fail())
|
||||
@ -4351,8 +4391,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const normal_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.mean() << __sp << __x.stddev() << __sp << __x._V_hot_;
|
||||
@ -4370,7 +4411,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __mean;
|
||||
result_type __stddev;
|
||||
result_type _Vp = 0;
|
||||
@ -4618,7 +4660,7 @@ poisson_distribution<_IntType>::param_type::param_type(double __mean)
|
||||
{
|
||||
__s_ = _VSTD::sqrt(__mean_);
|
||||
__d_ = 6 * __mean_ * __mean_;
|
||||
__l_ = std::trunc(__mean_ - 1.1484);
|
||||
__l_ = _VSTD::trunc(__mean_ - 1.1484);
|
||||
__omega_ = .3989423 / __s_;
|
||||
double __b1_ = .4166667E-1 / __mean_;
|
||||
double __b2_ = .3 * __b1_ * __b1_;
|
||||
@ -4650,13 +4692,13 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
double __u;
|
||||
if (__g > 0)
|
||||
{
|
||||
__tx = std::trunc(__g);
|
||||
__tx = _VSTD::trunc(__g);
|
||||
if (__tx >= __pr.__l_)
|
||||
return std::__clamp_to_integral<result_type>(__tx);
|
||||
return _VSTD::__clamp_to_integral<result_type>(__tx);
|
||||
__difmuk = __pr.__mean_ - __tx;
|
||||
__u = __urd(__urng);
|
||||
if (__pr.__d_ * __u >= __difmuk * __difmuk * __difmuk)
|
||||
return std::__clamp_to_integral<result_type>(__tx);
|
||||
return _VSTD::__clamp_to_integral<result_type>(__tx);
|
||||
}
|
||||
exponential_distribution<double> __edist;
|
||||
for (bool __using_exp_dist = false; true; __using_exp_dist = true)
|
||||
@ -4672,7 +4714,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
__u += __u - 1;
|
||||
__t = 1.8 + (__u < 0 ? -__e : __e);
|
||||
} while (__t <= -.6744);
|
||||
__tx = std::trunc(__pr.__mean_ + __pr.__s_ * __t);
|
||||
__tx = _VSTD::trunc(__pr.__mean_ + __pr.__s_ * __t);
|
||||
__difmuk = __pr.__mean_ - __tx;
|
||||
__using_exp_dist = true;
|
||||
}
|
||||
@ -4716,7 +4758,7 @@ poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& __pr
|
||||
}
|
||||
}
|
||||
}
|
||||
return std::__clamp_to_integral<result_type>(__tx);
|
||||
return _VSTD::__clamp_to_integral<result_type>(__tx);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _IntType>
|
||||
@ -4725,8 +4767,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const poisson_distribution<_IntType>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
return __os << __x.mean();
|
||||
}
|
||||
|
||||
@ -4738,7 +4781,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef poisson_distribution<_IntType> _Eng;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
double __mean;
|
||||
__is >> __mean;
|
||||
if (!__is.fail())
|
||||
@ -4836,8 +4880,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const weibull_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.a() << __sp << __x.b();
|
||||
@ -4853,7 +4898,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __a;
|
||||
result_type __b;
|
||||
__is >> __a >> __b;
|
||||
@ -4955,8 +5001,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const extreme_value_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.a() << __sp << __x.b();
|
||||
@ -4972,7 +5019,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __a;
|
||||
result_type __b;
|
||||
__is >> __a >> __b;
|
||||
@ -5127,8 +5175,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const gamma_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.alpha() << __sp << __x.beta();
|
||||
@ -5144,7 +5193,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __alpha;
|
||||
result_type __beta;
|
||||
__is >> __alpha >> __beta;
|
||||
@ -5263,8 +5313,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const negative_binomial_distribution<_IntType>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
return __os << __x.k() << __sp << __x.p();
|
||||
@ -5279,7 +5330,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __k;
|
||||
double __p;
|
||||
__is >> __k >> __p;
|
||||
@ -5369,8 +5421,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const geometric_distribution<_IntType>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
return __os << __x.p();
|
||||
}
|
||||
|
||||
@ -5382,7 +5435,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef geometric_distribution<_IntType> _Eng;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
double __p;
|
||||
__is >> __p;
|
||||
if (!__is.fail())
|
||||
@ -5473,8 +5527,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const chi_squared_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
__os << __x.n();
|
||||
return __os;
|
||||
}
|
||||
@ -5488,7 +5543,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __n;
|
||||
__is >> __n;
|
||||
if (!__is.fail())
|
||||
@ -5593,8 +5649,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const cauchy_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.a() << __sp << __x.b();
|
||||
@ -5610,7 +5667,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __a;
|
||||
result_type __b;
|
||||
__is >> __a >> __b;
|
||||
@ -5715,8 +5773,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const fisher_f_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
__os << __x.m() << __sp << __x.n();
|
||||
@ -5732,7 +5791,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __m;
|
||||
result_type __n;
|
||||
__is >> __m >> __n;
|
||||
@ -5831,8 +5891,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const student_t_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
__os << __x.n();
|
||||
return __os;
|
||||
}
|
||||
@ -5846,7 +5907,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef typename _Eng::result_type result_type;
|
||||
typedef typename _Eng::param_type param_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
result_type __n;
|
||||
__is >> __n;
|
||||
if (!__is.fail())
|
||||
@ -6054,8 +6116,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const discrete_distribution<_IT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
size_t __n = __x.__p_.__p_.size();
|
||||
@ -6071,7 +6134,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
discrete_distribution<_IT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
size_t __n;
|
||||
__is >> __n;
|
||||
vector<double> __p(__n);
|
||||
@ -6356,8 +6420,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const piecewise_constant_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
size_t __n = __x.__p_.__b_.size();
|
||||
@ -6383,7 +6448,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef piecewise_constant_distribution<_RT> _Eng;
|
||||
typedef typename _Eng::result_type result_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
size_t __n;
|
||||
__is >> __n;
|
||||
vector<result_type> __b(__n);
|
||||
@ -6696,8 +6762,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
const piecewise_linear_distribution<_RT>& __x)
|
||||
{
|
||||
__save_flags<_CharT, _Traits> __lx(__os);
|
||||
__os.flags(ios_base::dec | ios_base::left | ios_base::fixed |
|
||||
ios_base::scientific);
|
||||
typedef basic_ostream<_CharT, _Traits> _OStream;
|
||||
__os.flags(_OStream::dec | _OStream::left | _OStream::fixed |
|
||||
_OStream::scientific);
|
||||
_CharT __sp = __os.widen(' ');
|
||||
__os.fill(__sp);
|
||||
size_t __n = __x.__p_.__b_.size();
|
||||
@ -6723,7 +6790,8 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
|
||||
typedef piecewise_linear_distribution<_RT> _Eng;
|
||||
typedef typename _Eng::result_type result_type;
|
||||
__save_flags<_CharT, _Traits> __lx(__is);
|
||||
__is.flags(ios_base::dec | ios_base::skipws);
|
||||
typedef basic_istream<_CharT, _Traits> _Istream;
|
||||
__is.flags(_Istream::dec | _Istream::skipws);
|
||||
size_t __n;
|
||||
__is >> __n;
|
||||
vector<result_type> __b(__n);
|
||||
|
@ -32,7 +32,8 @@ enum syntax_option_type
|
||||
extended = unspecified,
|
||||
awk = unspecified,
|
||||
grep = unspecified,
|
||||
egrep = unspecified
|
||||
egrep = unspecified,
|
||||
multiline = unspecified
|
||||
};
|
||||
|
||||
constexpr syntax_option_type operator~(syntax_option_type f);
|
||||
@ -142,6 +143,7 @@ public:
|
||||
static constexpr regex_constants::syntax_option_type awk = regex_constants::awk;
|
||||
static constexpr regex_constants::syntax_option_type grep = regex_constants::grep;
|
||||
static constexpr regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
||||
static constexpr regex_constants::syntax_option_type multiline = regex_constants::multiline;
|
||||
|
||||
// construct/copy/destroy:
|
||||
basic_regex();
|
||||
@ -802,7 +804,9 @@ enum syntax_option_type
|
||||
extended = 1 << 5,
|
||||
awk = 1 << 6,
|
||||
grep = 1 << 7,
|
||||
egrep = 1 << 8
|
||||
egrep = 1 << 8,
|
||||
// 1 << 9 may be used by ECMAScript
|
||||
multiline = 1 << 10
|
||||
};
|
||||
|
||||
inline _LIBCPP_CONSTEXPR
|
||||
@ -1982,24 +1986,33 @@ __word_boundary<_CharT, _Traits>::__exec(__state& __s) const
|
||||
// __l_anchor
|
||||
|
||||
template <class _CharT>
|
||||
class __l_anchor
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
|
||||
bool __is_eol(_CharT c)
|
||||
{
|
||||
return c == '\r' || c == '\n';
|
||||
}
|
||||
|
||||
template <class _CharT>
|
||||
class __l_anchor_multiline
|
||||
: public __owns_one_state<_CharT>
|
||||
{
|
||||
typedef __owns_one_state<_CharT> base;
|
||||
|
||||
bool __multiline;
|
||||
|
||||
public:
|
||||
typedef _VSTD::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__l_anchor(__node<_CharT>* __s)
|
||||
: base(__s) {}
|
||||
__l_anchor_multiline(bool __multiline, __node<_CharT>* __s)
|
||||
: base(__s), __multiline(__multiline) {}
|
||||
|
||||
virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__l_anchor<_CharT>::__exec(__state& __s) const
|
||||
__l_anchor_multiline<_CharT>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__at_first_ && __s.__current_ == __s.__first_ &&
|
||||
!(__s.__flags_ & regex_constants::match_not_bol))
|
||||
@ -2007,6 +2020,13 @@ __l_anchor<_CharT>::__exec(__state& __s) const
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
}
|
||||
else if (__multiline &&
|
||||
!__s.__at_first_ &&
|
||||
__is_eol(*_VSTD::prev(__s.__current_)))
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
__s.__do_ = __state::__reject;
|
||||
@ -2017,24 +2037,26 @@ __l_anchor<_CharT>::__exec(__state& __s) const
|
||||
// __r_anchor
|
||||
|
||||
template <class _CharT>
|
||||
class __r_anchor
|
||||
class __r_anchor_multiline
|
||||
: public __owns_one_state<_CharT>
|
||||
{
|
||||
typedef __owns_one_state<_CharT> base;
|
||||
|
||||
bool __multiline;
|
||||
|
||||
public:
|
||||
typedef _VSTD::__state<_CharT> __state;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
__r_anchor(__node<_CharT>* __s)
|
||||
: base(__s) {}
|
||||
__r_anchor_multiline(bool __multiline, __node<_CharT>* __s)
|
||||
: base(__s), __multiline(__multiline) {}
|
||||
|
||||
virtual void __exec(__state&) const;
|
||||
};
|
||||
|
||||
template <class _CharT>
|
||||
void
|
||||
__r_anchor<_CharT>::__exec(__state& __s) const
|
||||
__r_anchor_multiline<_CharT>::__exec(__state& __s) const
|
||||
{
|
||||
if (__s.__current_ == __s.__last_ &&
|
||||
!(__s.__flags_ & regex_constants::match_not_eol))
|
||||
@ -2042,6 +2064,11 @@ __r_anchor<_CharT>::__exec(__state& __s) const
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
}
|
||||
else if (__multiline && __is_eol(*__s.__current_))
|
||||
{
|
||||
__s.__do_ = __state::__accept_but_not_consume;
|
||||
__s.__node_ = this->first();
|
||||
}
|
||||
else
|
||||
{
|
||||
__s.__do_ = __state::__reject;
|
||||
@ -2448,7 +2475,7 @@ __bracket_expression<_CharT, _Traits>::__exec(__state& __s) const
|
||||
{
|
||||
const bool __in_neg_mask = __traits_.isctype(__ch, __neg_mask_);
|
||||
const bool __in_neg_chars =
|
||||
std::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
|
||||
_VSTD::find(__neg_chars_.begin(), __neg_chars_.end(), __ch) !=
|
||||
__neg_chars_.end();
|
||||
if (!(__in_neg_mask || __in_neg_chars))
|
||||
{
|
||||
@ -2507,7 +2534,17 @@ __exit:
|
||||
template <class _CharT, class _Traits> class __lookahead;
|
||||
|
||||
template <class _CharT, class _Traits = regex_traits<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS basic_regex
|
||||
class _LIBCPP_TEMPLATE_VIS basic_regex;
|
||||
|
||||
typedef basic_regex<char> regex;
|
||||
typedef basic_regex<wchar_t> wregex;
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_PREFERRED_NAME(regex)
|
||||
_LIBCPP_PREFERRED_NAME(wregex)
|
||||
basic_regex
|
||||
{
|
||||
public:
|
||||
// types:
|
||||
@ -2541,17 +2578,18 @@ public:
|
||||
static const regex_constants::syntax_option_type awk = regex_constants::awk;
|
||||
static const regex_constants::syntax_option_type grep = regex_constants::grep;
|
||||
static const regex_constants::syntax_option_type egrep = regex_constants::egrep;
|
||||
static const regex_constants::syntax_option_type multiline = regex_constants::multiline;
|
||||
|
||||
// construct/copy/destroy:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex()
|
||||
: __flags_(regex_constants::ECMAScript), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_regex(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{
|
||||
__init(__p, __p + __traits_.length(__p));
|
||||
}
|
||||
@ -2559,7 +2597,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_regex(const value_type* __p, size_t __len, flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{
|
||||
__init(__p, __p + __len);
|
||||
}
|
||||
@ -2571,7 +2609,7 @@ public:
|
||||
explicit basic_regex(const basic_string<value_type, _ST, _SA>& __p,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{
|
||||
__init(__p.begin(), __p.end());
|
||||
}
|
||||
@ -2581,7 +2619,7 @@ public:
|
||||
basic_regex(_ForwardIterator __first, _ForwardIterator __last,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{
|
||||
__init(__first, __last);
|
||||
}
|
||||
@ -2590,7 +2628,7 @@ public:
|
||||
basic_regex(initializer_list<value_type> __il,
|
||||
flag_type __f = regex_constants::ECMAScript)
|
||||
: __flags_(__f), __marked_count_(0), __loop_count_(0), __open_count_(0),
|
||||
__end_(0)
|
||||
__end_(nullptr)
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
}
|
||||
@ -2707,6 +2745,12 @@ private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
unsigned __loop_count() const {return __loop_count_;}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __use_multiline() const
|
||||
{
|
||||
return __get_grammar(__flags_) == ECMAScript && (__flags_ & multiline);
|
||||
}
|
||||
|
||||
template <class _ForwardIterator>
|
||||
void
|
||||
__init(_ForwardIterator __first, _ForwardIterator __last);
|
||||
@ -4119,7 +4163,7 @@ basic_regex<_CharT, _Traits>::__parse_DUP_COUNT(_ForwardIterator __first,
|
||||
__first != __last && ( __val = __traits_.value(*__first, 10)) != -1;
|
||||
++__first)
|
||||
{
|
||||
if (__c >= std::numeric_limits<int>::max() / 10)
|
||||
if (__c >= numeric_limits<int>::max() / 10)
|
||||
__throw_regex_error<regex_constants::error_badbrace>();
|
||||
__c *= 10;
|
||||
__c += __val;
|
||||
@ -4383,7 +4427,7 @@ basic_regex<_CharT, _Traits>::__parse_decimal_escape(_ForwardIterator __first,
|
||||
for (++__first;
|
||||
__first != __last && '0' <= *__first && *__first <= '9'; ++__first)
|
||||
{
|
||||
if (__v >= std::numeric_limits<unsigned>::max() / 10)
|
||||
if (__v >= numeric_limits<unsigned>::max() / 10)
|
||||
__throw_regex_error<regex_constants::error_backref>();
|
||||
__v = 10 * __v + *__first - '0';
|
||||
}
|
||||
@ -4746,7 +4790,7 @@ template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_regex<_CharT, _Traits>::__push_l_anchor()
|
||||
{
|
||||
__end_->first() = new __l_anchor<_CharT>(__end_->first());
|
||||
__end_->first() = new __l_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
|
||||
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
||||
}
|
||||
|
||||
@ -4754,7 +4798,7 @@ template <class _CharT, class _Traits>
|
||||
void
|
||||
basic_regex<_CharT, _Traits>::__push_r_anchor()
|
||||
{
|
||||
__end_->first() = new __r_anchor<_CharT>(__end_->first());
|
||||
__end_->first() = new __r_anchor_multiline<_CharT>(__use_multiline(), __end_->first());
|
||||
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
||||
}
|
||||
|
||||
@ -4845,13 +4889,21 @@ basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
|
||||
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
|
||||
}
|
||||
|
||||
typedef basic_regex<char> regex;
|
||||
typedef basic_regex<wchar_t> wregex;
|
||||
|
||||
// sub_match
|
||||
|
||||
typedef sub_match<const char*> csub_match;
|
||||
typedef sub_match<const wchar_t*> wcsub_match;
|
||||
typedef sub_match<string::const_iterator> ssub_match;
|
||||
typedef sub_match<wstring::const_iterator> wssub_match;
|
||||
|
||||
template <class _BidirectionalIterator>
|
||||
class _LIBCPP_TEMPLATE_VIS sub_match
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_PREFERRED_NAME(csub_match)
|
||||
_LIBCPP_PREFERRED_NAME(wcsub_match)
|
||||
_LIBCPP_PREFERRED_NAME(ssub_match)
|
||||
_LIBCPP_PREFERRED_NAME(wssub_match)
|
||||
sub_match
|
||||
: public pair<_BidirectionalIterator, _BidirectionalIterator>
|
||||
{
|
||||
public:
|
||||
@ -4886,11 +4938,6 @@ public:
|
||||
{return str().compare(__s);}
|
||||
};
|
||||
|
||||
typedef sub_match<const char*> csub_match;
|
||||
typedef sub_match<const wchar_t*> wcsub_match;
|
||||
typedef sub_match<string::const_iterator> ssub_match;
|
||||
typedef sub_match<wstring::const_iterator> wssub_match;
|
||||
|
||||
template <class _BiIter>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
@ -5273,8 +5320,19 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
|
||||
return __os << __m.str();
|
||||
}
|
||||
|
||||
typedef match_results<const char*> cmatch;
|
||||
typedef match_results<const wchar_t*> wcmatch;
|
||||
typedef match_results<string::const_iterator> smatch;
|
||||
typedef match_results<wstring::const_iterator> wsmatch;
|
||||
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
class _LIBCPP_TEMPLATE_VIS match_results
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_PREFERRED_NAME(cmatch)
|
||||
_LIBCPP_PREFERRED_NAME(wcmatch)
|
||||
_LIBCPP_PREFERRED_NAME(smatch)
|
||||
_LIBCPP_PREFERRED_NAME(wsmatch)
|
||||
match_results
|
||||
{
|
||||
public:
|
||||
typedef _Allocator allocator_type;
|
||||
@ -5556,7 +5614,7 @@ match_results<_BidirectionalIterator, _Allocator>::format(_OutputIter __output_i
|
||||
'0' <= __fmt_first[1] && __fmt_first[1] <= '9')
|
||||
{
|
||||
++__fmt_first;
|
||||
if (__idx >= std::numeric_limits<size_t>::max() / 10)
|
||||
if (__idx >= numeric_limits<size_t>::max() / 10)
|
||||
__throw_regex_error<regex_constants::error_escape>();
|
||||
__idx = 10 * __idx + *__fmt_first - '0';
|
||||
}
|
||||
@ -5594,11 +5652,6 @@ match_results<_BidirectionalIterator, _Allocator>::swap(match_results& __m)
|
||||
swap(__ready_, __m.__ready_);
|
||||
}
|
||||
|
||||
typedef match_results<const char*> cmatch;
|
||||
typedef match_results<const wchar_t*> wcmatch;
|
||||
typedef match_results<string::const_iterator> smatch;
|
||||
typedef match_results<wstring::const_iterator> wsmatch;
|
||||
|
||||
template <class _BidirectionalIterator, class _Allocator>
|
||||
bool
|
||||
operator==(const match_results<_BidirectionalIterator, _Allocator>& __x,
|
||||
@ -6182,7 +6235,21 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
|
||||
template <class _BidirectionalIterator,
|
||||
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
||||
class _Traits = regex_traits<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS regex_iterator
|
||||
class _LIBCPP_TEMPLATE_VIS regex_iterator;
|
||||
|
||||
typedef regex_iterator<const char*> cregex_iterator;
|
||||
typedef regex_iterator<const wchar_t*> wcregex_iterator;
|
||||
typedef regex_iterator<string::const_iterator> sregex_iterator;
|
||||
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
|
||||
|
||||
template <class _BidirectionalIterator, class _CharT, class _Traits>
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_PREFERRED_NAME(cregex_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(wcregex_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(sregex_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(wsregex_iterator)
|
||||
regex_iterator
|
||||
{
|
||||
public:
|
||||
typedef basic_regex<_CharT, _Traits> regex_type;
|
||||
@ -6291,17 +6358,26 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef regex_iterator<const char*> cregex_iterator;
|
||||
typedef regex_iterator<const wchar_t*> wcregex_iterator;
|
||||
typedef regex_iterator<string::const_iterator> sregex_iterator;
|
||||
typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
|
||||
|
||||
// regex_token_iterator
|
||||
|
||||
template <class _BidirectionalIterator,
|
||||
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
|
||||
class _Traits = regex_traits<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS regex_token_iterator
|
||||
class _LIBCPP_TEMPLATE_VIS regex_token_iterator;
|
||||
|
||||
typedef regex_token_iterator<const char*> cregex_token_iterator;
|
||||
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
||||
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
|
||||
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
|
||||
|
||||
template <class _BidirectionalIterator, class _CharT, class _Traits>
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
_LIBCPP_PREFERRED_NAME(cregex_token_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(wcregex_token_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(sregex_token_iterator)
|
||||
_LIBCPP_PREFERRED_NAME(wsregex_token_iterator)
|
||||
regex_token_iterator
|
||||
{
|
||||
public:
|
||||
typedef basic_regex<_CharT, _Traits> regex_type;
|
||||
@ -6367,7 +6443,7 @@ public:
|
||||
regex_constants::match_flag_type __m =
|
||||
regex_constants::match_default);
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <std::size_t _Np>
|
||||
template <size_t _Np>
|
||||
regex_token_iterator(_BidirectionalIterator __a,
|
||||
_BidirectionalIterator __b,
|
||||
const regex_type&& __re,
|
||||
@ -6579,11 +6655,6 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
|
||||
return *this;
|
||||
}
|
||||
|
||||
typedef regex_token_iterator<const char*> cregex_token_iterator;
|
||||
typedef regex_token_iterator<const wchar_t*> wcregex_token_iterator;
|
||||
typedef regex_token_iterator<string::const_iterator> sregex_token_iterator;
|
||||
typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
|
||||
|
||||
// regex_replace
|
||||
|
||||
template <class _OutputIterator, class _BidirectionalIterator,
|
||||
|
@ -46,9 +46,9 @@ using binary_semaphore = counting_semaphore<1>;
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__threading_support>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
@ -58,6 +58,9 @@ using binary_semaphore = counting_semaphore<1>;
|
||||
# error <semaphore> is not supported on this single threaded system
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
#if _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
@ -68,7 +71,7 @@ __atomic_semaphore_base is the general-case implementation, to be used for
|
||||
user-requested least-max values that exceed the OS implementation support
|
||||
(incl. when the OS has no support of its own) and for binary semaphores.
|
||||
|
||||
It is a typical Dijsktra semaphore algorithm over atomics, wait and notify
|
||||
It is a typical Dijkstra semaphore algorithm over atomics, wait and notify
|
||||
functions. It avoids contention against users' own use of those facilities.
|
||||
|
||||
*/
|
||||
@ -232,4 +235,6 @@ _LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
#endif // _LIBCPP_STD_VER >= 14
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif //_LIBCPP_SEMAPHORE
|
||||
|
@ -123,6 +123,7 @@ template <class Mutex>
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <version>
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
|
@ -132,11 +132,14 @@ template<class Container>
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
|
||||
inline constexpr size_t dynamic_extent = (numeric_limits<size_t>::max)();
|
||||
inline constexpr size_t dynamic_extent = numeric_limits<size_t>::max();
|
||||
template <typename _Tp, size_t _Extent = dynamic_extent> class span;
|
||||
|
||||
|
||||
@ -546,4 +549,6 @@ template<class _Container>
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_SPAN
|
||||
|
@ -208,17 +208,23 @@ private:
|
||||
|
||||
public:
|
||||
// 27.8.1.1 Constructors:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringbuf(ios_base::openmode __wch = ios_base::in | ios_base::out)
|
||||
: __hm_(nullptr), __mode_(__wch)
|
||||
{ }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringbuf(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out)
|
||||
: __str_(__s.get_allocator()), __hm_(nullptr), __mode_(__wch)
|
||||
{
|
||||
str(__s);
|
||||
}
|
||||
|
||||
basic_stringbuf(basic_stringbuf&& __rhs);
|
||||
|
||||
// 27.8.1.2 Assign and swap:
|
||||
basic_stringbuf& operator=(basic_stringbuf&& __rhs);
|
||||
#endif
|
||||
void swap(basic_stringbuf& __rhs);
|
||||
|
||||
// 27.8.1.3 Get and set:
|
||||
@ -232,30 +238,13 @@ protected:
|
||||
virtual int_type overflow (int_type __c = traits_type::eof());
|
||||
virtual pos_type seekoff(off_type __off, ios_base::seekdir __way,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
virtual pos_type seekpos(pos_type __sp,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out) {
|
||||
return seekoff(__sp, ios_base::beg, __wch);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(ios_base::openmode __wch)
|
||||
: __hm_(0),
|
||||
__mode_(__wch)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(const string_type& __s,
|
||||
ios_base::openmode __wch)
|
||||
: __str_(__s.get_allocator()),
|
||||
__hm_(0),
|
||||
__mode_(__wch)
|
||||
{
|
||||
str(__s);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
|
||||
: __mode_(__rhs.__mode_)
|
||||
@ -345,8 +334,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
|
||||
@ -453,7 +440,7 @@ void
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
{
|
||||
__str_ = __s;
|
||||
__hm_ = 0;
|
||||
__hm_ = nullptr;
|
||||
if (__mode_ & ios_base::in)
|
||||
{
|
||||
__hm_ = const_cast<char_type*>(__str_.data()) + __str_.size();
|
||||
@ -600,9 +587,9 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
|
||||
return pos_type(-1);
|
||||
if (__noff != 0)
|
||||
{
|
||||
if ((__wch & ios_base::in) && this->gptr() == 0)
|
||||
if ((__wch & ios_base::in) && this->gptr() == nullptr)
|
||||
return pos_type(-1);
|
||||
if ((__wch & ios_base::out) && this->pptr() == 0)
|
||||
if ((__wch & ios_base::out) && this->pptr() == nullptr)
|
||||
return pos_type(-1);
|
||||
}
|
||||
if (__wch & ios_base::in)
|
||||
@ -615,14 +602,6 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekoff(off_type __off,
|
||||
return pos_type(__noff);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
typename basic_stringbuf<_CharT, _Traits, _Allocator>::pos_type
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
|
||||
ios_base::openmode __wch)
|
||||
{
|
||||
return seekoff(__sp, ios_base::beg, __wch);
|
||||
}
|
||||
|
||||
// basic_istringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@ -644,73 +623,53 @@ private:
|
||||
|
||||
public:
|
||||
// 27.8.2.1 Constructors:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_istringstream(ios_base::openmode __wch = ios_base::in)
|
||||
: basic_istream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__wch | ios_base::in)
|
||||
{ }
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_istringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_istringstream(basic_istringstream&& __rhs);
|
||||
ios_base::openmode __wch = ios_base::in)
|
||||
: basic_istream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__s, __wch | ios_base::in)
|
||||
{ }
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_istringstream& operator=(basic_istringstream&& __rhs);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_istringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(ios_base::openmode __wch)
|
||||
: basic_istream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__wch | ios_base::in)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const string_type& __s,
|
||||
ios_base::openmode __wch)
|
||||
: basic_istream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__s, __wch | ios_base::in)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
|
||||
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_istringstream(basic_istringstream&& __rhs)
|
||||
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs))
|
||||
, __sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
|
||||
{
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_istringstream& operator=(basic_istringstream&& __rhs) {
|
||||
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void basic_istringstream<_CharT, _Traits, _Allocator>::swap(basic_istringstream& __rhs)
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_istringstream& __rhs) {
|
||||
basic_istream<char_type, traits_type>::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const {
|
||||
return __sb_.str();
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s) {
|
||||
__sb_.str(__s);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@ -720,26 +679,6 @@ swap(basic_istringstream<_CharT, _Traits, _Allocator>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>*
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::rdbuf() const
|
||||
{
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
basic_istringstream<_CharT, _Traits, _Allocator>::str() const
|
||||
{
|
||||
return __sb_.str();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
{
|
||||
__sb_.str(__s);
|
||||
}
|
||||
|
||||
// basic_ostringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@ -761,74 +700,55 @@ private:
|
||||
|
||||
public:
|
||||
// 27.8.2.1 Constructors:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ostringstream(ios_base::openmode __wch = ios_base::out)
|
||||
: basic_ostream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__wch | ios_base::out)
|
||||
{ }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_ostringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::out);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostringstream(basic_ostringstream&& __rhs);
|
||||
ios_base::openmode __wch = ios_base::out)
|
||||
: basic_ostream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__s, __wch | ios_base::out)
|
||||
{ }
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_ostringstream& operator=(basic_ostringstream&& __rhs);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ostringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(ios_base::openmode __wch)
|
||||
: basic_ostream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__wch | ios_base::out)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const string_type& __s,
|
||||
ios_base::openmode __wch)
|
||||
: basic_ostream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__s, __wch | ios_base::out)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
|
||||
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_ostringstream(basic_ostringstream&& __rhs)
|
||||
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs))
|
||||
, __sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
|
||||
{
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_ostringstream& operator=(basic_ostringstream&& __rhs) {
|
||||
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::swap(basic_ostringstream& __rhs)
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_ostringstream& __rhs) {
|
||||
basic_ostream<char_type, traits_type>::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const {
|
||||
return __sb_.str();
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s) {
|
||||
__sb_.str(__s);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@ -838,27 +758,6 @@ swap(basic_ostringstream<_CharT, _Traits, _Allocator>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>*
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::rdbuf() const
|
||||
{
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::str() const
|
||||
{
|
||||
return __sb_.str();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
{
|
||||
__sb_.str(__s);
|
||||
}
|
||||
|
||||
// basic_stringstream
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@ -880,74 +779,54 @@ private:
|
||||
|
||||
public:
|
||||
// 27.8.2.1 Constructors:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringstream(ios_base::openmode __wch = ios_base::in | ios_base::out)
|
||||
: basic_iostream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__wch)
|
||||
{ }
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
explicit basic_stringstream(const string_type& __s,
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringstream(basic_stringstream&& __rhs);
|
||||
ios_base::openmode __wch = ios_base::in | ios_base::out)
|
||||
: basic_iostream<_CharT, _Traits>(&__sb_)
|
||||
, __sb_(__s, __wch)
|
||||
{ }
|
||||
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_stringstream& operator=(basic_stringstream&& __rhs);
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_stringstream& __rhs);
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const;
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s);
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(ios_base::openmode __wch)
|
||||
: basic_iostream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__wch)
|
||||
{
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string_type& __s,
|
||||
ios_base::openmode __wch)
|
||||
: basic_iostream<_CharT, _Traits>(&__sb_),
|
||||
__sb_(__s, __wch)
|
||||
{
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
|
||||
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)),
|
||||
__sb_(_VSTD::move(__rhs.__sb_))
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringstream(basic_stringstream&& __rhs)
|
||||
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs))
|
||||
, __sb_(_VSTD::move(__rhs.__sb_))
|
||||
{
|
||||
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>&
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
|
||||
{
|
||||
// 27.8.2.2 Assign and swap:
|
||||
basic_stringstream& operator=(basic_stringstream&& __rhs) {
|
||||
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs));
|
||||
__sb_ = _VSTD::move(__rhs.__sb_);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::swap(basic_stringstream& __rhs)
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void swap(basic_stringstream& __rhs) {
|
||||
basic_iostream<char_type, traits_type>::swap(__rhs);
|
||||
__sb_.swap(__rhs.__sb_);
|
||||
}
|
||||
|
||||
// 27.8.2.3 Members:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
basic_stringbuf<char_type, traits_type, allocator_type>* rdbuf() const {
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
string_type str() const {
|
||||
return __sb_.str();
|
||||
}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void str(const string_type& __s) {
|
||||
__sb_.str(__s);
|
||||
}
|
||||
};
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
@ -957,26 +836,12 @@ swap(basic_stringstream<_CharT, _Traits, _Allocator>& __x,
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_stringbuf<_CharT, _Traits, _Allocator>*
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::rdbuf() const
|
||||
{
|
||||
return const_cast<basic_stringbuf<char_type, traits_type, allocator_type>*>(&__sb_);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::str() const
|
||||
{
|
||||
return __sb_.str();
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_stringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
|
||||
{
|
||||
__sb_.str(__s);
|
||||
}
|
||||
#if defined(_LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringbuf<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_stringstream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ostringstream<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_istringstream<char>)
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -42,11 +42,9 @@ public:
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <cstdlib>
|
||||
#include <exception>
|
||||
#include <iosfwd> // for string forward decl
|
||||
#ifdef _LIBCPP_NO_EXCEPTIONS
|
||||
#include <cstdlib>
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
|
||||
#pragma GCC system_header
|
||||
|
@ -308,12 +308,12 @@ basic_streambuf<_CharT, _Traits>::~basic_streambuf()
|
||||
|
||||
template <class _CharT, class _Traits>
|
||||
basic_streambuf<_CharT, _Traits>::basic_streambuf()
|
||||
: __binp_(0),
|
||||
__ninp_(0),
|
||||
__einp_(0),
|
||||
__bout_(0),
|
||||
__nout_(0),
|
||||
__eout_(0)
|
||||
: __binp_(nullptr),
|
||||
__ninp_(nullptr),
|
||||
__einp_(nullptr),
|
||||
__bout_(nullptr),
|
||||
__nout_(nullptr),
|
||||
__eout_(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -485,13 +485,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
|
||||
return traits_type::eof();
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_DO_NOT_ASSUME_STREAMS_EXPLICIT_INSTANTIATION_IN_DYLIB
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_streambuf<wchar_t>)
|
||||
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<char>)
|
||||
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS basic_ios<wchar_t>)
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
|
@ -153,7 +153,8 @@ public:
|
||||
void resize(size_type n, value_type c);
|
||||
void resize(size_type n);
|
||||
|
||||
void reserve(size_type res_arg = 0);
|
||||
void reserve(size_type res_arg);
|
||||
void reserve(); // deprecated in C++20
|
||||
void shrink_to_fit();
|
||||
void clear() noexcept;
|
||||
bool empty() const noexcept;
|
||||
@ -448,15 +449,15 @@ typedef basic_string<wchar_t> wstring;
|
||||
typedef basic_string<char16_t> u16string;
|
||||
typedef basic_string<char32_t> u32string;
|
||||
|
||||
int stoi (const string& str, size_t* idx = 0, int base = 10);
|
||||
long stol (const string& str, size_t* idx = 0, int base = 10);
|
||||
unsigned long stoul (const string& str, size_t* idx = 0, int base = 10);
|
||||
long long stoll (const string& str, size_t* idx = 0, int base = 10);
|
||||
unsigned long long stoull(const string& str, size_t* idx = 0, int base = 10);
|
||||
int stoi (const string& str, size_t* idx = nullptr, int base = 10);
|
||||
long stol (const string& str, size_t* idx = nullptr, int base = 10);
|
||||
unsigned long stoul (const string& str, size_t* idx = nullptr, int base = 10);
|
||||
long long stoll (const string& str, size_t* idx = nullptr, int base = 10);
|
||||
unsigned long long stoull(const string& str, size_t* idx = nullptr, int base = 10);
|
||||
|
||||
float stof (const string& str, size_t* idx = 0);
|
||||
double stod (const string& str, size_t* idx = 0);
|
||||
long double stold(const string& str, size_t* idx = 0);
|
||||
float stof (const string& str, size_t* idx = nullptr);
|
||||
double stod (const string& str, size_t* idx = nullptr);
|
||||
long double stold(const string& str, size_t* idx = nullptr);
|
||||
|
||||
string to_string(int val);
|
||||
string to_string(unsigned val);
|
||||
@ -468,15 +469,15 @@ string to_string(float val);
|
||||
string to_string(double val);
|
||||
string to_string(long double val);
|
||||
|
||||
int stoi (const wstring& str, size_t* idx = 0, int base = 10);
|
||||
long stol (const wstring& str, size_t* idx = 0, int base = 10);
|
||||
unsigned long stoul (const wstring& str, size_t* idx = 0, int base = 10);
|
||||
long long stoll (const wstring& str, size_t* idx = 0, int base = 10);
|
||||
unsigned long long stoull(const wstring& str, size_t* idx = 0, int base = 10);
|
||||
int stoi (const wstring& str, size_t* idx = nullptr, int base = 10);
|
||||
long stol (const wstring& str, size_t* idx = nullptr, int base = 10);
|
||||
unsigned long stoul (const wstring& str, size_t* idx = nullptr, int base = 10);
|
||||
long long stoll (const wstring& str, size_t* idx = nullptr, int base = 10);
|
||||
unsigned long long stoull(const wstring& str, size_t* idx = nullptr, int base = 10);
|
||||
|
||||
float stof (const wstring& str, size_t* idx = 0);
|
||||
double stod (const wstring& str, size_t* idx = 0);
|
||||
long double stold(const wstring& str, size_t* idx = 0);
|
||||
float stof (const wstring& str, size_t* idx = nullptr);
|
||||
double stod (const wstring& str, size_t* idx = nullptr);
|
||||
long double stold(const wstring& str, size_t* idx = nullptr);
|
||||
|
||||
wstring to_wstring(int val);
|
||||
wstring to_wstring(unsigned val);
|
||||
@ -665,8 +666,26 @@ struct __padding<_CharT, 1>
|
||||
|
||||
#endif // _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef basic_string<char8_t> u8string;
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef basic_string<char16_t> u16string;
|
||||
typedef basic_string<char32_t> u32string;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
class _LIBCPP_TEMPLATE_VIS basic_string
|
||||
class
|
||||
_LIBCPP_TEMPLATE_VIS
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_LIBCPP_PREFERRED_NAME(u8string)
|
||||
#endif
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
_LIBCPP_PREFERRED_NAME(u16string)
|
||||
_LIBCPP_PREFERRED_NAME(u32string)
|
||||
#endif
|
||||
basic_string
|
||||
: private __basic_string_common<true>
|
||||
{
|
||||
public:
|
||||
@ -816,7 +835,7 @@ public:
|
||||
basic_string(const _CharT* __s) : __r_(__default_init_tag(), __default_init_tag()) {
|
||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
# if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
# if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
# endif
|
||||
}
|
||||
@ -890,7 +909,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY basic_string& operator=(const value_type* __s) {return assign(__s);}
|
||||
basic_string& operator=(value_type __c);
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator begin() _NOEXCEPT
|
||||
{return iterator(this, __get_pointer());}
|
||||
@ -916,7 +935,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator end() const _NOEXCEPT
|
||||
{return const_iterator(__get_pointer() + size());}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
reverse_iterator rbegin() _NOEXCEPT
|
||||
{return reverse_iterator(end());}
|
||||
@ -954,13 +973,13 @@ public:
|
||||
void resize(size_type __n, value_type __c);
|
||||
_LIBCPP_INLINE_VISIBILITY void resize(size_type __n) {resize(__n, value_type());}
|
||||
|
||||
void reserve(size_type __res_arg);
|
||||
void reserve(size_type __requested_capacity);
|
||||
_LIBCPP_INLINE_VISIBILITY void __resize_default_init(size_type __n);
|
||||
|
||||
_LIBCPP_DEPRECATED_IN_CXX20 _LIBCPP_INLINE_VISIBILITY
|
||||
void reserve() _NOEXCEPT {shrink_to_fit();}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve() _NOEXCEPT {reserve(0);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void shrink_to_fit() _NOEXCEPT {reserve();}
|
||||
void shrink_to_fit() _NOEXCEPT;
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void clear() _NOEXCEPT;
|
||||
_LIBCPP_NODISCARD_AFTER_CXX17 _LIBCPP_INLINE_VISIBILITY
|
||||
@ -1418,18 +1437,20 @@ public:
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __clear_and_shrink() _NOEXCEPT;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY void __shrink_or_extend(size_type __target_capacity);
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool __is_long() const _NOEXCEPT
|
||||
{return bool(__r_.first().__s.__size_ & __short_mask);}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1726,21 +1747,21 @@ inline
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invalidate_all_iterators()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__pos
|
||||
#endif
|
||||
)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
if (__c)
|
||||
{
|
||||
@ -1753,12 +1774,12 @@ basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type
|
||||
{
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
}
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
@ -1767,7 +1788,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
: __r_(__default_init_tag(), __default_init_tag())
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__zero();
|
||||
@ -1783,7 +1804,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __
|
||||
#endif
|
||||
: __r_(__default_init_tag(), __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__zero();
|
||||
@ -1845,7 +1866,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, const
|
||||
{
|
||||
_LIBCPP_ASSERT(__s != nullptr, "basic_string(const char*, allocator) detected nullptr");
|
||||
__init(__s, traits_type::length(__s));
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1857,7 +1878,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n) detected nullptr");
|
||||
__init(__s, __n);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1869,7 +1890,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _CharT* __s, size_
|
||||
{
|
||||
_LIBCPP_ASSERT(__n == 0 || __s != nullptr, "basic_string(const char*, n, allocator) detected nullptr");
|
||||
__init(__s, __n);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1884,7 +1905,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
__init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()),
|
||||
__str.__get_long_size());
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1899,7 +1920,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
else
|
||||
__init_copy_ctor_external(_VSTD::__to_address(__str.__get_long_pointer()),
|
||||
__str.__get_long_size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1936,7 +1957,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str)
|
||||
: __r_(_VSTD::move(__str.__r_))
|
||||
{
|
||||
__str.__zero();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
if (__is_long())
|
||||
__get_db()->swap(this, &__str);
|
||||
@ -1955,7 +1976,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(basic_string&& __str, co
|
||||
__r_.first().__r = __str.__r_.first().__r;
|
||||
__str.__zero();
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
if (__is_long())
|
||||
__get_db()->swap(this, &__str);
|
||||
@ -1994,7 +2015,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
|
||||
: __r_(__default_init_tag(), __default_init_tag())
|
||||
{
|
||||
__init(__n, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2005,7 +2026,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(size_type __n, _CharT __
|
||||
: __r_(__default_init_tag(), __a)
|
||||
{
|
||||
__init(__n, __c);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2020,7 +2041,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
if (__pos > __str_sz)
|
||||
this->__throw_out_of_range();
|
||||
__init(__str.data() + __pos, _VSTD::min(__n, __str_sz - __pos));
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2035,7 +2056,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const basic_string& __st
|
||||
if (__pos > __str_sz)
|
||||
this->__throw_out_of_range();
|
||||
__init(__str.data() + __pos, __str_sz - __pos);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2049,7 +2070,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
__self_view __sv0 = __t;
|
||||
__self_view __sv = __sv0.substr(__pos, __n);
|
||||
__init(__sv.data(), __sv.size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2061,7 +2082,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t)
|
||||
{
|
||||
__self_view __sv = __t;
|
||||
__init(__sv.data(), __sv.size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2073,7 +2094,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(const _Tp & __t, const _
|
||||
{
|
||||
__self_view __sv = __t;
|
||||
__init(__sv.data(), __sv.size());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2141,7 +2162,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
|
||||
: __r_(__default_init_tag(), __default_init_tag())
|
||||
{
|
||||
__init(__first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2154,7 +2175,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(_InputIterator __first,
|
||||
: __r_(__default_init_tag(), __a)
|
||||
{
|
||||
__init(__first, __last);
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2168,7 +2189,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
: __r_(__default_init_tag(), __default_init_tag())
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2181,7 +2202,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
: __r_(__default_init_tag(), __a)
|
||||
{
|
||||
__init(__il.begin(), __il.end());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2191,7 +2212,7 @@ basic_string<_CharT, _Traits, _Allocator>::basic_string(
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
basic_string<_CharT, _Traits, _Allocator>::~basic_string()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
if (__is_long())
|
||||
@ -2768,7 +2789,7 @@ _EnableIf
|
||||
>
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, range) called with an iterator not"
|
||||
" referring to this string");
|
||||
@ -2787,7 +2808,7 @@ _EnableIf
|
||||
>
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, _ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, range) called with an iterator not"
|
||||
" referring to this string");
|
||||
@ -2903,7 +2924,7 @@ inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::insert(const_iterator __pos, size_type __n, value_type __c)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::insert(iterator, n, value) called with an iterator not"
|
||||
" referring to this string");
|
||||
@ -3137,7 +3158,7 @@ inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__pos) == this,
|
||||
"string::erase(iterator) called with an iterator not"
|
||||
" referring to this string");
|
||||
@ -3155,7 +3176,7 @@ inline
|
||||
typename basic_string<_CharT, _Traits, _Allocator>::iterator
|
||||
basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
|
||||
"string::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this string");
|
||||
@ -3262,19 +3283,43 @@ basic_string<_CharT, _Traits, _Allocator>::max_size() const _NOEXCEPT
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __requested_capacity)
|
||||
{
|
||||
if (__res_arg > max_size())
|
||||
if (__requested_capacity > max_size())
|
||||
this->__throw_length_error();
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
// Reserve never shrinks as of C++20.
|
||||
if (__requested_capacity <= capacity()) return;
|
||||
#endif
|
||||
|
||||
size_type __target_capacity = _VSTD::max(__requested_capacity, size());
|
||||
__target_capacity = __recommend(__target_capacity);
|
||||
if (__target_capacity == capacity()) return;
|
||||
|
||||
__shrink_or_extend(__target_capacity);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::shrink_to_fit() _NOEXCEPT
|
||||
{
|
||||
size_type __target_capacity = __recommend(size());
|
||||
if (__target_capacity == capacity()) return;
|
||||
|
||||
__shrink_or_extend(__target_capacity);
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
void
|
||||
basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target_capacity)
|
||||
{
|
||||
size_type __cap = capacity();
|
||||
size_type __sz = size();
|
||||
__res_arg = _VSTD::max(__res_arg, __sz);
|
||||
__res_arg = __recommend(__res_arg);
|
||||
if (__res_arg != __cap)
|
||||
{
|
||||
|
||||
pointer __new_data, __p;
|
||||
bool __was_long, __now_long;
|
||||
if (__res_arg == __min_cap - 1)
|
||||
if (__target_capacity == __min_cap - 1)
|
||||
{
|
||||
__was_long = true;
|
||||
__now_long = false;
|
||||
@ -3283,15 +3328,15 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (__res_arg > __cap)
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
|
||||
if (__target_capacity > __cap)
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __target_capacity+1);
|
||||
else
|
||||
{
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __res_arg+1);
|
||||
__new_data = __alloc_traits::allocate(__alloc(), __target_capacity+1);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3313,7 +3358,7 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
__alloc_traits::deallocate(__alloc(), __p, __cap+1);
|
||||
if (__now_long)
|
||||
{
|
||||
__set_long_cap(__res_arg+1);
|
||||
__set_long_cap(__target_capacity+1);
|
||||
__set_long_size(__sz);
|
||||
__set_long_pointer(__new_data);
|
||||
}
|
||||
@ -3321,7 +3366,6 @@ basic_string<_CharT, _Traits, _Allocator>::reserve(size_type __res_arg)
|
||||
__set_short_size(__sz);
|
||||
__invalidate_all_iterators();
|
||||
}
|
||||
}
|
||||
|
||||
template <class _CharT, class _Traits, class _Allocator>
|
||||
inline
|
||||
@ -3426,7 +3470,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
__is_nothrow_swappable<allocator_type>::value)
|
||||
#endif
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
if (!__is_long())
|
||||
__get_db()->__invalidate_all(this);
|
||||
if (!__str.__is_long())
|
||||
@ -3438,7 +3482,7 @@ basic_string<_CharT, _Traits, _Allocator>::swap(basic_string& __str)
|
||||
__alloc_traits::is_always_equal::value ||
|
||||
__alloc() == __str.__alloc(), "swapping non-equal allocators");
|
||||
_VSTD::swap(__r_.first(), __str.__r_.first());
|
||||
__swap_allocator(__alloc(), __str.__alloc());
|
||||
_VSTD::__swap_allocator(__alloc(), __str.__alloc());
|
||||
}
|
||||
|
||||
// find
|
||||
@ -3939,9 +3983,9 @@ basic_string<_CharT, _Traits, _Allocator>::__invariants() const
|
||||
return false;
|
||||
if (capacity() < __min_cap - 1)
|
||||
return false;
|
||||
if (data() == 0)
|
||||
if (data() == nullptr)
|
||||
return false;
|
||||
if (data()[size()] != value_type(0))
|
||||
if (data()[size()] != value_type())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@ -3959,6 +4003,7 @@ basic_string<_CharT, _Traits, _Allocator>::__clear_and_shrink() _NOEXCEPT
|
||||
__alloc_traits::deallocate(__alloc(), __get_long_pointer(), capacity() + 1);
|
||||
__set_long_cap(0);
|
||||
__set_short_size(0);
|
||||
traits_type::assign(*__get_short_pointer(), value_type());
|
||||
}
|
||||
}
|
||||
|
||||
@ -4300,24 +4345,15 @@ swap(basic_string<_CharT, _Traits, _Allocator>& __lhs,
|
||||
__lhs.swap(__rhs);
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef basic_string<char8_t> u8string;
|
||||
#endif
|
||||
_LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef basic_string<char16_t> u16string;
|
||||
typedef basic_string<char32_t> u32string;
|
||||
#endif // _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
_LIBCPP_FUNC_VIS int stoi (const string& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long stol (const string& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long stoul (const string& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long long stoll (const string& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long long stoull(const string& __str, size_t* __idx = 0, int __base = 10);
|
||||
|
||||
_LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS float stof (const string& __str, size_t* __idx = nullptr);
|
||||
_LIBCPP_FUNC_VIS double stod (const string& __str, size_t* __idx = nullptr);
|
||||
_LIBCPP_FUNC_VIS long double stold(const string& __str, size_t* __idx = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS string to_string(int __val);
|
||||
_LIBCPP_FUNC_VIS string to_string(unsigned __val);
|
||||
@ -4329,15 +4365,15 @@ _LIBCPP_FUNC_VIS string to_string(float __val);
|
||||
_LIBCPP_FUNC_VIS string to_string(double __val);
|
||||
_LIBCPP_FUNC_VIS string to_string(long double __val);
|
||||
|
||||
_LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = 0, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS int stoi (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long stol (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long stoul (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS long long stoll (const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
_LIBCPP_FUNC_VIS unsigned long long stoull(const wstring& __str, size_t* __idx = nullptr, int __base = 10);
|
||||
|
||||
_LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = 0);
|
||||
_LIBCPP_FUNC_VIS float stof (const wstring& __str, size_t* __idx = nullptr);
|
||||
_LIBCPP_FUNC_VIS double stod (const wstring& __str, size_t* __idx = nullptr);
|
||||
_LIBCPP_FUNC_VIS long double stold(const wstring& __str, size_t* __idx = nullptr);
|
||||
|
||||
_LIBCPP_FUNC_VIS wstring to_wstring(int __val);
|
||||
_LIBCPP_FUNC_VIS wstring to_wstring(unsigned __val);
|
||||
@ -4425,7 +4461,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
}
|
||||
#endif
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template<class _CharT, class _Traits, class _Allocator>
|
||||
bool
|
||||
@ -4459,7 +4495,7 @@ basic_string<_CharT, _Traits, _Allocator>::__subscriptable(const const_iterator*
|
||||
return this->data() <= __p && __p < this->data() + this->size();
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
// Literal suffixes for basic_string [basic.string.literals]
|
||||
|
@ -192,7 +192,26 @@ _LIBCPP_PUSH_MACROS
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template<class _CharT, class _Traits = char_traits<_CharT> >
|
||||
class _LIBCPP_TEMPLATE_VIS basic_string_view {
|
||||
class _LIBCPP_TEMPLATE_VIS basic_string_view;
|
||||
|
||||
typedef basic_string_view<char> string_view;
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef basic_string_view<char8_t> u8string_view;
|
||||
#endif
|
||||
typedef basic_string_view<char16_t> u16string_view;
|
||||
typedef basic_string_view<char32_t> u32string_view;
|
||||
typedef basic_string_view<wchar_t> wstring_view;
|
||||
|
||||
template<class _CharT, class _Traits>
|
||||
class
|
||||
_LIBCPP_PREFERRED_NAME(string_view)
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
_LIBCPP_PREFERRED_NAME(u8string_view)
|
||||
#endif
|
||||
_LIBCPP_PREFERRED_NAME(u16string_view)
|
||||
_LIBCPP_PREFERRED_NAME(u32string_view)
|
||||
_LIBCPP_PREFERRED_NAME(wstring_view)
|
||||
basic_string_view {
|
||||
public:
|
||||
// types
|
||||
typedef _Traits traits_type;
|
||||
@ -236,7 +255,7 @@ public:
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
basic_string_view(const _CharT* __s)
|
||||
: __data(__s), __size(std::__char_traits_length_checked<_Traits>(__s)) {}
|
||||
: __data(__s), __size(_VSTD::__char_traits_length_checked<_Traits>(__s)) {}
|
||||
|
||||
// [string.view.iterators], iterators
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
@ -278,7 +297,9 @@ public:
|
||||
|
||||
// [string.view.access], element access
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference operator[](size_type __pos) const _NOEXCEPT { return __data[__pos]; }
|
||||
const_reference operator[](size_type __pos) const _NOEXCEPT {
|
||||
return _LIBCPP_ASSERT(__pos < size(), "string_view[] index out of bounds"), __data[__pos];
|
||||
}
|
||||
|
||||
_LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
|
||||
const_reference at(size_type __pos) const
|
||||
@ -774,14 +795,6 @@ basic_ostream<_CharT, _Traits>&
|
||||
operator<<(basic_ostream<_CharT, _Traits>& __os,
|
||||
basic_string_view<_CharT, _Traits> __str);
|
||||
|
||||
typedef basic_string_view<char> string_view;
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
typedef basic_string_view<char8_t> u8string_view;
|
||||
#endif
|
||||
typedef basic_string_view<char16_t> u16string_view;
|
||||
typedef basic_string_view<char32_t> u32string_view;
|
||||
typedef basic_string_view<wchar_t> wstring_view;
|
||||
|
||||
// [string.view.hash]
|
||||
template<class _CharT>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<basic_string_view<_CharT, char_traits<_CharT> > >
|
||||
|
@ -19,12 +19,12 @@ class strstreambuf
|
||||
public:
|
||||
explicit strstreambuf(streamsize alsize_arg = 0);
|
||||
strstreambuf(void* (*palloc_arg)(size_t), void (*pfree_arg)(void*));
|
||||
strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = 0);
|
||||
strstreambuf(char* gnext_arg, streamsize n, char* pbeg_arg = nullptr);
|
||||
strstreambuf(const char* gnext_arg, streamsize n);
|
||||
|
||||
strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = 0);
|
||||
strstreambuf(signed char* gnext_arg, streamsize n, signed char* pbeg_arg = nullptr);
|
||||
strstreambuf(const signed char* gnext_arg, streamsize n);
|
||||
strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = 0);
|
||||
strstreambuf(unsigned char* gnext_arg, streamsize n, unsigned char* pbeg_arg = nullptr);
|
||||
strstreambuf(const unsigned char* gnext_arg, streamsize n);
|
||||
|
||||
strstreambuf(strstreambuf&& rhs);
|
||||
@ -142,12 +142,12 @@ class _LIBCPP_TYPE_VIS strstreambuf
|
||||
public:
|
||||
explicit strstreambuf(streamsize __alsize = 0);
|
||||
strstreambuf(void* (*__palloc)(size_t), void (*__pfree)(void*));
|
||||
strstreambuf(char* __gnext, streamsize __n, char* __pbeg = 0);
|
||||
strstreambuf(char* __gnext, streamsize __n, char* __pbeg = nullptr);
|
||||
strstreambuf(const char* __gnext, streamsize __n);
|
||||
|
||||
strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = 0);
|
||||
strstreambuf(signed char* __gnext, streamsize __n, signed char* __pbeg = nullptr);
|
||||
strstreambuf(const signed char* __gnext, streamsize __n);
|
||||
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = 0);
|
||||
strstreambuf(unsigned char* __gnext, streamsize __n, unsigned char* __pbeg = nullptr);
|
||||
strstreambuf(const unsigned char* __gnext, streamsize __n);
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -290,7 +290,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
ostrstream(char* __s, int __n, ios_base::openmode __mode = ios_base::out)
|
||||
: ostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -350,7 +350,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
strstream(char* __s, int __n, ios_base::openmode __mode = ios_base::in | ios_base::out)
|
||||
: iostream(&__sb_),
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? strlen(__s) : 0))
|
||||
__sb_(__s, __n, __s + (__mode & ios::app ? _VSTD::strlen(__s) : 0))
|
||||
{}
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
38
lib/libcxx/include/support/ibm/nanosleep.h
Normal file
38
lib/libcxx/include/support/ibm/nanosleep.h
Normal file
@ -0,0 +1,38 @@
|
||||
// -*- C++ -*-
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
||||
#define _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
inline int nanosleep(const struct timespec* req, struct timespec* rem)
|
||||
{
|
||||
// The nanosleep() function is not available on z/OS. Therefore, we will call
|
||||
// sleep() to sleep for whole seconds and usleep() to sleep for any remaining
|
||||
// fraction of a second. Any remaining nanoseconds will round up to the next
|
||||
// microsecond.
|
||||
|
||||
useconds_t __micro_sec = (rem->tv_nsec + 999) / 1000;
|
||||
if (__micro_sec > 999999)
|
||||
{
|
||||
++rem->tv_sec;
|
||||
__micro_sec -= 1000000;
|
||||
}
|
||||
while (rem->tv_sec)
|
||||
rem->tv_sec = sleep(rem->tv_sec);
|
||||
if (__micro_sec) {
|
||||
rem->tv_nsec = __micro_sec * 1000;
|
||||
return usleep(__micro_sec);
|
||||
}
|
||||
rem->tv_nsec = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_SUPPORT_IBM_NANOSLEEP_H
|
@ -11,13 +11,13 @@
|
||||
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
#include <support/ibm/locale_mgmt_aix.h>
|
||||
|
||||
#if defined(_AIX)
|
||||
#include "cstdlib"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined(_AIX)
|
||||
#if !defined(_AIX71)
|
||||
// AIX 7.1 and higher has these definitions. Definitions and stubs
|
||||
// are provied here as a temporary workaround on AIX 6.1.
|
||||
@ -207,14 +207,20 @@ size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
|
||||
}
|
||||
#endif // !defined(_AIX71)
|
||||
|
||||
// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
|
||||
// implemented yet.
|
||||
// strftime_l() is defined by POSIX. However, AIX 7.1 and z/OS do not have it
|
||||
// implemented yet. z/OS retrieves it from the POSIX fallbacks.
|
||||
static inline
|
||||
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
|
||||
const struct tm *__tm, locale_t locale) {
|
||||
return __xstrftime(locale, __s, __size, __fmt, __tm);
|
||||
}
|
||||
|
||||
#elif defined(__MVS__)
|
||||
#include <wctype.h>
|
||||
// POSIX routines
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#endif // defined(__MVS__)
|
||||
|
||||
// The following are not POSIX routines. These are quick-and-dirty hacks
|
||||
// to make things pretend to work
|
||||
static inline
|
||||
@ -266,5 +272,4 @@ int vasprintf(char **strp, const char *fmt, va_list ap)
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif // defined(_AIX)
|
||||
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H
|
||||
|
18
lib/libcxx/include/support/nuttx/xlocale.h
Normal file
18
lib/libcxx/include/support/nuttx/xlocale.h
Normal file
@ -0,0 +1,18 @@
|
||||
// -*- C++ -*-
|
||||
//===-------------------- support/nuttx/xlocale.h -------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#ifndef _LIBCPP_SUPPORT_NUTTX_XLOCALE_H
|
||||
#define _LIBCPP_SUPPORT_NUTTX_XLOCALE_H
|
||||
|
||||
#if defined(__NuttX__)
|
||||
#include <support/xlocale/__posix_l_fallback.h>
|
||||
#include <support/xlocale/__strtonum_fallback.h>
|
||||
#endif // __NuttX__
|
||||
|
||||
#endif
|
@ -201,8 +201,8 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l );
|
||||
#define strtof_l _strtof_l
|
||||
#define strtold_l _strtold_l
|
||||
#else
|
||||
float strtof_l(const char*, char**, locale_t);
|
||||
long double strtold_l(const char*, char**, locale_t);
|
||||
_LIBCPP_FUNC_VIS float strtof_l(const char*, char**, locale_t);
|
||||
_LIBCPP_FUNC_VIS long double strtold_l(const char*, char**, locale_t);
|
||||
#endif
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
int
|
||||
|
@ -253,7 +253,7 @@ public:
|
||||
template <class _Ep>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
error_condition(_Ep __e,
|
||||
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
|
||||
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = nullptr
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_condition(__e);}
|
||||
|
||||
@ -325,7 +325,7 @@ public:
|
||||
template <class _Ep>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
error_code(_Ep __e,
|
||||
typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
|
||||
typename enable_if<is_error_code_enum<_Ep>::value>::type* = nullptr
|
||||
) _NOEXCEPT
|
||||
{*this = make_error_code(__e);}
|
||||
|
||||
|
@ -277,18 +277,18 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
__thread_execute(tuple<_TSp, _Fp, _Args...>& __t, __tuple_indices<_Indices...>)
|
||||
{
|
||||
__invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
|
||||
_VSTD::__invoke(_VSTD::move(_VSTD::get<1>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
|
||||
}
|
||||
|
||||
template <class _Fp>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void* __thread_proxy(void* __vp)
|
||||
{
|
||||
// _Fp = std::tuple< unique_ptr<__thread_struct>, Functor, Args...>
|
||||
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
__thread_local_data().set_pointer(_VSTD::get<0>(*__p).release());
|
||||
// _Fp = tuple< unique_ptr<__thread_struct>, Functor, Args...>
|
||||
unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
__thread_local_data().set_pointer(_VSTD::get<0>(*__p.get()).release());
|
||||
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 2>::type _Index;
|
||||
__thread_execute(*__p, _Index());
|
||||
_VSTD::__thread_execute(*__p.get(), _Index());
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -300,11 +300,11 @@ thread::thread(_Fp&& __f, _Args&&... __args)
|
||||
typedef unique_ptr<__thread_struct> _TSPtr;
|
||||
_TSPtr __tsp(new __thread_struct);
|
||||
typedef tuple<_TSPtr, typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp;
|
||||
_VSTD::unique_ptr<_Gp> __p(
|
||||
new _Gp(std::move(__tsp),
|
||||
__decay_copy(_VSTD::forward<_Fp>(__f)),
|
||||
__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
int __ec = __libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
|
||||
unique_ptr<_Gp> __p(
|
||||
new _Gp(_VSTD::move(__tsp),
|
||||
_VSTD::__decay_copy(_VSTD::forward<_Fp>(__f)),
|
||||
_VSTD::__decay_copy(_VSTD::forward<_Args>(__args))...));
|
||||
int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy<_Gp>, __p.get());
|
||||
if (__ec == 0)
|
||||
__p.release();
|
||||
else
|
||||
@ -326,7 +326,7 @@ struct __thread_invoke_pair {
|
||||
template <class _Fp>
|
||||
void* __thread_proxy_cxx03(void* __vp)
|
||||
{
|
||||
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp));
|
||||
__thread_local_data().set_pointer(__p->__tsp_.release());
|
||||
(__p->__fn_)();
|
||||
return nullptr;
|
||||
@ -337,9 +337,9 @@ thread::thread(_Fp __f)
|
||||
{
|
||||
|
||||
typedef __thread_invoke_pair<_Fp> _InvokePair;
|
||||
typedef std::unique_ptr<_InvokePair> _PairPtr;
|
||||
typedef unique_ptr<_InvokePair> _PairPtr;
|
||||
_PairPtr __pp(new _InvokePair(__f));
|
||||
int __ec = __libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
|
||||
int __ec = _VSTD::__libcpp_thread_create(&__t_, &__thread_proxy_cxx03<_InvokePair>, __pp.get());
|
||||
if (__ec == 0)
|
||||
__pp.release();
|
||||
else
|
||||
@ -360,25 +360,24 @@ template <class _Rep, class _Period>
|
||||
void
|
||||
sleep_for(const chrono::duration<_Rep, _Period>& __d)
|
||||
{
|
||||
using namespace chrono;
|
||||
if (__d > duration<_Rep, _Period>::zero())
|
||||
if (__d > chrono::duration<_Rep, _Period>::zero())
|
||||
{
|
||||
#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
|
||||
// GCC's long double const folding is incomplete for IBM128 long doubles.
|
||||
_LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
|
||||
_LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::duration<long double>(ULLONG_MAX/1000000000ULL) ;
|
||||
#else
|
||||
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
|
||||
_LIBCPP_CONSTEXPR chrono::duration<long double> _Max = chrono::nanoseconds::max();
|
||||
#endif
|
||||
nanoseconds __ns;
|
||||
chrono::nanoseconds __ns;
|
||||
if (__d < _Max)
|
||||
{
|
||||
__ns = duration_cast<nanoseconds>(__d);
|
||||
__ns = chrono::duration_cast<chrono::nanoseconds>(__d);
|
||||
if (__ns < __d)
|
||||
++__ns;
|
||||
}
|
||||
else
|
||||
__ns = nanoseconds::max();
|
||||
sleep_for(__ns);
|
||||
__ns = chrono::nanoseconds::max();
|
||||
this_thread::sleep_for(__ns);
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +385,6 @@ template <class _Clock, class _Duration>
|
||||
void
|
||||
sleep_until(const chrono::time_point<_Clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
mutex __mut;
|
||||
condition_variable __cv;
|
||||
unique_lock<mutex> __lk(__mut);
|
||||
@ -399,8 +397,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
|
||||
{
|
||||
using namespace chrono;
|
||||
sleep_for(__t - steady_clock::now());
|
||||
this_thread::sleep_for(__t - chrono::steady_clock::now());
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -1393,7 +1393,7 @@ struct _LIBCPP_TEMPLATE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
|
||||
|
||||
template <class _T1, class _T2>
|
||||
template <class... _Args1, class... _Args2, size_t ..._I1, size_t ..._I2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair<_T1, _T2>::pair(piecewise_construct_t,
|
||||
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
|
||||
__tuple_indices<_I1...>, __tuple_indices<_I2...>)
|
||||
|
@ -514,7 +514,7 @@ template <template <class...> class, class ...>
|
||||
false_type __sfinae_test_impl(...);
|
||||
|
||||
template <template <class ...> class _Templ, class ..._Args>
|
||||
using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(std::__sfinae_test_impl<_Templ, _Args...>(0));
|
||||
using _IsValidExpansion _LIBCPP_NODEBUG_TYPE = decltype(__sfinae_test_impl<_Templ, _Args...>(0));
|
||||
|
||||
template <class>
|
||||
struct __void_t { typedef void type; };
|
||||
@ -595,75 +595,6 @@ using __is_primary_template = _IsValidExpansion<
|
||||
__test_for_primary_template, _Tp
|
||||
>;
|
||||
|
||||
// addressof
|
||||
#ifndef _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_CONSTEXPR_AFTER_CXX14
|
||||
_LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return __builtin_addressof(__x);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_NO_CFI _LIBCPP_INLINE_VISIBILITY
|
||||
_Tp*
|
||||
addressof(_Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return reinterpret_cast<_Tp *>(
|
||||
const_cast<char *>(&reinterpret_cast<const volatile char &>(__x)));
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_BUILTIN_ADDRESSOF
|
||||
|
||||
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
|
||||
// Objective-C++ Automatic Reference Counting uses qualified pointers
|
||||
// that require special addressof() signatures. When
|
||||
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
|
||||
// itself is providing these definitions. Otherwise, we provide them.
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__strong _Tp*
|
||||
addressof(__strong _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__weak _Tp*
|
||||
addressof(__weak _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__autoreleasing _Tp*
|
||||
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
__unsafe_unretained _Tp*
|
||||
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
|
||||
{
|
||||
return &__x;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_CXX03_LANG)
|
||||
template <class _Tp> _Tp* addressof(const _Tp&&) noexcept = delete;
|
||||
#endif
|
||||
|
||||
struct __two {char __lx[2];};
|
||||
|
||||
// helper class:
|
||||
@ -1821,7 +1752,7 @@ template <typename _Tp>
|
||||
static void __test_noexcept(_Tp) noexcept;
|
||||
|
||||
template<typename _Fm, typename _To>
|
||||
static bool_constant<noexcept(__test_noexcept<_To>(declval<_Fm>()))>
|
||||
static bool_constant<noexcept(_VSTD::__test_noexcept<_To>(declval<_Fm>()))>
|
||||
__is_nothrow_convertible_test();
|
||||
|
||||
template <typename _Fm, typename _To>
|
||||
@ -2550,7 +2481,7 @@ _LIBCPP_INLINE_VAR _LIBCPP_CONSTEXPR bool is_destructible_v = __is_destructible(
|
||||
// if it's a function, return false
|
||||
// if it's void, return false
|
||||
// if it's an array of unknown bound, return false
|
||||
// Otherwise, return "std::declval<_Up&>().~_Up()" is well-formed
|
||||
// Otherwise, return "declval<_Up&>().~_Up()" is well-formed
|
||||
// where _Up is remove_all_extents<_Tp>::type
|
||||
|
||||
template <class>
|
||||
@ -2876,167 +2807,13 @@ struct __member_pointer_class_type<_Ret _ClassType::*> {
|
||||
typedef _ClassType type;
|
||||
};
|
||||
|
||||
// result_of
|
||||
|
||||
template <class _Callable> class result_of;
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
template <class _Fn, bool, bool>
|
||||
class __result_of
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn>
|
||||
class __result_of<_Fn(), true, false>
|
||||
{
|
||||
public:
|
||||
typedef decltype(declval<_Fn>()()) type;
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
class __result_of<_Fn(_A0), true, false>
|
||||
{
|
||||
public:
|
||||
typedef decltype(declval<_Fn>()(declval<_A0>())) type;
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
class __result_of<_Fn(_A0, _A1), true, false>
|
||||
{
|
||||
public:
|
||||
typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>())) type;
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
class __result_of<_Fn(_A0, _A1, _A2), true, false>
|
||||
{
|
||||
public:
|
||||
typedef decltype(declval<_Fn>()(declval<_A0>(), declval<_A1>(), declval<_A2>())) type;
|
||||
};
|
||||
|
||||
template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
|
||||
struct __result_of_mp;
|
||||
|
||||
// member function pointer
|
||||
|
||||
template <class _MP, class _Tp>
|
||||
struct __result_of_mp<_MP, _Tp, true>
|
||||
: public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
|
||||
{
|
||||
};
|
||||
|
||||
// member data pointer
|
||||
|
||||
template <class _MP, class _Tp, bool>
|
||||
struct __result_of_mdp;
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
|
||||
{
|
||||
typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
|
||||
{
|
||||
typedef typename __apply_cv<_Tp, _Rp>::type& type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mp<_Rp _Class::*, _Tp, false>
|
||||
: public __result_of_mdp<_Rp _Class::*, _Tp,
|
||||
is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <class _Fn, class _Tp>
|
||||
class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _Tp, class _A0>
|
||||
class __result_of<_Fn(_Tp, _A0), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _Tp, class _A0, class _A1>
|
||||
class __result_of<_Fn(_Tp, _A0, _A1), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _Tp, class _A0, class _A1, class _A2>
|
||||
class __result_of<_Fn(_Tp, _A0, _A1, _A2), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
// result_of
|
||||
|
||||
template <class _Fn>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fn()>
|
||||
: public __result_of<_Fn(),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0)>
|
||||
: public __result_of<_Fn(_A0),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0, class _A1>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1)>
|
||||
: public __result_of<_Fn(_A0, _A1),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _A0, class _A1, class _A2>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_A0, _A1, _A2)>
|
||||
: public __result_of<_Fn(_A0, _A1, _A2),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_HAS_NO_VARIADICS
|
||||
|
||||
// template <class T, class... Args> struct is_constructible;
|
||||
|
||||
namespace __is_construct
|
||||
{
|
||||
struct __nat {};
|
||||
}
|
||||
#if defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW >= 10000
|
||||
# define _LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE
|
||||
#endif
|
||||
|
||||
#if !defined(_LIBCPP_CXX03_LANG) && (!__has_feature(is_constructible) || \
|
||||
defined(_LIBCPP_TESTING_FALLBACK_IS_CONSTRUCTIBLE))
|
||||
#if !defined(_LIBCPP_CXX03_LANG) && !__has_feature(is_constructible) && !defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE)
|
||||
|
||||
template <class _Tp, class... _Args>
|
||||
struct __libcpp_is_constructible;
|
||||
@ -3151,7 +2928,7 @@ struct __libcpp_is_constructible<_Tp&&, _A0>
|
||||
|
||||
#endif
|
||||
|
||||
#if __has_feature(is_constructible)
|
||||
#if __has_feature(is_constructible) || defined(_LIBCPP_GCC_SUPPORTS_IS_CONSTRUCTIBLE)
|
||||
template <class _Tp, class ..._Args>
|
||||
struct _LIBCPP_TEMPLATE_VIS is_constructible
|
||||
: public integral_constant<bool, __is_constructible(_Tp, _Args...)>
|
||||
@ -3442,7 +3219,7 @@ void __implicit_conversion_to(_Tp) noexcept { }
|
||||
|
||||
template <class _Tp, class _Arg>
|
||||
struct __libcpp_is_nothrow_constructible</*is constructible*/true, /*is reference*/true, _Tp, _Arg>
|
||||
: public integral_constant<bool, noexcept(__implicit_conversion_to<_Tp>(declval<_Arg>()))>
|
||||
: public integral_constant<bool, noexcept(_VSTD::__implicit_conversion_to<_Tp>(declval<_Arg>()))>
|
||||
{
|
||||
};
|
||||
|
||||
@ -3982,14 +3759,97 @@ struct __invoke_of
|
||||
{
|
||||
};
|
||||
|
||||
#endif // _LIBCPP_CXX03_LANG
|
||||
|
||||
// result_of
|
||||
|
||||
template <class _Callable> class result_of;
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
|
||||
template <class _Fp, class ..._Args>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fp(_Args...)>
|
||||
: public __invoke_of<_Fp, _Args...>
|
||||
{
|
||||
};
|
||||
|
||||
#else // C++03
|
||||
|
||||
template <class _Fn, bool, bool>
|
||||
class __result_of
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class ..._Args>
|
||||
class __result_of<_Fn(_Args...), true, false>
|
||||
{
|
||||
public:
|
||||
typedef decltype(declval<_Fn>()(declval<_Args>()...)) type;
|
||||
};
|
||||
|
||||
template <class _MP, class _Tp, bool _IsMemberFunctionPtr>
|
||||
struct __result_of_mp;
|
||||
|
||||
// member function pointer
|
||||
|
||||
template <class _MP, class _Tp>
|
||||
struct __result_of_mp<_MP, _Tp, true>
|
||||
: public __identity<typename __member_pointer_traits<_MP>::_ReturnType>
|
||||
{
|
||||
};
|
||||
|
||||
// member data pointer
|
||||
|
||||
template <class _MP, class _Tp, bool>
|
||||
struct __result_of_mdp;
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mdp<_Rp _Class::*, _Tp, false>
|
||||
{
|
||||
typedef typename __apply_cv<decltype(*_VSTD::declval<_Tp>()), _Rp>::type& type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mdp<_Rp _Class::*, _Tp, true>
|
||||
{
|
||||
typedef typename __apply_cv<_Tp, _Rp>::type& type;
|
||||
};
|
||||
|
||||
template <class _Rp, class _Class, class _Tp>
|
||||
struct __result_of_mp<_Rp _Class::*, _Tp, false>
|
||||
: public __result_of_mdp<_Rp _Class::*, _Tp,
|
||||
is_base_of<_Class, typename remove_reference<_Tp>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _Tp>
|
||||
class __result_of<_Fn(_Tp), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class _Tp, class ..._Args>
|
||||
class __result_of<_Fn(_Tp, _Args...), false, true> // _Fn must be member pointer
|
||||
: public __result_of_mp<typename remove_reference<_Fn>::type,
|
||||
_Tp,
|
||||
is_member_function_pointer<typename remove_reference<_Fn>::type>::value>
|
||||
{
|
||||
};
|
||||
|
||||
template <class _Fn, class ..._Args>
|
||||
class _LIBCPP_TEMPLATE_VIS result_of<_Fn(_Args...)>
|
||||
: public __result_of<_Fn(_Args...),
|
||||
is_class<typename remove_reference<_Fn>::type>::value ||
|
||||
is_function<typename remove_pointer<typename remove_reference<_Fn>::type>::type>::value,
|
||||
is_member_pointer<typename remove_reference<_Fn>::type>::value
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // C++03
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp> using result_of_t = typename result_of<_Tp>::type;
|
||||
#endif
|
||||
@ -4045,8 +3905,6 @@ _LIBCPP_INLINE_VAR constexpr bool is_nothrow_invocable_r_v
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
#endif // !defined(_LIBCPP_CXX03_LANG)
|
||||
|
||||
template <class _Tp> struct __is_swappable;
|
||||
template <class _Tp> struct __is_nothrow_swappable;
|
||||
|
||||
@ -4341,7 +4199,6 @@ _LIBCPP_INLINE_VAR constexpr bool negation_v
|
||||
#endif // _LIBCPP_STD_VER > 14
|
||||
|
||||
// These traits are used in __tree and __hash_table
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
struct __extract_key_fail_tag {};
|
||||
struct __extract_key_self_tag {};
|
||||
struct __extract_key_first_tag {};
|
||||
@ -4371,8 +4228,6 @@ template <class _ValTy, class _Key, class _RawValTy>
|
||||
struct __can_extract_map_key<_ValTy, _Key, _Key, _RawValTy>
|
||||
: false_type {};
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <exception>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
@ -141,7 +142,7 @@ public:
|
||||
// comparison is equal.
|
||||
// -------------------------------------------------------------------------- //
|
||||
// NonUniqueARMRTTIBit
|
||||
// (selected on ARM64 regardless of _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION)
|
||||
// (_LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION = 3)
|
||||
// -------------------------------------------------------------------------- //
|
||||
// This implementation of type_info does not assume always a unique copy of
|
||||
// the RTTI for a given type inside a program. It packs the pointer to the
|
||||
@ -160,6 +161,24 @@ public:
|
||||
// the pointer when it constructs the type_info, depending on whether it can
|
||||
// guarantee uniqueness for that specific type_info.
|
||||
|
||||
// This value can be overriden in the __config_site. When it's not overriden,
|
||||
// we pick a default implementation based on the platform here.
|
||||
#ifndef _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
|
||||
// Windows binaries can't merge typeinfos, so use the NonUnique implementation.
|
||||
# ifdef _LIBCPP_OBJECT_FORMAT_COFF
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 2
|
||||
|
||||
// On arm64 on Apple platforms, use the special NonUniqueARMRTTIBit implementation.
|
||||
# elif defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 3
|
||||
|
||||
// On all other platforms, assume the Itanium C++ ABI and use the Unique implementation.
|
||||
# else
|
||||
# define _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
struct __type_info_implementations {
|
||||
struct __string_impl_base {
|
||||
typedef const char* __type_name_t;
|
||||
@ -243,7 +262,7 @@ struct __type_info_implementations {
|
||||
private:
|
||||
// The unique bit is the top bit. It is expected that __type_name_t is 64 bits when
|
||||
// this implementation is actually used.
|
||||
typedef std::integral_constant<__type_name_t,
|
||||
typedef integral_constant<__type_name_t,
|
||||
(1ULL << ((__CHAR_BIT__ * sizeof(__type_name_t)) - 1))> __non_unique_rtti_bit;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -257,12 +276,12 @@ struct __type_info_implementations {
|
||||
};
|
||||
|
||||
typedef
|
||||
#if defined(__APPLE__) && defined(__LP64__) && !defined(__x86_64__)
|
||||
__non_unique_arm_rtti_bit_impl
|
||||
#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
|
||||
#if _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 1
|
||||
__unique_impl
|
||||
#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 2
|
||||
__non_unique_impl
|
||||
#elif _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION == 3
|
||||
__non_unique_arm_rtti_bit_impl
|
||||
#else
|
||||
# error invalid configuration for _LIBCPP_TYPEINFO_COMPARISON_IMPLEMENTATION
|
||||
#endif
|
||||
|
@ -173,10 +173,22 @@ public:
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
template<typename K>
|
||||
iterator find(const K& x); // C++20
|
||||
template<typename K>
|
||||
const_iterator find(const K& x) const; // C++20
|
||||
size_type count(const key_type& k) const;
|
||||
template<typename K>
|
||||
size_type count(const K& k) const; // C++20
|
||||
bool contains(const key_type& k) const; // C++20
|
||||
template<typename K>
|
||||
bool contains(const K& k) const; // C++20
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
template<typename K>
|
||||
pair<iterator, iterator> equal_range(const K& k); // C++20
|
||||
template<typename K>
|
||||
pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
|
||||
|
||||
mapped_type& operator[](const key_type& k);
|
||||
mapped_type& operator[](key_type&& k);
|
||||
@ -355,10 +367,22 @@ public:
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
template<typename K>
|
||||
iterator find(const K& x); // C++20
|
||||
template<typename K>
|
||||
const_iterator find(const K& x) const; // C++20
|
||||
size_type count(const key_type& k) const;
|
||||
template<typename K>
|
||||
size_type count(const K& k) const; // C++20
|
||||
bool contains(const key_type& k) const; // C++20
|
||||
template<typename K>
|
||||
bool contains(const K& k) const; // C++20
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
template<typename K>
|
||||
pair<iterator, iterator> equal_range(const K& k); // C++20
|
||||
template<typename K>
|
||||
pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
|
||||
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
@ -423,7 +447,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template <class _Key, class _Cp, class _Hash,
|
||||
template <class _Key, class _Cp, class _Hash, class _Pred,
|
||||
bool = is_empty<_Hash>::value && !__libcpp_is_final<_Hash>::value>
|
||||
class __unordered_map_hasher
|
||||
: private _Hash
|
||||
@ -445,6 +469,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Key& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _K2& __x) const
|
||||
{return static_cast<const _Hash&>(*this)(__x);}
|
||||
#endif
|
||||
void swap(__unordered_map_hasher&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
|
||||
{
|
||||
@ -453,8 +483,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Hash>
|
||||
class __unordered_map_hasher<_Key, _Cp, _Hash, false>
|
||||
template <class _Key, class _Cp, class _Hash, class _Pred>
|
||||
class __unordered_map_hasher<_Key, _Cp, _Hash, _Pred, false>
|
||||
{
|
||||
_Hash __hash_;
|
||||
public:
|
||||
@ -474,6 +504,12 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _Key& __x) const
|
||||
{return __hash_(__x);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(const _K2& __x) const
|
||||
{return __hash_(__x);}
|
||||
#endif
|
||||
void swap(__unordered_map_hasher&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Hash>::value)
|
||||
{
|
||||
@ -482,17 +518,17 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Hash, bool __b>
|
||||
template <class _Key, class _Cp, class _Hash, class _Pred, bool __b>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __x,
|
||||
__unordered_map_hasher<_Key, _Cp, _Hash, __b>& __y)
|
||||
swap(__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __x,
|
||||
__unordered_map_hasher<_Key, _Cp, _Hash, _Pred, __b>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
}
|
||||
|
||||
template <class _Key, class _Cp, class _Pred,
|
||||
template <class _Key, class _Cp, class _Pred, class _Hash,
|
||||
bool = is_empty<_Pred>::value && !__libcpp_is_final<_Pred>::value>
|
||||
class __unordered_map_equal
|
||||
: private _Pred
|
||||
@ -517,6 +553,24 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Cp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Cp& __x, const _K2& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x.__get_value().first, __y);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _K2& __x, const _Cp& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y.__get_value().first);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _K2& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _K2& __x, const _Key& __y) const
|
||||
{return static_cast<const _Pred&>(*this)(__x, __y);}
|
||||
#endif
|
||||
void swap(__unordered_map_equal&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
|
||||
{
|
||||
@ -525,8 +579,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Pred>
|
||||
class __unordered_map_equal<_Key, _Cp, _Pred, false>
|
||||
template <class _Key, class _Cp, class _Pred, class _Hash>
|
||||
class __unordered_map_equal<_Key, _Cp, _Pred, _Hash, false>
|
||||
{
|
||||
_Pred __pred_;
|
||||
public:
|
||||
@ -549,6 +603,24 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _Cp& __y) const
|
||||
{return __pred_(__x, __y.__get_value().first);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Cp& __x, const _K2& __y) const
|
||||
{return __pred_(__x.__get_value().first, __y);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _K2& __x, const _Cp& __y) const
|
||||
{return __pred_(__x, __y.__get_value().first);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _Key& __x, const _K2& __y) const
|
||||
{return __pred_(__x, __y);}
|
||||
template <typename _K2, typename = _EnableIf<__is_transparent<_Hash, _K2>::value && __is_transparent<_Pred, _K2>::value>>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool operator()(const _K2& __x, const _Key& __y) const
|
||||
{return __pred_(__x, __y);}
|
||||
#endif
|
||||
void swap(__unordered_map_equal&__y)
|
||||
_NOEXCEPT_(__is_nothrow_swappable<_Pred>::value)
|
||||
{
|
||||
@ -557,11 +629,11 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
template <class _Key, class _Cp, class _Pred, bool __b>
|
||||
template <class _Key, class _Cp, class _Pred, class _Hash, bool __b>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
swap(__unordered_map_equal<_Key, _Cp, _Pred, __b>& __x,
|
||||
__unordered_map_equal<_Key, _Cp, _Pred, __b>& __y)
|
||||
swap(__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __x,
|
||||
__unordered_map_equal<_Key, _Cp, _Pred, _Hash, __b>& __y)
|
||||
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
|
||||
{
|
||||
__x.swap(__y);
|
||||
@ -859,8 +931,8 @@ public:
|
||||
|
||||
private:
|
||||
typedef __hash_value_type<key_type, mapped_type> __value_type;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
|
||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
|
||||
@ -906,7 +978,7 @@ public:
|
||||
unordered_map()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1025,7 +1097,7 @@ public:
|
||||
{return __table_.__insert_unique(__x);}
|
||||
|
||||
iterator insert(const_iterator __p, const value_type& __x) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1049,7 +1121,7 @@ public:
|
||||
{return __table_.__insert_unique(_VSTD::move(__x));}
|
||||
|
||||
iterator insert(const_iterator __p, value_type&& __x) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered_map::insert(const_iterator, const value_type&) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1070,7 +1142,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator insert(const_iterator __p, _Pp&& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered_map::insert(const_iterator, value_type&&) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1089,7 +1161,7 @@ public:
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
"unordered_map::emplace_hint(const_iterator, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1106,7 +1178,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct,
|
||||
return __table_.__emplace_unique_key_args(__k, piecewise_construct,
|
||||
_VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
@ -1115,7 +1187,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, bool> try_emplace(key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
return __table_.__emplace_unique_key_args(__k, _VSTD::piecewise_construct,
|
||||
return __table_.__emplace_unique_key_args(__k, piecewise_construct,
|
||||
_VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple(_VSTD::forward<_Args>(__args)...));
|
||||
}
|
||||
@ -1124,7 +1196,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, const key_type& __k, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
|
||||
"unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1138,7 +1210,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
iterator try_emplace(const_iterator __h, key_type&& __k, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__h) == this,
|
||||
"unordered_map::try_emplace(const_iterator, key, args...) called with an iterator not"
|
||||
" referring to this unordered_map");
|
||||
@ -1280,11 +1352,34 @@ public:
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
|
||||
find(const _K2& __k) {return __table_.find(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
|
||||
find(const _K2& __k) const {return __table_.find(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
|
||||
count(const _K2& __k) const {return __table_.__count_unique(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool contains(const key_type& __k) const {return find(__k) != end();}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
|
||||
contains(const _K2& __k) const {return find(__k) != end();}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
@ -1292,6 +1387,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
|
||||
equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
|
||||
equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
mapped_type& operator[](const key_type& __k);
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
@ -1336,7 +1441,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(&__i->__i_);}
|
||||
@ -1347,7 +1452,7 @@ public:
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(&__i->__i_, __n);}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
|
||||
@ -1428,7 +1533,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1440,7 +1545,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1452,7 +1557,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const allocator_type& __a)
|
||||
: __table_(typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1462,7 +1567,7 @@ template <class _InputIterator>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__first, __last);
|
||||
@ -1475,7 +1580,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1489,7 +1594,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1501,7 +1606,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const unordered_map& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -1513,7 +1618,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const unordered_map& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -1529,7 +1634,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -1540,7 +1645,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
unordered_map&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a != __u.get_allocator())
|
||||
@ -1551,7 +1656,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
__u.__table_.remove((__i++).__i_)->__value_.__move());
|
||||
}
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
else
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -1561,7 +1666,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__il.begin(), __il.end());
|
||||
@ -1573,7 +1678,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1586,7 +1691,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_map(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1633,8 +1738,8 @@ _Tp&
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type& __k)
|
||||
{
|
||||
return __table_.__emplace_unique_key_args(__k,
|
||||
std::piecewise_construct, std::forward_as_tuple(__k),
|
||||
std::forward_as_tuple()).first->__get_value().second;
|
||||
piecewise_construct, _VSTD::forward_as_tuple(__k),
|
||||
_VSTD::forward_as_tuple()).first->__get_value().second;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@ -1642,8 +1747,8 @@ _Tp&
|
||||
unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](key_type&& __k)
|
||||
{
|
||||
return __table_.__emplace_unique_key_args(__k,
|
||||
std::piecewise_construct, std::forward_as_tuple(std::move(__k)),
|
||||
std::forward_as_tuple()).first->__get_value().second;
|
||||
piecewise_construct, _VSTD::forward_as_tuple(_VSTD::move(__k)),
|
||||
_VSTD::forward_as_tuple()).first->__get_value().second;
|
||||
}
|
||||
#else // _LIBCPP_CXX03_LANG
|
||||
|
||||
@ -1657,7 +1762,7 @@ unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node_with_key(const
|
||||
__h.get_deleter().__first_constructed = true;
|
||||
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.__get_value().second));
|
||||
__h.get_deleter().__second_constructed = true;
|
||||
return _LIBCPP_EXPLICIT_MOVE(__h); // explicitly moved for C++03
|
||||
return __h;
|
||||
}
|
||||
|
||||
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
@ -1763,8 +1868,8 @@ public:
|
||||
|
||||
private:
|
||||
typedef __hash_value_type<key_type, mapped_type> __value_type;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal> __key_equal;
|
||||
typedef __unordered_map_hasher<key_type, __value_type, hasher, key_equal> __hasher;
|
||||
typedef __unordered_map_equal<key_type, __value_type, key_equal, hasher> __key_equal;
|
||||
typedef typename __rebind_alloc_helper<allocator_traits<allocator_type>,
|
||||
__value_type>::type __allocator_type;
|
||||
|
||||
@ -1807,7 +1912,7 @@ public:
|
||||
unordered_multimap()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2059,11 +2164,32 @@ public:
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
|
||||
find(const _K2& __k) {return __table_.find(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
|
||||
find(const _K2& __k) const {return __table_.find(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
|
||||
count(const _K2& __k) const {return __table_.__count_multi(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool contains(const key_type& __k) const {return find(__k) != end();}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
|
||||
contains(const _K2& __k) const {return find(__k) != end();}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
@ -2071,6 +2197,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
|
||||
equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
|
||||
equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
@ -2108,7 +2244,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(&__i->__i_);}
|
||||
@ -2119,7 +2255,7 @@ public:
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(&__i->__i_, __n);}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
|
||||
};
|
||||
@ -2196,7 +2332,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -2208,7 +2344,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -2219,7 +2355,7 @@ template <class _InputIterator>
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__first, __last);
|
||||
@ -2232,7 +2368,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -2246,7 +2382,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -2259,7 +2395,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const allocator_type& __a)
|
||||
: __table_(typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -2269,7 +2405,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const unordered_multimap& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -2281,7 +2417,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const unordered_multimap& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -2297,7 +2433,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -2308,7 +2444,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
unordered_multimap&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a != __u.get_allocator())
|
||||
@ -2320,7 +2456,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
__u.__table_.remove((__i++).__i_)->__value_.__move());
|
||||
}
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
else
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -2330,7 +2466,7 @@ template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__il.begin(), __il.end());
|
||||
@ -2342,7 +2478,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -2355,7 +2491,7 @@ unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>::unordered_multimap(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, typename __table::allocator_type(__a))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
|
@ -145,10 +145,22 @@ public:
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
template<typename K>
|
||||
iterator find(const K& x); // C++20
|
||||
template<typename K>
|
||||
const_iterator find(const K& x) const; // C++20
|
||||
size_type count(const key_type& k) const;
|
||||
template<typename K>
|
||||
size_type count(const K& k) const; // C++20
|
||||
bool contains(const key_type& k) const; // C++20
|
||||
template<typename K>
|
||||
bool contains(const K& k) const; // C++20
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
template<typename K>
|
||||
pair<iterator, iterator> equal_range(const K& k); // C++20
|
||||
template<typename K>
|
||||
pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
|
||||
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
@ -310,10 +322,22 @@ public:
|
||||
|
||||
iterator find(const key_type& k);
|
||||
const_iterator find(const key_type& k) const;
|
||||
template<typename K>
|
||||
iterator find(const K& x); // C++20
|
||||
template<typename K>
|
||||
const_iterator find(const K& x) const; // C++20
|
||||
size_type count(const key_type& k) const;
|
||||
template<typename K>
|
||||
size_type count(const K& k) const; // C++20
|
||||
bool contains(const key_type& k) const; // C++20
|
||||
template<typename K>
|
||||
bool contains(const K& k) const; // C++20
|
||||
pair<iterator, iterator> equal_range(const key_type& k);
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& k) const;
|
||||
template<typename K>
|
||||
pair<iterator, iterator> equal_range(const K& k); // C++20
|
||||
template<typename K>
|
||||
pair<const_iterator, const_iterator> equal_range(const K& k) const; // C++20
|
||||
|
||||
size_type bucket_count() const noexcept;
|
||||
size_type max_bucket_count() const noexcept;
|
||||
@ -425,7 +449,7 @@ public:
|
||||
unordered_set()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -539,7 +563,7 @@ public:
|
||||
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
|
||||
template <class... _Args>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
iterator emplace_hint(const_iterator __p, _Args&&... __args)
|
||||
{
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
@ -556,7 +580,7 @@ public:
|
||||
pair<iterator, bool> insert(value_type&& __x)
|
||||
{return __table_.__insert_unique(_VSTD::move(__x));}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
iterator insert(const_iterator __p, value_type&& __x)
|
||||
{
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
@ -577,7 +601,7 @@ public:
|
||||
{return __table_.__insert_unique(__x);}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
iterator insert(const_iterator __p, const value_type& __x)
|
||||
{
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
|
||||
@ -679,11 +703,32 @@ public:
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
|
||||
find(const _K2& __k) {return __table_.find(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
|
||||
find(const _K2& __k) const {return __table_.find(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_unique(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
|
||||
count(const _K2& __k) const {return __table_.__count_unique(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool contains(const key_type& __k) const {return find(__k) != end();}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
|
||||
contains(const _K2& __k) const {return find(__k) != end();}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
@ -691,6 +736,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_unique(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
|
||||
equal_range(const _K2& __k) {return __table_.__equal_range_unique(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
|
||||
equal_range(const _K2& __k) const {return __table_.__equal_range_unique(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
@ -726,7 +781,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(__i);}
|
||||
@ -737,7 +792,7 @@ public:
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
};
|
||||
|
||||
@ -802,7 +857,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -813,7 +868,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -824,7 +879,7 @@ template <class _InputIterator>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__first, __last);
|
||||
@ -837,7 +892,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -851,7 +906,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -864,7 +919,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -874,7 +929,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const unordered_set& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -886,7 +941,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const unordered_set& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -902,7 +957,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -913,7 +968,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
unordered_set&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a != __u.get_allocator())
|
||||
@ -922,7 +977,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
else
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -932,7 +987,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__il.begin(), __il.end());
|
||||
@ -944,7 +999,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -957,7 +1012,7 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1091,7 +1146,7 @@ public:
|
||||
unordered_multiset()
|
||||
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1314,11 +1369,32 @@ public:
|
||||
iterator find(const key_type& __k) {return __table_.find(__k);}
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
const_iterator find(const key_type& __k) const {return __table_.find(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, iterator>
|
||||
find(const _K2& __k) {return __table_.find(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, const_iterator>
|
||||
find(const _K2& __k) const {return __table_.find(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type count(const key_type& __k) const {return __table_.__count_multi(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, size_type>
|
||||
count(const _K2& __k) const {return __table_.__count_multi(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
bool contains(const key_type& __k) const {return find(__k) != end();}
|
||||
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, bool>
|
||||
contains(const _K2& __k) const {return find(__k) != end();}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<iterator, iterator> equal_range(const key_type& __k)
|
||||
@ -1326,6 +1402,16 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
pair<const_iterator, const_iterator> equal_range(const key_type& __k) const
|
||||
{return __table_.__equal_range_multi(__k);}
|
||||
#if _LIBCPP_STD_VER > 17
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<iterator, iterator>>
|
||||
equal_range(const _K2& __k) {return __table_.__equal_range_multi(__k);}
|
||||
template <typename _K2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_EnableIf<__is_transparent<hasher, _K2>::value && __is_transparent<key_equal, _K2>::value, pair<const_iterator, const_iterator>>
|
||||
equal_range(const _K2& __k) const {return __table_.__equal_range_multi(__k);}
|
||||
#endif // _LIBCPP_STD_VER > 17
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_type bucket_count() const _NOEXCEPT {return __table_.bucket_count();}
|
||||
@ -1361,7 +1447,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void reserve(size_type __n) {__table_.reserve(__n);}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const
|
||||
{return __table_.__dereferenceable(__i);}
|
||||
@ -1372,7 +1458,7 @@ public:
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
|
||||
{return __table_.__addable(__i, __n);}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
};
|
||||
|
||||
@ -1435,7 +1521,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
size_type __n, const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1447,7 +1533,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1458,7 +1544,7 @@ template <class _InputIterator>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
_InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__first, __last);
|
||||
@ -1471,7 +1557,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const hasher& __hf, const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1485,7 +1571,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1498,7 +1584,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const allocator_type& __a)
|
||||
: __table_(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -1508,7 +1594,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const unordered_multiset& __u)
|
||||
: __table_(__u.__table_)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -1520,7 +1606,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const unordered_multiset& __u, const allocator_type& __a)
|
||||
: __table_(__u.__table_, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__u.bucket_count());
|
||||
@ -1536,7 +1622,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
|
||||
: __table_(_VSTD::move(__u.__table_))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -1547,7 +1633,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
unordered_multiset&& __u, const allocator_type& __a)
|
||||
: __table_(_VSTD::move(__u.__table_), __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a != __u.get_allocator())
|
||||
@ -1556,7 +1642,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
while (__u.size() != 0)
|
||||
__table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
|
||||
}
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
else
|
||||
__get_db()->swap(this, &__u);
|
||||
#endif
|
||||
@ -1566,7 +1652,7 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
|
||||
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
insert(__il.begin(), __il.end());
|
||||
@ -1578,7 +1664,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const key_equal& __eql)
|
||||
: __table_(__hf, __eql)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
@ -1591,7 +1677,7 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
|
||||
const key_equal& __eql, const allocator_type& __a)
|
||||
: __table_(__hf, __eql, __a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
__table_.rehash(__n);
|
||||
|
@ -499,7 +499,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
|
||||
second(_VSTD::get<1>(_VSTD::forward<_Tuple>(__p))) {}
|
||||
|
||||
template <class... _Args1, class... _Args2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair(piecewise_construct_t __pc,
|
||||
tuple<_Args1...> __first_args, tuple<_Args2...> __second_args)
|
||||
_NOEXCEPT_((is_nothrow_constructible<first_type, _Args1...>::value &&
|
||||
@ -508,7 +508,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
|
||||
typename __make_tuple_indices<sizeof...(_Args1)>::type(),
|
||||
typename __make_tuple_indices<sizeof...(_Args2) >::type()) {}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair& operator=(typename conditional<
|
||||
is_copy_assignable<first_type>::value &&
|
||||
is_copy_assignable<second_type>::value,
|
||||
@ -521,7 +521,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
|
||||
return *this;
|
||||
}
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair& operator=(typename conditional<
|
||||
is_move_assignable<first_type>::value &&
|
||||
is_move_assignable<second_type>::value,
|
||||
@ -537,7 +537,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
|
||||
template <class _Tuple, _EnableB<
|
||||
_CheckTLC<_Tuple>::template __enable_assign<_Tuple>()
|
||||
> = false>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair& operator=(_Tuple&& __p) {
|
||||
first = _VSTD::get<0>(_VSTD::forward<_Tuple>(__p));
|
||||
second = _VSTD::get<1>(_VSTD::forward<_Tuple>(__p));
|
||||
@ -545,7 +545,7 @@ struct _LIBCPP_TEMPLATE_VIS pair
|
||||
}
|
||||
#endif
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
void
|
||||
swap(pair& __p) _NOEXCEPT_(__is_nothrow_swappable<first_type>::value &&
|
||||
__is_nothrow_swappable<second_type>::value)
|
||||
@ -558,7 +558,7 @@ private:
|
||||
|
||||
#ifndef _LIBCPP_CXX03_LANG
|
||||
template <class... _Args1, class... _Args2, size_t... _I1, size_t... _I2>
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
pair(piecewise_construct_t,
|
||||
tuple<_Args1...>& __first_args, tuple<_Args2...>& __second_args,
|
||||
__tuple_indices<_I1...>, __tuple_indices<_I2...>);
|
||||
@ -619,7 +619,7 @@ operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
|
||||
}
|
||||
|
||||
template <class _T1, class _T2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX17
|
||||
typename enable_if
|
||||
<
|
||||
__is_swappable<_T1>::value &&
|
||||
@ -970,7 +970,7 @@ _Size
|
||||
__loadword(const void* __p)
|
||||
{
|
||||
_Size __r;
|
||||
std::memcpy(&__r, __p, sizeof(__r));
|
||||
_VSTD::memcpy(&__r, __p, sizeof(__r));
|
||||
return __r;
|
||||
}
|
||||
|
||||
@ -1189,7 +1189,7 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
|
||||
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
|
||||
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
|
||||
__y + __loadword<_Size>(__s + 16));
|
||||
std::swap(__z, __x);
|
||||
_VSTD::swap(__z, __x);
|
||||
__s += 64;
|
||||
__len -= 64;
|
||||
} while (__len != 0);
|
||||
@ -1364,6 +1364,16 @@ struct _LIBCPP_TEMPLATE_VIS hash<unsigned char>
|
||||
size_t operator()(unsigned char __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
template <>
|
||||
struct _LIBCPP_TEMPLATE_VIS hash<char8_t>
|
||||
: public unary_function<char8_t, size_t>
|
||||
{
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
size_t operator()(char8_t __v) const _NOEXCEPT {return static_cast<size_t>(__v);}
|
||||
};
|
||||
#endif // !_LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
|
||||
template <>
|
||||
@ -1506,7 +1516,7 @@ struct _LIBCPP_TEMPLATE_VIS hash<long double>
|
||||
// -0.0 and 0.0 should return same hash
|
||||
if (__v == 0.0L)
|
||||
return 0;
|
||||
#if defined(__i386__)
|
||||
#if defined(__i386__) || (defined(__x86_64__) && defined(__ILP32__))
|
||||
// Zero out padding bits
|
||||
union
|
||||
{
|
||||
@ -1593,7 +1603,7 @@ using __check_hash_requirements _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
|
||||
__invokable_r<size_t, _Hash, _Key const&>::value
|
||||
>;
|
||||
|
||||
template <class _Key, class _Hash = std::hash<_Key> >
|
||||
template <class _Key, class _Hash = hash<_Key> >
|
||||
using __has_enabled_hash _LIBCPP_NODEBUG_TYPE = integral_constant<bool,
|
||||
__check_hash_requirements<_Key, _Hash>::value &&
|
||||
is_default_constructible<_Hash>::value
|
||||
|
@ -136,6 +136,7 @@ public:
|
||||
void operator>>=(const valarray<value_type>& v) const;
|
||||
|
||||
void operator=(const value_type& x) const;
|
||||
void operator=(const valarray<T>& val_arr) const;
|
||||
|
||||
slice_array() = delete;
|
||||
};
|
||||
@ -802,7 +803,7 @@ private:
|
||||
public:
|
||||
// construct/destroy:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
valarray() : __begin_(0), __end_(0) {}
|
||||
valarray() : __begin_(nullptr), __end_(nullptr) {}
|
||||
inline _LIBCPP_HIDE_FROM_ABI_AFTER_V1
|
||||
explicit valarray(size_t __n);
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
@ -1264,6 +1265,9 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator=(const value_type& __x) const;
|
||||
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
void operator=(const valarray<value_type>& __va) const;
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
slice_array(const slice& __sl, const valarray<value_type>& __v)
|
||||
@ -1303,6 +1307,15 @@ slice_array<_Tp>::operator=(const _Expr& __v) const
|
||||
*__t = __v[__i];
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
inline void
|
||||
slice_array<_Tp>::operator=(const valarray<value_type>& __va) const
|
||||
{
|
||||
value_type* __t = __vp_;
|
||||
for (size_t __i = 0; __i < __va.size(); ++__i, __t += __stride_)
|
||||
*__t = __va[__i];
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
template <class _Expr>
|
||||
inline
|
||||
@ -2738,11 +2751,9 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<result_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(result_type), _LIBCPP_ALIGNOF(result_type)));
|
||||
__r.__end_ = allocator<result_type>().allocate(__n);
|
||||
for (size_t __i = 0; __i != __n; ++__r.__end_, ++__i)
|
||||
::new (__r.__end_) result_type(__expr_[__i]);
|
||||
::new ((void*)__r.__end_) result_type(__expr_[__i]);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -2752,19 +2763,18 @@ __val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
|
||||
template <class _Tp>
|
||||
inline
|
||||
valarray<_Tp>::valarray(size_t __n)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
|
||||
::new (__end_) value_type();
|
||||
::new ((void*)__end_) value_type();
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2779,27 +2789,26 @@ valarray<_Tp>::valarray(size_t __n)
|
||||
template <class _Tp>
|
||||
inline
|
||||
valarray<_Tp>::valarray(const value_type& __x, size_t __n)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
resize(__n, __x);
|
||||
}
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const value_type* __p, size_t __n)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (size_t __n_left = __n; __n_left; ++__end_, ++__p, --__n_left)
|
||||
::new (__end_) value_type(*__p);
|
||||
::new ((void*)__end_) value_type(*__p);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2813,19 +2822,18 @@ valarray<_Tp>::valarray(const value_type* __p, size_t __n)
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const valarray& __v)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
if (__v.size())
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__v.size() * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__v.size());
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (value_type* __p = __v.__begin_; __p != __v.__end_; ++__end_, ++__p)
|
||||
::new (__end_) value_type(*__p);
|
||||
::new ((void*)__end_) value_type(*__p);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2850,21 +2858,20 @@ valarray<_Tp>::valarray(valarray&& __v) _NOEXCEPT
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(initializer_list<value_type> __il)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
const size_t __n = __il.size();
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
size_t __n_left = __n;
|
||||
for (const value_type* __p = __il.begin(); __n_left; ++__end_, ++__p, --__n_left)
|
||||
::new (__end_) value_type(*__p);
|
||||
::new ((void*)__end_) value_type(*__p);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2880,21 +2887,20 @@ _VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)))
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
const size_t __n = __sa.__size_;
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
size_t __n_left = __n;
|
||||
for (const value_type* __p = __sa.__vp_; __n_left; ++__end_, __p += __sa.__stride_, --__n_left)
|
||||
::new (__end_) value_type(*__p);
|
||||
::new ((void*)__end_) value_type(*__p);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2908,14 +2914,13 @@ valarray<_Tp>::valarray(const slice_array<value_type>& __sa)
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
const size_t __n = __ga.__1d_.size();
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
@ -2924,7 +2929,7 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
|
||||
const value_type* __s = __ga.__vp_;
|
||||
for (_Ip __i = __ga.__1d_.__begin_, __e = __ga.__1d_.__end_;
|
||||
__i != __e; ++__i, ++__end_)
|
||||
::new (__end_) value_type(__s[*__i]);
|
||||
::new ((void*)__end_) value_type(__s[*__i]);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2938,14 +2943,13 @@ valarray<_Tp>::valarray(const gslice_array<value_type>& __ga)
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
const size_t __n = __ma.__1d_.size();
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
@ -2954,7 +2958,7 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
|
||||
const value_type* __s = __ma.__vp_;
|
||||
for (_Ip __i = __ma.__1d_.__begin_, __e = __ma.__1d_.__end_;
|
||||
__i != __e; ++__i, ++__end_)
|
||||
::new (__end_) value_type(__s[*__i]);
|
||||
::new ((void*)__end_) value_type(__s[*__i]);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -2968,14 +2972,13 @@ valarray<_Tp>::valarray(const mask_array<value_type>& __ma)
|
||||
|
||||
template <class _Tp>
|
||||
valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
|
||||
: __begin_(0),
|
||||
__end_(0)
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr)
|
||||
{
|
||||
const size_t __n = __ia.__1d_.size();
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
@ -2984,7 +2987,7 @@ valarray<_Tp>::valarray(const indirect_array<value_type>& __ia)
|
||||
const value_type* __s = __ia.__vp_;
|
||||
for (_Ip __i = __ia.__1d_.__begin_, __e = __ia.__1d_.__end_;
|
||||
__i != __e; ++__i, ++__end_)
|
||||
::new (__end_) value_type(__s[*__i]);
|
||||
::new ((void*)__end_) value_type(__s[*__i]);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
@ -3011,8 +3014,7 @@ valarray<_Tp>::__assign_range(const value_type* __f, const value_type* __l)
|
||||
if (size() != __n)
|
||||
{
|
||||
__clear(size());
|
||||
__begin_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = allocator<value_type>().allocate(__n);
|
||||
__end_ = __begin_ + __n;
|
||||
_VSTD::uninitialized_copy(__f, __l, __begin_);
|
||||
} else {
|
||||
@ -3265,12 +3267,9 @@ valarray<_Tp>::operator+() const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) value_type(+*__p);
|
||||
::new ((void*)__r.__end_) value_type(+*__p);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3283,12 +3282,9 @@ valarray<_Tp>::operator-() const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) value_type(-*__p);
|
||||
::new ((void*)__r.__end_) value_type(-*__p);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3301,12 +3297,9 @@ valarray<_Tp>::operator~() const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) value_type(~*__p);
|
||||
::new ((void*)__r.__end_) value_type(~*__p);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3319,11 +3312,9 @@ valarray<_Tp>::operator!() const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<bool*>(_VSTD::__libcpp_allocate(__n * sizeof(bool), _LIBCPP_ALIGNOF(bool)));
|
||||
__r.__begin_ = __r.__end_ = allocator<bool>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) bool(!*__p);
|
||||
::new ((void*)__r.__end_) bool(!*__p);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3639,10 +3630,7 @@ valarray<_Tp>::shift(int __i) const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
const value_type* __sb;
|
||||
value_type* __tb;
|
||||
value_type* __te;
|
||||
@ -3661,11 +3649,11 @@ valarray<_Tp>::shift(int __i) const
|
||||
__te = __r.__begin_ + __n;
|
||||
}
|
||||
for (; __r.__end_ != __tb; ++__r.__end_)
|
||||
::new (__r.__end_) value_type();
|
||||
::new ((void*)__r.__end_) value_type();
|
||||
for (; __r.__end_ != __te; ++__r.__end_, ++__sb)
|
||||
::new (__r.__end_) value_type(*__sb);
|
||||
::new ((void*)__r.__end_) value_type(*__sb);
|
||||
for (__te = __r.__begin_ + __n; __r.__end_ != __te; ++__r.__end_)
|
||||
::new (__r.__end_) value_type();
|
||||
::new ((void*)__r.__end_) value_type();
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3678,16 +3666,13 @@ valarray<_Tp>::cshift(int __i) const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
__i %= static_cast<int>(__n);
|
||||
const value_type* __m = __i >= 0 ? __begin_ + __i : __end_ + __i;
|
||||
for (const value_type* __s = __m; __s != __end_; ++__r.__end_, ++__s)
|
||||
::new (__r.__end_) value_type(*__s);
|
||||
::new ((void*)__r.__end_) value_type(*__s);
|
||||
for (const value_type* __s = __begin_; __s != __m; ++__r.__end_, ++__s)
|
||||
::new (__r.__end_) value_type(*__s);
|
||||
::new ((void*)__r.__end_) value_type(*__s);
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3700,12 +3685,9 @@ valarray<_Tp>::apply(value_type __f(value_type)) const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) value_type(__f(*__p));
|
||||
::new ((void*)__r.__end_) value_type(__f(*__p));
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3718,12 +3700,9 @@ valarray<_Tp>::apply(value_type __f(const value_type&)) const
|
||||
size_t __n = size();
|
||||
if (__n)
|
||||
{
|
||||
__r.__begin_ =
|
||||
__r.__end_ =
|
||||
static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__r.__begin_ = __r.__end_ = allocator<value_type>().allocate(__n);
|
||||
for (const value_type* __p = __begin_; __n; ++__r.__end_, ++__p, --__n)
|
||||
::new (__r.__end_) value_type(__f(*__p));
|
||||
::new ((void*)__r.__end_) value_type(__f(*__p));
|
||||
}
|
||||
return __r;
|
||||
}
|
||||
@ -3736,7 +3715,7 @@ void valarray<_Tp>::__clear(size_t __capacity)
|
||||
{
|
||||
while (__end_ != __begin_)
|
||||
(--__end_)->~value_type();
|
||||
_VSTD::__libcpp_deallocate(__begin_, __capacity * sizeof(value_type), _LIBCPP_ALIGNOF(value_type));
|
||||
allocator<value_type>().deallocate(__begin_, __capacity);
|
||||
__begin_ = __end_ = nullptr;
|
||||
}
|
||||
}
|
||||
@ -3748,14 +3727,13 @@ valarray<_Tp>::resize(size_t __n, value_type __x)
|
||||
__clear(size());
|
||||
if (__n)
|
||||
{
|
||||
__begin_ = __end_ = static_cast<value_type*>(
|
||||
_VSTD::__libcpp_allocate(__n * sizeof(value_type), _LIBCPP_ALIGNOF(value_type)));
|
||||
__begin_ = __end_ = allocator<value_type>().allocate(__n);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif // _LIBCPP_NO_EXCEPTIONS
|
||||
for (size_t __n_left = __n; __n_left; --__n_left, ++__end_)
|
||||
::new (__end_) value_type(__x);
|
||||
::new ((void*)__end_) value_type(__x);
|
||||
#ifndef _LIBCPP_NO_EXCEPTIONS
|
||||
}
|
||||
catch (...)
|
||||
|
@ -197,6 +197,7 @@ namespace std {
|
||||
*/
|
||||
|
||||
#include <__config>
|
||||
#include <__availability>
|
||||
#include <__tuple>
|
||||
#include <array>
|
||||
#include <exception>
|
||||
@ -227,7 +228,10 @@ public:
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 14
|
||||
// TODO: GCC 5 lies about its support for C++17 (it says it supports it but it
|
||||
// really doesn't). That breaks variant, which uses some C++17 features.
|
||||
// Remove this once we drop support for GCC 5.
|
||||
#if _LIBCPP_STD_VER > 14 && !(defined(_LIBCPP_COMPILER_GCC) && _GNUC_VER_NEW < 6000)
|
||||
|
||||
_LIBCPP_NORETURN
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
@ -290,9 +294,9 @@ struct _LIBCPP_TEMPLATE_VIS variant_alternative<_Ip, variant<_Types...>> {
|
||||
_LIBCPP_INLINE_VAR constexpr size_t variant_npos = static_cast<size_t>(-1);
|
||||
|
||||
constexpr int __choose_index_type(unsigned int __num_elem) {
|
||||
if (__num_elem < std::numeric_limits<unsigned char>::max())
|
||||
if (__num_elem < numeric_limits<unsigned char>::max())
|
||||
return 0;
|
||||
if (__num_elem < std::numeric_limits<unsigned short>::max())
|
||||
if (__num_elem < numeric_limits<unsigned short>::max())
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
@ -482,12 +486,12 @@ private:
|
||||
return __result{{_VSTD::forward<_Fs>(__fs)...}};
|
||||
}
|
||||
|
||||
template <std::size_t... _Is>
|
||||
template <size_t... _Is>
|
||||
struct __dispatcher {
|
||||
template <class _Fp, class... _Vs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static constexpr decltype(auto) __dispatch(_Fp __f, _Vs... __vs) {
|
||||
return __invoke_constexpr(
|
||||
return _VSTD::__invoke_constexpr(
|
||||
static_cast<_Fp>(__f),
|
||||
__access::__base::__get_alt<_Is>(static_cast<_Vs>(__vs))...);
|
||||
}
|
||||
@ -595,7 +599,7 @@ private:
|
||||
__std_visit_exhaustive_visitor_check<
|
||||
_Visitor,
|
||||
decltype((_VSTD::forward<_Alts>(__alts).__value))...>();
|
||||
return __invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
|
||||
return _VSTD::__invoke_constexpr(_VSTD::forward<_Visitor>(__visitor),
|
||||
_VSTD::forward<_Alts>(__alts).__value...);
|
||||
}
|
||||
_Visitor&& __visitor;
|
||||
@ -720,11 +724,11 @@ protected:
|
||||
};
|
||||
|
||||
template <class _Traits, _Trait = _Traits::__destructible_trait>
|
||||
class _LIBCPP_TEMPLATE_VIS __destructor;
|
||||
class _LIBCPP_TEMPLATE_VIS __dtor;
|
||||
|
||||
#define _LIBCPP_VARIANT_DESTRUCTOR(destructible_trait, destructor, destroy) \
|
||||
template <class... _Types> \
|
||||
class _LIBCPP_TEMPLATE_VIS __destructor<__traits<_Types...>, \
|
||||
class _LIBCPP_TEMPLATE_VIS __dtor<__traits<_Types...>, \
|
||||
destructible_trait> \
|
||||
: public __base<destructible_trait, _Types...> { \
|
||||
using __base_type = __base<destructible_trait, _Types...>; \
|
||||
@ -734,11 +738,11 @@ class _LIBCPP_TEMPLATE_VIS __destructor;
|
||||
using __base_type::__base_type; \
|
||||
using __base_type::operator=; \
|
||||
\
|
||||
__destructor(const __destructor&) = default; \
|
||||
__destructor(__destructor&&) = default; \
|
||||
__dtor(const __dtor&) = default; \
|
||||
__dtor(__dtor&&) = default; \
|
||||
destructor \
|
||||
__destructor& operator=(const __destructor&) = default; \
|
||||
__destructor& operator=(__destructor&&) = default; \
|
||||
__dtor& operator=(const __dtor&) = default; \
|
||||
__dtor& operator=(__dtor&&) = default; \
|
||||
\
|
||||
protected: \
|
||||
inline _LIBCPP_INLINE_VISIBILITY \
|
||||
@ -747,12 +751,12 @@ class _LIBCPP_TEMPLATE_VIS __destructor;
|
||||
|
||||
_LIBCPP_VARIANT_DESTRUCTOR(
|
||||
_Trait::_TriviallyAvailable,
|
||||
~__destructor() = default;,
|
||||
~__dtor() = default;,
|
||||
void __destroy() noexcept { this->__index = __variant_npos<__index_t>; });
|
||||
|
||||
_LIBCPP_VARIANT_DESTRUCTOR(
|
||||
_Trait::_Available,
|
||||
~__destructor() { __destroy(); },
|
||||
~__dtor() { __destroy(); },
|
||||
void __destroy() noexcept {
|
||||
if (!this->valueless_by_exception()) {
|
||||
__visitation::__base::__visit_alt(
|
||||
@ -767,14 +771,14 @@ _LIBCPP_VARIANT_DESTRUCTOR(
|
||||
|
||||
_LIBCPP_VARIANT_DESTRUCTOR(
|
||||
_Trait::_Unavailable,
|
||||
~__destructor() = delete;,
|
||||
~__dtor() = delete;,
|
||||
void __destroy() noexcept = delete;);
|
||||
|
||||
#undef _LIBCPP_VARIANT_DESTRUCTOR
|
||||
|
||||
template <class _Traits>
|
||||
class _LIBCPP_TEMPLATE_VIS __constructor : public __destructor<_Traits> {
|
||||
using __base_type = __destructor<_Traits>;
|
||||
class _LIBCPP_TEMPLATE_VIS __ctor : public __dtor<_Traits> {
|
||||
using __base_type = __dtor<_Traits>;
|
||||
|
||||
public:
|
||||
using __base_type::__base_type;
|
||||
@ -791,7 +795,7 @@ protected:
|
||||
|
||||
template <class _Rhs>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
static void __generic_construct(__constructor& __lhs, _Rhs&& __rhs) {
|
||||
static void __generic_construct(__ctor& __lhs, _Rhs&& __rhs) {
|
||||
__lhs.__destroy();
|
||||
if (!__rhs.valueless_by_exception()) {
|
||||
__visitation::__base::__visit_alt_at(
|
||||
@ -815,8 +819,8 @@ class _LIBCPP_TEMPLATE_VIS __move_constructor;
|
||||
template <class... _Types> \
|
||||
class _LIBCPP_TEMPLATE_VIS __move_constructor<__traits<_Types...>, \
|
||||
move_constructible_trait> \
|
||||
: public __constructor<__traits<_Types...>> { \
|
||||
using __base_type = __constructor<__traits<_Types...>>; \
|
||||
: public __ctor<__traits<_Types...>> { \
|
||||
using __base_type = __ctor<__traits<_Types...>>; \
|
||||
\
|
||||
public: \
|
||||
using __base_type::__base_type; \
|
||||
@ -1104,7 +1108,7 @@ struct __narrowing_check {
|
||||
template <class _Dest>
|
||||
static auto __test_impl(_Dest (&&)[1]) -> __identity<_Dest>;
|
||||
template <class _Dest, class _Source>
|
||||
using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({std::declval<_Source>()}));
|
||||
using _Apply _LIBCPP_NODEBUG_TYPE = decltype(__test_impl<_Dest>({_VSTD::declval<_Source>()}));
|
||||
};
|
||||
|
||||
template <class _Dest, class _Source>
|
||||
@ -1510,7 +1514,7 @@ template <class _Operator>
|
||||
struct __convert_to_bool {
|
||||
template <class _T1, class _T2>
|
||||
_LIBCPP_INLINE_VISIBILITY constexpr bool operator()(_T1 && __t1, _T2&& __t2) const {
|
||||
static_assert(std::is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value,
|
||||
static_assert(is_convertible<decltype(_Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2))), bool>::value,
|
||||
"the relational operator does not return a type which is implicitly convertible to bool");
|
||||
return _Operator{}(_VSTD::forward<_T1>(__t1), _VSTD::forward<_T2>(__t2));
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
__vector_base<_Tp, _Allocator>::__vector_base(allocator_type&& __a) _NOEXCEPT
|
||||
: __begin_(nullptr),
|
||||
__end_(nullptr),
|
||||
__end_cap_(nullptr, std::move(__a)) {}
|
||||
__end_cap_(nullptr, _VSTD::move(__a)) {}
|
||||
#endif
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -496,7 +496,7 @@ public:
|
||||
_LIBCPP_INLINE_VISIBILITY
|
||||
vector() _NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -508,7 +508,7 @@ public:
|
||||
#endif
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -551,7 +551,7 @@ public:
|
||||
~vector()
|
||||
{
|
||||
__annotate_delete();
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__erase_c(this);
|
||||
#endif
|
||||
}
|
||||
@ -789,14 +789,14 @@ public:
|
||||
|
||||
bool __invariants() const;
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
bool __dereferenceable(const const_iterator* __i) const;
|
||||
bool __decrementable(const const_iterator* __i) const;
|
||||
bool __addable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const;
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
private:
|
||||
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
|
||||
@ -931,7 +931,7 @@ private:
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_DEDUCTION_GUIDES
|
||||
template<class _InputIterator,
|
||||
class _Alloc = typename std::allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class _Alloc = allocator<typename iterator_traits<_InputIterator>::value_type>,
|
||||
class = typename enable_if<__is_allocator<_Alloc>::value, void>::type
|
||||
>
|
||||
vector(_InputIterator, _InputIterator)
|
||||
@ -951,8 +951,7 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
|
||||
{
|
||||
|
||||
__annotate_delete();
|
||||
__alloc_traits::__construct_backward_with_exception_guarantees(
|
||||
this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
|
||||
_VSTD::__construct_backward_with_exception_guarantees(this->__alloc(), this->__begin_, this->__end_, __v.__begin_);
|
||||
_VSTD::swap(this->__begin_, __v.__begin_);
|
||||
_VSTD::swap(this->__end_, __v.__end_);
|
||||
_VSTD::swap(this->__end_cap(), __v.__end_cap());
|
||||
@ -967,10 +966,8 @@ vector<_Tp, _Allocator>::__swap_out_circular_buffer(__split_buffer<value_type, a
|
||||
{
|
||||
__annotate_delete();
|
||||
pointer __r = __v.__begin_;
|
||||
__alloc_traits::__construct_backward_with_exception_guarantees(
|
||||
this->__alloc(), this->__begin_, __p, __v.__begin_);
|
||||
__alloc_traits::__construct_forward_with_exception_guarantees(
|
||||
this->__alloc(), __p, this->__end_, __v.__end_);
|
||||
_VSTD::__construct_backward_with_exception_guarantees(this->__alloc(), this->__begin_, __p, __v.__begin_);
|
||||
_VSTD::__construct_forward_with_exception_guarantees(this->__alloc(), __p, this->__end_, __v.__end_);
|
||||
_VSTD::swap(this->__begin_, __v.__begin_);
|
||||
_VSTD::swap(this->__end_, __v.__end_);
|
||||
_VSTD::swap(this->__end_cap(), __v.__end_cap());
|
||||
@ -1077,7 +1074,7 @@ typename enable_if
|
||||
vector<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last, size_type __n)
|
||||
{
|
||||
_ConstructTransaction __tx(*this, __n);
|
||||
__alloc_traits::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_);
|
||||
_VSTD::__construct_range_forward(this->__alloc(), __first, __last, __tx.__pos_);
|
||||
}
|
||||
|
||||
// Default constructs __n objects starting at __end_
|
||||
@ -1121,7 +1118,7 @@ vector<_Tp, _Allocator>::__append(size_type __n, const_reference __x)
|
||||
template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__n > 0)
|
||||
@ -1136,7 +1133,7 @@ template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__n > 0)
|
||||
@ -1150,7 +1147,7 @@ vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
|
||||
template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__n > 0)
|
||||
@ -1164,7 +1161,7 @@ template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__n > 0)
|
||||
@ -1184,7 +1181,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first,
|
||||
typename iterator_traits<_InputIterator>::reference>::value,
|
||||
_InputIterator>::type __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __first != __last; ++__first)
|
||||
@ -1201,7 +1198,7 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
|
||||
typename iterator_traits<_InputIterator>::reference>::value>::type*)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
for (; __first != __last; ++__first)
|
||||
@ -1217,7 +1214,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
|
||||
typename iterator_traits<_ForwardIterator>::reference>::value,
|
||||
_ForwardIterator>::type __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
@ -1237,7 +1234,7 @@ vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __las
|
||||
typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
size_type __n = static_cast<size_type>(_VSTD::distance(__first, __last));
|
||||
@ -1252,7 +1249,7 @@ template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(const vector& __x)
|
||||
: __base(__alloc_traits::select_on_container_copy_construction(__x.__alloc()))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
size_type __n = __x.size();
|
||||
@ -1267,7 +1264,7 @@ template <class _Tp, class _Allocator>
|
||||
vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
size_type __n = __x.size();
|
||||
@ -1290,7 +1287,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
|
||||
#endif
|
||||
: __base(_VSTD::move(__x.__alloc()))
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif
|
||||
@ -1305,7 +1302,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__a == __x.__alloc())
|
||||
@ -1314,7 +1311,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
|
||||
this->__end_ = __x.__end_;
|
||||
this->__end_cap() = __x.__end_cap();
|
||||
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif
|
||||
}
|
||||
@ -1329,7 +1326,7 @@ template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__il.size() > 0)
|
||||
@ -1344,7 +1341,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
|
||||
: __base(__a)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__insert_c(this);
|
||||
#endif
|
||||
if (__il.size() > 0)
|
||||
@ -1390,7 +1387,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
|
||||
this->__end_ = __c.__end_;
|
||||
this->__end_cap() = __c.__end_cap();
|
||||
__c.__begin_ = __c.__end_ = __c.__end_cap() = nullptr;
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__c);
|
||||
#endif
|
||||
}
|
||||
@ -1493,7 +1490,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return iterator(this, __p);
|
||||
#else
|
||||
return iterator(__p);
|
||||
@ -1505,7 +1502,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename vector<_Tp, _Allocator>::const_iterator
|
||||
vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
return const_iterator(this, __p);
|
||||
#else
|
||||
return const_iterator(__p);
|
||||
@ -1709,7 +1706,7 @@ inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::erase(const_iterator __position)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::erase(iterator) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1728,7 +1725,7 @@ template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::erase(const_iterator __first, const_iterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__first) == this,
|
||||
"vector::erase(iterator, iterator) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1769,7 +1766,7 @@ template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, const_reference __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::insert(iterator, x) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1806,7 +1803,7 @@ template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, value_type&& __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::insert(iterator, x) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1839,7 +1836,7 @@ template <class... _Args>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::emplace(const_iterator __position, _Args&&... __args)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::emplace(iterator, x) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1874,7 +1871,7 @@ template <class _Tp, class _Allocator>
|
||||
typename vector<_Tp, _Allocator>::iterator
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, size_type __n, const_reference __x)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::insert(iterator, n, x) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1925,7 +1922,7 @@ typename enable_if
|
||||
>::type
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, _InputIterator __first, _InputIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::insert(iterator, range) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -1978,7 +1975,7 @@ typename enable_if
|
||||
>::type
|
||||
vector<_Tp, _Allocator>::insert(const_iterator __position, _ForwardIterator __first, _ForwardIterator __last)
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__position) == this,
|
||||
"vector::insert(iterator, range) called with an iterator not"
|
||||
" referring to this vector");
|
||||
@ -2057,11 +2054,11 @@ vector<_Tp, _Allocator>::swap(vector& __x)
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__end_, __x.__end_);
|
||||
_VSTD::swap(this->__end_cap(), __x.__end_cap());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
_VSTD::__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool,__alloc_traits::propagate_on_container_swap::value>());
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->swap(this, &__x);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
@ -2085,7 +2082,7 @@ vector<_Tp, _Allocator>::__invariants() const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
bool
|
||||
@ -2117,16 +2114,16 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
|
||||
return this->__begin_ <= __p && __p < this->__end_;
|
||||
}
|
||||
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif // _LIBCPP_DEBUG_LEVEL == 2
|
||||
|
||||
template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
vector<_Tp, _Allocator>::__invalidate_all_iterators()
|
||||
{
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__get_db()->__invalidate_all(this);
|
||||
#endif // _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -2134,7 +2131,7 @@ template <class _Tp, class _Allocator>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
void
|
||||
vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
|
||||
#if _LIBCPP_DEBUG_LEVEL >= 2
|
||||
#if _LIBCPP_DEBUG_LEVEL == 2
|
||||
__c_node* __c = __get_db()->__find_c_and_lock(this);
|
||||
for (__i_node** __p = __c->end_; __p != __c->beg_; ) {
|
||||
--__p;
|
||||
@ -2142,7 +2139,7 @@ vector<_Tp, _Allocator>::__invalidate_iterators_past(pointer __new_last) {
|
||||
if (__i->base() > __new_last) {
|
||||
(*__p)->__c_ = nullptr;
|
||||
if (--__c->end_ != __p)
|
||||
memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
_VSTD::memmove(__p, __p+1, (__c->end_ - __p)*sizeof(__i_node*));
|
||||
}
|
||||
}
|
||||
__get_db()->unlock();
|
||||
@ -2883,7 +2880,7 @@ inline _LIBCPP_INLINE_VISIBILITY vector<bool, _Allocator>::vector(vector&& __v)
|
||||
#endif
|
||||
: __begin_(__v.__begin_),
|
||||
__size_(__v.__size_),
|
||||
__cap_alloc_(std::move(__v.__cap_alloc_)) {
|
||||
__cap_alloc_(_VSTD::move(__v.__cap_alloc_)) {
|
||||
__v.__begin_ = nullptr;
|
||||
__v.__size_ = 0;
|
||||
__v.__cap() = 0;
|
||||
@ -3235,7 +3232,7 @@ vector<bool, _Allocator>::swap(vector& __x)
|
||||
_VSTD::swap(this->__begin_, __x.__begin_);
|
||||
_VSTD::swap(this->__size_, __x.__size_);
|
||||
_VSTD::swap(this->__cap(), __x.__cap());
|
||||
__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
_VSTD::__swap_allocator(this->__alloc(), __x.__alloc(),
|
||||
integral_constant<bool, __alloc_traits::propagate_on_container_swap::value>());
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,14 @@ __cpp_lib_apply 201603L <tuple>
|
||||
__cpp_lib_array_constexpr 201811L <iterator> <array>
|
||||
201603L // C++17
|
||||
__cpp_lib_as_const 201510L <utility>
|
||||
__cpp_lib_atomic_flag_test 201907L <atomic>
|
||||
__cpp_lib_atomic_float 201711L <atomic>
|
||||
__cpp_lib_atomic_is_always_lock_free 201603L <atomic>
|
||||
__cpp_lib_atomic_lock_free_type_aliases 201907L <atomic>
|
||||
__cpp_lib_atomic_ref 201806L <atomic>
|
||||
__cpp_lib_atomic_shared_ptr 201711L <atomic>
|
||||
__cpp_lib_atomic_value_initialization 201911L <atomic> <memory>
|
||||
__cpp_lib_atomic_wait 201907L <atomic>
|
||||
__cpp_lib_bind_front 201811L <functional>
|
||||
__cpp_lib_bit_cast 201806L <bit>
|
||||
__cpp_lib_bool_constant 201505L <type_traits>
|
||||
@ -39,9 +45,12 @@ __cpp_lib_chrono_udls 201304L <chrono>
|
||||
__cpp_lib_clamp 201603L <algorithm>
|
||||
__cpp_lib_complex_udls 201309L <complex>
|
||||
__cpp_lib_concepts 201806L <concepts>
|
||||
__cpp_lib_constexpr_dynamic_alloc 201907L <memory>
|
||||
__cpp_lib_constexpr_misc 201811L <array> <functional> <iterator>
|
||||
<string_view> <tuple> <utility>
|
||||
__cpp_lib_constexpr_numeric 201911L <numeric>
|
||||
__cpp_lib_constexpr_swap_algorithms 201806L <algorithm>
|
||||
__cpp_lib_constexpr_utility 201811L <utility>
|
||||
__cpp_lib_destroying_delete 201806L <new>
|
||||
__cpp_lib_enable_shared_from_this 201603L <memory>
|
||||
__cpp_lib_endian 201907L <bit>
|
||||
@ -58,6 +67,7 @@ __cpp_lib_hardware_interference_size 201703L <new>
|
||||
__cpp_lib_has_unique_object_representations 201606L <type_traits>
|
||||
__cpp_lib_hypot 201603L <cmath>
|
||||
__cpp_lib_incomplete_container_elements 201505L <forward_list> <list> <vector>
|
||||
__cpp_lib_int_pow2 202002L <bit>
|
||||
__cpp_lib_integer_sequence 201304L <utility>
|
||||
__cpp_lib_integral_constant_callable 201304L <type_traits>
|
||||
__cpp_lib_interpolate 201902L <numeric>
|
||||
@ -200,7 +210,7 @@ __cpp_lib_void_t 201411L <type_traits>
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# define __cpp_lib_shared_mutex 201505L
|
||||
# endif
|
||||
// # define __cpp_lib_shared_ptr_arrays 201611L
|
||||
# define __cpp_lib_shared_ptr_arrays 201611L
|
||||
# define __cpp_lib_shared_ptr_weak_type 201606L
|
||||
# define __cpp_lib_string_view 201606L
|
||||
// # define __cpp_lib_to_chars 201611L
|
||||
@ -217,22 +227,44 @@ __cpp_lib_void_t 201411L <type_traits>
|
||||
# undef __cpp_lib_array_constexpr
|
||||
# define __cpp_lib_array_constexpr 201811L
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# define __cpp_lib_atomic_flag_test 201907L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
// # define __cpp_lib_atomic_float 201711L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# define __cpp_lib_atomic_lock_free_type_aliases 201907L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
// # define __cpp_lib_atomic_ref 201806L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
// # define __cpp_lib_atomic_shared_ptr 201711L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
// # define __cpp_lib_atomic_value_initialization 201911L
|
||||
# endif
|
||||
# if !defined(_LIBCPP_HAS_NO_THREADS)
|
||||
# define __cpp_lib_atomic_wait 201907L
|
||||
# endif
|
||||
// # define __cpp_lib_bind_front 201811L
|
||||
// # define __cpp_lib_bit_cast 201806L
|
||||
# if !defined(_LIBCPP_NO_HAS_CHAR8_T)
|
||||
# define __cpp_lib_char8_t 201811L
|
||||
# endif
|
||||
// # define __cpp_lib_concepts 201806L
|
||||
# define __cpp_lib_constexpr_dynamic_alloc 201907L
|
||||
// # define __cpp_lib_constexpr_misc 201811L
|
||||
# define __cpp_lib_constexpr_numeric 201911L
|
||||
// # define __cpp_lib_constexpr_swap_algorithms 201806L
|
||||
# define __cpp_lib_constexpr_utility 201811L
|
||||
# if _LIBCPP_STD_VER > 17 && defined(__cpp_impl_destroying_delete) && __cpp_impl_destroying_delete >= 201806L
|
||||
# define __cpp_lib_destroying_delete 201806L
|
||||
# endif
|
||||
# define __cpp_lib_endian 201907L
|
||||
# define __cpp_lib_erase_if 202002L
|
||||
// # define __cpp_lib_generic_unordered_lookup 201811L
|
||||
# define __cpp_lib_generic_unordered_lookup 201811L
|
||||
# define __cpp_lib_int_pow2 202002L
|
||||
# define __cpp_lib_interpolate 201902L
|
||||
# if !defined(_LIBCPP_HAS_NO_BUILTIN_IS_CONSTANT_EVALUATED)
|
||||
# define __cpp_lib_is_constant_evaluated 201811L
|
||||
|
@ -50,7 +50,9 @@ wctrans_t wctrans(const char* property);
|
||||
#pragma GCC system_header
|
||||
#endif
|
||||
|
||||
#if __has_include_next(<wctype.h>)
|
||||
# include_next <wctype.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include <atomic>
|
||||
#include <functional>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include <unistd.h>
|
||||
|
@ -27,20 +27,14 @@ public:
|
||||
};
|
||||
|
||||
ptrdiff_t& __expected;
|
||||
unique_ptr<char[]> __state_allocation;
|
||||
__state_t* __state;
|
||||
unique_ptr<__state_t[]> __state;
|
||||
|
||||
_LIBCPP_HIDDEN
|
||||
__barrier_algorithm_base(ptrdiff_t& __expected)
|
||||
: __expected(__expected)
|
||||
{
|
||||
size_t const __count = (__expected + 1) >> 1;
|
||||
size_t const __size = sizeof(__state_t) * __count;
|
||||
size_t __allocation_size = __size + alignof(__state_t);
|
||||
__state_allocation = unique_ptr<char[]>(new char[__allocation_size]);
|
||||
void* __allocation = __state_allocation.get();
|
||||
void* const __state_ = align(alignof(__state_t), __size, __allocation, __allocation_size);
|
||||
__state = new (__state_) __barrier_algorithm_base::__state_t[__count];
|
||||
__state = unique_ptr<__state_t[]>(new __state_t[__count]);
|
||||
}
|
||||
_LIBCPP_HIDDEN
|
||||
bool __arrive(__barrier_phase_t __old_phase)
|
||||
|
@ -16,6 +16,10 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if __has_include(<sys/time.h>)
|
||||
# include <sys/time.h> // for gettimeofday and timeval
|
||||
#endif
|
||||
|
||||
#if !defined(__APPLE__) && _POSIX_TIMERS > 0
|
||||
# define _LIBCPP_USE_CLOCK_GETTIME
|
||||
#endif
|
||||
@ -27,10 +31,6 @@
|
||||
# if _WIN32_WINNT >= _WIN32_WINNT_WIN8
|
||||
# include <winapifamily.h>
|
||||
# endif
|
||||
#else
|
||||
# if !defined(CLOCK_REALTIME)
|
||||
# include <sys/time.h> // for gettimeofday and timeval
|
||||
# endif // !defined(CLOCK_REALTIME)
|
||||
#endif // defined(_LIBCPP_WIN32API)
|
||||
|
||||
#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
|
||||
@ -42,14 +42,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
|
||||
namespace chrono
|
||||
{
|
||||
|
||||
//
|
||||
// system_clock
|
||||
//
|
||||
|
||||
const bool system_clock::is_steady;
|
||||
|
||||
system_clock::time_point
|
||||
system_clock::now() _NOEXCEPT
|
||||
{
|
||||
#if defined(_LIBCPP_WIN32API)
|
||||
|
||||
static system_clock::time_point __libcpp_system_clock_now() {
|
||||
// FILETIME is in 100ns units
|
||||
using filetime_duration =
|
||||
_VSTD::chrono::duration<__int64,
|
||||
@ -60,31 +59,42 @@ system_clock::now() _NOEXCEPT
|
||||
static _LIBCPP_CONSTEXPR const seconds nt_to_unix_epoch{11644473600};
|
||||
|
||||
FILETIME ft;
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
|
||||
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
#if _WIN32_WINNT >= _WIN32_WINNT_WIN8 && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
GetSystemTimePreciseAsFileTime(&ft);
|
||||
#else
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
#endif
|
||||
#else
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
#endif
|
||||
|
||||
filetime_duration d{(static_cast<__int64>(ft.dwHighDateTime) << 32) |
|
||||
static_cast<__int64>(ft.dwLowDateTime)};
|
||||
return time_point(duration_cast<duration>(d - nt_to_unix_epoch));
|
||||
#else
|
||||
#if defined(CLOCK_REALTIME)
|
||||
return system_clock::time_point(duration_cast<system_clock::duration>(d - nt_to_unix_epoch));
|
||||
}
|
||||
|
||||
#elif defined(CLOCK_REALTIME) && defined(_LIBCPP_USE_CLOCK_GETTIME)
|
||||
|
||||
static system_clock::time_point __libcpp_system_clock_now() {
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_REALTIME, &tp))
|
||||
__throw_system_error(errno, "clock_gettime(CLOCK_REALTIME) failed");
|
||||
return time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000));
|
||||
return system_clock::time_point(seconds(tp.tv_sec) + microseconds(tp.tv_nsec / 1000));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static system_clock::time_point __libcpp_system_clock_now() {
|
||||
timeval tv;
|
||||
gettimeofday(&tv, 0);
|
||||
return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
|
||||
#endif // CLOCK_REALTIME
|
||||
return system_clock::time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
const bool system_clock::is_steady;
|
||||
|
||||
system_clock::time_point
|
||||
system_clock::now() _NOEXCEPT
|
||||
{
|
||||
return __libcpp_system_clock_now();
|
||||
}
|
||||
|
||||
time_t
|
||||
@ -99,33 +109,28 @@ system_clock::from_time_t(time_t t) _NOEXCEPT
|
||||
return system_clock::time_point(seconds(t));
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
//
|
||||
// steady_clock
|
||||
//
|
||||
// Warning: If this is not truly steady, then it is non-conforming. It is
|
||||
// better for it to not exist and have the rest of libc++ use system_clock
|
||||
// instead.
|
||||
//
|
||||
|
||||
const bool steady_clock::is_steady;
|
||||
#ifndef _LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
|
||||
#if defined(__APPLE__)
|
||||
|
||||
#if !defined(CLOCK_MONOTONIC_RAW)
|
||||
# error "Building libc++ on Apple platforms requires CLOCK_MONOTONIC_RAW"
|
||||
#endif
|
||||
|
||||
// On Apple platforms, only CLOCK_UPTIME_RAW, CLOCK_MONOTONIC_RAW or
|
||||
// mach_absolute_time are able to time functions in the nanosecond range.
|
||||
// Furthermore, only CLOCK_MONOTONIC_RAW is truly monotonic, because it
|
||||
// also counts cycles when the system is asleep. Thus, it is the only
|
||||
// acceptable implementation of steady_clock.
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
static steady_clock::time_point __libcpp_steady_clock_now() {
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_MONOTONIC_RAW, &tp))
|
||||
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC_RAW) failed");
|
||||
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||
return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||
}
|
||||
|
||||
#elif defined(_LIBCPP_WIN32API)
|
||||
@ -143,31 +148,35 @@ __QueryPerformanceFrequency()
|
||||
return val;
|
||||
}
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
static steady_clock::time_point __libcpp_steady_clock_now() {
|
||||
static const LARGE_INTEGER freq = __QueryPerformanceFrequency();
|
||||
|
||||
LARGE_INTEGER counter;
|
||||
(void) QueryPerformanceCounter(&counter);
|
||||
return time_point(duration(counter.QuadPart * nano::den / freq.QuadPart));
|
||||
return steady_clock::time_point(steady_clock::duration(counter.QuadPart * nano::den / freq.QuadPart));
|
||||
}
|
||||
|
||||
#elif defined(CLOCK_MONOTONIC)
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
static steady_clock::time_point __libcpp_steady_clock_now() {
|
||||
struct timespec tp;
|
||||
if (0 != clock_gettime(CLOCK_MONOTONIC, &tp))
|
||||
__throw_system_error(errno, "clock_gettime(CLOCK_MONOTONIC) failed");
|
||||
return time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||
return steady_clock::time_point(seconds(tp.tv_sec) + nanoseconds(tp.tv_nsec));
|
||||
}
|
||||
|
||||
#else
|
||||
# error "Monotonic clock not implemented"
|
||||
# error "Monotonic clock not implemented on this platform"
|
||||
#endif
|
||||
|
||||
const bool steady_clock::is_steady;
|
||||
|
||||
steady_clock::time_point
|
||||
steady_clock::now() _NOEXCEPT
|
||||
{
|
||||
return __libcpp_steady_clock_now();
|
||||
}
|
||||
|
||||
#endif // !_LIBCPP_HAS_NO_MONOTONIC_CLOCK
|
||||
|
||||
}
|
||||
|
@ -76,16 +76,6 @@ union ResourceInitHelper {
|
||||
~ResourceInitHelper() {}
|
||||
};
|
||||
|
||||
// Detect if the init_priority attribute is supported.
|
||||
#if (defined(_LIBCPP_COMPILER_GCC) && defined(__APPLE__)) \
|
||||
|| defined(_LIBCPP_COMPILER_MSVC)
|
||||
// GCC on Apple doesn't support the init priority attribute,
|
||||
// and MSVC doesn't support any GCC attributes.
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX
|
||||
#else
|
||||
# define _LIBCPP_INIT_PRIORITY_MAX __attribute__((init_priority(101)))
|
||||
#endif
|
||||
|
||||
// When compiled in C++14 this initialization should be a constant expression.
|
||||
// Only in C++11 is "init_priority" needed to ensure initialization order.
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
|
@ -13,8 +13,9 @@
|
||||
#include "filesystem"
|
||||
#include "array"
|
||||
#include "chrono"
|
||||
#include "cstdlib"
|
||||
#include "climits"
|
||||
#include "cstdlib"
|
||||
#include "ctime"
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
@ -47,7 +48,7 @@ static string format_string_imp(const char* msg, ...) {
|
||||
struct GuardVAList {
|
||||
va_list& target;
|
||||
bool active = true;
|
||||
GuardVAList(va_list& target) : target(target), active(true) {}
|
||||
GuardVAList(va_list& tgt) : target(tgt), active(true) {}
|
||||
void clear() {
|
||||
if (active)
|
||||
va_end(target);
|
||||
@ -134,50 +135,50 @@ path error_value<path>() {
|
||||
|
||||
template <class T>
|
||||
struct ErrorHandler {
|
||||
const char* func_name;
|
||||
error_code* ec = nullptr;
|
||||
const path* p1 = nullptr;
|
||||
const path* p2 = nullptr;
|
||||
const char* func_name_;
|
||||
error_code* ec_ = nullptr;
|
||||
const path* p1_ = nullptr;
|
||||
const path* p2_ = nullptr;
|
||||
|
||||
ErrorHandler(const char* fname, error_code* ec, const path* p1 = nullptr,
|
||||
const path* p2 = nullptr)
|
||||
: func_name(fname), ec(ec), p1(p1), p2(p2) {
|
||||
if (ec)
|
||||
ec->clear();
|
||||
: func_name_(fname), ec_(ec), p1_(p1), p2_(p2) {
|
||||
if (ec_)
|
||||
ec_->clear();
|
||||
}
|
||||
|
||||
T report(const error_code& m_ec) const {
|
||||
if (ec) {
|
||||
*ec = m_ec;
|
||||
T report(const error_code& ec) const {
|
||||
if (ec_) {
|
||||
*ec_ = ec;
|
||||
return error_value<T>();
|
||||
}
|
||||
string what = string("in ") + func_name;
|
||||
switch (bool(p1) + bool(p2)) {
|
||||
string what = string("in ") + func_name_;
|
||||
switch (bool(p1_) + bool(p2_)) {
|
||||
case 0:
|
||||
__throw_filesystem_error(what, m_ec);
|
||||
__throw_filesystem_error(what, ec);
|
||||
case 1:
|
||||
__throw_filesystem_error(what, *p1, m_ec);
|
||||
__throw_filesystem_error(what, *p1_, ec);
|
||||
case 2:
|
||||
__throw_filesystem_error(what, *p1, *p2, m_ec);
|
||||
__throw_filesystem_error(what, *p1_, *p2_, ec);
|
||||
}
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
|
||||
template <class... Args>
|
||||
T report(const error_code& m_ec, const char* msg, Args const&... args) const {
|
||||
if (ec) {
|
||||
*ec = m_ec;
|
||||
T report(const error_code& ec, const char* msg, Args const&... args) const {
|
||||
if (ec_) {
|
||||
*ec_ = ec;
|
||||
return error_value<T>();
|
||||
}
|
||||
string what =
|
||||
string("in ") + func_name + ": " + format_string(msg, args...);
|
||||
switch (bool(p1) + bool(p2)) {
|
||||
string("in ") + func_name_ + ": " + format_string(msg, args...);
|
||||
switch (bool(p1_) + bool(p2_)) {
|
||||
case 0:
|
||||
__throw_filesystem_error(what, m_ec);
|
||||
__throw_filesystem_error(what, ec);
|
||||
case 1:
|
||||
__throw_filesystem_error(what, *p1, m_ec);
|
||||
__throw_filesystem_error(what, *p1_, ec);
|
||||
case 2:
|
||||
__throw_filesystem_error(what, *p1, *p2, m_ec);
|
||||
__throw_filesystem_error(what, *p1_, *p2_, ec);
|
||||
}
|
||||
_LIBCPP_UNREACHABLE();
|
||||
}
|
||||
@ -197,8 +198,9 @@ private:
|
||||
using chrono::duration;
|
||||
using chrono::duration_cast;
|
||||
|
||||
using TimeSpec = struct ::timespec;
|
||||
using StatT = struct ::stat;
|
||||
using TimeSpec = struct timespec;
|
||||
using TimeVal = struct timeval;
|
||||
using StatT = struct stat;
|
||||
|
||||
template <class FileTimeT, class TimeT,
|
||||
bool IsFloat = is_floating_point<typename FileTimeT::rep>::value>
|
||||
@ -380,26 +382,38 @@ public:
|
||||
using fs_time = time_util<file_time_type, time_t, TimeSpec>;
|
||||
|
||||
#if defined(__APPLE__)
|
||||
TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
|
||||
TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
|
||||
inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtimespec; }
|
||||
inline TimeSpec extract_atime(StatT const& st) { return st.st_atimespec; }
|
||||
#elif defined(__MVS__)
|
||||
inline TimeSpec extract_mtime(StatT const& st) {
|
||||
TimeSpec TS = {st.st_mtime, 0};
|
||||
return TS;
|
||||
}
|
||||
inline TimeSpec extract_atime(StatT const& st) {
|
||||
TimeSpec TS = {st.st_atime, 0};
|
||||
return TS;
|
||||
}
|
||||
#else
|
||||
TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
|
||||
TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
|
||||
inline TimeSpec extract_mtime(StatT const& st) { return st.st_mtim; }
|
||||
inline TimeSpec extract_atime(StatT const& st) { return st.st_atim; }
|
||||
#endif
|
||||
|
||||
// allow the utimes implementation to compile even it we're not going
|
||||
// to use it.
|
||||
|
||||
bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
|
||||
error_code& ec) {
|
||||
inline TimeVal make_timeval(TimeSpec const& ts) {
|
||||
using namespace chrono;
|
||||
auto Convert = [](long nsec) {
|
||||
using int_type = decltype(std::declval< ::timeval>().tv_usec);
|
||||
using int_type = decltype(std::declval<TimeVal>().tv_usec);
|
||||
auto dur = duration_cast<microseconds>(nanoseconds(nsec)).count();
|
||||
return static_cast<int_type>(dur);
|
||||
};
|
||||
struct ::timeval ConvertedTS[2] = {{TS[0].tv_sec, Convert(TS[0].tv_nsec)},
|
||||
{TS[1].tv_sec, Convert(TS[1].tv_nsec)}};
|
||||
TimeVal TV = {};
|
||||
TV.tv_sec = ts.tv_sec;
|
||||
TV.tv_usec = Convert(ts.tv_nsec);
|
||||
return TV;
|
||||
}
|
||||
|
||||
inline bool posix_utimes(const path& p, std::array<TimeSpec, 2> const& TS,
|
||||
error_code& ec) {
|
||||
TimeVal ConvertedTS[2] = {make_timeval(TS[0]), make_timeval(TS[1])};
|
||||
if (::utimes(p.c_str(), ConvertedTS) == -1) {
|
||||
ec = capture_errno();
|
||||
return true;
|
||||
|
@ -9,8 +9,6 @@
|
||||
#include "filesystem"
|
||||
#include "array"
|
||||
#include "iterator"
|
||||
#include "fstream"
|
||||
#include "random" /* for unique_path */
|
||||
#include "string_view"
|
||||
#include "type_traits"
|
||||
#include "vector"
|
||||
@ -25,31 +23,25 @@
|
||||
#include <time.h>
|
||||
#include <fcntl.h> /* values for fchmodat */
|
||||
|
||||
#if defined(__linux__)
|
||||
#include <linux/version.h>
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 33)
|
||||
#if __has_include(<sys/sendfile.h>)
|
||||
# include <sys/sendfile.h>
|
||||
#define _LIBCPP_USE_SENDFILE
|
||||
#endif
|
||||
# define _LIBCPP_FILESYSTEM_USE_SENDFILE
|
||||
#elif defined(__APPLE__) || __has_include(<copyfile.h>)
|
||||
# include <copyfile.h>
|
||||
#define _LIBCPP_USE_COPYFILE
|
||||
# define _LIBCPP_FILESYSTEM_USE_COPYFILE
|
||||
#else
|
||||
# include "fstream"
|
||||
# define _LIBCPP_FILESYSTEM_USE_FSTREAM
|
||||
#endif
|
||||
|
||||
#if !defined(CLOCK_REALTIME)
|
||||
# include <sys/time.h> // for gettimeofday and timeval
|
||||
#endif // !defined(CLOCK_REALTIME)
|
||||
#endif
|
||||
|
||||
#if defined(__ELF__) && defined(_LIBCPP_LINK_RT_LIB)
|
||||
# pragma comment(lib, "rt")
|
||||
#endif
|
||||
|
||||
#if defined(_LIBCPP_COMPILER_GCC)
|
||||
#if _GNUC_VER < 500
|
||||
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
|
||||
|
||||
namespace {
|
||||
@ -542,7 +534,7 @@ path __canonical(path const& orig_p, error_code* ec) {
|
||||
ErrorHandler<path> err("canonical", ec, &orig_p, &cwd);
|
||||
|
||||
path p = __do_absolute(orig_p, &cwd, ec);
|
||||
#if _POSIX_VERSION >= 200112
|
||||
#if defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112
|
||||
std::unique_ptr<char, decltype(&::free)>
|
||||
hold(::realpath(p.c_str(), nullptr), &::free);
|
||||
if (hold.get() == nullptr)
|
||||
@ -646,10 +638,8 @@ void __copy(const path& from, const path& to, copy_options options,
|
||||
namespace detail {
|
||||
namespace {
|
||||
|
||||
#ifdef _LIBCPP_USE_SENDFILE
|
||||
bool copy_file_impl_sendfile(FileDescriptor& read_fd, FileDescriptor& write_fd,
|
||||
error_code& ec) {
|
||||
|
||||
#if defined(_LIBCPP_FILESYSTEM_USE_SENDFILE)
|
||||
bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
|
||||
size_t count = read_fd.get_stat().st_size;
|
||||
do {
|
||||
ssize_t res;
|
||||
@ -664,9 +654,8 @@ bool copy_file_impl_sendfile(FileDescriptor& read_fd, FileDescriptor& write_fd,
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(_LIBCPP_USE_COPYFILE)
|
||||
bool copy_file_impl_copyfile(FileDescriptor& read_fd, FileDescriptor& write_fd,
|
||||
error_code& ec) {
|
||||
#elif defined(_LIBCPP_FILESYSTEM_USE_COPYFILE)
|
||||
bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
|
||||
struct CopyFileState {
|
||||
copyfile_state_t state;
|
||||
CopyFileState() { state = copyfile_state_alloc(); }
|
||||
@ -686,13 +675,8 @@ bool copy_file_impl_copyfile(FileDescriptor& read_fd, FileDescriptor& write_fd,
|
||||
ec.clear();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Note: This function isn't guarded by ifdef's even though it may be unused
|
||||
// in order to assure it still compiles.
|
||||
__attribute__((unused)) bool copy_file_impl_default(FileDescriptor& read_fd,
|
||||
FileDescriptor& write_fd,
|
||||
error_code& ec) {
|
||||
#elif defined(_LIBCPP_FILESYSTEM_USE_FSTREAM)
|
||||
bool copy_file_impl(FileDescriptor& read_fd, FileDescriptor& write_fd, error_code& ec) {
|
||||
ifstream in;
|
||||
in.__open(read_fd.fd, ios::binary);
|
||||
if (!in.is_open()) {
|
||||
@ -700,12 +684,14 @@ __attribute__((unused)) bool copy_file_impl_default(FileDescriptor& read_fd,
|
||||
ec = capture_errno();
|
||||
return false;
|
||||
}
|
||||
read_fd.fd = -1;
|
||||
ofstream out;
|
||||
out.__open(write_fd.fd, ios::binary);
|
||||
if (!out.is_open()) {
|
||||
ec = capture_errno();
|
||||
return false;
|
||||
}
|
||||
write_fd.fd = -1;
|
||||
|
||||
if (in.good() && out.good()) {
|
||||
using InIt = istreambuf_iterator<char>;
|
||||
@ -723,19 +709,12 @@ __attribute__((unused)) bool copy_file_impl_default(FileDescriptor& read_fd,
|
||||
ec.clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool copy_file_impl(FileDescriptor& from, FileDescriptor& to, error_code& ec) {
|
||||
#if defined(_LIBCPP_USE_SENDFILE)
|
||||
return copy_file_impl_sendfile(from, to, ec);
|
||||
#elif defined(_LIBCPP_USE_COPYFILE)
|
||||
return copy_file_impl_copyfile(from, to, ec);
|
||||
#else
|
||||
return copy_file_impl_default(from, to, ec);
|
||||
#endif
|
||||
}
|
||||
# error "Unknown implementation for copy_file_impl"
|
||||
#endif // copy_file_impl implementation
|
||||
|
||||
} // namespace
|
||||
} // namespace detail
|
||||
} // end anonymous namespace
|
||||
} // end namespace detail
|
||||
|
||||
bool __copy_file(const path& from, const path& to, copy_options options,
|
||||
error_code* ec) {
|
||||
@ -870,8 +849,17 @@ bool __create_directory(const path& p, error_code* ec) {
|
||||
|
||||
if (::mkdir(p.c_str(), static_cast<int>(perms::all)) == 0)
|
||||
return true;
|
||||
if (errno != EEXIST)
|
||||
|
||||
if (errno == EEXIST) {
|
||||
error_code mec = capture_errno();
|
||||
error_code ignored_ec;
|
||||
const file_status st = status(p, ignored_ec);
|
||||
if (!is_directory(st)) {
|
||||
err.report(mec);
|
||||
}
|
||||
} else {
|
||||
err.report(capture_errno());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -889,8 +877,17 @@ bool __create_directory(path const& p, path const& attributes, error_code* ec) {
|
||||
|
||||
if (::mkdir(p.c_str(), attr_stat.st_mode) == 0)
|
||||
return true;
|
||||
if (errno != EEXIST)
|
||||
|
||||
if (errno == EEXIST) {
|
||||
error_code mec = capture_errno();
|
||||
error_code ignored_ec;
|
||||
const file_status st = status(p, ignored_ec);
|
||||
if (!is_directory(st)) {
|
||||
err.report(mec);
|
||||
}
|
||||
} else {
|
||||
err.report(capture_errno());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -17,10 +17,14 @@
|
||||
#include <errno.h>
|
||||
#endif
|
||||
|
||||
// Note: _LIBCPP_ELAST needs to be defined only on platforms
|
||||
// where strerror/strerror_r can't handle out-of-range errno values.
|
||||
#if defined(ELAST)
|
||||
#define _LIBCPP_ELAST ELAST
|
||||
#elif defined(_NEWLIB_VERSION)
|
||||
#define _LIBCPP_ELAST __ELASTERROR
|
||||
#elif defined(__NuttX__)
|
||||
// No _LIBCPP_ELAST needed on NuttX
|
||||
#elif defined(__Fuchsia__)
|
||||
// No _LIBCPP_ELAST needed on Fuchsia
|
||||
#elif defined(__wasi__)
|
||||
|
@ -13,11 +13,24 @@
|
||||
#include <stdexcept>
|
||||
#include <cstddef>
|
||||
#include <cstring>
|
||||
#ifdef __APPLE__
|
||||
#include "atomic_support.h"
|
||||
|
||||
// MacOS and iOS used to ship with libstdc++, and still support old applications
|
||||
// linking against libstdc++. The libc++ and libstdc++ exceptions are supposed
|
||||
// to be ABI compatible, such that they can be thrown from one library and caught
|
||||
// in the other.
|
||||
//
|
||||
// For that reason, we must look for libstdc++ in the same process and if found,
|
||||
// check the string stored in the exception object to see if it is the GCC empty
|
||||
// string singleton before manipulating the reference count. This is done so that
|
||||
// if an exception is created with a zero-length string in libstdc++, libc++abi
|
||||
// won't try to delete the memory.
|
||||
#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) || \
|
||||
defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__)
|
||||
# define _LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE
|
||||
# include <dlfcn.h>
|
||||
# include <mach-o/dyld.h>
|
||||
#endif
|
||||
#include "atomic_support.h"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
@ -40,7 +53,7 @@ inline char * data_from_rep(_Rep_base *rep) noexcept {
|
||||
return data + sizeof(*rep);
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
|
||||
inline
|
||||
const char* compute_gcc_empty_string_storage() _NOEXCEPT
|
||||
{
|
||||
@ -115,7 +128,7 @@ __libcpp_refstring::~__libcpp_refstring() {
|
||||
|
||||
inline
|
||||
bool __libcpp_refstring::__uses_refcount() const {
|
||||
#ifdef __APPLE__
|
||||
#if defined(_LIBCPP_CHECK_FOR_GCC_EMPTY_STRING_STORAGE)
|
||||
return __imp_ != get_gcc_empty_string_storage();
|
||||
#else
|
||||
return true;
|
||||
|
@ -15,30 +15,14 @@
|
||||
#include "__locale"
|
||||
#include "algorithm"
|
||||
#include "include/config_elast.h"
|
||||
#include "istream"
|
||||
#include "limits"
|
||||
#include "memory"
|
||||
#include "new"
|
||||
#include "streambuf"
|
||||
#include "string"
|
||||
#include "__undef_macros"
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
|
||||
|
||||
class _LIBCPP_HIDDEN __iostream_category
|
||||
: public __do_message
|
||||
{
|
||||
|
43
lib/libcxx/src/ios.instantiations.cpp
Normal file
43
lib/libcxx/src/ios.instantiations.cpp
Normal file
@ -0,0 +1,43 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "__config"
|
||||
#include "fstream"
|
||||
#include "ios"
|
||||
#include "istream"
|
||||
#include "ostream"
|
||||
#include "sstream"
|
||||
#include "streambuf"
|
||||
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
// Original explicit instantiations provided in the library
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ios<wchar_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_streambuf<wchar_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istream<wchar_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostream<wchar_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_iostream<char>;
|
||||
|
||||
// Additional instantiations added later. Whether programs rely on these being
|
||||
// available is protected by _LIBCPP_ABI_ENABLE_ADDITIONAL_IOSTREAM_EXPLICIT_INSTANTIATIONS_1.
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringbuf<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_stringstream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ostringstream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_istringstream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ifstream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_ofstream<char>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS basic_filebuf<char>;
|
||||
|
||||
// Add more here if needed...
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
@ -77,7 +77,7 @@ __asm__("?wclog@" _LIBCPP_ABI_NAMESPACE_STR "@std@@3V?$basic_ostream@_WU?$char_t
|
||||
#endif
|
||||
;
|
||||
|
||||
_LIBCPP_HIDDEN ios_base::Init __start_std_streams;
|
||||
_LIBCPP_HIDDEN ios_base::Init __start_std_streams _LIBCPP_INIT_PRIORITY_MAX;
|
||||
|
||||
// On Windows the TLS storage for locales needs to be initialized before we create
|
||||
// the standard streams, otherwise it may not be alive during program termination
|
||||
|
@ -30,7 +30,7 @@
|
||||
#include "__sso_allocator"
|
||||
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
|
||||
#include "support/win32/locale_win32.h"
|
||||
#elif !defined(__BIONIC__)
|
||||
#elif !defined(__BIONIC__) && !defined(__NuttX__)
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
@ -158,7 +158,7 @@ const locale::category locale::all;
|
||||
class _LIBCPP_HIDDEN locale::__imp
|
||||
: public facet
|
||||
{
|
||||
enum {N = 28};
|
||||
enum {N = 30};
|
||||
#if defined(_LIBCPP_COMPILER_MSVC)
|
||||
// FIXME: MSVC doesn't support aligned parameters by value.
|
||||
// I can't get the __sso_allocator to work here
|
||||
@ -202,8 +202,14 @@ locale::__imp::__imp(size_t refs)
|
||||
install(&make<_VSTD::ctype<wchar_t> >(1u));
|
||||
install(&make<codecvt<char, char, mbstate_t> >(1u));
|
||||
install(&make<codecvt<wchar_t, char, mbstate_t> >(1u));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
install(&make<codecvt<char16_t, char, mbstate_t> >(1u));
|
||||
install(&make<codecvt<char32_t, char, mbstate_t> >(1u));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
install(&make<codecvt<char16_t, char8_t, mbstate_t> >(1u));
|
||||
install(&make<codecvt<char32_t, char8_t, mbstate_t> >(1u));
|
||||
#endif
|
||||
install(&make<numpunct<char> >(1u));
|
||||
install(&make<numpunct<wchar_t> >(1u));
|
||||
install(&make<num_get<char> >(1u));
|
||||
@ -245,8 +251,14 @@ locale::__imp::__imp(const string& name, size_t refs)
|
||||
install(new ctype_byname<wchar_t>(name_));
|
||||
install(new codecvt_byname<char, char, mbstate_t>(name_));
|
||||
install(new codecvt_byname<wchar_t, char, mbstate_t>(name_));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
install(new codecvt_byname<char16_t, char, mbstate_t>(name_));
|
||||
install(new codecvt_byname<char32_t, char, mbstate_t>(name_));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name_));
|
||||
install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name_));
|
||||
#endif
|
||||
install(new numpunct_byname<char>(name_));
|
||||
install(new numpunct_byname<wchar_t>(name_));
|
||||
install(new moneypunct_byname<char, false>(name_));
|
||||
@ -315,8 +327,14 @@ locale::__imp::__imp(const __imp& other, const string& name, locale::category c)
|
||||
install(new ctype_byname<wchar_t>(name));
|
||||
install(new codecvt_byname<char, char, mbstate_t>(name));
|
||||
install(new codecvt_byname<wchar_t, char, mbstate_t>(name));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
install(new codecvt_byname<char16_t, char, mbstate_t>(name));
|
||||
install(new codecvt_byname<char32_t, char, mbstate_t>(name));
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
install(new codecvt_byname<char16_t, char8_t, mbstate_t>(name));
|
||||
install(new codecvt_byname<char32_t, char8_t, mbstate_t>(name));
|
||||
#endif
|
||||
}
|
||||
if (c & locale::monetary)
|
||||
{
|
||||
@ -385,8 +403,14 @@ locale::__imp::__imp(const __imp& other, const __imp& one, locale::category c)
|
||||
install_from<_VSTD::ctype<char> >(one);
|
||||
install_from<_VSTD::ctype<wchar_t> >(one);
|
||||
install_from<_VSTD::codecvt<char, char, mbstate_t> >(one);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_PUSH
|
||||
install_from<_VSTD::codecvt<char16_t, char, mbstate_t> >(one);
|
||||
install_from<_VSTD::codecvt<char32_t, char, mbstate_t> >(one);
|
||||
_LIBCPP_SUPPRESS_DEPRECATED_POP
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
install_from<_VSTD::codecvt<char16_t, char8_t, mbstate_t> >(one);
|
||||
install_from<_VSTD::codecvt<char32_t, char8_t, mbstate_t> >(one);
|
||||
#endif
|
||||
install_from<_VSTD::codecvt<wchar_t, char, mbstate_t> >(one);
|
||||
}
|
||||
if (c & locale::monetary)
|
||||
@ -1149,7 +1173,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
|
||||
{
|
||||
return _LIBCPP_GET_C_LOCALE->__ctype_toupper;
|
||||
}
|
||||
#elif __NetBSD__
|
||||
#elif defined(__NetBSD__)
|
||||
const short*
|
||||
ctype<char>::__classic_lower_table() _NOEXCEPT
|
||||
{
|
||||
@ -3171,6 +3195,87 @@ codecvt<char16_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
return 4;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char16_t, char8_t, mbstate_t>
|
||||
|
||||
locale::id codecvt<char16_t, char8_t, mbstate_t>::id;
|
||||
|
||||
codecvt<char16_t, char8_t, mbstate_t>::~codecvt()
|
||||
{
|
||||
}
|
||||
|
||||
codecvt<char16_t, char8_t, mbstate_t>::result
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_out(state_type&,
|
||||
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
|
||||
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
|
||||
{
|
||||
const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
|
||||
const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
|
||||
const uint16_t* _frm_nxt = _frm;
|
||||
uint8_t* _to = reinterpret_cast<uint8_t*>(to);
|
||||
uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
|
||||
uint8_t* _to_nxt = _to;
|
||||
result r = utf16_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
|
||||
frm_nxt = frm + (_frm_nxt - _frm);
|
||||
to_nxt = to + (_to_nxt - _to);
|
||||
return r;
|
||||
}
|
||||
|
||||
codecvt<char16_t, char8_t, mbstate_t>::result
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_in(state_type&,
|
||||
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
|
||||
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
|
||||
{
|
||||
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
|
||||
const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
|
||||
const uint8_t* _frm_nxt = _frm;
|
||||
uint16_t* _to = reinterpret_cast<uint16_t*>(to);
|
||||
uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
|
||||
uint16_t* _to_nxt = _to;
|
||||
result r = utf8_to_utf16(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
|
||||
frm_nxt = frm + (_frm_nxt - _frm);
|
||||
to_nxt = to + (_to_nxt - _to);
|
||||
return r;
|
||||
}
|
||||
|
||||
codecvt<char16_t, char8_t, mbstate_t>::result
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_unshift(state_type&,
|
||||
extern_type* to, extern_type*, extern_type*& to_nxt) const
|
||||
{
|
||||
to_nxt = to;
|
||||
return noconv;
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_length(state_type&,
|
||||
const extern_type* frm, const extern_type* frm_end, size_t mx) const
|
||||
{
|
||||
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
|
||||
const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
|
||||
return utf8_to_utf16_length(_frm, _frm_end, mx);
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char16_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// template <> class codecvt<char32_t, char, mbstate_t>
|
||||
|
||||
locale::id codecvt<char32_t, char, mbstate_t>::id;
|
||||
@ -3248,6 +3353,87 @@ codecvt<char32_t, char, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
return 4;
|
||||
}
|
||||
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
|
||||
// template <> class codecvt<char32_t, char8_t, mbstate_t>
|
||||
|
||||
locale::id codecvt<char32_t, char8_t, mbstate_t>::id;
|
||||
|
||||
codecvt<char32_t, char8_t, mbstate_t>::~codecvt()
|
||||
{
|
||||
}
|
||||
|
||||
codecvt<char32_t, char8_t, mbstate_t>::result
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_out(state_type&,
|
||||
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
|
||||
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
|
||||
{
|
||||
const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
|
||||
const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
|
||||
const uint32_t* _frm_nxt = _frm;
|
||||
uint8_t* _to = reinterpret_cast<uint8_t*>(to);
|
||||
uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
|
||||
uint8_t* _to_nxt = _to;
|
||||
result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
|
||||
frm_nxt = frm + (_frm_nxt - _frm);
|
||||
to_nxt = to + (_to_nxt - _to);
|
||||
return r;
|
||||
}
|
||||
|
||||
codecvt<char32_t, char8_t, mbstate_t>::result
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_in(state_type&,
|
||||
const extern_type* frm, const extern_type* frm_end, const extern_type*& frm_nxt,
|
||||
intern_type* to, intern_type* to_end, intern_type*& to_nxt) const
|
||||
{
|
||||
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
|
||||
const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
|
||||
const uint8_t* _frm_nxt = _frm;
|
||||
uint32_t* _to = reinterpret_cast<uint32_t*>(to);
|
||||
uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
|
||||
uint32_t* _to_nxt = _to;
|
||||
result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt);
|
||||
frm_nxt = frm + (_frm_nxt - _frm);
|
||||
to_nxt = to + (_to_nxt - _to);
|
||||
return r;
|
||||
}
|
||||
|
||||
codecvt<char32_t, char8_t, mbstate_t>::result
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_unshift(state_type&,
|
||||
extern_type* to, extern_type*, extern_type*& to_nxt) const
|
||||
{
|
||||
to_nxt = to;
|
||||
return noconv;
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_encoding() const _NOEXCEPT
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_always_noconv() const _NOEXCEPT
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_length(state_type&,
|
||||
const extern_type* frm, const extern_type* frm_end, size_t mx) const
|
||||
{
|
||||
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
|
||||
const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
|
||||
return utf8_to_ucs4_length(_frm, _frm_end, mx);
|
||||
}
|
||||
|
||||
int
|
||||
codecvt<char32_t, char8_t, mbstate_t>::do_max_length() const _NOEXCEPT
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// __codecvt_utf8<wchar_t>
|
||||
|
||||
__codecvt_utf8<wchar_t>::result
|
||||
@ -5128,7 +5314,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
mb = mbstate_t();
|
||||
const char* bb = buf;
|
||||
size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
|
||||
if (j == size_t(-1))
|
||||
if (j == size_t(-1) || j == 0)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
__weeks_[i].assign(wbuf, wbe);
|
||||
@ -5136,7 +5322,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
|
||||
if (j == size_t(-1))
|
||||
if (j == size_t(-1) || j == 0)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
__weeks_[i+7].assign(wbuf, wbe);
|
||||
@ -5149,7 +5335,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
mb = mbstate_t();
|
||||
const char* bb = buf;
|
||||
size_t j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
|
||||
if (j == size_t(-1))
|
||||
if (j == size_t(-1) || j == 0)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
__months_[i].assign(wbuf, wbe);
|
||||
@ -5157,7 +5343,7 @@ __time_get_storage<wchar_t>::init(const ctype<wchar_t>& ct)
|
||||
mb = mbstate_t();
|
||||
bb = buf;
|
||||
j = __libcpp_mbsrtowcs_l(wbuf, &bb, countof(wbuf), &mb, __loc_);
|
||||
if (j == size_t(-1))
|
||||
if (j == size_t(-1) || j == 0)
|
||||
__throw_runtime_error("locale not supported");
|
||||
wbe = wbuf + j;
|
||||
__months_[i+12].assign(wbuf, wbe);
|
||||
@ -6148,7 +6334,11 @@ template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS messages_byname<wchar_t>
|
||||
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char, char, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<wchar_t, char, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char16_t, char, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS _LIBCPP_DEPRECATED_IN_CXX20 codecvt_byname<char32_t, char, mbstate_t>;
|
||||
#ifndef _LIBCPP_NO_HAS_CHAR8_T
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char16_t, char8_t, mbstate_t>;
|
||||
template class _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS codecvt_byname<char32_t, char8_t, mbstate_t>;
|
||||
#endif
|
||||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user