Compare commits

..

4 Commits

Author SHA1 Message Date
Bryce Lelbach (wash)
1179b32b93 GCC: fix __config for always inline/variadics 2011-04-22 14:56:55 +09:00
Bryce Lelbach (wash)
1160236b87 CMake: Change check target to libcxx.check to avoid CMake target conflicts. 2011-04-22 14:56:32 +09:00
Bryce Lelbach (wash)
afb2c7d9ff CMake: Install to include/libcxx/v1 instead of lib/c++/v1, don't depend on headers. 2011-04-22 14:56:17 +09:00
Bryce Lelbach (wash)
58da822e10 CMake: fix minimum version required: 2.6.4 works. 2011-04-22 14:56:04 +09:00
770 changed files with 13018 additions and 30239 deletions

View File

@@ -5,10 +5,10 @@
#=============================================================================== #===============================================================================
project(libcxx CXX C) project(libcxx CXX C)
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.6.4)
set(PACKAGE_NAME libcxx) set(PACKAGE_NAME libcxx)
set(PACKAGE_VERSION trunk-svn) set(PACKAGE_VERSION lll)
set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu") set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
@@ -87,17 +87,17 @@ macro(append_if list condition var)
endmacro() endmacro()
# Get warning flags # Get warning flags
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR) if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif() endif()
if (LIBCXX_ENABLE_PEDANTIC) if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif() endif()
# Get feature flags. # Get feature flags.
@@ -119,8 +119,7 @@ if (NOT LIBCXX_ENABLE_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti) append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif() endif()
# Assert # Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) if (LLVM_ENABLE_ASSERTIONS)
if (LIBCXX_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379. # MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC) if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG) list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)

View File

@@ -13,64 +13,6 @@ E: hhinnant@apple.com
D: Architect and primary author of libc++ D: Architect and primary author of libc++
N: Marshall Clow N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes. D: Minor patches and bug fixes.
N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.
N: Craig Silverstein
E: csilvers@google.com
D: Implemented Cityhash as the string hash function on 64-bit machines
N: Google Inc.
D: Copyright owner and contributor of the CityHash algorithm
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com
D: Linux fixes.
N: Jonathan Sauer
D: Minor patches, mostly related to constexpr
N: Richard Smith
D: Minor patches.
N: Andrew Morrow
E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes.
N: Hyeon-bin Jeong
E: tuhertz@gmail.com
D: Minor patches and bug fixes.
N: Michel Morin
E: mimomorin@gmail.com
D: Minor patches to is_convertible.
N: Dimitry Andric
E: dimitry@andric.com
D: Visibility fixes, minor FreeBSD portability patches.
N: Holger Arnold
E: holgerar@gmail.com
D: Minor fix.
N: Argyrios Kyrtzidis
E: kyrtzidis@apple.com
D: Bug fixes.

View File

@@ -14,7 +14,7 @@ Full text of the relevant licenses is included below.
University of Illinois/NCSA University of Illinois/NCSA
Open Source License Open Source License
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
All rights reserved. All rights reserved.
@@ -55,7 +55,7 @@ SOFTWARE.
============================================================================== ==============================================================================
Copyright (c) 2009-2012 by the contributors listed in CREDITS.TXT Copyright (c) 2009-2010 by the contributors listed in CREDITS.TXT
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@@ -9,18 +9,6 @@ OBJROOT=.
SYMROOT=. SYMROOT=.
export TRIPLE=-apple- export TRIPLE=-apple-
ifeq (,$(RC_INDIGO))
INSTALL_PREFIX=""
else
INSTALL_PREFIX="$(SDKROOT)"
endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders install
help::
@echo "Use make install DSTROOT=<destination>"
installsrc:: $(SRCROOT) installsrc:: $(SRCROOT)
ditto $(SRCDIRS)/include $(SRCROOT)/include ditto $(SRCDIRS)/include $(SRCROOT)/include
@@ -30,24 +18,21 @@ installsrc:: $(SRCROOT)
clean:: clean::
# The installheaders target is used by clang's runtime/libcxx makefile. installhdrs::
installheaders::
mkdir -p $(HEADER_DIR)/c++/v1/ext
rsync -r --exclude=".*" --exclude="support" $(SRCDIRS)/include/* \
$(HEADER_DIR)/c++/v1/
chown -R root:wheel $(HEADER_DIR)/c++
chmod 755 $(HEADER_DIR)/c++/v1
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
install:: mkdir -p $(DSTROOT)/usr/include/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/usr/include/c++/v1/
chown -R root:wheel $(DSTROOT)/usr/include
chmod 755 $(DSTROOT)/usr/include/c++/v1
chmod 644 $(DSTROOT)/usr/include/c++/v1/*
chmod 755 $(DSTROOT)/usr/include/c++/v1/ext
chmod 644 $(DSTROOT)/usr/include/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \ cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
$(SYMROOT)/usr/lib/libc++.1.dylib mkdir -p $(DSTROOT)/usr/lib
mkdir -p $(INSTALL_DIR)/usr/lib strip -S -o $(DSTROOT)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \ cd $(DSTROOT)/usr/lib && ln -s libc++.1.dylib libc++.dylib
$(SYMROOT)/usr/lib/libc++.1.dylib
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -25,7 +25,6 @@ check_cxx_compiler_flag(/GR- LIBCXX_HAS_NO_GR_FLAG)
check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB) check_library_exists(pthread pthread_create "" LIBCXX_HAS_PTHREAD_LIB)
check_library_exists(c printf "" LIBCXX_HAS_C_LIB) check_library_exists(c printf "" LIBCXX_HAS_C_LIB)
check_library_exists(m ccos "" LIBCXX_HAS_M_LIB) check_library_exists(m ccos "" LIBCXX_HAS_M_LIB)
check_library_exists(rt clock_gettime "" LIBCXX_HAS_RT_LIB)
check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB) check_library_exists(gcc_s __gcc_personality_v0 "" LIBCXX_HAS_GCC_S_LIB)
# Check C++0x features # Check C++0x features

File diff suppressed because it is too large Load Diff

View File

@@ -11,15 +11,9 @@
#ifndef _LIBCPP_CONFIG #ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG #define _LIBCPP_CONFIG
#if !_MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef __GNUC__ #define _LIBCPP_VERSION 1000
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1 #define _LIBCPP_ABI_VERSION 1
@@ -53,27 +47,6 @@
# endif // _BYTE_ORDER == _LITTLE_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN
#endif // __FreeBSD__ #endif // __FreeBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
|| (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif
#endif // __sun__
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h> # include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN # if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -87,49 +60,17 @@
# endif # endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#if _WIN32 #ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_VISIBLE
#endif #endif
#ifndef _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_VISIBILITY_TAG
# if _MSC_VER
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_VISIBLE
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# if _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
#endif // _WIN32
#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif
#ifndef _LIBCPP_VISIBLE
#define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default"))) #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#endif #else // _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_HIDDEN
#define _LIBCPP_VISIBLE
#endif // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_INLINE_VISIBILITY #ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
@@ -139,27 +80,14 @@
#define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif #endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__) #if defined(__clang__)
#if __has_feature(cxx_alignas) #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
#if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#ifdef __linux__ #ifdef __linux__
@@ -178,18 +106,12 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI #define _LIBCPP_NO_RTTI
#endif #endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype)) #if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#endif #endif
#if __has_feature(cxx_attributes) #if !(__has_feature(cxx_attributes))
# define _LIBCPP_NORETURN [[noreturn]] #define _LIBCPP_HAS_NO_ATTRIBUTES
#else
# define _LIBCPP_NORETURN __attribute__ ((noreturn))
#endif #endif
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -218,10 +140,6 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_AUTO_TYPE #define _LIBCPP_HAS_NO_AUTO_TYPE
#endif #endif
#if !(__has_feature(cxx_access_control_sfinae)) || !__has_feature(cxx_trailing_return)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#endif
#if !(__has_feature(cxx_variadic_templates)) #if !(__has_feature(cxx_variadic_templates))
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#endif #endif
@@ -230,62 +148,24 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_TRAILING_RETURN
#endif #endif
#if !(__has_feature(cxx_generalized_initializers))
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif
#if __has_feature(is_base_of)
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
#if __has_feature(objc_arc)
#define _LIBCPP_HAS_OBJC_ARC
#endif
#if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if __FreeBSD__ && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x)
#else
# define _NOEXCEPT throw()
# define _NOEXCEPT_(x)
#endif
#if __has_feature(underlying_type)
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif
// Inline namespaces are available in Clang regardless of C++ dialect. // Inline namespaces are available in Clang regardless of C++ dialect.
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } } #define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE #define _STD std::_LIBCPP_NAMESPACE
namespace std { namespace std {
inline namespace _LIBCPP_NAMESPACE { inline namespace _LIBCPP_NAMESPACE {
} }
} }
#if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
// end defined(__clang__)
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#if !__EXCEPTIONS #if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS
#endif #endif
@@ -293,9 +173,6 @@ namespace std {
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CONSTEXPR
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#ifndef __GXX_EXPERIMENTAL_CXX0X__ #ifndef __GXX_EXPERIMENTAL_CXX0X__
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
@@ -314,25 +191,24 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif #endif
#if _GNUC_VER < 403 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_STATIC_ASSERT #define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif #endif
#if _GNUC_VER < 404 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#endif // _GNUC_VER < 404
#if _GNUC_VER < 406 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_NULLPTR
#endif #endif
@@ -340,7 +216,7 @@ namespace std {
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE { #define _LIBCPP_BEGIN_NAMESPACE_STD namespace std { namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } } #define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE #define _STD std::_LIBCPP_NAMESPACE
namespace std { namespace std {
namespace _LIBCPP_NAMESPACE { namespace _LIBCPP_NAMESPACE {
@@ -348,29 +224,7 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
} }
#elif defined(_MSC_VER) #endif // defined(__GNUC__)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
namespace std {
}
#endif // __clang__ || __GNUC___ || _MSC_VER
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t; typedef unsigned short char16_t;
@@ -393,73 +247,11 @@ template <unsigned> struct __static_assert_check {};
#endif #endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR #ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_CONSTEXPR #define constexpr const
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifdef __GNUC__
#define _NOALIAS __attribute__((malloc))
#else
#define _NOALIAS
#endif #endif
#ifndef __has_feature #ifndef __has_feature
#define __has_feature(__x) 0 #define __has_feature(__x) 0
#endif #endif
#if __has_feature(cxx_explicit_conversions)
# define _LIBCPP_EXPLICIT explicit
#else
# define _LIBCPP_EXPLICIT
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_VISIBLE x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
__lx __v_; \
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_VISIBLE x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#endif
#if __APPLE__ || __FreeBSD__ || _WIN32 || __sun__
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#if __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
#if __APPLE__ || __FreeBSD__
#define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif
#if __APPLE__ || __FreeBSD__ || __sun__
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#ifdef _LIBCPP_DEBUG2
# if _LIBCPP_DEBUG2 == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG2 == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG2 are 0 and 1
# endif
#endif
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG #endif // _LIBCPP_CONFIG

View File

@@ -1,191 +0,0 @@
// -*- C++ -*-
//===--------------------------- __debug ----------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_DEBUG_H
#define _LIBCPP_DEBUG_H
#if _LIBCPP_DEBUG_LEVEL >= 1
# include <cstdlib>
# include <cstdio>
# include <cstddef>
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
#endif
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_VISIBLE __c_node;
struct _LIBCPP_VISIBLE __i_node
{
void* __i_;
__i_node* __next_;
__c_node* __c_;
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__i_node(void* __i, __i_node* __next, __c_node* __c)
: __i_(__i), __next_(__next), __c_(__c) {}
~__i_node();
};
struct _LIBCPP_VISIBLE __c_node
{
void* __c_;
__c_node* __next_;
__i_node** beg_;
__i_node** end_;
__i_node** cap_;
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
_LIBCPP_INLINE_VISIBILITY
__c_node(void* __c, __c_node* __next)
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
virtual ~__c_node();
virtual bool __dereferenceable(const void*) const = 0;
virtual bool __decrementable(const void*) const = 0;
virtual bool __addable(const void*, ptrdiff_t) const = 0;
virtual bool __subscriptable(const void*, ptrdiff_t) const = 0;
void __add(__i_node* __i);
_LIBCPP_HIDDEN void __remove(__i_node* __i);
};
template <class _Cont>
struct _C_node
: public __c_node
{
_C_node(void* __c, __c_node* __n)
: __c_node(__c, __n) {}
virtual bool __dereferenceable(const void*) const;
virtual bool __decrementable(const void*) const;
virtual bool __addable(const void*, ptrdiff_t) const;
virtual bool __subscriptable(const void*, ptrdiff_t) const;
};
template <class _Cont>
bool
_C_node<_Cont>::__dereferenceable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__dereferenceable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__decrementable(const void* __i) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__decrementable(__j);
}
template <class _Cont>
bool
_C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__addable(__j, __n);
}
template <class _Cont>
bool
_C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
{
typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_);
return _Cp->__subscriptable(__j, __n);
}
class _LIBCPP_VISIBLE __libcpp_db
{
__c_node** __cbeg_;
__c_node** __cend_;
size_t __csz_;
__i_node** __ibeg_;
__i_node** __iend_;
size_t __isz_;
__libcpp_db();
public:
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
~__libcpp_db();
class __db_c_iterator;
class __db_c_const_iterator;
class __db_i_iterator;
class __db_i_const_iterator;
__db_c_const_iterator __c_end() const;
__db_i_const_iterator __i_end() const;
template <class _Cont>
_LIBCPP_INLINE_VISIBILITY
void __insert_c(_Cont* __c)
{
__c_node* __n = __insert_c(static_cast<void*>(__c));
::new(__n) _C_node<_Cont>(__n->__c_, __n->__next_);
}
void __insert_i(void* __i);
__c_node* __insert_c(void* __c);
void __erase_c(void* __c);
void __insert_ic(void* __i, const void* __c);
void __iterator_copy(void* __i, const void* __i0);
void __erase_i(void* __i);
void* __find_c_from_i(void* __i) const;
void __invalidate_all(void* __c);
__c_node* __find_c_and_lock(void* __c) const;
__c_node* __find_c(void* __c) const;
void unlock() const;
void swap(void* __c1, void* __c2);
bool __dereferenceable(const void* __i) const;
bool __decrementable(const void* __i) const;
bool __addable(const void* __i, ptrdiff_t __n) const;
bool __subscriptable(const void* __i, ptrdiff_t __n) const;
bool __comparable(const void* __i, const void* __j) const;
private:
_LIBCPP_HIDDEN
__i_node* __insert_iterator(void* __i);
_LIBCPP_HIDDEN
__i_node* __find_iterator(const void* __i) const;
friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
};
_LIBCPP_VISIBLE __libcpp_db* __get_db();
_LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD
#endif
#endif // _LIBCPP_DEBUG_H

File diff suppressed because it is too large Load Diff

View File

@@ -16,9 +16,7 @@
#include <typeinfo> #include <typeinfo>
#include <exception> #include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -43,20 +41,13 @@ template <class _Tp>
struct __has_result_type struct __has_result_type
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
template <class _Up> static __two __test(...); template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0); template <class _Up> static char __test(typename _Up::result_type* = 0);
public: public:
static const bool value = sizeof(__test<_Tp>(0)) == 1; static const bool value = sizeof(__test<_Tp>(0)) == 1;
}; };
template <class _Tp>
struct _LIBCPP_VISIBLE less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#ifdef _LIBCPP_HAS_NO_VARIADICS #ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03> #include <__functional_base_03>
@@ -69,11 +60,11 @@ template <class _Tp>
struct __derives_from_unary_function struct __derives_from_unary_function
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
static __two __test(...); static __two __test(...);
template <class _Ap, class _Rp> template <class _A, class _R>
static unary_function<_Ap, _Rp> static unary_function<_A, _R>
__test(const volatile unary_function<_Ap, _Rp>*); __test(const volatile unary_function<_A, _R>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -83,11 +74,11 @@ template <class _Tp>
struct __derives_from_binary_function struct __derives_from_binary_function
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
static __two __test(...); static __two __test(...);
template <class _A1, class _A2, class _Rp> template <class _A1, class _A2, class _R>
static binary_function<_A1, _A2, _Rp> static binary_function<_A1, _A2, _R>
__test(const volatile binary_function<_A1, _A2, _Rp>*); __test(const volatile binary_function<_A1, _A2, _R>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -138,213 +129,319 @@ struct __weak_result_type
// 0 argument case // 0 argument case
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp ()> struct __weak_result_type<_R ()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp (&)()> struct __weak_result_type<_R (&)()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp (*)()> struct __weak_result_type<_R (*)()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
// 1 argument case // 1 argument case
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (_A1)> struct __weak_result_type<_R (_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (&)(_A1)> struct __weak_result_type<_R (&)(_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (*)(_A1)> struct __weak_result_type<_R (*)(_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)()> struct __weak_result_type<_R (_C::*)()>
: public unary_function<_Cp*, _Rp> : public unary_function<_C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() const> struct __weak_result_type<_R (_C::*)() const>
: public unary_function<const _Cp*, _Rp> : public unary_function<const _C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() volatile> struct __weak_result_type<_R (_C::*)() volatile>
: public unary_function<volatile _Cp*, _Rp> : public unary_function<volatile _C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() const volatile> struct __weak_result_type<_R (_C::*)() const volatile>
: public unary_function<const volatile _Cp*, _Rp> : public unary_function<const volatile _C*, _R>
{ {
}; };
// 2 argument case // 2 argument case
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)> struct __weak_result_type<_R (_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)> struct __weak_result_type<_R (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)> struct __weak_result_type<_R (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)> struct __weak_result_type<_R (_C::*)(_A1)>
: public binary_function<_Cp*, _A1, _Rp> : public binary_function<_C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const> struct __weak_result_type<_R (_C::*)(_A1) const>
: public binary_function<const _Cp*, _A1, _Rp> : public binary_function<const _C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> struct __weak_result_type<_R (_C::*)(_A1) volatile>
: public binary_function<volatile _Cp*, _A1, _Rp> : public binary_function<volatile _C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> struct __weak_result_type<_R (_C::*)(_A1) const volatile>
: public binary_function<const volatile _Cp*, _A1, _Rp> : public binary_function<const volatile _C*, _A1, _R>
{ {
}; };
// 3 or more arguments // 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
// __invoke // __invoke
// bullets 1 and 2 // first bullet
template <class _Fp, class _A0, class ..._Args> template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto typename enable_if
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) <
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{ {
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...); return (_STD::forward<_T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
} }
template <class _Fp, class _A0, class ..._Args> template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto typename enable_if
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) <
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{ {
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...); return (_STD::forward<const _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
} }
// bullets 3 and 4 template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto typename enable_if
__invoke(_Fp&& __f, _A0&& __a0) <
-> decltype(_VSTD::forward<_A0>(__a0).*__f) sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{ {
return _VSTD::forward<_A0>(__a0).*__f; return (_STD::forward<volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
} }
template <class _Fp, class _A0> template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto typename enable_if
__invoke(_Fp&& __f, _A0&& __a0) <
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f) sizeof...(_Param) == sizeof...(_Arg) &&
is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{ {
return (*_VSTD::forward<_A0>(__a0)).*__f; return (_STD::forward<const volatile _T>(__t1).*__f)(_STD::forward<_Arg>(__arg)...);
} }
// bullet 5 // second bullet
template <class _Fp, class ..._Args> template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto typename enable_if
__invoke(_Fp&& __f, _Args&& ...__args) <
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...), _T1&& __t1, _Arg&& ...__arg)
{ {
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...); return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
template <class _R, class _T, class _T1, class ..._Param, class ..._Arg>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
sizeof...(_Param) == sizeof...(_Arg) &&
!is_base_of<_T, typename remove_reference<_T1>::type>::value,
_R
>::type
__invoke(_R (_T::*__f)(_Param...) const volatile, _T1&& __t1, _Arg&& ...__arg)
{
return ((*_STD::forward<_T1>(__t1)).*__f)(_STD::forward<_Arg>(__arg)...);
}
// third bullet
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_base_of<_T, typename remove_reference<_T1>::type>::value,
typename __apply_cv<_T1, _R>::type&&
>::type
__invoke(_R _T::* __f, _T1&& __t1)
{
return _STD::forward<_T1>(__t1).*__f;
}
// forth bullet
template <class _T1, class _R, bool>
struct __4th_helper
{
};
template <class _T1, class _R>
struct __4th_helper<_T1, _R, true>
{
typedef typename __apply_cv<decltype(*_STD::declval<_T1>()), _R>::type type;
};
template <class _R, class _T, class _T1>
inline _LIBCPP_INLINE_VISIBILITY
typename __4th_helper<_T1, _R,
!is_base_of<_T,
typename remove_reference<_T1>::type
>::value
>::type&&
__invoke(_R _T::* __f, _T1&& __t1)
{
return (*_STD::forward<_T1>(__t1)).*__f;
}
// fifth bullet
template <class _F, class ..._T>
inline _LIBCPP_INLINE_VISIBILITY
typename result_of<_F(_T...)>::type
__invoke(_F&& __f, _T&& ...__t)
{
return _STD::forward<_F>(__f)(_STD::forward<_T>(__t)...);
} }
template <class _Tp, class ..._Args> template <class _Tp, class ..._Args>
struct __invoke_return struct __invoke_return
{ {
typedef decltype(__invoke(_VSTD::declval<_Tp>(), _VSTD::declval<_Args>()...)) type; typedef decltype(__invoke(_STD::declval<_Tp>(), _STD::declval<_Args>()...)) type;
}; };
template <class _Tp> template <class _Tp>
@@ -359,22 +456,22 @@ private:
public: public:
// construct/copy/destroy // construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {} _LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif #endif
// access // access
_LIBCPP_INLINE_VISIBILITY operator type& () const _NOEXCEPT {return *__f_;} _LIBCPP_INLINE_VISIBILITY operator type& () const {return *__f_;}
_LIBCPP_INLINE_VISIBILITY type& get() const _NOEXCEPT {return *__f_;} _LIBCPP_INLINE_VISIBILITY type& get() const {return *__f_;}
// invoke // invoke
template <class... _ArgTypes> template <class... _ArgTypes>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
typename __invoke_of<type&, _ArgTypes...>::type typename __invoke_return<type&, _ArgTypes...>::type
operator() (_ArgTypes&&... __args) const operator() (_ArgTypes&&... __args) const
{ {
return __invoke(get(), _VSTD::forward<_ArgTypes>(__args)...); return __invoke(get(), _STD::forward<_ArgTypes>(__args)...);
} }
}; };
@@ -386,7 +483,7 @@ template <class _Tp> struct __is_reference_wrapper
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp> reference_wrapper<_Tp>
ref(_Tp& __t) _NOEXCEPT ref(_Tp& __t)
{ {
return reference_wrapper<_Tp>(__t); return reference_wrapper<_Tp>(__t);
} }
@@ -394,7 +491,7 @@ ref(_Tp& __t) _NOEXCEPT
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<_Tp> reference_wrapper<_Tp>
ref(reference_wrapper<_Tp> __t) _NOEXCEPT ref(reference_wrapper<_Tp> __t)
{ {
return ref(__t.get()); return ref(__t.get());
} }
@@ -402,7 +499,7 @@ ref(reference_wrapper<_Tp> __t) _NOEXCEPT
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp> reference_wrapper<const _Tp>
cref(const _Tp& __t) _NOEXCEPT cref(const _Tp& __t)
{ {
return reference_wrapper<const _Tp>(__t); return reference_wrapper<const _Tp>(__t);
} }
@@ -410,7 +507,7 @@ cref(const _Tp& __t) _NOEXCEPT
template <class _Tp> template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
reference_wrapper<const _Tp> reference_wrapper<const _Tp>
cref(reference_wrapper<_Tp> __t) _NOEXCEPT cref(reference_wrapper<_Tp> __t)
{ {
return cref(__t.get()); return cref(__t.get());
} }
@@ -418,13 +515,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&) = delete; template <class _Tp> void ref(const _Tp&& __t) = delete;
template <class _Tp> void cref(const _Tp&&) = delete; template <class _Tp> void cref(const _Tp&& __t) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&);// = delete; template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete; template <class _Tp> void cref(const _Tp&& __t);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -19,36 +19,23 @@
#include <cstdint> #include <cstdint>
#include <cctype> #include <cctype>
#include <locale.h> #include <locale.h>
#if _WIN32 #include <xlocale.h>
# include <support/win32/locale_win32.h>
#elif (__GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE locale; class locale;
template <class _Facet> template <class _Facet> bool has_facet(const locale&) throw();
_LIBCPP_INLINE_VISIBILITY template <class _Facet> const _Facet& use_facet(const locale&);
bool
has_facet(const locale&) _NOEXCEPT;
template <class _Facet>
_LIBCPP_INLINE_VISIBILITY
const _Facet&
use_facet(const locale&);
class _LIBCPP_VISIBLE locale class _LIBCPP_VISIBLE locale
{ {
public: public:
// types: // types:
class _LIBCPP_VISIBLE facet; class facet;
class _LIBCPP_VISIBLE id; class id;
typedef int category; typedef int category;
static const category // values assigned here are for exposition only static const category // values assigned here are for exposition only
@@ -62,8 +49,8 @@ public:
all = collate | ctype | monetary | numeric | time | messages; all = collate | ctype | monetary | numeric | time | messages;
// construct/copy/destroy: // construct/copy/destroy:
locale() _NOEXCEPT; locale() throw();
locale(const locale&) _NOEXCEPT; locale(const locale&) throw();
explicit locale(const char*); explicit locale(const char*);
explicit locale(const string&); explicit locale(const string&);
locale(const locale&, const char*, category); locale(const locale&, const char*, category);
@@ -72,9 +59,9 @@ public:
_LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*); _LIBCPP_INLINE_VISIBILITY locale(const locale&, _Facet*);
locale(const locale&, const locale&, category); locale(const locale&, const locale&, category);
~locale(); ~locale() throw();
const locale& operator=(const locale&) _NOEXCEPT; const locale& operator=(const locale&) throw();
template <class _Facet> locale combine(const locale&) const; template <class _Facet> locale combine(const locale&) const;
@@ -99,7 +86,7 @@ private:
bool has_facet(id&) const; bool has_facet(id&) const;
const facet* use_facet(id&) const; const facet* use_facet(id&) const;
template <class _Facet> friend bool has_facet(const locale&) _NOEXCEPT; template <class _Facet> friend bool has_facet(const locale&) throw();
template <class _Facet> friend const _Facet& use_facet(const locale&); template <class _Facet> friend const _Facet& use_facet(const locale&);
}; };
@@ -116,7 +103,7 @@ protected:
// facet(const facet&) = delete; // effectively done in __shared_count // facet(const facet&) = delete; // effectively done in __shared_count
// void operator=(const facet&) = delete; // void operator=(const facet&) = delete;
private: private:
virtual void __on_zero_shared() _NOEXCEPT; virtual void __on_zero_shared();
}; };
class _LIBCPP_VISIBLE locale::id class _LIBCPP_VISIBLE locale::id
@@ -126,7 +113,7 @@ class _LIBCPP_VISIBLE locale::id
static int32_t __next_id; static int32_t __next_id;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} _LIBCPP_INLINE_VISIBILITY id() {}
private: private:
void __init(); void __init();
void operator=(const id&); // = delete; void operator=(const id&); // = delete;
@@ -150,16 +137,16 @@ locale
locale::combine(const locale& __other) const locale::combine(const locale& __other) const
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (!_VSTD::has_facet<_Facet>(__other)) if (!_STD::has_facet<_Facet>(__other))
throw runtime_error("locale::combine: locale missing facet"); throw runtime_error("locale::combine: locale missing facet");
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
return locale(*this, &const_cast<_Facet&>(_VSTD::use_facet<_Facet>(__other))); return locale(*this, &const_cast<_Facet&>(_STD::use_facet<_Facet>(__other)));
} }
template <class _Facet> template <class _Facet>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
has_facet(const locale& __l) _NOEXCEPT has_facet(const locale& __l) throw()
{ {
return __l.has_facet(_Facet::id); return __l.has_facet(_Facet::id);
} }
@@ -240,22 +227,22 @@ collate<_CharT>::do_compare(const char_type* __lo1, const char_type* __hi1,
template <class _CharT> template <class _CharT>
long long
collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const collate<_CharT>::do_hash(const char_type* lo, const char_type* hi) const
{ {
size_t __h = 0; size_t h = 0;
const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8; const size_t sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __mask = size_t(0xF) << (__sr + 4); const size_t mask = size_t(0xF) << (sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p) for(const char_type* p = lo; p != hi; ++p)
{ {
__h = (__h << 4) + static_cast<size_t>(*__p); h = (h << 4) + *p;
size_t __g = __h & __mask; size_t g = h & mask;
__h ^= __g | (__g >> __sr); h ^= g | (g >> sr);
} }
return static_cast<long>(__h); return static_cast<long>(h);
} }
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<char>) extern template class _LIBCPP_VISIBLE collate<char>;
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_VISIBLE collate<wchar_t>) extern template class _LIBCPP_VISIBLE collate<wchar_t>;
// template <class CharT> class collate_byname; // template <class CharT> class collate_byname;
@@ -305,7 +292,7 @@ bool
locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x, locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
const basic_string<_CharT, _Traits, _Allocator>& __y) const const basic_string<_CharT, _Traits, _Allocator>& __y) const
{ {
return _VSTD::use_facet<_VSTD::collate<_CharT> >(*this).compare( return _STD::use_facet<_STD::collate<_CharT> >(*this).compare(
__x.data(), __x.data() + __x.size(), __x.data(), __x.data() + __x.size(),
__y.data(), __y.data() + __y.size()) < 0; __y.data(), __y.data() + __y.size()) < 0;
} }
@@ -315,36 +302,9 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
class _LIBCPP_VISIBLE ctype_base class _LIBCPP_VISIBLE ctype_base
{ {
public: public:
#if __GLIBC__
typedef unsigned short mask;
static const mask space = _ISspace;
static const mask print = _ISprint;
static const mask cntrl = _IScntrl;
static const mask upper = _ISupper;
static const mask lower = _ISlower;
static const mask alpha = _ISalpha;
static const mask digit = _ISdigit;
static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank;
#elif _WIN32
typedef unsigned short mask;
static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
static const mask cntrl = _CONTROL;
static const mask upper = _UPPER;
static const mask lower = _LOWER;
static const mask alpha = _ALPHA;
static const mask digit = _DIGIT;
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif (__APPLE__ || __FreeBSD__)
#if __APPLE__
typedef __uint32_t mask; typedef __uint32_t mask;
#elif __FreeBSD__
typedef unsigned long mask; #if __APPLE__
#endif
static const mask space = _CTYPE_S; static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R; static const mask print = _CTYPE_R;
static const mask cntrl = _CTYPE_C; static const mask cntrl = _CTYPE_C;
@@ -355,31 +315,18 @@ public:
static const mask punct = _CTYPE_P; static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X; static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B; static const mask blank = _CTYPE_B;
#elif __sun__ #else // __APPLE__
typedef unsigned int mask; static const mask space = _ISspace;
static const mask space = _ISSPACE; static const mask print = _ISprint;
static const mask print = _ISPRINT; static const mask cntrl = _IScntrl;
static const mask cntrl = _ISCNTRL; static const mask upper = _ISupper;
static const mask upper = _ISUPPER; static const mask lower = _ISlower;
static const mask lower = _ISLOWER; static const mask alpha = _ISalpha;
static const mask alpha = _ISALPHA; static const mask digit = _ISdigit;
static const mask digit = _ISDIGIT; static const mask punct = _ISpunct;
static const mask punct = _ISPUNCT; static const mask xdigit = _ISxdigit;
static const mask xdigit = _ISXDIGIT; static const mask blank = _ISblank;
static const mask blank = _ISBLANK; #endif // __APPLE__
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __sun__
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;
#endif // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
static const mask alnum = alpha | digit; static const mask alnum = alpha | digit;
static const mask graph = alnum | punct; static const mask graph = alnum | punct;
@@ -504,14 +451,14 @@ public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const bool is(mask __m, char_type __c) const
{ {
return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false; return isascii(__c) ? __tab_[__c] & __m : false;
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{ {
for (; __low != __high; ++__low, ++__vec) for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0; *__vec = isascii(*__low) ? __tab_[*__low] : 0;
return __low; return __low;
} }
@@ -519,7 +466,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) if (isascii(*__low) && (__tab_[*__low] & __m))
break; break;
return __low; return __low;
} }
@@ -528,7 +475,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) if (!(isascii(*__low) && (__tab_[*__low] & __m)))
break; break;
return __low; return __low;
} }
@@ -588,12 +535,8 @@ public:
#else #else
static const size_t table_size = 256; // FIXME: Don't hardcode this. static const size_t table_size = 256; // FIXME: Don't hardcode this.
#endif #endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} _LIBCPP_ALWAYS_INLINE const mask* table() const throw() {return __tab_;}
static const mask* classic_table() _NOEXCEPT; static const mask* classic_table() throw();
#if defined(__GLIBC__)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
protected: protected:
~ctype(); ~ctype();
@@ -812,13 +755,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const _NOEXCEPT int encoding() const throw()
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const _NOEXCEPT bool always_noconv() const throw()
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -830,7 +773,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const _NOEXCEPT int max_length() const throw()
{ {
return do_max_length(); return do_max_length();
} }
@@ -852,10 +795,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const _NOEXCEPT; virtual int do_encoding() const throw();
virtual bool do_always_noconv() const _NOEXCEPT; virtual bool do_always_noconv() const throw();
virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const; virtual int do_length(state_type& __st, const extern_type* __frm, const extern_type* __end, size_t __mx) const;
virtual int do_max_length() const _NOEXCEPT; virtual int do_max_length() const throw();
}; };
// template <> class codecvt<wchar_t, char, mbstate_t> // template <> class codecvt<wchar_t, char, mbstate_t>
@@ -897,13 +840,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const _NOEXCEPT int encoding() const throw()
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const _NOEXCEPT bool always_noconv() const throw()
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -915,7 +858,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const _NOEXCEPT int max_length() const throw()
{ {
return do_max_length(); return do_max_length();
} }
@@ -935,10 +878,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const _NOEXCEPT; virtual int do_encoding() const throw();
virtual bool do_always_noconv() const _NOEXCEPT; virtual bool do_always_noconv() const throw();
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 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; virtual int do_max_length() const throw();
}; };
// template <> class codecvt<char16_t, char, mbstate_t> // template <> class codecvt<char16_t, char, mbstate_t>
@@ -981,13 +924,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const _NOEXCEPT int encoding() const throw()
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const _NOEXCEPT bool always_noconv() const throw()
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -999,7 +942,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const _NOEXCEPT int max_length() const throw()
{ {
return do_max_length(); return do_max_length();
} }
@@ -1021,10 +964,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const _NOEXCEPT; virtual int do_encoding() const throw();
virtual bool do_always_noconv() const _NOEXCEPT; virtual bool do_always_noconv() const throw();
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 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; virtual int do_max_length() const throw();
}; };
// template <> class codecvt<char32_t, char, mbstate_t> // template <> class codecvt<char32_t, char, mbstate_t>
@@ -1067,13 +1010,13 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int encoding() const _NOEXCEPT int encoding() const throw()
{ {
return do_encoding(); return do_encoding();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool always_noconv() const _NOEXCEPT bool always_noconv() const throw()
{ {
return do_always_noconv(); return do_always_noconv();
} }
@@ -1085,7 +1028,7 @@ public:
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int max_length() const _NOEXCEPT int max_length() const throw()
{ {
return do_max_length(); return do_max_length();
} }
@@ -1107,10 +1050,10 @@ protected:
intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const; intern_type* __to, intern_type* __to_end, intern_type*& __to_nxt) const;
virtual result do_unshift(state_type& __st, virtual result do_unshift(state_type& __st,
extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const; extern_type* __to, extern_type* __to_end, extern_type*& __to_nxt) const;
virtual int do_encoding() const _NOEXCEPT; virtual int do_encoding() const throw();
virtual bool do_always_noconv() const _NOEXCEPT; virtual bool do_always_noconv() const throw();
virtual int do_length(state_type&, const extern_type* __frm, const extern_type* __end, size_t __mx) const; 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; virtual int do_max_length() const throw();
}; };
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
@@ -1135,14 +1078,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{ {
} }
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>) extern template class codecvt_byname<char, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>) extern template class codecvt_byname<wchar_t, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>) extern template class codecvt_byname<char16_t, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>) extern template class codecvt_byname<char32_t, char, mbstate_t>;
_LIBCPP_VISIBLE void __throw_runtime_error(const char*); _LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _Np> template <size_t _N>
struct __narrow_to_utf8 struct __narrow_to_utf8
{ {
template <class _OutputIterator, class _CharT> template <class _OutputIterator, class _CharT>
@@ -1232,7 +1175,7 @@ struct __narrow_to_utf8<32>
} }
}; };
template <size_t _Np> template <size_t _N>
struct __widen_from_utf8 struct __widen_from_utf8
{ {
template <class _OutputIterator> template <class _OutputIterator>

View File

@@ -16,15 +16,13 @@
#include <system_error> #include <system_error>
#include <pthread.h> #include <pthread.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef _LIBCPP_SHARED_LOCK #ifdef _LIBCPP_SHARED_LOCK
namespace ting { namespace ting {
template <class _Mutex> class shared_lock; template <class> class shared_lock;
template <class _Mutex> class upgrade_lock; template <class> class upgrade_lock;
} }
#endif // _LIBCPP_SHARED_LOCK #endif // _LIBCPP_SHARED_LOCK
@@ -38,11 +36,7 @@ class _LIBCPP_VISIBLE mutex
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_CONSTEXPR mutex() {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
constexpr mutex() _NOEXCEPT : __m_(PTHREAD_MUTEX_INITIALIZER) {}
#else
mutex() _NOEXCEPT {__m_ = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER;}
#endif
~mutex(); ~mutex();
private: private:
@@ -51,8 +45,8 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
void unlock() _NOEXCEPT; void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;} _LIBCPP_INLINE_VISIBILITY native_handle_type native_handle() {return &__m_;}
@@ -62,19 +56,17 @@ struct _LIBCPP_VISIBLE defer_lock_t {};
struct _LIBCPP_VISIBLE try_to_lock_t {}; struct _LIBCPP_VISIBLE try_to_lock_t {};
struct _LIBCPP_VISIBLE adopt_lock_t {}; struct _LIBCPP_VISIBLE adopt_lock_t {};
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MUTEX) //constexpr
extern const
defer_lock_t defer_lock;
extern const defer_lock_t defer_lock; //constexpr
extern const try_to_lock_t try_to_lock; extern const
extern const adopt_lock_t adopt_lock; try_to_lock_t try_to_lock;
#else //constexpr
extern const
constexpr defer_lock_t defer_lock = defer_lock_t(); adopt_lock_t adopt_lock;
constexpr try_to_lock_t try_to_lock = try_to_lock_t();
constexpr adopt_lock_t adopt_lock = adopt_lock_t();
#endif
template <class _Mutex> template <class _Mutex>
class _LIBCPP_VISIBLE lock_guard class _LIBCPP_VISIBLE lock_guard
@@ -112,12 +104,12 @@ private:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock() _NOEXCEPT : __m_(nullptr), __owns_(false) {} unique_lock() : __m_(nullptr), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit unique_lock(mutex_type& __m) explicit unique_lock(mutex_type& __m)
: __m_(&__m), __owns_(true) {__m_->lock();} : __m_(&__m), __owns_(true) {__m_->lock();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, defer_lock_t) _NOEXCEPT unique_lock(mutex_type& __m, defer_lock_t)
: __m_(&__m), __owns_(false) {} : __m_(&__m), __owns_(false) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(mutex_type& __m, try_to_lock_t) unique_lock(mutex_type& __m, try_to_lock_t)
@@ -147,11 +139,11 @@ private:
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock(unique_lock&& __u) _NOEXCEPT unique_lock(unique_lock&& __u)
: __m_(__u.__m_), __owns_(__u.__owns_) : __m_(__u.__m_), __owns_(__u.__owns_)
{__u.__m_ = nullptr; __u.__owns_ = false;} {__u.__m_ = nullptr; __u.__owns_ = false;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
unique_lock& operator=(unique_lock&& __u) _NOEXCEPT unique_lock& operator=(unique_lock&& __u)
{ {
if (__owns_) if (__owns_)
__m_->unlock(); __m_->unlock();
@@ -196,13 +188,13 @@ public:
void unlock(); void unlock();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(unique_lock& __u) _NOEXCEPT void swap(unique_lock& __u)
{ {
_VSTD::swap(__m_, __u.__m_); _STD::swap(__m_, __u.__m_);
_VSTD::swap(__owns_, __u.__owns_); _STD::swap(__owns_, __u.__owns_);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
mutex_type* release() _NOEXCEPT mutex_type* release()
{ {
mutex_type* __m = __m_; mutex_type* __m = __m_;
__m_ = nullptr; __m_ = nullptr;
@@ -211,12 +203,12 @@ public:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool owns_lock() const _NOEXCEPT {return __owns_;} bool owns_lock() const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT // explicit
operator bool () const _NOEXCEPT {return __owns_;} operator bool () const {return __owns_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const _NOEXCEPT {return __m_;} mutex_type* mutex() const {return __m_;}
}; };
template <class _Mutex> template <class _Mutex>
@@ -282,19 +274,18 @@ unique_lock<_Mutex>::unlock()
template <class _Mutex> template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) _NOEXCEPT swap(unique_lock<_Mutex>& __x, unique_lock<_Mutex>& __y) {__x.swap(__y);}
{__x.swap(__y);}
struct _LIBCPP_VISIBLE cv_status struct _LIBCPP_VISIBLE cv_status
{ {
enum __lx { enum _ {
no_timeout, no_timeout,
timeout timeout
}; };
__lx __v_; _ __v_;
_LIBCPP_INLINE_VISIBILITY cv_status(__lx __v) : __v_(__v) {} _LIBCPP_INLINE_VISIBILITY cv_status(_ __v) : __v_(__v) {}
_LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;} _LIBCPP_INLINE_VISIBILITY operator int() const {return __v_;}
}; };
@@ -304,11 +295,7 @@ class _LIBCPP_VISIBLE condition_variable
pthread_cond_t __cv_; pthread_cond_t __cv_;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
constexpr condition_variable() : __cv_(PTHREAD_COND_INITIALIZER) {}
#else
condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;} condition_variable() {__cv_ = (pthread_cond_t)PTHREAD_COND_INITIALIZER;}
#endif
~condition_variable(); ~condition_variable();
private: private:
@@ -316,13 +303,18 @@ private:
condition_variable& operator=(const condition_variable&); // = delete; condition_variable& operator=(const condition_variable&); // = delete;
public: public:
void notify_one() _NOEXCEPT; void notify_one();
void notify_all() _NOEXCEPT; void notify_all();
void wait(unique_lock<mutex>& __lk); void wait(unique_lock<mutex>& __lk);
template <class _Predicate> template <class _Predicate>
void wait(unique_lock<mutex>& __lk, _Predicate __pred); void wait(unique_lock<mutex>& __lk, _Predicate __pred);
template <class _Duration>
cv_status
wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<chrono::system_clock, _Duration>& __t);
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
cv_status cv_status
wait_until(unique_lock<mutex>& __lk, wait_until(unique_lock<mutex>& __lk,
@@ -377,13 +369,28 @@ condition_variable::wait(unique_lock<mutex>& __lk, _Predicate __pred)
wait(__lk); wait(__lk);
} }
template <class _Duration>
cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<chrono::system_clock, _Duration>& __t)
{
using namespace chrono;
typedef time_point<system_clock, nanoseconds> __nano_sys_tmpt;
__do_timed_wait(__lk,
__nano_sys_tmpt(__ceil<nanoseconds>(__t.time_since_epoch())));
return system_clock::now() < __t ? cv_status::no_timeout :
cv_status::timeout;
}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
cv_status cv_status
condition_variable::wait_until(unique_lock<mutex>& __lk, condition_variable::wait_until(unique_lock<mutex>& __lk,
const chrono::time_point<_Clock, _Duration>& __t) const chrono::time_point<_Clock, _Duration>& __t)
{ {
using namespace chrono; using namespace chrono;
wait_for(__lk, __t - _Clock::now()); system_clock::time_point __s_now = system_clock::now();
typename _Clock::time_point __c_now = _Clock::now();
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__t - __c_now));
return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout;
} }
@@ -407,17 +414,9 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
const chrono::duration<_Rep, _Period>& __d) const chrono::duration<_Rep, _Period>& __d)
{ {
using namespace chrono; using namespace chrono;
if (__d <= __d.zero())
return cv_status::timeout;
typedef time_point<system_clock, duration<long double, nano> > __sys_tpf;
typedef time_point<system_clock, nanoseconds> __sys_tpi;
__sys_tpf _Max = __sys_tpi::max();
system_clock::time_point __s_now = system_clock::now(); system_clock::time_point __s_now = system_clock::now();
steady_clock::time_point __c_now = steady_clock::now(); steady_clock::time_point __c_now = steady_clock::now();
if (_Max - __d > __s_now) __do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
__do_timed_wait(__lk, __s_now + __ceil<nanoseconds>(__d));
else
__do_timed_wait(__lk, __sys_tpi::max());
return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : return steady_clock::now() - __c_now < __d ? cv_status::no_timeout :
cv_status::timeout; cv_status::timeout;
} }
@@ -430,7 +429,7 @@ condition_variable::wait_for(unique_lock<mutex>& __lk,
_Predicate __pred) _Predicate __pred)
{ {
return wait_until(__lk, chrono::steady_clock::now() + __d, return wait_until(__lk, chrono::steady_clock::now() + __d,
_VSTD::move(__pred)); _STD::move(__pred));
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -6,11 +6,7 @@
#include <type_traits> #include <type_traits>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -51,36 +47,29 @@ public:
typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref; typedef typename add_lvalue_reference<allocator_type>::type __alloc_ref;
typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref; typedef typename add_lvalue_reference<allocator_type>::type __alloc_const_ref;
_LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() _NOEXCEPT {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY __alloc_rr& __alloc() {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const _NOEXCEPT {return __end_cap_.second();} _LIBCPP_INLINE_VISIBILITY const __alloc_rr& __alloc() const {return __end_cap_.second();}
_LIBCPP_INLINE_VISIBILITY pointer& __end_cap() _NOEXCEPT {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY pointer& __end_cap() {return __end_cap_.first();}
_LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const _NOEXCEPT {return __end_cap_.first();} _LIBCPP_INLINE_VISIBILITY const pointer& __end_cap() const {return __end_cap_.first();}
__split_buffer() __split_buffer();
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value);
explicit __split_buffer(__alloc_rr& __a); explicit __split_buffer(__alloc_rr& __a);
explicit __split_buffer(const __alloc_rr& __a); explicit __split_buffer(const __alloc_rr& __a);
__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a); __split_buffer(size_type __cap, size_type __start, __alloc_rr& __a);
~__split_buffer(); ~__split_buffer();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__split_buffer(__split_buffer&& __c) __split_buffer(__split_buffer&& __c);
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value);
__split_buffer(__split_buffer&& __c, const __alloc_rr& __a); __split_buffer(__split_buffer&& __c, const __alloc_rr& __a);
__split_buffer& operator=(__split_buffer&& __c) __split_buffer& operator=(__split_buffer&& __c);
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY iterator begin() _NOEXCEPT {return __begin_;} _LIBCPP_INLINE_VISIBILITY iterator begin() {return __begin_;}
_LIBCPP_INLINE_VISIBILITY const_iterator begin() const _NOEXCEPT {return __begin_;} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return __begin_;}
_LIBCPP_INLINE_VISIBILITY iterator end() _NOEXCEPT {return __end_;} _LIBCPP_INLINE_VISIBILITY iterator end() {return __end_;}
_LIBCPP_INLINE_VISIBILITY const_iterator end() const _NOEXCEPT {return __end_;} _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return __end_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY void clear() {__destruct_at_end(__begin_);}
void clear() _NOEXCEPT
{__destruct_at_end(__begin_);}
_LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);} _LIBCPP_INLINE_VISIBILITY size_type size() const {return static_cast<size_type>(__end_ - __begin_);}
_LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;} _LIBCPP_INLINE_VISIBILITY bool empty() const {return __end_ == __begin_;}
_LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);} _LIBCPP_INLINE_VISIBILITY size_type capacity() const {return static_cast<size_type>(__end_cap() - __first_);}
@@ -93,9 +82,9 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);} _LIBCPP_INLINE_VISIBILITY const_reference back() const {return *(__end_ - 1);}
void reserve(size_type __n); void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT; void shrink_to_fit();
void push_front(const_reference __x); void push_front(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x); void push_front(value_type&& __x);
void push_back(value_type&& __x); void push_back(value_type&& __x);
@@ -131,49 +120,40 @@ public:
void __destruct_at_begin(pointer __new_begin, false_type); void __destruct_at_begin(pointer __new_begin, false_type);
void __destruct_at_begin(pointer __new_begin, true_type); void __destruct_at_begin(pointer __new_begin, true_type);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last)
void __destruct_at_end(pointer __new_last) _NOEXCEPT {__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
{__destruct_at_end(__new_last, false_type());} void __destruct_at_end(pointer __new_last, false_type);
_LIBCPP_INLINE_VISIBILITY void __destruct_at_end(pointer __new_last, true_type);
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x) void swap(__split_buffer& __x);
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value);
bool __invariants() const; bool __invariants() const;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer& __c, true_type) void __move_assign_alloc(const __split_buffer& __c, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{ {
__alloc() = _VSTD::move(__c.__alloc()); __alloc() = _STD::move(__c.__alloc());
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT void __move_assign_alloc(const __split_buffer& __c, false_type)
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y) static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__alloc_traits::propagate_on_container_swap::value>());} __alloc_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type) static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__alloc_rr>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type)
{} {}
}; };
@@ -214,7 +194,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n)
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
do do
{ {
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); __alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), value_type());
++this->__end_; ++this->__end_;
--__n; --__n;
} while (__n > 0); } while (__n > 0);
@@ -233,7 +213,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_referen
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
do do
{ {
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); __alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), __x);
++this->__end_; ++this->__end_;
--__n; --__n;
} while (__n > 0); } while (__n > 0);
@@ -255,14 +235,14 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_InputIter __first, _InputIt
if (__end_ == __end_cap()) if (__end_ == __end_cap())
{ {
size_type __old_cap = __end_cap() - __first_; size_type __old_cap = __end_cap() - __first_;
size_type __new_cap = _VSTD::max<size_type>(2 * __old_cap, 8); size_type __new_cap = _STD::max<size_type>(2 * __old_cap, 8);
__split_buffer __buf(__new_cap, 0, __a); __split_buffer __buf(__new_cap, 0, __a);
for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_) for (pointer __p = __begin_; __p != __end_; ++__p, ++__buf.__end_)
__alloc_traits::construct(__buf.__alloc(), __alloc_traits::construct(__buf.__alloc(),
_VSTD::__to_raw_pointer(__buf.__end_), _VSTD::move(*__p)); _STD::__to_raw_pointer(__buf.__end_), _STD::move(*__p));
swap(__buf); swap(__buf);
} }
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); __alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
++this->__end_; ++this->__end_;
} }
} }
@@ -279,7 +259,7 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
__alloc_rr& __a = this->__alloc(); __alloc_rr& __a = this->__alloc();
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
{ {
__alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); __alloc_traits::construct(__a, _STD::__to_raw_pointer(this->__end_), *__first);
++this->__end_; ++this->__end_;
} }
} }
@@ -289,7 +269,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{ {
while (__begin_ != __new_begin) while (__begin_ < __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++); __alloc_traits::destroy(__alloc(), __begin_++);
} }
@@ -304,16 +284,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type)
{ {
while (__new_last != __end_) while (__new_last < __end_)
__alloc_traits::destroy(__alloc(), --__end_); __alloc_traits::destroy(__alloc(), --__end_);
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type)
{ {
__end_ = __new_last; __end_ = __new_last;
} }
@@ -330,7 +310,6 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer() __split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0) : __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{ {
} }
@@ -361,11 +340,10 @@ __split_buffer<_Tp, _Allocator>::~__split_buffer()
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c) __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value) : __first_(_STD::move(__c.__first_)),
: __first_(_VSTD::move(__c.__first_)), __begin_(_STD::move(__c.__begin_)),
__begin_(_VSTD::move(__c.__begin_)), __end_(_STD::move(__c.__end_)),
__end_(_VSTD::move(__c.__end_)), __end_cap_(_STD::move(__c.__end_cap_))
__end_cap_(_VSTD::move(__c.__end_cap_))
{ {
__c.__first_ = nullptr; __c.__first_ = nullptr;
__c.__begin_ = nullptr; __c.__begin_ = nullptr;
@@ -394,17 +372,14 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap); __first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_; __begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap; __end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); __construct_at_end(_I(__c.begin()), _I(__c.end()));
} }
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>& __split_buffer<_Tp, _Allocator>&
__split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c) __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
_NOEXCEPT_((__alloc_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value) ||
!__alloc_traits::propagate_on_container_move_assignment::value)
{ {
clear(); clear();
shrink_to_fit(); shrink_to_fit();
@@ -424,13 +399,11 @@ __split_buffer<_Tp, _Allocator>::operator=(__split_buffer&& __c)
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
void void
__split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x) __split_buffer<_Tp, _Allocator>::swap(__split_buffer& __x)
_NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value||
__is_nothrow_swappable<__alloc_rr>::value)
{ {
_VSTD::swap(__first_, __x.__first_); _STD::swap(__first_, __x.__first_);
_VSTD::swap(__begin_, __x.__begin_); _STD::swap(__begin_, __x.__begin_);
_VSTD::swap(__end_, __x.__end_); _STD::swap(__end_, __x.__end_);
_VSTD::swap(__end_cap(), __x.__end_cap()); _STD::swap(__end_cap(), __x.__end_cap());
__swap_alloc(__alloc(), __x.__alloc()); __swap_alloc(__alloc(), __x.__alloc());
} }
@@ -443,16 +416,16 @@ __split_buffer<_Tp, _Allocator>::reserve(size_type __n)
__split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__n, 0, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
template <class _Tp, class _Allocator> template <class _Tp, class _Allocator>
void void
__split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT __split_buffer<_Tp, _Allocator>::shrink_to_fit()
{ {
if (capacity() > size()) if (capacity() > size())
{ {
@@ -464,10 +437,10 @@ __split_buffer<_Tp, _Allocator>::shrink_to_fit() _NOEXCEPT
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
__t.__end_ = __t.__begin_ + (__end_ - __begin_); __t.__end_ = __t.__begin_ + (__end_ - __begin_);
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
@@ -487,22 +460,22 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
{ {
difference_type __d = __end_cap() - __end_; difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d); __begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d; __end_ += __d;
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __x); __alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1), __x);
--__begin_; --__begin_;
} }
@@ -518,23 +491,23 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
{ {
difference_type __d = __end_cap() - __end_; difference_type __d = __end_cap() - __end_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__begin_ = _VSTD::move_backward(__begin_, __end_, __end_ + __d); __begin_ = _STD::move_backward(__begin_, __end_, __end_ + __d);
__end_ += __d; __end_ += __d;
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__begin_-1), __alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__begin_-1),
_VSTD::move(__x)); _STD::move(__x));
--__begin_; --__begin_;
} }
@@ -551,22 +524,22 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d); __end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __x); __alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_), __x);
++__end_; ++__end_;
} }
@@ -582,23 +555,23 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d); __end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
_VSTD::move(__x)); _STD::move(__x));
++__end_; ++__end_;
} }
@@ -615,23 +588,23 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{ {
difference_type __d = __begin_ - __first_; difference_type __d = __begin_ - __first_;
__d = (__d + 1) / 2; __d = (__d + 1) / 2;
__end_ = _VSTD::move(__begin_, __end_, __begin_ - __d); __end_ = _STD::move(__begin_, __end_, __begin_ - __d);
__begin_ -= __d; __begin_ -= __d;
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
_VSTD::swap(__first_, __t.__first_); _STD::swap(__first_, __t.__first_);
_VSTD::swap(__begin_, __t.__begin_); _STD::swap(__begin_, __t.__begin_);
_VSTD::swap(__end_, __t.__end_); _STD::swap(__end_, __t.__end_);
_VSTD::swap(__end_cap(), __t.__end_cap()); _STD::swap(__end_cap(), __t.__end_cap());
} }
} }
__alloc_traits::construct(__alloc(), _VSTD::__to_raw_pointer(__end_), __alloc_traits::construct(__alloc(), _STD::__to_raw_pointer(__end_),
_VSTD::forward<_Args>(__args)...); _STD::forward<_Args>(__args)...);
++__end_; ++__end_;
} }
@@ -639,16 +612,6 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
}
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_SPLIT_BUFFER #endif // _LIBCPP_SPLIT_BUFFER

View File

@@ -15,26 +15,24 @@
#include <type_traits> #include <type_traits>
#include <new> #include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Np> class _LIBCPP_HIDDEN __sso_allocator; template <class _Tp, size_t _N> class _LIBCPP_HIDDEN __sso_allocator;
template <size_t _Np> template <size_t _N>
class _LIBCPP_HIDDEN __sso_allocator<void, _Np> class _LIBCPP_HIDDEN __sso_allocator<void, _N>
{ {
public: public:
typedef const void* const_pointer; typedef const void* const_pointer;
typedef void value_type; typedef void value_type;
}; };
template <class _Tp, size_t _Np> template <class _Tp, size_t _N>
class _LIBCPP_HIDDEN __sso_allocator class _LIBCPP_HIDDEN __sso_allocator
{ {
typename aligned_storage<sizeof(_Tp) * _Np>::type buf_; typename aligned_storage<sizeof(_Tp) * _N>::type buf_;
bool __allocated_; bool __allocated_;
public: public:
typedef size_t size_type; typedef size_t size_type;
@@ -43,14 +41,14 @@ public:
_LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {} _LIBCPP_INLINE_VISIBILITY __sso_allocator() throw() : __allocated_(false) {}
_LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {} _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator&) throw() : __allocated_(false) {}
template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _Np>&) throw() template <class _Up> _LIBCPP_INLINE_VISIBILITY __sso_allocator(const __sso_allocator<_Up, _N>&) throw()
: __allocated_(false) {} : __allocated_(false) {}
private: private:
__sso_allocator& operator=(const __sso_allocator&); __sso_allocator& operator=(const __sso_allocator&);
public: 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, _N>::const_pointer = 0)
{ {
if (!__allocated_ && __n <= _Np) if (!__allocated_ && __n <= _N)
{ {
__allocated_ = true; __allocated_ = true;
return (pointer)&buf_; return (pointer)&buf_;

View File

@@ -17,15 +17,11 @@
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8; static const unsigned __limit = 8;
// __stdinbuf // __stdinbuf
@@ -101,10 +97,10 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume) __stdinbuf<_CharT>::__getchar(bool __consume)
{ {
char __extbuf[__limit]; char __extbuf[__limit];
int __nread = _VSTD::max(1, __encoding_); int __nread = _STD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i) for (int __i = 0; __i < __nread; ++__i)
{ {
int __c = getc(__file_); char __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c); __extbuf[__i] = static_cast<char>(__c);
@@ -124,14 +120,14 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
&__1buf, &__1buf + 1, __inxt); &__1buf, &__1buf + 1, __inxt);
switch (__r) switch (__r)
{ {
case _VSTD::codecvt_base::ok: case _STD::codecvt_base::ok:
break; break;
case codecvt_base::partial: case codecvt_base::partial:
__st_ = __sv_st; __st_ = __sv_st;
if (__nread == sizeof(__extbuf)) if (__nread == sizeof(__extbuf))
return traits_type::eof(); return traits_type::eof();
{ {
int __c = getc(__file_); char __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c); __extbuf[__nread] = static_cast<char>(__c);
@@ -140,11 +136,11 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
break; break;
case codecvt_base::error: case codecvt_base::error:
return traits_type::eof(); return traits_type::eof();
case _VSTD::codecvt_base::noconv: case _STD::codecvt_base::noconv:
__1buf = static_cast<char_type>(__extbuf[0]); __1buf = static_cast<char_type>(__extbuf[0]);
break; break;
} }
} while (__r == _VSTD::codecvt_base::partial); } while (__r == _STD::codecvt_base::partial);
} }
if (!__consume) if (!__consume)
{ {
@@ -170,9 +166,9 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt, switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt)) __extbuf, __extbuf + sizeof(__extbuf), __enxt))
{ {
case _VSTD::codecvt_base::ok: case _STD::codecvt_base::ok:
break; break;
case _VSTD::codecvt_base::noconv: case _STD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__c); __extbuf[0] = static_cast<char>(__c);
__enxt = __extbuf + 1; __enxt = __extbuf + 1;
break; break;
@@ -268,7 +264,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial) if (__r == codecvt_base::partial)
{ {
this->setp((char_type*)__e, this->pptr()); this->setp((char_type*)__e, this->pptr());
this->pbump(static_cast<int>(this->epptr() - this->pbase())); this->pbump(this->epptr() - this->pbase());
} }
} }
else else

View File

@@ -17,25 +17,17 @@
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree; template <class, class, class> class __tree;
template <class _Tp, class _NodePtr, class _DiffType> template <class, class, class> class _LIBCPP_VISIBLE __tree_iterator;
class _LIBCPP_VISIBLE __tree_iterator; template <class, class, class> class _LIBCPP_VISIBLE __tree_const_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType> template <class, class, class, class> class _LIBCPP_VISIBLE map;
class _LIBCPP_VISIBLE __tree_const_iterator; template <class, class, class, class> class _LIBCPP_VISIBLE multimap;
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class, class, class> class _LIBCPP_VISIBLE set;
class _LIBCPP_VISIBLE map; template <class, class, class> class _LIBCPP_VISIBLE multiset;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE multimap;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE set;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_VISIBLE multiset;
/* /*
@@ -63,7 +55,7 @@ __root, have a non-null __parent_ field.
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__tree_is_left_child(_NodePtr __x) _NOEXCEPT __tree_is_left_child(_NodePtr __x)
{ {
return __x == __x->__parent_->__left_; return __x == __x->__parent_->__left_;
} }
@@ -129,7 +121,7 @@ __tree_invariant(_NodePtr __root)
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_NodePtr _NodePtr
__tree_min(_NodePtr __x) _NOEXCEPT __tree_min(_NodePtr __x)
{ {
while (__x->__left_ != nullptr) while (__x->__left_ != nullptr)
__x = __x->__left_; __x = __x->__left_;
@@ -141,7 +133,7 @@ __tree_min(_NodePtr __x) _NOEXCEPT
template <class _NodePtr> template <class _NodePtr>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_NodePtr _NodePtr
__tree_max(_NodePtr __x) _NOEXCEPT __tree_max(_NodePtr __x)
{ {
while (__x->__right_ != nullptr) while (__x->__right_ != nullptr)
__x = __x->__right_; __x = __x->__right_;
@@ -152,7 +144,7 @@ __tree_max(_NodePtr __x) _NOEXCEPT
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_next(_NodePtr __x) _NOEXCEPT __tree_next(_NodePtr __x)
{ {
if (__x->__right_ != nullptr) if (__x->__right_ != nullptr)
return __tree_min(__x->__right_); return __tree_min(__x->__right_);
@@ -165,7 +157,7 @@ __tree_next(_NodePtr __x) _NOEXCEPT
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_prev(_NodePtr __x) _NOEXCEPT __tree_prev(_NodePtr __x)
{ {
if (__x->__left_ != nullptr) if (__x->__left_ != nullptr)
return __tree_max(__x->__left_); return __tree_max(__x->__left_);
@@ -178,7 +170,7 @@ __tree_prev(_NodePtr __x) _NOEXCEPT
// Precondition: __x != nullptr. // Precondition: __x != nullptr.
template <class _NodePtr> template <class _NodePtr>
_NodePtr _NodePtr
__tree_leaf(_NodePtr __x) _NOEXCEPT __tree_leaf(_NodePtr __x)
{ {
while (true) while (true)
{ {
@@ -202,7 +194,7 @@ __tree_leaf(_NodePtr __x) _NOEXCEPT
// Precondition: __x->__right_ != nullptr // Precondition: __x->__right_ != nullptr
template <class _NodePtr> template <class _NodePtr>
void void
__tree_left_rotate(_NodePtr __x) _NOEXCEPT __tree_left_rotate(_NodePtr __x)
{ {
_NodePtr __y = __x->__right_; _NodePtr __y = __x->__right_;
__x->__right_ = __y->__left_; __x->__right_ = __y->__left_;
@@ -222,7 +214,7 @@ __tree_left_rotate(_NodePtr __x) _NOEXCEPT
// Precondition: __x->__left_ != nullptr // Precondition: __x->__left_ != nullptr
template <class _NodePtr> template <class _NodePtr>
void void
__tree_right_rotate(_NodePtr __x) _NOEXCEPT __tree_right_rotate(_NodePtr __x)
{ {
_NodePtr __y = __x->__left_; _NodePtr __y = __x->__left_;
__x->__left_ = __y->__right_; __x->__left_ = __y->__right_;
@@ -247,7 +239,7 @@ __tree_right_rotate(_NodePtr __x) _NOEXCEPT
// may be different than the value passed in as __root. // may be different than the value passed in as __root.
template <class _NodePtr> template <class _NodePtr>
void void
__tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT __tree_balance_after_insert(_NodePtr __root, _NodePtr __x)
{ {
__x->__is_black_ = __x == __root; __x->__is_black_ = __x == __root;
while (__x != __root && !__x->__parent_->__is_black_) while (__x != __root && !__x->__parent_->__is_black_)
@@ -317,7 +309,7 @@ __tree_balance_after_insert(_NodePtr __root, _NodePtr __x) _NOEXCEPT
// may be different than the value passed in as __root. // may be different than the value passed in as __root.
template <class _NodePtr> template <class _NodePtr>
void void
__tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT __tree_remove(_NodePtr __root, _NodePtr __z)
{ {
// __z will be removed from the tree. Client still needs to destruct/deallocate it // __z will be removed from the tree. Client still needs to destruct/deallocate it
// __y is either __z, or if __z has two children, __tree_next(__z). // __y is either __z, or if __z has two children, __tree_next(__z).
@@ -502,7 +494,7 @@ __tree_remove(_NodePtr __root, _NodePtr __z) _NOEXCEPT
} }
} }
template <class _Allocator> class __map_node_destructor; template <class> class __map_node_destructor;
template <class _Allocator> template <class _Allocator>
class __tree_node_destructor class __tree_node_destructor
@@ -522,16 +514,16 @@ public:
bool __value_constructed; bool __value_constructed;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node_destructor(allocator_type& __na) _NOEXCEPT explicit __tree_node_destructor(allocator_type& __na)
: __na_(__na), : __na_(__na),
__value_constructed(false) __value_constructed(false)
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void operator()(pointer __p) _NOEXCEPT void operator()(pointer __p)
{ {
if (__value_constructed) if (__value_constructed)
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_)); __alloc_traits::destroy(__na_, _STD::addressof(__p->__value_));
if (__p) if (__p)
__alloc_traits::deallocate(__na_, __p, 1); __alloc_traits::deallocate(__na_, __p, 1);
} }
@@ -549,7 +541,7 @@ public:
pointer __left_; pointer __left_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_end_node() _NOEXCEPT : __left_() {} __tree_end_node() : __left_() {}
}; };
template <class _VoidPtr> template <class _VoidPtr>
@@ -588,8 +580,7 @@ public:
bool __is_black_; bool __is_black_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_node_base() _NOEXCEPT __tree_node_base() : __right_(), __parent_(), __is_black_(false) {}
: __right_(), __parent_(), __is_black_(false) {}
}; };
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
@@ -606,7 +597,7 @@ public:
template <class ..._Args> template <class ..._Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node(_Args&& ...__args) explicit __tree_node(_Args&& ...__args)
: __value_(_VSTD::forward<_Args>(__args)...) {} : __value_(_STD::forward<_Args>(__args)...) {}
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_node(const value_type& __v) explicit __tree_node(const value_type& __v)
@@ -614,8 +605,8 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
}; };
template <class _TreeIterator> class _LIBCPP_VISIBLE __map_iterator; template <class> class __map_iterator;
template <class _TreeIterator> class _LIBCPP_VISIBLE __map_const_iterator; template <class> class __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType> template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_VISIBLE __tree_iterator class _LIBCPP_VISIBLE __tree_iterator
@@ -641,7 +632,7 @@ public:
#endif #endif
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY __tree_iterator() {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
@@ -671,7 +662,7 @@ public:
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} explicit __tree_iterator(__node_pointer __p) : __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator; template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_VISIBLE __map_iterator; template <class> friend class _LIBCPP_VISIBLE __map_iterator;
@@ -725,8 +716,7 @@ private:
__non_const_iterator; __non_const_iterator;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__tree_const_iterator(__non_const_iterator __p) _NOEXCEPT __tree_const_iterator(__non_const_iterator __p) : __ptr_(__p.__ptr_) {}
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;} _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
@@ -756,8 +746,7 @@ public:
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT explicit __tree_const_iterator(__node_pointer __p) : __ptr_(__p) {}
: __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_VISIBLE map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
@@ -816,7 +805,7 @@ private:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __end_node() _NOEXCEPT __node_pointer __end_node()
{ {
return static_cast<__node_pointer> return static_cast<__node_pointer>
( (
@@ -824,7 +813,7 @@ public:
); );
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __end_node() const _NOEXCEPT __node_const_pointer __end_node() const
{ {
return static_cast<__node_const_pointer> return static_cast<__node_const_pointer>
( (
@@ -832,45 +821,39 @@ public:
); );
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_allocator& __node_alloc() _NOEXCEPT {return __pair1_.second();} __node_allocator& __node_alloc() {return __pair1_.second();}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_allocator& __node_alloc() const _NOEXCEPT const __node_allocator& __node_alloc() const {return __pair1_.second();}
{return __pair1_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer& __begin_node() _NOEXCEPT {return __begin_node_;} __node_pointer& __begin_node() {return __begin_node_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_pointer& __begin_node() const _NOEXCEPT {return __begin_node_;} const __node_pointer& __begin_node() const {return __begin_node_;}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type __alloc() const _NOEXCEPT allocator_type __alloc() const {return allocator_type(__node_alloc());}
{return allocator_type(__node_alloc());}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type& size() _NOEXCEPT {return __pair3_.first();} size_type& size() {return __pair3_.first();}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const size_type& size() const _NOEXCEPT {return __pair3_.first();} const size_type& size() const {return __pair3_.first();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
value_compare& value_comp() _NOEXCEPT {return __pair3_.second();} value_compare& value_comp() {return __pair3_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const value_compare& value_comp() const _NOEXCEPT const value_compare& value_comp() const {return __pair3_.second();}
{return __pair3_.second();}
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __root() _NOEXCEPT __node_pointer __root()
{return static_cast<__node_pointer> (__end_node()->__left_);} {return static_cast<__node_pointer> (__end_node()->__left_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __root() const _NOEXCEPT __node_const_pointer __root() const
{return static_cast<__node_const_pointer>(__end_node()->__left_);} {return static_cast<__node_const_pointer>(__end_node()->__left_);}
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator; typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator; typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
explicit __tree(const value_compare& __comp) explicit __tree(const value_compare& __comp);
_NOEXCEPT_(
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_copy_constructible<value_compare>::value);
explicit __tree(const allocator_type& __a); explicit __tree(const allocator_type& __a);
__tree(const value_compare& __comp, const allocator_type& __a); __tree(const value_compare& __comp, const allocator_type& __a);
__tree(const __tree& __t); __tree(const __tree& __t);
@@ -880,40 +863,28 @@ public:
template <class _InputIterator> template <class _InputIterator>
void __assign_multi(_InputIterator __first, _InputIterator __last); void __assign_multi(_InputIterator __first, _InputIterator __last);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__tree(__tree&& __t) __tree(__tree&& __t);
_NOEXCEPT_(
is_nothrow_move_constructible<__node_allocator>::value &&
is_nothrow_move_constructible<value_compare>::value);
__tree(__tree&& __t, const allocator_type& __a); __tree(__tree&& __t, const allocator_type& __a);
__tree& operator=(__tree&& __t) __tree& operator=(__tree&& __t);
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
~__tree(); ~__tree();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return iterator(__begin_node());} iterator begin() {return iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return const_iterator(__begin_node());} const_iterator begin() const {return const_iterator(__begin_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return iterator(__end_node());} iterator end() {return iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return const_iterator(__end_node());} const_iterator end() const {return const_iterator(__end_node());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT size_type max_size() const {return __node_traits::max_size(__node_alloc());}
{return __node_traits::max_size(__node_alloc());}
void clear() _NOEXCEPT; void clear();
void swap(__tree& __t) void swap(__tree& __t);
_NOEXCEPT_(
__is_nothrow_swappable<value_compare>::value &&
(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value));
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -932,14 +903,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args); __emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Vp> template <class _V>
pair<iterator, bool> __insert_unique(_Vp&& __v); pair<iterator, bool> __insert_unique(_V&& __v);
template <class _Vp> template <class _V>
iterator __insert_unique(const_iterator __p, _Vp&& __v); iterator __insert_unique(const_iterator __p, _V&& __v);
template <class _Vp> template <class _V>
iterator __insert_multi(_Vp&& __v); iterator __insert_multi(_V&& __v);
template <class _Vp> template <class _V>
iterator __insert_multi(const_iterator __p, _Vp&& __v); iterator __insert_multi(const_iterator __p, _V&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v); pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -1021,10 +992,10 @@ public:
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const; __equal_range_multi(const _Key& __k) const;
typedef __tree_node_destructor<__node_allocator> _Dp; typedef __tree_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
__node_holder remove(const_iterator __p) _NOEXCEPT; __node_holder remove(const_iterator __p);
private: private:
typename __node_base::pointer& typename __node_base::pointer&
__find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v); __find_leaf_low(typename __node_base::pointer& __parent, const value_type& __v);
@@ -1048,7 +1019,7 @@ private:
__node_holder __construct_node(const value_type& __v); __node_holder __construct_node(const value_type& __v);
#endif #endif
void destroy(__node_pointer __nd) _NOEXCEPT; void destroy(__node_pointer __nd);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __tree& __t) void __copy_assign_alloc(const __tree& __t)
@@ -1062,42 +1033,31 @@ private:
void __copy_assign_alloc(const __tree& __t, false_type) {} void __copy_assign_alloc(const __tree& __t, false_type) {}
void __move_assign(__tree& __t, false_type); void __move_assign(__tree& __t, false_type);
void __move_assign(__tree& __t, true_type) void __move_assign(__tree& __t, true_type);
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t) void __move_assign_alloc(__tree& __t)
_NOEXCEPT_(
!__node_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<__node_allocator>::value)
{__move_assign_alloc(__t, integral_constant<bool, {__move_assign_alloc(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());} __node_traits::propagate_on_container_move_assignment::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, true_type) void __move_assign_alloc(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {__node_alloc() = _STD::move(__t.__node_alloc());}
{__node_alloc() = _VSTD::move(__t.__node_alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__tree& __t, false_type) _NOEXCEPT {} void __move_assign_alloc(__tree& __t, false_type) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
_NOEXCEPT_(
!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());} __node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, false_type)
_NOEXCEPT
{} {}
__node_pointer __detach(); __node_pointer __detach();
@@ -1106,9 +1066,6 @@ private:
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp) __tree<_Tp, _Compare, _Allocator>::__tree(const value_compare& __comp)
_NOEXCEPT_(
is_nothrow_default_constructible<__node_allocator>::value &&
is_nothrow_copy_constructible<value_compare>::value)
: __pair3_(0, __comp) : __pair3_(0, __comp)
{ {
__begin_node() = __end_node(); __begin_node() = __end_node();
@@ -1283,12 +1240,9 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t) __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
_NOEXCEPT_( : __begin_node_(_STD::move(__t.__begin_node_)),
is_nothrow_move_constructible<__node_allocator>::value && __pair1_(_STD::move(__t.__pair1_)),
is_nothrow_move_constructible<value_compare>::value) __pair3_(_STD::move(__t.__pair3_))
: __begin_node_(_VSTD::move(__t.__begin_node_)),
__pair1_(_VSTD::move(__t.__pair1_)),
__pair3_(_VSTD::move(__t.__pair3_))
{ {
if (size() == 0) if (size() == 0)
__begin_node() = __end_node(); __begin_node() = __end_node();
@@ -1304,7 +1258,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a) __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __a)
: __pair1_(__node_allocator(__a)), : __pair1_(__node_allocator(__a)),
__pair3_(0, _VSTD::move(__t.value_comp())) __pair3_(0, _STD::move(__t.value_comp()))
{ {
if (__a == __t.__alloc()) if (__a == __t.__alloc())
{ {
@@ -1330,14 +1284,12 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type) __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value)
{ {
destroy(static_cast<__node_pointer>(__end_node()->__left_)); destroy(static_cast<__node_pointer>(__end_node()->__left_));
__begin_node_ = __t.__begin_node_; __begin_node_ = __t.__begin_node_;
__pair1_.first() = __t.__pair1_.first(); __pair1_.first() = __t.__pair1_.first();
__move_assign_alloc(__t); __move_assign_alloc(__t);
__pair3_ = _VSTD::move(__t.__pair3_); __pair3_ = _STD::move(__t.__pair3_);
if (size() == 0) if (size() == 0)
__begin_node() = __end_node(); __begin_node() = __end_node();
else else
@@ -1357,7 +1309,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
__move_assign(__t, true_type()); __move_assign(__t, true_type());
else else
{ {
value_comp() = _VSTD::move(__t.value_comp()); value_comp() = _STD::move(__t.value_comp());
const_iterator __e = end(); const_iterator __e = end();
if (size() != 0) if (size() != 0)
{ {
@@ -1368,7 +1320,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
while (__cache != nullptr && __t.size() != 0) while (__cache != nullptr && __t.size() != 0)
{ {
__cache->__value_ = _VSTD::move(__t.remove(__t.begin())->__value_); __cache->__value_ = _STD::move(__t.remove(__t.begin())->__value_);
__node_pointer __next = __detach(__cache); __node_pointer __next = __detach(__cache);
__node_insert_multi(__cache); __node_insert_multi(__cache);
__cache = __next; __cache = __next;
@@ -1391,18 +1343,13 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, false_type)
} }
} }
while (__t.size() != 0) while (__t.size() != 0)
__insert_multi(__e, _VSTD::move(__t.remove(__t.begin())->__value_)); __insert_multi(__e, _STD::move(__t.remove(__t.begin())->__value_));
} }
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
__tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>&
__tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t) __tree<_Tp, _Compare, _Allocator>::operator=(__tree&& __t)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<value_compare>::value &&
is_nothrow_move_assignable<__node_allocator>::value)
{ {
__move_assign(__t, integral_constant<bool, __move_assign(__t, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>()); __node_traits::propagate_on_container_move_assignment::value>());
@@ -1419,14 +1366,14 @@ __tree<_Tp, _Compare, _Allocator>::~__tree()
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd)
{ {
if (__nd != nullptr) if (__nd != nullptr)
{ {
destroy(static_cast<__node_pointer>(__nd->__left_)); destroy(static_cast<__node_pointer>(__nd->__left_));
destroy(static_cast<__node_pointer>(__nd->__right_)); destroy(static_cast<__node_pointer>(__nd->__right_));
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, _VSTD::addressof(__nd->__value_)); __node_traits::destroy(__na, _STD::addressof(__nd->__value_));
__node_traits::deallocate(__na, __nd, 1); __node_traits::deallocate(__na, __nd, 1);
} }
} }
@@ -1434,12 +1381,8 @@ __tree<_Tp, _Compare, _Allocator>::destroy(__node_pointer __nd) _NOEXCEPT
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
_NOEXCEPT_(
__is_nothrow_swappable<value_compare>::value &&
(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value))
{ {
using _VSTD::swap; using _STD::swap;
swap(__begin_node_, __t.__begin_node_); swap(__begin_node_, __t.__begin_node_);
swap(__pair1_.first(), __t.__pair1_.first()); swap(__pair1_.first(), __t.__pair1_.first());
__swap_alloc(__node_alloc(), __t.__node_alloc()); __swap_alloc(__node_alloc(), __t.__node_alloc());
@@ -1456,7 +1399,7 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
void void
__tree<_Tp, _Compare, _Allocator>::clear() _NOEXCEPT __tree<_Tp, _Compare, _Allocator>::clear()
{ {
destroy(__root()); destroy(__root());
size() = 0; size() = 0;
@@ -1663,10 +1606,10 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
else if (value_comp()(*__hint, __v)) // check after else if (value_comp()(*__hint, __v)) // check after
{ {
// *__hint < __v // *__hint < __v
const_iterator __next = _VSTD::next(__hint); const_iterator __next = _STD::next(__hint);
if (__next == end() || value_comp()(__v, *__next)) if (__next == end() || value_comp()(__v, *__next))
{ {
// *__hint < __v < *_VSTD::next(__hint) // *__hint < __v < *next(__hint)
if (__hint.__ptr_->__right_ == nullptr) if (__hint.__ptr_->__right_ == nullptr)
{ {
__parent = const_cast<__node_pointer&>(__hint.__ptr_); __parent = const_cast<__node_pointer&>(__hint.__ptr_);
@@ -1711,8 +1654,8 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __node_traits::construct(__na, _STD::addressof(__h->__value_), _STD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return __h; return __h;
} }
@@ -1722,7 +1665,7 @@ template <class... _Args>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__parent, __h->__value_); __node_base_pointer& __child = __find_equal(__parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child); __node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1741,7 +1684,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Args&&... __args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_equal(__p, __parent, __h->__value_);
__node_pointer __r = static_cast<__node_pointer>(__child); __node_pointer __r = static_cast<__node_pointer>(__child);
@@ -1758,7 +1701,7 @@ template <class... _Args>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args) __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1771,7 +1714,7 @@ typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p, __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
_Args&&... __args) _Args&&... __args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_STD::forward<_Args>(__args)...);
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1781,11 +1724,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_STD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get()); pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second) if (__r.second)
__h.release(); __h.release();
@@ -1793,11 +1736,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_STD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get()); iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get()) if (__r.__ptr_ == __h.get())
__h.release(); __h.release();
@@ -1805,11 +1748,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1817,11 +1760,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_STD::forward<_V>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1835,10 +1778,10 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v) __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__na, _STD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); return _STD::move(__h);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1964,7 +1907,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
__begin_node() = __r.__ptr_; __begin_node() = __r.__ptr_;
--size(); --size();
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_traits::destroy(__na, const_cast<value_type*>(_VSTD::addressof(*__p))); __node_traits::destroy(__na, const_cast<value_type*>(_STD::addressof(*__p)));
__tree_remove(__end_node()->__left_, __tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np)); static_cast<__node_base_pointer>(__np));
__node_traits::deallocate(__na, __np, 1); __node_traits::deallocate(__na, __np, 1);
@@ -2053,7 +1996,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2066,7 +2009,7 @@ __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _VSTD::distance( return _STD::distance(
__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), __lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result) __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)
); );
@@ -2160,7 +2103,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
{ {
typedef pair<iterator, iterator> _Pp; typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node(); __node_pointer __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2173,13 +2116,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else else
return _Pp(iterator(__rt), return _P(iterator(__rt),
iterator( iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_)) static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _Pp(iterator(__result), iterator(__result)); return _P(iterator(__result), iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2188,7 +2131,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator> typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2201,13 +2144,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _Pp(const_iterator(__rt), return _P(const_iterator(__rt),
const_iterator( const_iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_)) static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _Pp(const_iterator(__result), const_iterator(__result)); return _P(const_iterator(__result), const_iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2216,7 +2159,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
{ {
typedef pair<iterator, iterator> _Pp; typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node(); __node_pointer __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2229,10 +2172,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else else
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt), return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
} }
return _Pp(iterator(__result), iterator(__result)); return _P(iterator(__result), iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2241,7 +2184,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator> typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2254,15 +2197,15 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)); __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
} }
return _Pp(const_iterator(__result), const_iterator(__result)); return _P(const_iterator(__result), const_iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p)
{ {
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_); __node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
if (__begin_node() == __np) if (__begin_node() == __np)
@@ -2275,17 +2218,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
--size(); --size();
__tree_remove(__end_node()->__left_, __tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np)); static_cast<__node_base_pointer>(__np));
return __node_holder(__np, _Dp(__node_alloc())); return __node_holder(__np, _D(__node_alloc()));
}
template <class _Tp, class _Compare, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(__tree<_Tp, _Compare, _Allocator>& __x,
__tree<_Tp, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{
__x.swap(__y);
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -15,9 +15,7 @@
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS #ifdef _LIBCPP_HAS_NO_VARIADICS
@@ -65,7 +63,7 @@ public:
}; };
template <class ..._Tp> class _LIBCPP_VISIBLE tuple; template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> struct _LIBCPP_VISIBLE pair; template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array; template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {}; template <class _Tp> struct __tuple_like : false_type {};
@@ -79,49 +77,40 @@ template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type& typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT; get(tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type& const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT; get(const tuple<_Tp...>&);
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&& typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT; get(tuple<_Tp...>&&);
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type& typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT; get(pair<_T1, _T2>&);
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type& const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT; get(const pair<_T1, _T2>&);
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&& typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT; get(pair<_T1, _T2>&&);
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp& _Tp&
get(array<_Tp, _Size>&) _NOEXCEPT; get(array<_Tp, _Size>&);
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
const _Tp& const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT; get(const array<_Tp, _Size>&);
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp&& _Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT; get(array<_Tp, _Size>&&);
// __make_tuple_indices // __make_tuple_indices
@@ -225,7 +214,11 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up> template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool, : public integral_constant<bool,
#if 1 // waiting on cwg 1170
is_convertible<_Tp0, _Up0>::value && is_convertible<_Tp0, _Up0>::value &&
#else
is_constructible<_Up0, _Tp0>::value &&
#endif
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; __tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <> template <>
@@ -244,33 +237,6 @@ struct __tuple_convertible<_Tp, _Up, true, true>
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type> typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{}; {};
// __tuple_constructible
template <bool, class _Tp, class _Up>
struct __tuple_constructible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_constructible<_Up0, _Tp0>::value &&
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_constructible
: public false_type {};
template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
// __tuple_assignable // __tuple_assignable
template <bool, class _Tp, class _Up> template <bool, class _Tp, class _Up>

View File

@@ -13,9 +13,7 @@
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -34,28 +34,28 @@ struct array
// No explicit construct/copy/destroy for aggregate type // No explicit construct/copy/destroy for aggregate type
void fill(const T& u); void fill(const T& u);
void swap(array& a) noexcept(noexcept(swap(declval<T&>(), declval<T&>()))); void swap(array& a);
// iterators: // iterators:
iterator begin() noexcept; iterator begin();
const_iterator begin() const noexcept; const_iterator begin() const;
iterator end() noexcept; iterator end();
const_iterator end() const noexcept; const_iterator end() const;
reverse_iterator rbegin() noexcept; reverse_iterator rbegin();
const_reverse_iterator rbegin() const noexcept; const_reverse_iterator rbegin() const;
reverse_iterator rend() noexcept; reverse_iterator rend();
const_reverse_iterator rend() const noexcept; const_reverse_iterator rend() const;
const_iterator cbegin() const noexcept; const_iterator cbegin() const;
const_iterator cend() const noexcept; const_iterator cend() const;
const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const noexcept; const_reverse_iterator crend() const;
// capacity: // capacity:
constexpr size_type size() const noexcept; constexpr size_type size() const;
constexpr size_type max_size() const noexcept; constexpr size_type max_size() const;
constexpr bool empty() const noexcept; bool empty() const;
// element access: // element access:
reference operator[](size_type n); reference operator[](size_type n);
@@ -68,8 +68,8 @@ struct array
reference back(); reference back();
const_reference back() const; const_reference back() const;
T* data() noexcept; T* data();
const T* data() const noexcept; const T* data() const;
}; };
template <class T, size_t N> template <class T, size_t N>
@@ -86,15 +86,15 @@ template <class T, size_t N>
bool operator>=(const array<T,N>& x, const array<T,N>& y); bool operator>=(const array<T,N>& x, const array<T,N>& y);
template <class T, size_t N > template <class T, size_t N >
void swap(array<T,N>& x, array<T,N>& y) noexcept(noexcept(x.swap(y))); void swap(array<T,N>& x, array<T,N>& y);
template <class T> class tuple_size; template <class T> class tuple_size;
template <int I, class T> class tuple_element; template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>; template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>; template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; template <int I, class T, size_t N> T& get(array<T, N>&);
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; template <int I, class T, size_t N> const T& get(const array<T, N>&);
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; template <int I, class T, size_t N> T&& get(array<T, N>&&);
} // std } // std
@@ -111,9 +111,7 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -138,46 +136,30 @@ struct _LIBCPP_VISIBLE array
// No explicit construct/copy/destroy for aggregate type // No explicit construct/copy/destroy for aggregate type
_LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u) _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __u)
{_VSTD::fill_n(__elems_, _Size, __u);} {_STD::fill_n(__elems_, _Size, __u);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY void swap(array& __a)
void swap(array& __a) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::value) {_STD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
{_VSTD::swap_ranges(__elems_, __elems_ + _Size, __a.__elems_);}
// iterators: // iterators:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__elems_);}
iterator begin() _NOEXCEPT {return iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY const_iterator begin() const {return const_iterator(__elems_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__elems_ + _Size);}
const_iterator begin() const _NOEXCEPT {return const_iterator(__elems_);} _LIBCPP_INLINE_VISIBILITY const_iterator end() const {return const_iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return const_iterator(__elems_ + _Size);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() {return reverse_iterator(end());}
reverse_iterator rbegin() _NOEXCEPT {return reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() {return reverse_iterator(begin());}
const_reverse_iterator rbegin() const _NOEXCEPT {return const_reverse_iterator(end());} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT {return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT {return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const {return begin();}
const_iterator cbegin() const _NOEXCEPT {return begin();} _LIBCPP_INLINE_VISIBILITY const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const {return rbegin();}
const_iterator cend() const _NOEXCEPT {return end();} _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();}
_LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();}
// capacity: // capacity:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type size() const {return _Size;}
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} _LIBCPP_INLINE_VISIBILITY /*constexpr*/ size_type max_size() const {return _Size;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY bool empty() const {return _Size == 0;}
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;}
// element access: // element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
@@ -190,10 +172,8 @@ struct _LIBCPP_VISIBLE array
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];} _LIBCPP_INLINE_VISIBILITY const_reference back() const {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY value_type* data() {return __elems_;}
value_type* data() _NOEXCEPT {return __elems_;} _LIBCPP_INLINE_VISIBILITY const value_type* data() const {return __elems_;}
_LIBCPP_INLINE_VISIBILITY
const value_type* data() const _NOEXCEPT {return __elems_;}
}; };
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -227,7 +207,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{ {
return _VSTD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_); return _STD::equal(__x.__elems_, __x.__elems_ + _Size, __y.__elems_);
} }
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -243,7 +223,7 @@ _LIBCPP_INLINE_VISIBILITY inline
bool bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{ {
return _VSTD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size); return _STD::lexicographical_compare(__x.__elems_, __x.__elems_ + _Size, __y.__elems_, __y.__elems_ + _Size);
} }
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
@@ -272,13 +252,8 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
typename enable_if void
<
__is_swappable<_Tp>::value,
void
>::type
swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y) swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
_NOEXCEPT_(__is_nothrow_swappable<_Tp>::value)
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -308,7 +283,7 @@ public:
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
_Tp& _Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT get(array<_Tp, _Size>& __a)
{ {
return __a[_Ip]; return __a[_Ip];
} }
@@ -316,7 +291,7 @@ get(array<_Tp, _Size>& __a) _NOEXCEPT
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
const _Tp& const _Tp&
get(const array<_Tp, _Size>& __a) _NOEXCEPT get(const array<_Tp, _Size>& __a)
{ {
return __a[_Ip]; return __a[_Ip];
} }
@@ -326,9 +301,9 @@ get(const array<_Tp, _Size>& __a) _NOEXCEPT
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
_Tp&& _Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT get(array<_Tp, _Size>&& __a)
{ {
return _VSTD::move(__a[_Ip]); return _STD::move(__a[_Ip]);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

File diff suppressed because it is too large Load Diff

View File

@@ -27,19 +27,19 @@ public:
class reference class reference
{ {
friend class bitset; friend class bitset;
reference() noexcept; reference();
public: public:
~reference() noexcept; ~reference();
reference& operator=(bool x) noexcept; // for b[i] = x; reference& operator=(bool x); // for b[i] = x;
reference& operator=(const reference&) noexcept; // for b[i] = b[j]; reference& operator=(const reference&); // for b[i] = b[j];
bool operator~() const noexcept; // flips the bit bool operator~() const; // flips the bit
operator bool() const noexcept; // for x = b[i]; operator bool() const; // for x = b[i];
reference& flip() noexcept; // for b[i].flip(); reference& flip(); // for b[i].flip();
}; };
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
constexpr bitset() noexcept; constexpr bitset();
constexpr bitset(unsigned long long val) noexcept; constexpr bitset(unsigned long long val);
template <class charT> template <class charT>
explicit bitset(const charT* str, explicit bitset(const charT* str,
typename basic_string<charT>::size_type n = basic_string<charT>::npos, typename basic_string<charT>::size_type n = basic_string<charT>::npos,
@@ -52,17 +52,17 @@ public:
charT zero = charT('0'), charT one = charT('1')); charT zero = charT('0'), charT one = charT('1'));
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& rhs) noexcept; bitset& operator&=(const bitset& rhs);
bitset& operator|=(const bitset& rhs) noexcept; bitset& operator|=(const bitset& rhs);
bitset& operator^=(const bitset& rhs) noexcept; bitset& operator^=(const bitset& rhs);
bitset& operator<<=(size_t pos) noexcept; bitset& operator<<=(size_t pos);
bitset& operator>>=(size_t pos) noexcept; bitset& operator>>=(size_t pos);
bitset& set() noexcept; bitset& set();
bitset& set(size_t pos, bool val = true); bitset& set(size_t pos, bool val = true);
bitset& reset() noexcept; bitset& reset();
bitset& reset(size_t pos); bitset& reset(size_t pos);
bitset operator~() const noexcept; bitset operator~() const;
bitset& flip() noexcept; bitset& flip();
bitset& flip(size_t pos); bitset& flip(size_t pos);
// element access: // element access:
@@ -77,27 +77,27 @@ public:
template <class charT> template <class charT>
basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const; basic_string<charT, char_traits<charT>, allocator<charT> > to_string(charT zero = charT('0'), charT one = charT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const; basic_string<char, char_traits<char>, allocator<char> > to_string(char zero = '0', char one = '1') const;
size_t count() const noexcept; size_t count() const;
constexpr size_t size() const noexcept; constexpr size_t size() const;
bool operator==(const bitset& rhs) const noexcept; bool operator==(const bitset& rhs) const;
bool operator!=(const bitset& rhs) const noexcept; bool operator!=(const bitset& rhs) const;
bool test(size_t pos) const; bool test(size_t pos) const;
bool all() const noexcept; bool all() const;
bool any() const noexcept; bool any() const;
bool none() const noexcept; bool none() const;
bitset operator<<(size_t pos) const noexcept; bitset operator<<(size_t pos) const;
bitset operator>>(size_t pos) const noexcept; bitset operator>>(size_t pos) const;
}; };
// 23.3.5.3 bitset operators: // 23.3.5.3 bitset operators:
template <size_t N> template <size_t N>
bitset<N> operator&(const bitset<N>&, const bitset<N>&) noexcept; bitset<N> operator&(const bitset<N>&, const bitset<N>&);
template <size_t N> template <size_t N>
bitset<N> operator|(const bitset<N>&, const bitset<N>&) noexcept; bitset<N> operator|(const bitset<N>&, const bitset<N>&);
template <size_t N> template <size_t N>
bitset<N> operator^(const bitset<N>&, const bitset<N>&) noexcept; bitset<N> operator^(const bitset<N>&, const bitset<N>&);
template <class charT, class traits, size_t N> template <class charT, class traits, size_t N>
basic_istream<charT, traits>& basic_istream<charT, traits>&
@@ -113,9 +113,7 @@ template <size_t N> struct hash<std::bitset<N>>;
*/ */
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#include <__config> #include <__config>
#include <__bit_reference> #include <__bit_reference>
@@ -129,28 +127,17 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <cassert> #include <cassert>
#endif #endif
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size>
class __bitset;
template <size_t _N_words, size_t _Size>
struct __has_storage_type<__bitset<_N_words, _Size> >
{
static const bool value = true;
};
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
class __bitset class __bitset
{ {
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -159,7 +146,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
__storage_type __first_[_N_words]; __storage_type __first_[_N_words];
@@ -168,36 +155,34 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset();
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; explicit __bitset(unsigned long long __v);
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
{return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return const_iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v) _NOEXCEPT; void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v) _NOEXCEPT; void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v) _NOEXCEPT; void operator^=(const __bitset& __v);
void flip() _NOEXCEPT; void flip();
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const
{return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());} {return to_ulong(integral_constant<bool, _Size < sizeof(unsigned long) * CHAR_BIT>());}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const
{return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());} {return to_ullong(integral_constant<bool, _Size < sizeof(unsigned long long) * CHAR_BIT>());}
bool all() const _NOEXCEPT; bool all() const;
bool any() const _NOEXCEPT; bool any() const;
size_t __hash_code() const _NOEXCEPT; size_t __hash_code() const;
private: private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR void __init(unsigned long long __v, false_type);
void __init(unsigned long long __v, false_type) _NOEXCEPT; void __init(unsigned long long __v, true_type);
void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const; unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const; unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const; unsigned long long to_ullong(false_type) const;
@@ -208,59 +193,43 @@ private:
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset()
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
: __first_{0}
#endif
{ {
#ifdef _LIBCPP_HAS_NO_CONSTEXPR _STD::fill_n(__first_, _N_words, __storage_type(0));
_VSTD::fill_n(__first_, _N_words, __storage_type(0));
#endif
} }
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
{ {
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word) for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
__t[__i] = static_cast<__storage_type>(__v); __t[__i] = static_cast<__storage_type>(__v);
_VSTD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_); _STD::copy(__t, __t + sizeof(__t)/sizeof(__t[0]), __first_);
_VSTD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]), _STD::fill(__first_ + sizeof(__t)/sizeof(__t[0]), __first_ + sizeof(__first_)/sizeof(__first_[0]),
__storage_type(0)); __storage_type(0));
} }
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
{ {
__first_[0] = __v; __first_[0] = __v;
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); _STD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
} }
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<_N_words, _Size>::__bitset(unsigned long long __v)
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
: __first_{__v}
#endif
{ {
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>()); __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
} }
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT __bitset<_N_words, _Size>::operator&=(const __bitset& __v)
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] &= __v.__first_[__i]; __first_[__i] &= __v.__first_[__i];
@@ -269,7 +238,7 @@ __bitset<_N_words, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT __bitset<_N_words, _Size>::operator|=(const __bitset& __v)
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] |= __v.__first_[__i]; __first_[__i] |= __v.__first_[__i];
@@ -278,7 +247,7 @@ __bitset<_N_words, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT __bitset<_N_words, _Size>::operator^=(const __bitset& __v)
{ {
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
__first_[__i] ^= __v.__first_[__i]; __first_[__i] ^= __v.__first_[__i];
@@ -286,7 +255,7 @@ __bitset<_N_words, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
void void
__bitset<_N_words, _Size>::flip() _NOEXCEPT __bitset<_N_words, _Size>::flip()
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -308,7 +277,7 @@ unsigned long
__bitset<_N_words, _Size>::to_ulong(false_type) const __bitset<_N_words, _Size>::to_ulong(false_type) const
{ {
const_iterator __e = __make_iter(_Size); const_iterator __e = __make_iter(_Size);
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true); const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long) * CHAR_BIT), __e, true);
if (__i != __e) if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ulong overflow error"); throw overflow_error("bitset to_ulong overflow error");
@@ -331,7 +300,7 @@ unsigned long long
__bitset<_N_words, _Size>::to_ullong(false_type) const __bitset<_N_words, _Size>::to_ullong(false_type) const
{ {
const_iterator __e = __make_iter(_Size); const_iterator __e = __make_iter(_Size);
const_iterator __i = _VSTD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true); const_iterator __i = _STD::find(__make_iter(sizeof(unsigned long long) * CHAR_BIT), __e, true);
if (__i != __e) if (__i != __e)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw overflow_error("bitset to_ullong overflow error"); throw overflow_error("bitset to_ullong overflow error");
@@ -369,7 +338,7 @@ __bitset<_N_words, _Size>::to_ullong(true_type, true_type) const
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
bool bool
__bitset<_N_words, _Size>::all() const _NOEXCEPT __bitset<_N_words, _Size>::all() const
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -389,7 +358,7 @@ __bitset<_N_words, _Size>::all() const _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
bool bool
__bitset<_N_words, _Size>::any() const _NOEXCEPT __bitset<_N_words, _Size>::any() const
{ {
// do middle whole words // do middle whole words
size_type __n = _Size; size_type __n = _Size;
@@ -410,7 +379,7 @@ __bitset<_N_words, _Size>::any() const _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
__bitset<_N_words, _Size>::__hash_code() const _NOEXCEPT __bitset<_N_words, _Size>::__hash_code() const
{ {
size_t __h = 0; size_t __h = 0;
for (size_type __i = 0; __i < _N_words; ++__i) for (size_type __i = 0; __i < _N_words; ++__i)
@@ -424,9 +393,9 @@ class __bitset<1, _Size>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -435,7 +404,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
__storage_type __first_; __storage_type __first_;
@@ -444,45 +413,43 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset();
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; explicit __bitset(unsigned long long __v);
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos)
{return reference(&__first_, __storage_type(1) << __pos);} {return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const
{return const_reference(&__first_, __storage_type(1) << __pos);} {return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
{return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return const_iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
void operator&=(const __bitset& __v) _NOEXCEPT; void operator&=(const __bitset& __v);
void operator|=(const __bitset& __v) _NOEXCEPT; void operator|=(const __bitset& __v);
void operator^=(const __bitset& __v) _NOEXCEPT; void operator^=(const __bitset& __v);
void flip() _NOEXCEPT; void flip();
unsigned long to_ulong() const; unsigned long to_ulong() const;
unsigned long long to_ullong() const; unsigned long long to_ullong() const;
bool all() const _NOEXCEPT; bool all() const;
bool any() const _NOEXCEPT; bool any() const;
size_t __hash_code() const _NOEXCEPT; size_t __hash_code() const;
}; };
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset()
__bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0) : __first_(0)
{ {
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<1, _Size>::__bitset(unsigned long long __v)
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v)) : __first_(static_cast<__storage_type>(__v))
{ {
} }
@@ -490,7 +457,7 @@ __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT __bitset<1, _Size>::operator&=(const __bitset& __v)
{ {
__first_ &= __v.__first_; __first_ &= __v.__first_;
} }
@@ -498,7 +465,7 @@ __bitset<1, _Size>::operator&=(const __bitset& __v) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT __bitset<1, _Size>::operator|=(const __bitset& __v)
{ {
__first_ |= __v.__first_; __first_ |= __v.__first_;
} }
@@ -506,7 +473,7 @@ __bitset<1, _Size>::operator|=(const __bitset& __v) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT __bitset<1, _Size>::operator^=(const __bitset& __v)
{ {
__first_ ^= __v.__first_; __first_ ^= __v.__first_;
} }
@@ -514,7 +481,7 @@ __bitset<1, _Size>::operator^=(const __bitset& __v) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<1, _Size>::flip() _NOEXCEPT __bitset<1, _Size>::flip()
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
__first_ = ~__first_; __first_ = ~__first_;
@@ -540,7 +507,7 @@ __bitset<1, _Size>::to_ullong() const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__bitset<1, _Size>::all() const _NOEXCEPT __bitset<1, _Size>::all() const
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return !(~__first_ & __m); return !(~__first_ & __m);
@@ -549,7 +516,7 @@ __bitset<1, _Size>::all() const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__bitset<1, _Size>::any() const _NOEXCEPT __bitset<1, _Size>::any() const
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - _Size);
return __first_ & __m; return __first_ & __m;
@@ -558,7 +525,7 @@ __bitset<1, _Size>::any() const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
__bitset<1, _Size>::__hash_code() const _NOEXCEPT __bitset<1, _Size>::__hash_code() const
{ {
return __first_; return __first_;
} }
@@ -569,9 +536,9 @@ class __bitset<0, 0>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -580,53 +547,51 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference; typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference; typedef __bit_const_reference<__bitset> const_reference;
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset();
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; explicit __bitset(unsigned long long);
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t)
{return reference(0, 1);} {return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const
{return const_reference(0, 1);} {return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos)
{return iterator(0, 0);} {return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const
{return const_iterator(0, 0);} {return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator|=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator^=(const __bitset&) {}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void flip() {}
_LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;} _LIBCPP_INLINE_VISIBILITY unsigned long to_ulong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;} _LIBCPP_INLINE_VISIBILITY unsigned long long to_ullong() const {return 0;}
_LIBCPP_INLINE_VISIBILITY bool all() const _NOEXCEPT {return true;} _LIBCPP_INLINE_VISIBILITY bool all() const {return true;}
_LIBCPP_INLINE_VISIBILITY bool any() const _NOEXCEPT {return false;} _LIBCPP_INLINE_VISIBILITY bool any() const {return false;}
_LIBCPP_INLINE_VISIBILITY size_t __hash_code() const _NOEXCEPT {return 0;} _LIBCPP_INLINE_VISIBILITY size_t __hash_code() const {return 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset()
__bitset<0, 0>::__bitset() _NOEXCEPT
{ {
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR __bitset<0, 0>::__bitset(unsigned long long)
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{ {
} }
template <size_t _Size> class _LIBCPP_VISIBLE bitset; template <size_t _Size> class bitset;
template <size_t _Size> struct hash<bitset<_Size> >; template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size> template <size_t _Size>
@@ -641,9 +606,8 @@ public:
typedef typename base::const_reference const_reference; typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) : base(__v) {}
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT> template<class _CharT>
explicit bitset(const _CharT* __str, explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@@ -656,22 +620,21 @@ public:
_CharT __zero = _CharT('0'), _CharT __one = _CharT('1')); _CharT __zero = _CharT('0'), _CharT __one = _CharT('1'));
// 23.3.5.2 bitset operations: // 23.3.5.2 bitset operations:
bitset& operator&=(const bitset& __rhs) _NOEXCEPT; bitset& operator&=(const bitset& __rhs);
bitset& operator|=(const bitset& __rhs) _NOEXCEPT; bitset& operator|=(const bitset& __rhs);
bitset& operator^=(const bitset& __rhs) _NOEXCEPT; bitset& operator^=(const bitset& __rhs);
bitset& operator<<=(size_t __pos) _NOEXCEPT; bitset& operator<<=(size_t __pos);
bitset& operator>>=(size_t __pos) _NOEXCEPT; bitset& operator>>=(size_t __pos);
bitset& set() _NOEXCEPT; bitset& set();
bitset& set(size_t __pos, bool __val = true); bitset& set(size_t __pos, bool __val = true);
bitset& reset() _NOEXCEPT; bitset& reset();
bitset& reset(size_t __pos); bitset& reset(size_t __pos);
bitset operator~() const _NOEXCEPT; bitset operator~() const;
bitset& flip() _NOEXCEPT; bitset& flip();
bitset& flip(size_t __pos); bitset& flip(size_t __pos);
// element access: // element access:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const; unsigned long to_ulong() const;
unsigned long long to_ullong() const; unsigned long long to_ullong() const;
@@ -686,21 +649,21 @@ public:
_CharT __one = _CharT('1')) const; _CharT __one = _CharT('1')) const;
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const; char __one = '1') const;
size_t count() const _NOEXCEPT; size_t count() const;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT; bool operator==(const bitset& __rhs) const;
bool operator!=(const bitset& __rhs) const _NOEXCEPT; bool operator!=(const bitset& __rhs) const;
bool test(size_t __pos) const; bool test(size_t __pos) const;
bool all() const _NOEXCEPT; bool all() const;
bool any() const _NOEXCEPT; bool any() const;
_LIBCPP_INLINE_VISIBILITY bool none() const _NOEXCEPT {return !any();} _LIBCPP_INLINE_VISIBILITY bool none() const {return !any();}
bitset operator<<(size_t __pos) const _NOEXCEPT; bitset operator<<(size_t __pos) const;
bitset operator>>(size_t __pos) const _NOEXCEPT; bitset operator>>(size_t __pos) const;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t __hash_code() const _NOEXCEPT {return base::__hash_code();} size_t __hash_code() const {return base::__hash_code();}
friend struct hash<bitset>; friend struct hash<bitset>;
}; };
@@ -711,7 +674,7 @@ bitset<_Size>::bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n, typename basic_string<_CharT>::size_type __n,
_CharT __zero, _CharT __one) _CharT __zero, _CharT __one)
{ {
size_t __rlen = _VSTD::min(__n, char_traits<_CharT>::length(__str)); size_t __rlen = _STD::min(__n, char_traits<_CharT>::length(__str));
for (size_t __i = 0; __i < __rlen; ++__i) for (size_t __i = 0; __i < __rlen; ++__i)
if (__str[__i] != __zero && __str[__i] != __one) if (__str[__i] != __zero && __str[__i] != __one)
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -719,17 +682,17 @@ bitset<_Size>::bitset(const _CharT* __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _Mp = _VSTD::min(__rlen, _Size); size_t _M = _STD::min(__rlen, _Size);
size_t __i = 0; size_t __i = 0;
for (; __i < _Mp; ++__i) for (; __i < _M; ++__i)
{ {
_CharT __c = __str[_Mp - 1 - __i]; _CharT __c = __str[_M - 1 - __i];
if (__c == __zero) if (__c == __zero)
(*this)[__i] = false; (*this)[__i] = false;
else else
(*this)[__i] = true; (*this)[__i] = true;
} }
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); _STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
} }
template <size_t _Size> template <size_t _Size>
@@ -745,7 +708,7 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else #else
assert(!"bitset string pos out of range"); assert(!"bitset string pos out of range");
#endif #endif
size_t __rlen = _VSTD::min(__n, __str.size() - __pos); size_t __rlen = _STD::min(__n, __str.size() - __pos);
for (size_t __i = __pos; __i < __pos + __rlen; ++__i) for (size_t __i = __pos; __i < __pos + __rlen; ++__i)
if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one)) if (!_Traits::eq(__str[__i], __zero) && !_Traits::eq(__str[__i], __one))
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -753,23 +716,23 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _Mp = _VSTD::min(__rlen, _Size); size_t _M = _STD::min(__rlen, _Size);
size_t __i = 0; size_t __i = 0;
for (; __i < _Mp; ++__i) for (; __i < _M; ++__i)
{ {
_CharT __c = __str[__pos + _Mp - 1 - __i]; _CharT __c = __str[__pos + _M - 1 - __i];
if (_Traits::eq(__c, __zero)) if (_Traits::eq(__c, __zero))
(*this)[__i] = false; (*this)[__i] = false;
else else
(*this)[__i] = true; (*this)[__i] = true;
} }
_VSTD::fill(base::__make_iter(__i), base::__make_iter(_Size), false); _STD::fill(base::__make_iter(__i), base::__make_iter(_Size), false);
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT bitset<_Size>::operator&=(const bitset& __rhs)
{ {
base::operator&=(__rhs); base::operator&=(__rhs);
return *this; return *this;
@@ -778,7 +741,7 @@ bitset<_Size>::operator&=(const bitset& __rhs) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT bitset<_Size>::operator|=(const bitset& __rhs)
{ {
base::operator|=(__rhs); base::operator|=(__rhs);
return *this; return *this;
@@ -787,7 +750,7 @@ bitset<_Size>::operator|=(const bitset& __rhs) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT bitset<_Size>::operator^=(const bitset& __rhs)
{ {
base::operator^=(__rhs); base::operator^=(__rhs);
return *this; return *this;
@@ -795,30 +758,30 @@ bitset<_Size>::operator^=(const bitset& __rhs) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator<<=(size_t __pos) _NOEXCEPT bitset<_Size>::operator<<=(size_t __pos)
{ {
__pos = _VSTD::min(__pos, _Size); __pos = _STD::min(__pos, _Size);
_VSTD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size)); _STD::copy_backward(base::__make_iter(0), base::__make_iter(_Size - __pos), base::__make_iter(_Size));
_VSTD::fill_n(base::__make_iter(0), __pos, false); _STD::fill_n(base::__make_iter(0), __pos, false);
return *this; return *this;
} }
template <size_t _Size> template <size_t _Size>
bitset<_Size>& bitset<_Size>&
bitset<_Size>::operator>>=(size_t __pos) _NOEXCEPT bitset<_Size>::operator>>=(size_t __pos)
{ {
__pos = _VSTD::min(__pos, _Size); __pos = _STD::min(__pos, _Size);
_VSTD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0)); _STD::copy(base::__make_iter(__pos), base::__make_iter(_Size), base::__make_iter(0));
_VSTD::fill_n(base::__make_iter(_Size - __pos), __pos, false); _STD::fill_n(base::__make_iter(_Size - __pos), __pos, false);
return *this; return *this;
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::set() _NOEXCEPT bitset<_Size>::set()
{ {
_VSTD::fill_n(base::__make_iter(0), _Size, true); _STD::fill_n(base::__make_iter(0), _Size, true);
return *this; return *this;
} }
@@ -839,9 +802,9 @@ bitset<_Size>::set(size_t __pos, bool __val)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::reset() _NOEXCEPT bitset<_Size>::reset()
{ {
_VSTD::fill_n(base::__make_iter(0), _Size, false); _STD::fill_n(base::__make_iter(0), _Size, false);
return *this; return *this;
} }
@@ -862,7 +825,7 @@ bitset<_Size>::reset(size_t __pos)
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator~() const _NOEXCEPT bitset<_Size>::operator~() const
{ {
bitset __x(*this); bitset __x(*this);
__x.flip(); __x.flip();
@@ -872,7 +835,7 @@ bitset<_Size>::operator~() const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size>& bitset<_Size>&
bitset<_Size>::flip() _NOEXCEPT bitset<_Size>::flip()
{ {
base::flip(); base::flip();
return *this; return *this;
@@ -952,23 +915,23 @@ bitset<_Size>::to_string(char __zero, char __one) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
size_t size_t
bitset<_Size>::count() const _NOEXCEPT bitset<_Size>::count() const
{ {
return static_cast<size_t>(_VSTD::count(base::__make_iter(0), base::__make_iter(_Size), true)); return static_cast<size_t>(_STD::count(base::__make_iter(0), base::__make_iter(_Size), true));
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::operator==(const bitset& __rhs) const _NOEXCEPT bitset<_Size>::operator==(const bitset& __rhs) const
{ {
return _VSTD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0)); return _STD::equal(base::__make_iter(0), base::__make_iter(_Size), __rhs.__make_iter(0));
} }
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::operator!=(const bitset& __rhs) const _NOEXCEPT bitset<_Size>::operator!=(const bitset& __rhs) const
{ {
return !(*this == __rhs); return !(*this == __rhs);
} }
@@ -989,7 +952,7 @@ bitset<_Size>::test(size_t __pos) const
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::all() const _NOEXCEPT bitset<_Size>::all() const
{ {
return base::all(); return base::all();
} }
@@ -997,7 +960,7 @@ bitset<_Size>::all() const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
bitset<_Size>::any() const _NOEXCEPT bitset<_Size>::any() const
{ {
return base::any(); return base::any();
} }
@@ -1005,7 +968,7 @@ bitset<_Size>::any() const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT bitset<_Size>::operator<<(size_t __pos) const
{ {
bitset __r = *this; bitset __r = *this;
__r <<= __pos; __r <<= __pos;
@@ -1015,7 +978,7 @@ bitset<_Size>::operator<<(size_t __pos) const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT bitset<_Size>::operator>>(size_t __pos) const
{ {
bitset __r = *this; bitset __r = *this;
__r >>= __pos; __r >>= __pos;
@@ -1025,7 +988,7 @@ bitset<_Size>::operator>>(size_t __pos) const _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT operator&(const bitset<_Size>& __x, const bitset<_Size>& __y)
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r &= __y; __r &= __y;
@@ -1035,7 +998,7 @@ operator&(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT operator|(const bitset<_Size>& __x, const bitset<_Size>& __y)
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r |= __y; __r |= __y;
@@ -1045,7 +1008,7 @@ operator|(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bitset<_Size> bitset<_Size>
operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT operator^(const bitset<_Size>& __x, const bitset<_Size>& __y)
{ {
bitset<_Size> __r = __x; bitset<_Size> __r = __x;
__r ^= __y; __r ^= __y;
@@ -1057,18 +1020,10 @@ struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t> : public unary_function<bitset<_Size>, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t operator()(const bitset<_Size>& __bs) const _NOEXCEPT size_t operator()(const bitset<_Size>& __bs) const
{return __bs.__hash_code();} {return __bs.__hash_code();}
}; };
template <class _CharT, class _Traits, size_t _Size>
basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x);
template <class _CharT, class _Traits, size_t _Size>
basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x);
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_BITSET #endif // _LIBCPP_BITSET

View File

@@ -20,6 +20,4 @@ Macros:
#include <__config> #include <__config>
#include <assert.h> #include <assert.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif

View File

@@ -20,9 +20,7 @@
#include <complex> #include <complex>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
// hh 080623 Created // hh 080623 Created

View File

@@ -37,13 +37,8 @@ int toupper(int c);
#include <__config> #include <__config>
#include <ctype.h> #include <ctype.h>
#if defined(_MSC_VER)
#include "support/win32/support.h"
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -26,368 +26,32 @@ Macros:
#include <__config> #include <__config>
#include <errno.h> #include <errno.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
#ifdef ELAST
const int __elast1 = ELAST+1; const int __elast1 = ELAST+1;
const int __elast2 = ELAST+2; const int __elast2 = ELAST+2;
#undef ELAST
#else
const int __elast1 = 104;
const int __elast2 = 105;
#endif
#ifdef ENOTRECOVERABLE #ifdef ENOTRECOVERABLE
#define EOWNERDEAD __elast1 #define EOWNERDEAD __elast1
#ifdef ELAST
#undef ELAST
#define ELAST EOWNERDEAD #define ELAST EOWNERDEAD
#endif
#elif defined(EOWNERDEAD) #elif defined(EOWNERDEAD)
#define ENOTRECOVERABLE __elast1 #define ENOTRECOVERABLE __elast1
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE #define ELAST ENOTRECOVERABLE
#endif
#else // defined(EOWNERDEAD) #else // defined(EOWNERDEAD)
#define EOWNERDEAD __elast1 #define EOWNERDEAD __elast1
#define ENOTRECOVERABLE __elast2 #define ENOTRECOVERABLE __elast2
#ifdef ELAST
#undef ELAST
#define ELAST ENOTRECOVERABLE #define ELAST ENOTRECOVERABLE
#endif
#endif // defined(EOWNERDEAD) #endif // defined(EOWNERDEAD)
#endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) #endif // !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)
// supply errno values likely to be missing, particularly on Windows
#ifndef EAFNOSUPPORT
#define EAFNOSUPPORT 9901
#endif
#ifndef EADDRINUSE
#define EADDRINUSE 9902
#endif
#ifndef EADDRNOTAVAIL
#define EADDRNOTAVAIL 9903
#endif
#ifndef EISCONN
#define EISCONN 9904
#endif
#ifndef EBADMSG
#define EBADMSG 9905
#endif
#ifndef ECONNABORTED
#define ECONNABORTED 9906
#endif
#ifndef EALREADY
#define EALREADY 9907
#endif
#ifndef ECONNREFUSED
#define ECONNREFUSED 9908
#endif
#ifndef ECONNRESET
#define ECONNRESET 9909
#endif
#ifndef EDESTADDRREQ
#define EDESTADDRREQ 9910
#endif
#ifndef EHOSTUNREACH
#define EHOSTUNREACH 9911
#endif
#ifndef EIDRM
#define EIDRM 9912
#endif
#ifndef EMSGSIZE
#define EMSGSIZE 9913
#endif
#ifndef ENETDOWN
#define ENETDOWN 9914
#endif
#ifndef ENETRESET
#define ENETRESET 9915
#endif
#ifndef ENETUNREACH
#define ENETUNREACH 9916
#endif
#ifndef ENOBUFS
#define ENOBUFS 9917
#endif
#ifndef ENOLINK
#define ENOLINK 9918
#endif
#ifndef ENODATA
#define ENODATA 9919
#endif
#ifndef ENOMSG
#define ENOMSG 9920
#endif
#ifndef ENOPROTOOPT
#define ENOPROTOOPT 9921
#endif
#ifndef ENOSR
#define ENOSR 9922
#endif
#ifndef ENOTSOCK
#define ENOTSOCK 9923
#endif
#ifndef ENOSTR
#define ENOSTR 9924
#endif
#ifndef ENOTCONN
#define ENOTCONN 9925
#endif
#ifndef ENOTSUP
#define ENOTSUP 9926
#endif
#ifndef ECANCELED
#define ECANCELED 9927
#endif
#ifndef EINPROGRESS
#define EINPROGRESS 9928
#endif
#ifndef EOPNOTSUPP
#define EOPNOTSUPP 9929
#endif
#ifndef EWOULDBLOCK
#define EWOULDBLOCK 9930
#endif
#ifndef EOWNERDEAD
#define EOWNERDEAD 9931
#endif
#ifndef EPROTO
#define EPROTO 9932
#endif
#ifndef EPROTONOSUPPORT
#define EPROTONOSUPPORT 9933
#endif
#ifndef ENOTRECOVERABLE
#define ENOTRECOVERABLE 9934
#endif
#ifndef ETIME
#define ETIME 9935
#endif
#ifndef ETXTBSY
#define ETXTBSY 9936
#endif
#ifndef ETIMEDOUT
#define ETIMEDOUT 9938
#endif
#ifndef ELOOP
#define ELOOP 9939
#endif
#ifndef EOVERFLOW
#define EOVERFLOW 9940
#endif
#ifndef EPROTOTYPE
#define EPROTOTYPE 9941
#endif
#ifndef ENOSYS
#define ENOSYS 9942
#endif
#ifndef EINVAL
#define EINVAL 9943
#endif
#ifndef ERANGE
#define ERANGE 9944
#endif
#ifndef EILSEQ
#define EILSEQ 9945
#endif
// Windows Mobile doesn't appear to define these:
#ifndef E2BIG
#define E2BIG 9946
#endif
#ifndef EDOM
#define EDOM 9947
#endif
#ifndef EFAULT
#define EFAULT 9948
#endif
#ifndef EBADF
#define EBADF 9949
#endif
#ifndef EPIPE
#define EPIPE 9950
#endif
#ifndef EXDEV
#define EXDEV 9951
#endif
#ifndef EBUSY
#define EBUSY 9952
#endif
#ifndef ENOTEMPTY
#define ENOTEMPTY 9953
#endif
#ifndef ENOEXEC
#define ENOEXEC 9954
#endif
#ifndef EEXIST
#define EEXIST 9955
#endif
#ifndef EFBIG
#define EFBIG 9956
#endif
#ifndef ENAMETOOLONG
#define ENAMETOOLONG 9957
#endif
#ifndef ENOTTY
#define ENOTTY 9958
#endif
#ifndef EINTR
#define EINTR 9959
#endif
#ifndef ESPIPE
#define ESPIPE 9960
#endif
#ifndef EIO
#define EIO 9961
#endif
#ifndef EISDIR
#define EISDIR 9962
#endif
#ifndef ECHILD
#define ECHILD 9963
#endif
#ifndef ENOLCK
#define ENOLCK 9964
#endif
#ifndef ENOSPC
#define ENOSPC 9965
#endif
#ifndef ENXIO
#define ENXIO 9966
#endif
#ifndef ENODEV
#define ENODEV 9967
#endif
#ifndef ENOENT
#define ENOENT 9968
#endif
#ifndef ESRCH
#define ESRCH 9969
#endif
#ifndef ENOTDIR
#define ENOTDIR 9970
#endif
#ifndef ENOMEM
#define ENOMEM 9971
#endif
#ifndef EPERM
#define EPERM 9972
#endif
#ifndef EACCES
#define EACCES 9973
#endif
#ifndef EROFS
#define EROFS 9974
#endif
#ifndef EDEADLK
#define EDEADLK 9975
#endif
#ifndef EAGAIN
#define EAGAIN 9976
#endif
#ifndef ENFILE
#define ENFILE 9977
#endif
#ifndef EMFILE
#define EMFILE 9978
#endif
#ifndef EMLINK
#define EMLINK 9979
#endif
#endif // _LIBCPP_CERRNO #endif // _LIBCPP_CERRNO

View File

@@ -56,9 +56,7 @@ int feupdateenv(const fenv_t* envp);
#include <__config> #include <__config>
#include <fenv.h> #include <fenv.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -63,9 +63,7 @@ Macros:
#include <__config> #include <__config>
#include <float.h> #include <float.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifndef FLT_EVAL_METHOD #ifndef FLT_EVAL_METHOD
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__ #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__

View File

@@ -20,7 +20,6 @@ namespace chrono
{ {
template <class ToDuration, class Rep, class Period> template <class ToDuration, class Rep, class Period>
constexpr
ToDuration ToDuration
duration_cast(const duration<Rep, Period>& fd); duration_cast(const duration<Rep, Period>& fd);
@@ -30,9 +29,9 @@ template <class Rep>
struct duration_values struct duration_values
{ {
public: public:
static constexpr Rep zero(); static Rep zero();
static constexpr Rep max(); static Rep max();
static constexpr Rep min(); static Rep min();
}; };
// duration // duration
@@ -47,9 +46,9 @@ public:
typedef Rep rep; typedef Rep rep;
typedef Period period; typedef Period period;
constexpr duration() = default; duration() = default;
template <class Rep2> template <class Rep2>
constexpr explicit duration(const Rep2& r, explicit duration(const Rep2& r,
typename enable_if typename enable_if
< <
is_convertible<Rep2, rep>::value && is_convertible<Rep2, rep>::value &&
@@ -59,7 +58,7 @@ public:
// conversions // conversions
template <class Rep2, class Period2> template <class Rep2, class Period2>
constexpr duration(const duration<Rep2, Period2>& d, duration(const duration<Rep2, Period2>& d,
typename enable_if typename enable_if
< <
treat_as_floating_point<rep>::value || treat_as_floating_point<rep>::value ||
@@ -68,12 +67,12 @@ public:
// observer // observer
constexpr rep count() const; rep count() const;
// arithmetic // arithmetic
constexpr duration operator+() const; duration operator+() const;
constexpr duration operator-() const; duration operator-() const;
duration& operator++(); duration& operator++();
duration operator++(int); duration operator++(int);
duration& operator--(); duration& operator--();
@@ -87,9 +86,9 @@ public:
// special values // special values
static constexpr duration zero(); static duration zero();
static constexpr duration min(); static duration min();
static constexpr duration max(); static duration max();
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -146,48 +145,36 @@ namespace chrono {
// duration arithmetic // duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s); operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d); operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s); operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<Rep1, Rep2>::type typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons // duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast // duration_cast
@@ -238,9 +225,9 @@ public:
typedef chrono::time_point<system_clock> time_point; typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; static const bool is_steady = false;
static time_point now() noexcept; static time_point now();
static time_t to_time_t (const time_point& __t) noexcept; static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t) noexcept; static time_point from_time_t(time_t __t);
}; };
class steady_clock class steady_clock
@@ -252,7 +239,7 @@ public:
typedef chrono::time_point<steady_clock, duration> time_point; typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; static const bool is_steady = true;
static time_point now() noexcept; static time_point now();
}; };
typedef steady_clock high_resolution_clock; typedef steady_clock high_resolution_clock;
@@ -268,11 +255,7 @@ typedef steady_clock high_resolution_clock;
#include <ratio> #include <ratio>
#include <limits> #include <limits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -319,7 +302,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count())); return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
@@ -329,7 +312,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -341,7 +324,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -353,7 +336,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -365,7 +348,6 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
template <class _ToDuration, class _Rep, class _Period> template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
__is_duration<_ToDuration>::value, __is_duration<_ToDuration>::value,
@@ -383,9 +365,9 @@ template <class _Rep>
struct _LIBCPP_VISIBLE duration_values struct _LIBCPP_VISIBLE duration_values
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);} _LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();} _LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();} _LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
}; };
// duration // duration
@@ -403,9 +385,9 @@ private:
rep __rep_; rep __rep_;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default; _LIBCPP_INLINE_VISIBILITY duration() {} // = default;
template <class _Rep2> template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
explicit duration(const _Rep2& __r, explicit duration(const _Rep2& __r,
typename enable_if typename enable_if
< <
@@ -417,7 +399,7 @@ public:
// conversions // conversions
template <class _Rep2, class _Period2> template <class _Rep2, class _Period2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
duration(const duration<_Rep2, _Period2>& __d, duration(const duration<_Rep2, _Period2>& __d,
typename enable_if typename enable_if
< <
@@ -425,16 +407,16 @@ public:
(ratio_divide<_Period2, period>::type::den == 1 && (ratio_divide<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value) !treat_as_floating_point<_Rep2>::value)
>::type* = 0) >::type* = 0)
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {} : __rep_(_STD::chrono::duration_cast<duration>(__d).count()) {}
// observer // observer
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;} _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
// arithmetic // arithmetic
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;} _LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);} _LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -450,9 +432,9 @@ public:
// special values // special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());} _LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());} _LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());} _LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -467,7 +449,7 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration> template <class _LhsDuration, class _RhsDuration>
struct __duration_eq struct __duration_eq
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -478,14 +460,13 @@ struct __duration_eq
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration> struct __duration_eq<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();} {return __lhs.count() == __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -496,7 +477,6 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -508,7 +488,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _LhsDuration, class _RhsDuration> template <class _LhsDuration, class _RhsDuration>
struct __duration_lt struct __duration_lt
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -519,14 +499,13 @@ struct __duration_lt
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration> struct __duration_lt<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();} {return __lhs.count() < __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -537,7 +516,6 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -548,7 +526,6 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -559,7 +536,6 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -570,31 +546,30 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count()); __r += __rhs;
return __r;
} }
// Duration - // Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count()); __r -= __rhs;
return __r;
} }
// Duration * // Duration *
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -603,13 +578,13 @@ typename enable_if
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s)); __r *= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -648,18 +623,17 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s)); __r /= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -671,24 +645,23 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s)); __r %= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; __r %= __rhs;
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count())); return __r;
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@@ -728,13 +701,13 @@ public:
// arithmetic // arithmetic
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
// special values // special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());} _LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());} _LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
}; };
} // chrono } // chrono
@@ -753,7 +726,7 @@ inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, _ToDuration> time_point<_Clock, _ToDuration>
time_point_cast(const time_point<_Clock, _Duration>& __t) time_point_cast(const time_point<_Clock, _Duration>& __t)
{ {
return time_point<_Clock, _ToDuration>(_VSTD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch())); return time_point<_Clock, _ToDuration>(_STD::chrono::duration_cast<_ToDuration>(__t.time_since_epoch()));
} }
// time_point == // time_point ==
@@ -872,9 +845,9 @@ public:
typedef chrono::time_point<system_clock> time_point; typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; static const bool is_steady = false;
static time_point now() _NOEXCEPT; static time_point now();
static time_t to_time_t (const time_point& __t) _NOEXCEPT; static time_t to_time_t (const time_point& __t);
static time_point from_time_t(time_t __t) _NOEXCEPT; static time_point from_time_t(time_t __t);
}; };
class _LIBCPP_VISIBLE steady_clock class _LIBCPP_VISIBLE steady_clock
@@ -886,7 +859,7 @@ public:
typedef chrono::time_point<steady_clock, duration> time_point; typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; static const bool is_steady = true;
static time_point now() _NOEXCEPT; static time_point now();
}; };
typedef steady_clock high_resolution_clock; typedef steady_clock high_resolution_clock;

View File

@@ -239,9 +239,7 @@ uintmax_t wcstoumax(const wchar_t* restrict nptr, wchar_t** restrict endptr, int
#include <cstdint> #include <cstdint>
#include <inttypes.h> #include <inttypes.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -18,8 +18,6 @@
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CISO646 #endif // _LIBCPP_CISO646

View File

@@ -41,8 +41,6 @@ Macros:
#include <__config> #include <__config>
#include <limits.h> #include <limits.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CLIMITS #endif // _LIBCPP_CLIMITS

View File

@@ -38,9 +38,7 @@ lconv* localeconv();
#include <__config> #include <__config>
#include <locale.h> #include <locale.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -55,9 +55,7 @@ class codecvt_utf8_utf16
#include <__config> #include <__config>
#include <__locale> #include <__locale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -249,9 +249,7 @@ template<class T, class charT, class traits>
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -282,8 +280,7 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -330,19 +327,18 @@ class _LIBCPP_VISIBLE complex<float>
public: public:
typedef float value_type; typedef float value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c); explicit /*constexpr*/ complex(const complex<double>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -386,19 +382,18 @@ class _LIBCPP_VISIBLE complex<double>
public: public:
typedef double value_type; typedef double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c); /*constexpr*/ complex(const complex<float>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -442,19 +437,18 @@ class _LIBCPP_VISIBLE complex<long double>
public: public:
typedef long double value_type; typedef long double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c); /*constexpr*/ complex(const complex<float>& __c);
_LIBCPP_CONSTEXPR complex(const complex<double>& __c); /*constexpr*/ complex(const complex<double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -490,33 +484,33 @@ public:
} }
}; };
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c) complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c) complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c) complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c) complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c) complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c) complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
@@ -1179,7 +1173,7 @@ complex<typename __promote<_Tp, _Up>::type>
pow(const complex<_Tp>& __x, const complex<_Up>& __y) pow(const complex<_Tp>& __x, const complex<_Up>& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _VSTD::pow(result_type(__x), result_type(__y)); return _STD::pow(result_type(__x), result_type(__y));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -1192,7 +1186,7 @@ typename enable_if
pow(const complex<_Tp>& __x, const _Up& __y) pow(const complex<_Tp>& __x, const _Up& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _VSTD::pow(result_type(__x), result_type(__y)); return _STD::pow(result_type(__x), result_type(__y));
} }
template<class _Tp, class _Up> template<class _Tp, class _Up>
@@ -1205,7 +1199,7 @@ typename enable_if
pow(const _Tp& __x, const complex<_Up>& __y) pow(const _Tp& __x, const complex<_Up>& __y)
{ {
typedef complex<typename __promote<_Tp, _Up>::type> result_type; typedef complex<typename __promote<_Tp, _Up>::type> result_type;
return _VSTD::pow(result_type(__x), result_type(__y)); return _STD::pow(result_type(__x), result_type(__y));
} }
// asinh // asinh
@@ -1249,12 +1243,10 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag())) if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag()); return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag())) if (isinf(__x.imag()))
{
if (__x.real() > 0) if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0) if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
@@ -1353,11 +1345,7 @@ tanh(const complex<_Tp>& __x)
_Tp __2r(_Tp(2) * __x.real()); _Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag()); _Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i)); _Tp __d(cosh(__2r) + cos(__2i));
_Tp __2rsh(sinh(__2r)); return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
if (isinf(__2rsh) && isinf(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
} }
// asin // asin

View File

@@ -28,8 +28,6 @@
#endif // __cplusplus #endif // __cplusplus
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_COMPLEX_H #endif // _LIBCPP_COMPLEX_H

View File

@@ -28,8 +28,8 @@ public:
condition_variable(const condition_variable&) = delete; condition_variable(const condition_variable&) = delete;
condition_variable& operator=(const condition_variable&) = delete; condition_variable& operator=(const condition_variable&) = delete;
void notify_one() noexcept; void notify_one();
void notify_all() noexcept; void notify_all();
void wait(unique_lock<mutex>& lock); void wait(unique_lock<mutex>& lock);
template <class Predicate> template <class Predicate>
@@ -72,8 +72,8 @@ public:
condition_variable_any(const condition_variable_any&) = delete; condition_variable_any(const condition_variable_any&) = delete;
condition_variable_any& operator=(const condition_variable_any&) = delete; condition_variable_any& operator=(const condition_variable_any&) = delete;
void notify_one() noexcept; void notify_one();
void notify_all() noexcept; void notify_all();
template <class Lock> template <class Lock>
void wait(Lock& lock); void wait(Lock& lock);
@@ -111,9 +111,7 @@ public:
#include <__mutex_base> #include <__mutex_base>
#include <memory> #include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -124,8 +122,8 @@ class _LIBCPP_VISIBLE condition_variable_any
public: public:
condition_variable_any(); condition_variable_any();
void notify_one() _NOEXCEPT; void notify_one();
void notify_all() _NOEXCEPT; void notify_all();
template <class _Lock> template <class _Lock>
void wait(_Lock& __lock); void wait(_Lock& __lock);
@@ -161,17 +159,17 @@ condition_variable_any::condition_variable_any()
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
condition_variable_any::notify_one() _NOEXCEPT condition_variable_any::notify_one()
{ {
{lock_guard<mutex> __lx(*__mut_);} {lock_guard<mutex> _(*__mut_);}
__cv_.notify_one(); __cv_.notify_one();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
condition_variable_any::notify_all() _NOEXCEPT condition_variable_any::notify_all()
{ {
{lock_guard<mutex> __lx(*__mut_);} {lock_guard<mutex> _(*__mut_);}
__cv_.notify_all(); __cv_.notify_all();
} }
@@ -188,8 +186,8 @@ condition_variable_any::wait(_Lock& __lock)
shared_ptr<mutex> __mut = __mut_; shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut); unique_lock<mutex> __lk(*__mut);
__lock.unlock(); __lock.unlock();
unique_ptr<_Lock, __lock_external> __lxx(&__lock); unique_ptr<_Lock, __lock_external> __(&__lock);
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock); lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
__cv_.wait(__lk); __cv_.wait(__lk);
} // __mut_.unlock(), __lock.lock() } // __mut_.unlock(), __lock.lock()
@@ -210,8 +208,8 @@ condition_variable_any::wait_until(_Lock& __lock,
shared_ptr<mutex> __mut = __mut_; shared_ptr<mutex> __mut = __mut_;
unique_lock<mutex> __lk(*__mut); unique_lock<mutex> __lk(*__mut);
__lock.unlock(); __lock.unlock();
unique_ptr<_Lock, __lock_external> __lxx(&__lock); unique_ptr<_Lock, __lock_external> __(&__lock);
lock_guard<unique_lock<mutex> > __lx(__lk, adopt_lock); lock_guard<unique_lock<mutex> > _(__lk, adopt_lock);
return __cv_.wait_until(__lk, __t); return __cv_.wait_until(__lk, __t);
} // __mut_.unlock(), __lock.lock() } // __mut_.unlock(), __lock.lock()
@@ -245,7 +243,7 @@ condition_variable_any::wait_for(_Lock& __lock,
_Predicate __pred) _Predicate __pred)
{ {
return wait_until(__lock, chrono::steady_clock::now() + __d, return wait_until(__lock, chrono::steady_clock::now() + __d,
_VSTD::move(__pred)); _STD::move(__pred));
} }
_LIBCPP_VISIBLE _LIBCPP_VISIBLE

View File

@@ -34,9 +34,7 @@ void longjmp(jmp_buf env, int val);
#include <__config> #include <__config>
#include <setjmp.h> #include <setjmp.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifndef setjmp #ifndef setjmp
#define setjmp(env) setjmp(env) #define setjmp(env) setjmp(env)

View File

@@ -43,9 +43,7 @@ int raise(int sig);
#include <__config> #include <__config>
#include <signal.h> #include <signal.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -35,9 +35,7 @@ Types:
#include <__config> #include <__config>
#include <stdarg.h> #include <stdarg.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -22,9 +22,7 @@ Macros:
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#undef __bool_true_false_are_defined #undef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1 #define __bool_true_false_are_defined 1

View File

@@ -43,9 +43,7 @@ Types:
#include <stddef.h> #include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -58,46 +56,40 @@ typedef long double max_align_t;
struct _LIBCPP_VISIBLE nullptr_t struct _LIBCPP_VISIBLE nullptr_t
{ {
void* __lx; void* _;
struct __nat {int __for_bool_;}; struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
template <class _Tp> template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR _LIBCPP_ALWAYS_INLINE
operator _Tp* () const {return 0;} operator _Tp* () const {return 0;}
template <class _Tp, class _Up> template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;} operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
}; };
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t() #define nullptr _STD::__get_nullptr_t()
#else // _LIBCPP_HAS_NO_NULLPTR
typedef decltype(nullptr) nullptr_t;
#endif // _LIBCPP_HAS_NO_NULLPTR #endif // _LIBCPP_HAS_NO_NULLPTR
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_NULLPTR
namespace std
{
typedef decltype(nullptr) nullptr_t;
}
#endif // _LIBCPP_HAS_NO_NULLPTR
#endif // _LIBCPP_CSTDDEF #endif // _LIBCPP_CSTDDEF

View File

@@ -144,9 +144,7 @@ Types:
#include <__config> #include <__config>
#include <stdint.h> #include <stdint.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -99,21 +99,7 @@ void perror(const char* s);
#include <__config> #include <__config>
#include <stdio.h> #include <stdio.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
inline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
#endif // getc
#ifdef putc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
#undef putc
inline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
#endif // putc
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -138,15 +124,13 @@ using ::scanf;
using ::snprintf; using ::snprintf;
using ::sprintf; using ::sprintf;
using ::sscanf; using ::sscanf;
#ifndef _MSC_VER
using ::vfprintf; using ::vfprintf;
using ::vfscanf; using ::vfscanf;
using ::vscanf;
using ::vsscanf;
#endif // _MSC_VER
using ::vprintf; using ::vprintf;
using ::vscanf;
using ::vsnprintf; using ::vsnprintf;
using ::vsprintf; using ::vsprintf;
using ::vsscanf;
using ::fgetc; using ::fgetc;
using ::fgets; using ::fgets;
using ::fputc; using ::fputc;

View File

@@ -74,9 +74,6 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar); int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
int at_quick_exit(void (*func)(void)) // C++11
void quick_exit(int status); // C++11
void *aligned_alloc(size_t alignment, size_t size); // C11
} // std } // std
@@ -84,13 +81,8 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config> #include <__config>
#include <stdlib.h> #include <stdlib.h>
#ifdef _MSC_VER
#include "support/win32/locale_win32.h"
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -134,22 +126,12 @@ using ::mbtowc;
using ::wctomb; using ::wctomb;
using ::mbstowcs; using ::mbstowcs;
using ::wcstombs; using ::wcstombs;
#ifdef _LIBCPP_HAS_QUICK_EXIT
using ::at_quick_exit;
using ::quick_exit;
#endif
#ifdef _LIBCPP_HAS_C11_FEATURES
using ::aligned_alloc;
#endif
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
#if !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);} inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
#endif // _MSC_VER
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -60,9 +60,7 @@ size_t strlen(const char* s);
#include <__config> #include <__config>
#include <string.h> #include <string.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -93,8 +91,7 @@ using ::strspn;
using ::strstr; using ::strstr;
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus #ifndef __GLIBC__ // GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY char* strchr( char* __s, int __c) {return ::strchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY char* strpbrk( char* __s1, const char* __s2) {return ::strpbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY char* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}

View File

@@ -22,8 +22,6 @@
#include <ccomplex> #include <ccomplex>
#include <cmath> #include <cmath>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_CTGMATH #endif // _LIBCPP_CTGMATH

View File

@@ -47,9 +47,7 @@ size_t strftime(char* restrict s, size_t maxsize, const char* restrict format,
#include <__config> #include <__config>
#include <time.h> #include <time.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -106,13 +106,8 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config> #include <__config>
#include <cwctype> #include <cwctype>
#include <wchar.h> #include <wchar.h>
#if _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -124,15 +119,13 @@ using ::FILE;
using ::fwprintf; using ::fwprintf;
using ::fwscanf; using ::fwscanf;
using ::swprintf; using ::swprintf;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
#ifndef _MSC_VER
using ::swscanf; using ::swscanf;
using ::vfwprintf;
using ::vfwscanf; using ::vfwscanf;
using ::vswprintf;
using ::vswscanf; using ::vswscanf;
using ::vwprintf;
using ::vwscanf; using ::vwscanf;
#endif // _MSC_VER
using ::wprintf; using ::wprintf;
using ::wscanf; using ::wscanf;
using ::fgetwc; using ::fgetwc;
@@ -146,10 +139,8 @@ using ::putwc;
using ::putwchar; using ::putwchar;
using ::ungetwc; using ::ungetwc;
using ::wcstod; using ::wcstod;
#ifndef _MSC_VER
using ::wcstof; using ::wcstof;
using ::wcstold; using ::wcstold;
#endif // _MSC_VER
using ::wcstol; using ::wcstol;
using ::wcstoll; using ::wcstoll;
using ::wcstoul; using ::wcstoul;

View File

@@ -54,9 +54,7 @@ wctrans_t wctrans(const char* property);
#include <cctype> #include <cctype>
#include <wctype.h> #include <wctype.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -20,56 +20,56 @@ namespace std
class exception class exception
{ {
public: public:
exception() noexcept; exception() throw();
exception(const exception&) noexcept; exception(const exception&) throw();
exception& operator=(const exception&) noexcept; exception& operator=(const exception&) throw();
virtual ~exception() noexcept; virtual ~exception() throw();
virtual const char* what() const noexcept; virtual const char* what() const throw();
}; };
class bad_exception class bad_exception
: public exception : public exception
{ {
public: public:
bad_exception() noexcept; bad_exception() throw();
bad_exception(const bad_exception&) noexcept; bad_exception(const bad_exception&) throw();
bad_exception& operator=(const bad_exception&) noexcept; bad_exception& operator=(const bad_exception&) throw();
virtual ~bad_exception() noexcept; virtual ~bad_exception() throw();
virtual const char* what() const noexcept; virtual const char* what() const throw();
}; };
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
unexpected_handler set_unexpected(unexpected_handler f ) noexcept; unexpected_handler set_unexpected(unexpected_handler f ) throw();
unexpected_handler get_unexpected() noexcept; unexpected_handler get_unexpected() throw();
[[noreturn]] void unexpected(); void unexpected [[noreturn]] ();
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
terminate_handler set_terminate(terminate_handler f ) noexcept; terminate_handler set_terminate(terminate_handler f ) throw();
terminate_handler get_terminate() noexcept; terminate_handler get_terminate() throw();
[[noreturn]] void terminate() noexcept; void terminate [[noreturn]] ();
bool uncaught_exception() noexcept; bool uncaught_exception() throw();
typedef unspecified exception_ptr; typedef unspecified exception_ptr;
exception_ptr current_exception() noexcept; exception_ptr current_exception();
void rethrow_exception [[noreturn]] (exception_ptr p); void rethrow_exception [[noreturn]] (exception_ptr p);
template<class E> exception_ptr make_exception_ptr(E e) noexcept; template<class E> exception_ptr make_exception_ptr(E e);
class nested_exception class nested_exception
{ {
public: public:
nested_exception() noexcept; nested_exception() throw();
nested_exception(const nested_exception&) noexcept = default; nested_exception(const nested_exception&) throw() = default;
nested_exception& operator=(const nested_exception&) noexcept = default; nested_exception& operator=(const nested_exception&) throw() = default;
virtual ~nested_exception() = default; virtual ~nested_exception() = default;
// access functions // access functions
[[noreturn]] void rethrow_nested() const; void rethrow_nested [[noreturn]] () const;
exception_ptr nested_ptr() const noexcept; exception_ptr nested_ptr() const;
}; };
template <class T> [[noreturn]] void throw_with_nested(T&& t); template <class T> void throw_with_nested [[noreturn]] (T&& t);
template <class E> void rethrow_if_nested(const E& e); template <class E> void rethrow_if_nested(const E& e);
} // std } // std
@@ -80,9 +80,7 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -90,65 +88,65 @@ namespace std // purposefully not using versioning namespace
class _LIBCPP_EXCEPTION_ABI exception class _LIBCPP_EXCEPTION_ABI exception
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY exception() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY exception() throw() {}
virtual ~exception() _NOEXCEPT; virtual ~exception() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
class _LIBCPP_EXCEPTION_ABI bad_exception class _LIBCPP_EXCEPTION_ABI bad_exception
: public exception : public exception
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY bad_exception() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY bad_exception() throw() {}
virtual ~bad_exception() _NOEXCEPT; virtual ~bad_exception() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
_LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) throw();
_LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT; _LIBCPP_VISIBLE unexpected_handler get_unexpected() throw();
_LIBCPP_NORETURN _LIBCPP_VISIBLE void unexpected(); _LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
_LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT; _LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) throw();
_LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT; _LIBCPP_VISIBLE terminate_handler get_terminate() throw();
_LIBCPP_NORETURN _LIBCPP_VISIBLE void terminate() _NOEXCEPT; _LIBCPP_VISIBLE void terminate() __attribute__((__noreturn__));
_LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT; _LIBCPP_VISIBLE bool uncaught_exception() throw();
class _LIBCPP_VISIBLE exception_ptr; class exception_ptr;
exception_ptr current_exception() _NOEXCEPT; exception_ptr current_exception();
_LIBCPP_NORETURN void rethrow_exception(exception_ptr); void rethrow_exception(exception_ptr); // noreturn
class _LIBCPP_VISIBLE exception_ptr class _LIBCPP_VISIBLE exception_ptr
{ {
void* __ptr_; void* __ptr_;
public: public:
_LIBCPP_INLINE_VISIBILITY exception_ptr() _NOEXCEPT : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr() : __ptr_() {}
_LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) _NOEXCEPT : __ptr_() {} _LIBCPP_INLINE_VISIBILITY exception_ptr(nullptr_t) : __ptr_() {}
exception_ptr(const exception_ptr&) _NOEXCEPT; exception_ptr(const exception_ptr&);
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT; exception_ptr& operator=(const exception_ptr&);
~exception_ptr() _NOEXCEPT; ~exception_ptr();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT // explicit
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} operator bool() const {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT bool operator==(const exception_ptr& __x, const exception_ptr& __y)
{return __x.__ptr_ == __y.__ptr_;} {return __x.__ptr_ == __y.__ptr_;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT bool operator!=(const exception_ptr& __x, const exception_ptr& __y)
{return !(__x == __y);} {return !(__x == __y);}
friend exception_ptr current_exception() _NOEXCEPT; friend exception_ptr current_exception();
_LIBCPP_NORETURN friend void rethrow_exception(exception_ptr); friend void rethrow_exception(exception_ptr); // noreturn
}; };
template<class _Ep> template<class _E>
exception_ptr exception_ptr
make_exception_ptr(_Ep __e) _NOEXCEPT make_exception_ptr(_E __e)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
@@ -168,14 +166,14 @@ class _LIBCPP_EXCEPTION_ABI nested_exception
{ {
exception_ptr __ptr_; exception_ptr __ptr_;
public: public:
nested_exception() _NOEXCEPT; nested_exception();
// nested_exception(const nested_exception&) noexcept = default; // nested_exception(const nested_exception&) throw() = default;
// nested_exception& operator=(const nested_exception&) noexcept = default; // nested_exception& operator=(const nested_exception&) throw() = default;
virtual ~nested_exception() _NOEXCEPT; virtual ~nested_exception();
// access functions // access functions
_LIBCPP_NORETURN void rethrow_nested() const; void rethrow_nested /*[[noreturn]]*/ () const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;} _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const {return __ptr_;}
}; };
template <class _Tp> template <class _Tp>
@@ -187,10 +185,9 @@ struct __nested
}; };
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if< throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
is_class<typename remove_reference<_Tp>::type>::value && is_class<typename remove_reference<_Tp>::type>::value &&
!is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value !is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0) >::type* = 0)
@@ -201,15 +198,14 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw __nested<typename remove_reference<_Tp>::type>(_VSTD::forward<_Tp>(__t)); throw __nested<typename remove_reference<_Tp>::type>(_STD::forward<_Tp>(__t));
#endif #endif
} }
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if< throw_with_nested /*[[noreturn]]*/ (_Tp&& __t, typename enable_if<
!is_class<typename remove_reference<_Tp>::type>::value || !is_class<typename remove_reference<_Tp>::type>::value ||
is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value is_base_of<nested_exception, typename remove_reference<_Tp>::type>::value
>::type* = 0) >::type* = 0)
@@ -220,15 +216,15 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
throw _VSTD::forward<_Tp>(__t); throw _STD::forward<_Tp>(__t);
#endif #endif
} }
template <class _Ep> template <class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep& __e, typename enable_if< rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_Ep>::value is_polymorphic<_E>::value
>::type* = 0) >::type* = 0)
{ {
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e); const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
@@ -236,11 +232,11 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
__nep->rethrow_nested(); __nep->rethrow_nested();
} }
template <class _Ep> template <class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep&, typename enable_if< rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_Ep>::value !is_polymorphic<_E>::value
>::type* = 0) >::type* = 0)
{ {
} }

View File

@@ -1,46 +0,0 @@
// -*- C++ -*-
//===------------------------- hash_set ------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_EXT_HASH
#define _LIBCPP_EXT_HASH
#pragma GCC system_header
#include <string>
#include <cstring>
namespace __gnu_cxx {
using namespace std;
template <typename T> struct _LIBCPP_VISIBLE hash : public std::hash<T>
{ };
template <> struct _LIBCPP_VISIBLE hash<const char*>
: public unary_function<const char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(const char *__c) const _NOEXCEPT
{
return __do_string_hash(__c, __c + strlen(__c));
}
};
template <> struct _LIBCPP_VISIBLE hash<char *>
: public unary_function<char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
size_t operator()(char *__c) const _NOEXCEPT
{
return __do_string_hash<const char *>(__c, __c + strlen(__c));
}
};
}
#endif // _LIBCPP_EXT_HASH

View File

@@ -203,11 +203,8 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <__hash_table> #include <__hash_table>
#include <functional> #include <functional>
#include <stdexcept> #include <stdexcept>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map> #warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header #pragma GCC system_header
@@ -215,11 +212,7 @@ namespace __gnu_cxx {
using namespace std; using namespace std;
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
#if __has_feature(is_final)
&& !__is_final(_Hash)
#endif
>
class __hash_map_hasher class __hash_map_hasher
: private _Hash : private _Hash
{ {
@@ -251,11 +244,7 @@ public:
{return __hash_(__x);} {return __hash_(__x);}
}; };
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
#if __has_feature(is_final)
&& !__is_final(_Pred)
#endif
>
class __hash_map_equal class __hash_map_equal
: private _Pred : private _Pred
{ {
@@ -352,9 +341,9 @@ public:
void operator()(pointer __p) void operator()(pointer __p)
{ {
if (__second_constructed) if (__second_constructed)
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.second)); __alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.second));
if (__first_constructed) if (__first_constructed)
__alloc_traits::destroy(__na_, _VSTD::addressof(__p->__value_.first)); __alloc_traits::destroy(__na_, _STD::addressof(__p->__value_.first));
if (__p) if (__p)
__alloc_traits::deallocate(__na_, __p, 1); __alloc_traits::deallocate(__na_, __p, 1);
} }
@@ -477,7 +466,6 @@ public:
// types // types
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher; typedef _Hash hasher;
typedef _Pred key_equal; typedef _Pred key_equal;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -507,8 +495,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;
@@ -561,8 +549,6 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x) pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);} {return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -679,12 +665,12 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{ {
__node_allocator& __na = __table_.__node_alloc(); __node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __node_traits::construct(__na, _STD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); __node_traits::construct(__na, _STD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); return _STD::move(__h);
} }
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -756,7 +742,6 @@ public:
// types // types
typedef _Key key_type; typedef _Key key_type;
typedef _Tp mapped_type; typedef _Tp mapped_type;
typedef _Tp data_type;
typedef _Hash hasher; typedef _Hash hasher;
typedef _Pred key_equal; typedef _Pred key_equal;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -784,8 +769,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;
@@ -838,8 +823,6 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -980,9 +963,9 @@ operator==(const hash_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
{ {
_EqRng __xeq = __x.equal_range(__i->first); _EqRng __xeq = __x.equal_range(__i->first);
_EqRng __yeq = __y.equal_range(__i->first); _EqRng __yeq = __y.equal_range(__i->first);
if (_VSTD::distance(__xeq.first, __xeq.second) != if (_STD::distance(__xeq.first, __xeq.second) !=
_VSTD::distance(__yeq.first, __yeq.second) || _STD::distance(__yeq.first, __yeq.second) ||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) !_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false; return false;
__i = __xeq.second; __i = __xeq.second;
} }

View File

@@ -196,17 +196,14 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <__config> #include <__config>
#include <__hash_table> #include <__hash_table>
#include <functional> #include <functional>
#include <ext/__hash>
#if __DEPRECATED
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set> #warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx { namespace __gnu_cxx {
using namespace std; using namespace std;
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, template <class _Value, class _Hash = std::hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> > class _Alloc = allocator<_Value> >
class _LIBCPP_VISIBLE hash_set class _LIBCPP_VISIBLE hash_set
{ {
@@ -275,8 +272,6 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x) pair<iterator, bool> insert(const value_type& __x)
{return __table_.__insert_unique(__x);} {return __table_.__insert_unique(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x).first;}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -495,8 +490,6 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);} iterator insert(const value_type& __x) {return __table_.__insert_multi(__x);}
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator, const value_type& __x) {return insert(__x);}
template <class _InputIterator> template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last); void insert(_InputIterator __first, _InputIterator __last);
@@ -634,9 +627,9 @@ operator==(const hash_multiset<_Value, _Hash, _Pred, _Alloc>& __x,
{ {
_EqRng __xeq = __x.equal_range(*__i); _EqRng __xeq = __x.equal_range(*__i);
_EqRng __yeq = __y.equal_range(*__i); _EqRng __yeq = __y.equal_range(*__i);
if (_VSTD::distance(__xeq.first, __xeq.second) != if (_STD::distance(__xeq.first, __xeq.second) !=
_VSTD::distance(__yeq.first, __yeq.second) || _STD::distance(__yeq.first, __yeq.second) ||
!_VSTD::is_permutation(__xeq.first, __xeq.second, __yeq.first)) !_STD::is_permutation(__xeq.first, __xeq.second, __yeq.first))
return false; return false;
__i = __xeq.second; __i = __xeq.second;
} }

View File

@@ -34,8 +34,7 @@ public:
typedef <details> iterator; typedef <details> iterator;
typedef <details> const_iterator; typedef <details> const_iterator;
forward_list() forward_list();
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit forward_list(const allocator_type& a); explicit forward_list(const allocator_type& a);
explicit forward_list(size_type n); explicit forward_list(size_type n);
forward_list(size_type n, const value_type& v); forward_list(size_type n, const value_type& v);
@@ -46,8 +45,7 @@ public:
forward_list(InputIterator first, InputIterator last, const allocator_type& a); forward_list(InputIterator first, InputIterator last, const allocator_type& a);
forward_list(const forward_list& x); forward_list(const forward_list& x);
forward_list(const forward_list& x, const allocator_type& a); forward_list(const forward_list& x, const allocator_type& a);
forward_list(forward_list&& x) forward_list(forward_list&& x);
noexcept(is_nothrow_move_constructible<allocator_type>::value);
forward_list(forward_list&& x, const allocator_type& a); forward_list(forward_list&& x, const allocator_type& a);
forward_list(initializer_list<value_type> il); forward_list(initializer_list<value_type> il);
forward_list(initializer_list<value_type> il, const allocator_type& a); forward_list(initializer_list<value_type> il, const allocator_type& a);
@@ -55,10 +53,7 @@ public:
~forward_list(); ~forward_list();
forward_list& operator=(const forward_list& x); forward_list& operator=(const forward_list& x);
forward_list& operator=(forward_list&& x) forward_list& operator=(forward_list&& x);
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
forward_list& operator=(initializer_list<value_type> il); forward_list& operator=(initializer_list<value_type> il);
template <class InputIterator> template <class InputIterator>
@@ -66,22 +61,22 @@ public:
void assign(size_type n, const value_type& v); void assign(size_type n, const value_type& v);
void assign(initializer_list<value_type> il); void assign(initializer_list<value_type> il);
allocator_type get_allocator() const noexcept; allocator_type get_allocator() const;
iterator begin() noexcept; iterator begin();
const_iterator begin() const noexcept; const_iterator begin() const;
iterator end() noexcept; iterator end();
const_iterator end() const noexcept; const_iterator end() const;
const_iterator cbegin() const noexcept; const_iterator cbegin() const;
const_iterator cend() const noexcept; const_iterator cend() const;
iterator before_begin() noexcept; iterator before_begin();
const_iterator before_begin() const noexcept; const_iterator before_begin() const;
const_iterator cbefore_begin() const noexcept; const_iterator cbefore_begin() const;
bool empty() const noexcept; bool empty() const;
size_type max_size() const noexcept; size_type max_size() const;
reference front(); reference front();
const_reference front() const; const_reference front() const;
@@ -105,13 +100,11 @@ public:
iterator erase_after(const_iterator p); iterator erase_after(const_iterator p);
iterator erase_after(const_iterator first, const_iterator last); iterator erase_after(const_iterator first, const_iterator last);
void swap(forward_list& x) void swap(forward_list& x);
noexcept(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value);
void resize(size_type n); void resize(size_type n);
void resize(size_type n, const value_type& v); void resize(size_type n, const value_type& v);
void clear() noexcept; void clear();
void splice_after(const_iterator p, forward_list& x); void splice_after(const_iterator p, forward_list& x);
void splice_after(const_iterator p, forward_list&& x); void splice_after(const_iterator p, forward_list&& x);
@@ -131,7 +124,7 @@ public:
template <class Compare> void merge(forward_list&& x, Compare comp); template <class Compare> void merge(forward_list&& x, Compare comp);
void sort(); void sort();
template <class Compare> void sort(Compare comp); template <class Compare> void sort(Compare comp);
void reverse() noexcept; void reverse();
}; };
template <class T, class Allocator> template <class T, class Allocator>
@@ -159,8 +152,7 @@ template <class T, class Allocator>
const forward_list<T, Allocator>& y); const forward_list<T, Allocator>& y);
template <class T, class Allocator> template <class T, class Allocator>
void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y) void swap(forward_list<T, Allocator>& x, forward_list<T, Allocator>& y);
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -174,15 +166,11 @@ template <class T, class Allocator>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __forward_list_node; template <class, class> struct __forward_list_node;
template <class _NodePtr> template <class _NodePtr>
struct __forward_begin_node struct __forward_begin_node
@@ -212,8 +200,8 @@ struct __forward_list_node
value_type __value_; value_type __value_;
}; };
template<class _Tp, class _Alloc> class _LIBCPP_VISIBLE forward_list; template<class, class> class forward_list;
template<class _NodeConstPtr> class _LIBCPP_VISIBLE __forward_list_const_iterator; template<class> class __forward_list_const_iterator;
template <class _NodePtr> template <class _NodePtr>
class _LIBCPP_VISIBLE __forward_list_iterator class _LIBCPP_VISIBLE __forward_list_iterator
@@ -223,10 +211,10 @@ class _LIBCPP_VISIBLE __forward_list_iterator
__node_pointer __ptr_; __node_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} explicit __forward_list_iterator(__node_pointer __p) : __ptr_(__p) {}
template<class, class> friend class _LIBCPP_VISIBLE forward_list; template<class, class> friend class forward_list;
template<class> friend class _LIBCPP_VISIBLE __forward_list_const_iterator; template<class> friend class __forward_list_const_iterator;
public: public:
typedef forward_iterator_tag iterator_category; typedef forward_iterator_tag iterator_category;
@@ -244,7 +232,7 @@ public:
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_iterator() _NOEXCEPT : __ptr_(nullptr) {} __forward_list_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;} reference operator*() const {return __ptr_->__value_;}
@@ -283,7 +271,7 @@ class _LIBCPP_VISIBLE __forward_list_const_iterator
__node_const_pointer __ptr_; __node_const_pointer __ptr_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __forward_list_const_iterator(__node_const_pointer __p) _NOEXCEPT explicit __forward_list_const_iterator(__node_const_pointer __p)
: __ptr_(__p) {} : __ptr_(__p) {}
typedef typename remove_const typedef typename remove_const
@@ -315,9 +303,9 @@ public:
pointer; pointer;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator() _NOEXCEPT : __ptr_(nullptr) {} __forward_list_const_iterator() : __ptr_(nullptr) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p) _NOEXCEPT __forward_list_const_iterator(__forward_list_iterator<__node_pointer> __p)
: __ptr_(__p.__ptr_) {} : __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -373,47 +361,41 @@ protected:
__compressed_pair<__begin_node, __node_allocator> __before_begin_; __compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin() _NOEXCEPT __node_pointer __before_begin()
{return pointer_traits<__node_pointer>::pointer_to( {return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));} static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const _NOEXCEPT __node_const_pointer __before_begin() const
{return pointer_traits<__node_const_pointer>::pointer_to( {return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));} static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() _NOEXCEPT __node_allocator& __alloc() {return __before_begin_.second();}
{return __before_begin_.second();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const __node_allocator& __alloc() const _NOEXCEPT const __node_allocator& __alloc() const {return __before_begin_.second();}
{return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator; typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator; typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_base() __forward_list_base()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
: __before_begin_(__begin_node()) {} : __before_begin_(__begin_node()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__forward_list_base(const allocator_type& __a) __forward_list_base(const allocator_type& __a)
: __before_begin_(__begin_node(), __node_allocator(__a)) {} : __before_begin_(__begin_node(), __node_allocator(__a)) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
public: __forward_list_base(__forward_list_base&& __x);
__forward_list_base(__forward_list_base&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value);
__forward_list_base(__forward_list_base&& __x, const allocator_type& __a); __forward_list_base(__forward_list_base&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: private:
__forward_list_base(const __forward_list_base&); __forward_list_base(const __forward_list_base&);
__forward_list_base& operator=(const __forward_list_base&); __forward_list_base& operator=(const __forward_list_base&);
protected:
public:
~__forward_list_base(); ~__forward_list_base();
protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __forward_list_base& __x) void __copy_assign_alloc(const __forward_list_base& __x)
{__copy_assign_alloc(__x, integral_constant<bool, {__copy_assign_alloc(__x, integral_constant<bool,
@@ -421,17 +403,11 @@ protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x) void __move_assign_alloc(__forward_list_base& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_move_assignment::value ||
is_nothrow_move_assignable<__node_allocator>::value)
{__move_assign_alloc(__x, integral_constant<bool, {__move_assign_alloc(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>());} __node_traits::propagate_on_container_move_assignment::value>());}
public: void swap(__forward_list_base& __x);
void swap(__forward_list_base& __x) void clear();
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value);
protected:
void clear() _NOEXCEPT;
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -445,30 +421,24 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, false_type) _NOEXCEPT void __move_assign_alloc(__forward_list_base& __x, false_type) {}
{}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__forward_list_base& __x, true_type) void __move_assign_alloc(__forward_list_base& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<__node_allocator>::value) {__alloc() = _STD::move(__x.__alloc());}
{__alloc() = _VSTD::move(__x.__alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y) static void __swap_alloc(__node_allocator& __x, __node_allocator& __y)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{__swap_alloc(__x, __y, integral_constant<bool, {__swap_alloc(__x, __y, integral_constant<bool,
__node_traits::propagate_on_container_swap::value>());} __node_traits::propagate_on_container_swap::value>());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
false_type) false_type)
_NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__node_allocator& __x, __node_allocator& __y, static void __swap_alloc(__node_allocator& __x, __node_allocator& __y,
true_type) true_type)
_NOEXCEPT_(__is_nothrow_swappable<__node_allocator>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(__x, __y); swap(__x, __y);
} }
}; };
@@ -478,8 +448,7 @@ private:
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x) __forward_list_base<_Tp, _Alloc>::__forward_list_base(__forward_list_base&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<__node_allocator>::value) : __before_begin_(_STD::move(__x.__before_begin_))
: __before_begin_(_VSTD::move(__x.__before_begin_))
{ {
__x.__before_begin()->__next_ = nullptr; __x.__before_begin()->__next_ = nullptr;
} }
@@ -509,23 +478,21 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x) __forward_list_base<_Tp, _Alloc>::swap(__forward_list_base& __x)
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{ {
__swap_alloc(__alloc(), __x.__alloc()); __swap_alloc(__alloc(), __x.__alloc());
using _VSTD::swap; using _STD::swap;
swap(__before_begin()->__next_, __x.__before_begin()->__next_); swap(__before_begin()->__next_, __x.__before_begin()->__next_);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
__forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT __forward_list_base<_Tp, _Alloc>::clear()
{ {
__node_allocator& __a = __alloc(); __node_allocator& __a = __alloc();
for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;) for (__node_pointer __p = __before_begin()->__next_; __p != nullptr;)
{ {
__node_pointer __next = __p->__next_; __node_pointer __next = __p->__next_;
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_)); __node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1); __node_traits::deallocate(__a, __p, 1);
__p = __next; __p = __next;
} }
@@ -537,11 +504,6 @@ class _LIBCPP_VISIBLE forward_list
: private __forward_list_base<_Tp, _Alloc> : private __forward_list_base<_Tp, _Alloc>
{ {
typedef __forward_list_base<_Tp, _Alloc> base; typedef __forward_list_base<_Tp, _Alloc> base;
typedef typename base::__node_allocator __node_allocator;
typedef typename base::__node __node;
typedef typename base::__node_traits __node_traits;
typedef typename base::__node_pointer __node_pointer;
public: public:
typedef _Tp value_type; typedef _Tp value_type;
typedef _Alloc allocator_type; typedef _Alloc allocator_type;
@@ -556,10 +518,7 @@ public:
typedef typename base::iterator iterator; typedef typename base::iterator iterator;
typedef typename base::const_iterator const_iterator; typedef typename base::const_iterator const_iterator;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY forward_list() {} // = default;
forward_list()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value)
{} // = default;
explicit forward_list(const allocator_type& __a); explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n); explicit forward_list(size_type __n);
forward_list(size_type __n, const value_type& __v); forward_list(size_type __n, const value_type& __v);
@@ -579,28 +538,19 @@ public:
forward_list(const forward_list& __x, const allocator_type& __a); forward_list(const forward_list& __x, const allocator_type& __a);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
forward_list(forward_list&& __x) forward_list(forward_list&& __x) : base(_STD::move(__x)) {}
_NOEXCEPT_(is_nothrow_move_constructible<base>::value)
: base(_VSTD::move(__x)) {}
forward_list(forward_list&& __x, const allocator_type& __a); forward_list(forward_list&& __x, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list(initializer_list<value_type> __il); forward_list(initializer_list<value_type> __il);
forward_list(initializer_list<value_type> __il, const allocator_type& __a); forward_list(initializer_list<value_type> __il, const allocator_type& __a);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~forward_list() = default; // ~forward_list() = default;
forward_list& operator=(const forward_list& __x); forward_list& operator=(const forward_list& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
forward_list& operator=(forward_list&& __x) forward_list& operator=(forward_list&& __x);
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
forward_list& operator=(initializer_list<value_type> __il); forward_list& operator=(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _InputIterator> template <class _InputIterator>
typename enable_if typename enable_if
@@ -610,50 +560,36 @@ public:
>::type >::type
assign(_InputIterator __f, _InputIterator __l); assign(_InputIterator __f, _InputIterator __l);
void assign(size_type __n, const value_type& __v); void assign(size_type __n, const value_type& __v);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
void assign(initializer_list<value_type> __il); void assign(initializer_list<value_type> __il);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT allocator_type get_allocator() const {return allocator_type(base::__alloc());}
{return allocator_type(base::__alloc());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT iterator begin() {return iterator(base::__before_begin()->__next_);}
{return iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT const_iterator begin() const {return const_iterator(base::__before_begin()->__next_);}
{return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT iterator end() {return iterator(nullptr);}
{return iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT const_iterator end() const {return const_iterator(nullptr);}
{return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT const_iterator cbegin() const {return const_iterator(base::__before_begin()->__next_);}
{return const_iterator(base::__before_begin()->__next_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT const_iterator cend() const {return const_iterator(nullptr);}
{return const_iterator(nullptr);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator before_begin() _NOEXCEPT iterator before_begin() {return iterator(base::__before_begin());}
{return iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator before_begin() const _NOEXCEPT const_iterator before_begin() const {return const_iterator(base::__before_begin());}
{return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbefore_begin() const _NOEXCEPT const_iterator cbefore_begin() const {return const_iterator(base::__before_begin());}
{return const_iterator(base::__before_begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT bool empty() const {return base::__before_begin()->__next_ == nullptr;}
{return base::__before_begin()->__next_ == nullptr;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT size_type max_size() const {return numeric_limits<size_type>::max();}
{return numeric_limits<size_type>::max();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reference front() {return base::__before_begin()->__next_->__value_;} reference front() {return base::__before_begin()->__next_->__value_;}
@@ -687,24 +623,19 @@ public:
iterator iterator
>::type >::type
insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l); insert_after(const_iterator __p, _InputIterator __f, _InputIterator __l);
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator insert_after(const_iterator __p, initializer_list<value_type> __il) iterator insert_after(const_iterator __p, initializer_list<value_type> __il)
{return insert_after(__p, __il.begin(), __il.end());} {return insert_after(__p, __il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
iterator erase_after(const_iterator __p); iterator erase_after(const_iterator __p);
iterator erase_after(const_iterator __f, const_iterator __l); iterator erase_after(const_iterator __f, const_iterator __l);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(forward_list& __x) void swap(forward_list& __x) {base::swap(__x);}
_NOEXCEPT_(!__node_traits::propagate_on_container_swap::value ||
__is_nothrow_swappable<__node_allocator>::value)
{base::swap(__x);}
void resize(size_type __n); void resize(size_type __n);
void resize(size_type __n, const value_type& __v); void resize(size_type __n, const value_type& __v);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {base::clear();} void clear() {base::clear();}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -730,7 +661,7 @@ public:
template <class _Compare> template <class _Compare>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(forward_list&& __x, _Compare __comp) void merge(forward_list&& __x, _Compare __comp)
{merge(__x, _VSTD::move(__comp));} {merge(__x, _STD::move(__comp));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void merge(forward_list& __x) {merge(__x, __less<value_type>());} void merge(forward_list& __x) {merge(__x, __less<value_type>());}
@@ -738,13 +669,16 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void sort() {sort(__less<value_type>());} void sort() {sort(__less<value_type>());}
template <class _Compare> void sort(_Compare __comp); template <class _Compare> void sort(_Compare __comp);
void reverse() _NOEXCEPT; void reverse();
private: private:
typedef typename base::__node_allocator __node_allocator;
typedef typename base::__node __node;
typedef typename base::__node_traits __node_traits;
typedef typename base::__node_pointer __node_pointer;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
void __move_assign(forward_list& __x, true_type) void __move_assign(forward_list& __x, true_type);
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(forward_list& __x, false_type); void __move_assign(forward_list& __x, false_type);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -772,13 +706,13 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n, for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_) __p = __p->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_)); __node_traits::construct(__a, _STD::addressof(__h->__value_));
__h->__next_ = nullptr; __h->__next_ = nullptr;
__p->__next_ = __h.release(); __p->__next_ = __h.release();
} }
@@ -844,19 +778,17 @@ forward_list<_Tp, _Alloc>::forward_list(const forward_list& __x,
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x, forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
const allocator_type& __a) const allocator_type& __a)
: base(_VSTD::move(__x), __a) : base(_STD::move(__x), __a)
{ {
if (base::__alloc() != __x.__alloc()) if (base::__alloc() != __x.__alloc())
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
} }
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il) forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il)
{ {
@@ -871,8 +803,6 @@ forward_list<_Tp, _Alloc>::forward_list(initializer_list<value_type> __il,
insert_after(cbefore_begin(), __il.begin(), __il.end()); insert_after(cbefore_begin(), __il.begin(), __il.end());
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(const forward_list& __x) forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
@@ -890,7 +820,6 @@ forward_list<_Tp, _Alloc>::operator=(const forward_list& __x)
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type) forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, true_type)
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value)
{ {
clear(); clear();
base::__move_assign_alloc(__x); base::__move_assign_alloc(__x);
@@ -906,8 +835,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type()); __move_assign(__x, true_type());
else else
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__x.begin()), _Ip(__x.end())); assign(_I(__x.begin()), _I(__x.end()));
} }
} }
@@ -915,9 +844,6 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
forward_list<_Tp, _Alloc>::operator=(forward_list&& __x) forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
_NOEXCEPT_(
__node_traits::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value)
{ {
__move_assign(__x, integral_constant<bool, __move_assign(__x, integral_constant<bool,
__node_traits::propagate_on_container_move_assignment::value>()); __node_traits::propagate_on_container_move_assignment::value>());
@@ -926,8 +852,6 @@ forward_list<_Tp, _Alloc>::operator=(forward_list&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
forward_list<_Tp, _Alloc>& forward_list<_Tp, _Alloc>&
@@ -937,8 +861,6 @@ forward_list<_Tp, _Alloc>::operator=(initializer_list<value_type> __il)
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
template <class _InputIterator> template <class _InputIterator>
typename enable_if typename enable_if
@@ -949,7 +871,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l) forward_list<_Tp, _Alloc>::assign(_InputIterator __f, _InputIterator __l)
{ {
iterator __i = before_begin(); iterator __i = before_begin();
iterator __j = _VSTD::next(__i); iterator __j = _STD::next(__i);
iterator __e = end(); iterator __e = end();
for (; __j != __e && __f != __l; ++__i, ++__j, ++__f) for (; __j != __e && __f != __l; ++__i, ++__j, ++__f)
*__j = *__f; *__j = *__f;
@@ -964,7 +886,7 @@ void
forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v) forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
{ {
iterator __i = before_begin(); iterator __i = before_begin();
iterator __j = _VSTD::next(__i); iterator __j = _STD::next(__i);
iterator __e = end(); iterator __e = end();
for (; __j != __e && __n > 0; --__n, ++__i, ++__j) for (; __j != __e && __n > 0; --__n, ++__i, ++__j)
*__j = __v; *__j = __v;
@@ -974,8 +896,6 @@ forward_list<_Tp, _Alloc>::assign(size_type __n, const value_type& __v)
erase_after(__i, __e); erase_after(__i, __e);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
@@ -984,8 +904,6 @@ forward_list<_Tp, _Alloc>::assign(initializer_list<value_type> __il)
assign(__il.begin(), __il.end()); assign(__il.begin(), __il.end());
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -995,10 +913,10 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __node_traits::construct(__a, _STD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...); _STD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -1010,9 +928,9 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v) forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -1024,9 +942,9 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v) forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
} }
@@ -1038,7 +956,7 @@ forward_list<_Tp, _Alloc>::pop_front()
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
__node_pointer __p = base::__before_begin()->__next_; __node_pointer __p = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __p->__next_; base::__before_begin()->__next_ = __p->__next_;
__node_traits::destroy(__a, _VSTD::addressof(__p->__value_)); __node_traits::destroy(__a, _STD::addressof(__p->__value_));
__node_traits::deallocate(__a, __p, 1); __node_traits::deallocate(__a, __p, 1);
} }
@@ -1052,10 +970,10 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __node_traits::construct(__a, _STD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...); _STD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -1069,9 +987,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __node_traits::construct(__a, _STD::addressof(__h->__value_), _STD::move(__v));
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -1085,9 +1003,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
return iterator(__r->__next_); return iterator(__r->__next_);
@@ -1102,9 +1020,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1114,7 +1032,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
for (--__n; __n != 0; --__n, __last = __last->__next_) for (--__n; __n != 0; --__n, __last = __last->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__last->__next_ = __h.release(); __last->__next_ = __h.release();
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1124,7 +1042,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
while (__first != nullptr) while (__first != nullptr)
{ {
__node_pointer __next = __first->__next_; __node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_)); __node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1); __node_traits::deallocate(__a, __first, 1);
__first = __next; __first = __next;
} }
@@ -1152,9 +1070,9 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
if (__f != __l) if (__f != __l)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1164,7 +1082,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
for (++__f; __f != __l; ++__f, __last = __last->__next_) for (++__f; __f != __l; ++__f, __last = __last->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __node_traits::construct(__a, _STD::addressof(__h->__value_), *__f);
__last->__next_ = __h.release(); __last->__next_ = __h.release();
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -1174,7 +1092,7 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
while (__first != nullptr) while (__first != nullptr)
{ {
__node_pointer __next = __first->__next_; __node_pointer __next = __first->__next_;
__node_traits::destroy(__a, _VSTD::addressof(__first->__value_)); __node_traits::destroy(__a, _STD::addressof(__first->__value_));
__node_traits::deallocate(__a, __first, 1); __node_traits::deallocate(__a, __first, 1);
__first = __next; __first = __next;
} }
@@ -1196,7 +1114,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
__node_pointer __n = __p->__next_; __node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_; __p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_)); __node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1); __node_traits::deallocate(__a, __n, 1);
return iterator(__p->__next_); return iterator(__p->__next_);
} }
@@ -1217,7 +1135,7 @@ forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
do do
{ {
__p = __n->__next_; __p = __n->__next_;
__node_traits::destroy(__a, _VSTD::addressof(__n->__value_)); __node_traits::destroy(__a, _STD::addressof(__n->__value_));
__node_traits::deallocate(__a, __n, 1); __node_traits::deallocate(__a, __n, 1);
__n = __p; __n = __p;
} while (__n != __e); } while (__n != __e);
@@ -1244,13 +1162,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_)); __node_traits::construct(__a, _STD::addressof(__h->__value_));
__h->__next_ = nullptr; __h->__next_ = nullptr;
__ptr->__next_ = __h.release(); __ptr->__next_ = __h.release();
} }
@@ -1276,13 +1194,13 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
__h.reset(__node_traits::allocate(__a, 1)); __h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _STD::addressof(__h->__value_), __v);
__h->__next_ = nullptr; __h->__next_ = nullptr;
__ptr->__next_ = __h.release(); __ptr->__next_ = __h.release();
} }
@@ -1317,7 +1235,7 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
forward_list& __x, forward_list& __x,
const_iterator __i) const_iterator __i)
{ {
const_iterator __lm1 = _VSTD::next(__i); const_iterator __lm1 = _STD::next(__i);
if (__p != __i && __p != __lm1) if (__p != __i && __p != __lm1)
{ {
const_cast<__node_pointer>(__i.__ptr_)->__next_ = const_cast<__node_pointer>(__i.__ptr_)->__next_ =
@@ -1394,7 +1312,7 @@ forward_list<_Tp, _Alloc>::remove(const value_type& __v)
{ {
if (__i.__ptr_->__next_->__value_ == __v) if (__i.__ptr_->__next_->__value_ == __v)
{ {
iterator __j = _VSTD::next(__i, 2); iterator __j = _STD::next(__i, 2);
for (; __j != __e && *__j == __v; ++__j) for (; __j != __e && *__j == __v; ++__j)
; ;
erase_after(__i, __j); erase_after(__i, __j);
@@ -1417,7 +1335,7 @@ forward_list<_Tp, _Alloc>::remove_if(_Predicate __pred)
{ {
if (__pred(__i.__ptr_->__next_->__value_)) if (__pred(__i.__ptr_->__next_->__value_))
{ {
iterator __j = _VSTD::next(__i, 2); iterator __j = _STD::next(__i, 2);
for (; __j != __e && __pred(*__j); ++__j) for (; __j != __e && __pred(*__j); ++__j)
; ;
erase_after(__i, __j); erase_after(__i, __j);
@@ -1437,7 +1355,7 @@ forward_list<_Tp, _Alloc>::unique(_BinaryPredicate __binary_pred)
{ {
for (iterator __i = begin(), __e = end(); __i != __e;) for (iterator __i = begin(), __e = end(); __i != __e;)
{ {
iterator __j = _VSTD::next(__i); iterator __j = _STD::next(__i);
for (; __j != __e && __binary_pred(*__i, *__j); ++__j) for (; __j != __e && __binary_pred(*__i, *__j); ++__j)
; ;
if (__i.__ptr_->__next_ != __j.__ptr_) if (__i.__ptr_->__next_ != __j.__ptr_)
@@ -1512,7 +1430,7 @@ void
forward_list<_Tp, _Alloc>::sort(_Compare __comp) forward_list<_Tp, _Alloc>::sort(_Compare __comp)
{ {
base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_, base::__before_begin()->__next_ = __sort(base::__before_begin()->__next_,
_VSTD::distance(begin(), end()), __comp); _STD::distance(begin(), end()), __comp);
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
@@ -1538,7 +1456,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
} }
difference_type __sz1 = __sz / 2; difference_type __sz1 = __sz / 2;
difference_type __sz2 = __sz - __sz1; difference_type __sz2 = __sz - __sz1;
__node_pointer __t = _VSTD::next(iterator(__f1), __sz1 - 1).__ptr_; __node_pointer __t = _STD::next(iterator(__f1), __sz1 - 1).__ptr_;
__node_pointer __f2 = __t->__next_; __node_pointer __f2 = __t->__next_;
__t->__next_ = nullptr; __t->__next_ = nullptr;
return __merge(__sort(__f1, __sz1, __comp), return __merge(__sort(__f1, __sz1, __comp),
@@ -1547,7 +1465,7 @@ forward_list<_Tp, _Alloc>::__sort(__node_pointer __f1, difference_type __sz,
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
void void
forward_list<_Tp, _Alloc>::reverse() _NOEXCEPT forward_list<_Tp, _Alloc>::reverse()
{ {
__node_pointer __p = base::__before_begin()->__next_; __node_pointer __p = base::__before_begin()->__next_;
if (__p != nullptr) if (__p != nullptr)
@@ -1569,12 +1487,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x, bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y) const forward_list<_Tp, _Alloc>& __y)
{ {
typedef forward_list<_Tp, _Alloc> _Cp; typedef forward_list<_Tp, _Alloc> _C;
typedef typename _Cp::const_iterator _Ip; typedef typename _C::const_iterator _I;
_Ip __ix = __x.begin(); _I __ix = __x.begin();
_Ip __ex = __x.end(); _I __ex = __x.end();
_Ip __iy = __y.begin(); _I __iy = __y.begin();
_Ip __ey = __y.end(); _I __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy)) if (!(*__ix == *__iy))
return false; return false;
@@ -1594,7 +1512,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator< (const forward_list<_Tp, _Alloc>& __x, bool operator< (const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y) const forward_list<_Tp, _Alloc>& __y)
{ {
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), return _STD::lexicographical_compare(__x.begin(), __x.end(),
__y.begin(), __y.end()); __y.begin(), __y.end());
} }
@@ -1626,7 +1544,6 @@ template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y) swap(forward_list<_Tp, _Alloc>& __x, forward_list<_Tp, _Alloc>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -171,11 +171,7 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -234,7 +230,6 @@ private:
FILE* __file_; FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_; const codecvt<char_type, char, state_type>* __cv_;
state_type __st_; state_type __st_;
state_type __st_last_;
ios_base::openmode __om_; ios_base::openmode __om_;
ios_base::openmode __cm_; ios_base::openmode __cm_;
bool __owns_eb_; bool __owns_eb_;
@@ -254,20 +249,14 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__intbuf_(0), __intbuf_(0),
__ibs_(0), __ibs_(0),
__file_(0), __file_(0),
__cv_(nullptr), __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(), __st_(),
__st_last_(),
__om_(0), __om_(0),
__cm_(0), __cm_(0),
__owns_eb_(false), __owns_eb_(false),
__owns_ib_(false), __owns_ib_(false),
__always_noconv_(false) __always_noconv_(__cv_->always_noconv())
{ {
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
{
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
__always_noconv_ = __cv_->always_noconv();
}
setbuf(0, 4096); setbuf(0, 4096);
} }
@@ -295,7 +284,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__file_ = __rhs.__file_; __file_ = __rhs.__file_;
__cv_ = __rhs.__cv_; __cv_ = __rhs.__cv_;
__st_ = __rhs.__st_; __st_ = __rhs.__st_;
__st_last_ = __rhs.__st_last_;
__om_ = __rhs.__om_; __om_ = __rhs.__om_;
__cm_ = __rhs.__cm_; __cm_ = __rhs.__cm_;
__owns_eb_ = __rhs.__owns_eb_; __owns_eb_ = __rhs.__owns_eb_;
@@ -328,7 +316,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__rhs.__ibs_ = 0; __rhs.__ibs_ = 0;
__rhs.__file_ = 0; __rhs.__file_ = 0;
__rhs.__st_ = state_type(); __rhs.__st_ = state_type();
__rhs.__st_last_ = state_type();
__rhs.__om_ = 0; __rhs.__om_ = 0;
__rhs.__cm_ = 0; __rhs.__cm_ = 0;
__rhs.__owns_eb_ = false; __rhs.__owns_eb_ = false;
@@ -344,7 +331,6 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
{ {
close(); close();
swap(__rhs); swap(__rhs);
return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -376,9 +362,9 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
basic_streambuf<char_type, traits_type>::swap(__rhs); basic_streambuf<char_type, traits_type>::swap(__rhs);
if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_) if (__extbuf_ != __extbuf_min_ && __rhs.__extbuf_ != __rhs.__extbuf_min_)
{ {
_VSTD::swap(__extbuf_, __rhs.__extbuf_); _STD::swap(__extbuf_, __rhs.__extbuf_);
_VSTD::swap(__extbufnext_, __rhs.__extbufnext_); _STD::swap(__extbufnext_, __rhs.__extbufnext_);
_VSTD::swap(__extbufend_, __rhs.__extbufend_); _STD::swap(__extbufend_, __rhs.__extbufend_);
} }
else else
{ {
@@ -401,18 +387,17 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
__rhs.__extbufnext_ = __rhs.__extbuf_ + __ln; __rhs.__extbufnext_ = __rhs.__extbuf_ + __ln;
__rhs.__extbufend_ = __rhs.__extbuf_ + __le; __rhs.__extbufend_ = __rhs.__extbuf_ + __le;
} }
_VSTD::swap(__ebs_, __rhs.__ebs_); _STD::swap(__ebs_, __rhs.__ebs_);
_VSTD::swap(__intbuf_, __rhs.__intbuf_); _STD::swap(__intbuf_, __rhs.__intbuf_);
_VSTD::swap(__ibs_, __rhs.__ibs_); _STD::swap(__ibs_, __rhs.__ibs_);
_VSTD::swap(__file_, __rhs.__file_); _STD::swap(__file_, __rhs.__file_);
_VSTD::swap(__cv_, __rhs.__cv_); _STD::swap(__cv_, __rhs.__cv_);
_VSTD::swap(__st_, __rhs.__st_); _STD::swap(__st_, __rhs.__st_);
_VSTD::swap(__st_last_, __rhs.__st_last_); _STD::swap(__om_, __rhs.__om_);
_VSTD::swap(__om_, __rhs.__om_); _STD::swap(__cm_, __rhs.__cm_);
_VSTD::swap(__cm_, __rhs.__cm_); _STD::swap(__owns_eb_, __rhs.__owns_eb_);
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_); _STD::swap(__owns_ib_, __rhs.__owns_ib_);
_VSTD::swap(__owns_ib_, __rhs.__owns_ib_); _STD::swap(__always_noconv_, __rhs.__always_noconv_);
_VSTD::swap(__always_noconv_, __rhs.__always_noconv_);
if (this->eback() == (char_type*)__rhs.__extbuf_min_) if (this->eback() == (char_type*)__rhs.__extbuf_min_)
{ {
ptrdiff_t __n = this->gptr() - this->eback(); ptrdiff_t __n = this->gptr() - this->eback();
@@ -560,7 +545,7 @@ basic_filebuf<_CharT, _Traits>::close()
{ {
__rt = this; __rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
if (sync()) if ((__cm_ & ios_base::out) && sync())
__rt = 0; __rt = 0;
if (fclose(__h.release()) == 0) if (fclose(__h.release()) == 0)
__file_ = 0; __file_ = 0;
@@ -602,22 +587,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), size_t __nmemb = _STD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_)); static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r; codecvt_base::result __r;
__st_last_ = __st_; state_type __svs = __st_;
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
if (__nr != 0) if (__nr != 0)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
__extbufend_ = __extbufnext_ + __nr; __extbufend_ = __extbufnext_ + __nr;
char_type* __inext; char_type* __inext;
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
this->eback() + __unget_sz, this->eback() + __unget_sz,
this->eback() + __ibs_, __inext); this->egptr(), __inext);
if (__r == codecvt_base::noconv) if (__r == codecvt_base::noconv)
{ {
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
@@ -691,10 +672,6 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
codecvt_base::result __r; codecvt_base::result __r;
do do
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
const char_type* __e; const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe); __extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -784,10 +761,6 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode) ios_base::openmode)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
int __width = __cv_->encoding(); int __width = __cv_->encoding();
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1)); return pos_type(off_type(-1));
@@ -822,7 +795,6 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
return pos_type(off_type(-1)); return pos_type(off_type(-1));
if (fseeko(__file_, __sp, SEEK_SET)) if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1)); return pos_type(off_type(-1));
__st_ = __sp.state();
return __sp; return __sp;
} }
@@ -832,10 +804,6 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (__file_ == 0) if (__file_ == 0)
return 0; return 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
if (__cm_ & ios_base::out) if (__cm_ & ios_base::out)
{ {
if (this->pptr() != this->pbase()) if (this->pptr() != this->pbase())
@@ -858,8 +826,6 @@ basic_filebuf<_CharT, _Traits>::sync()
else if (__cm_ & ios_base::in) else if (__cm_ & ios_base::in)
{ {
off_type __c; off_type __c;
state_type __state = __st_last_;
bool __update_st = false;
if (__always_noconv_) if (__always_noconv_)
__c = this->egptr() - this->gptr(); __c = this->egptr() - this->gptr();
else else
@@ -872,19 +838,32 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (this->gptr() != this->egptr()) if (this->gptr() != this->egptr())
{ {
const int __off = __cv_->length(__state, __extbuf_, reverse(this->gptr(), this->egptr());
__extbufnext_, codecvt_base::result __r;
this->gptr() - this->eback()); const char_type* __e = this->gptr();
__c += __extbufnext_ - __extbuf_ - __off; char* __extbe;
__update_st = true; do
{
__r = __cv_->out(__st_, __e, this->egptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe);
switch (__r)
{
case codecvt_base::noconv:
__c += this->egptr() - this->gptr();
break;
case codecvt_base::ok:
case codecvt_base::partial:
__c += __extbe - __extbuf_;
break;
default:
return -1;
}
} while (__r == codecvt_base::partial);
} }
} }
} }
if (fseeko(__file_, -__c, SEEK_CUR)) if (fseeko(__file_, -__c, SEEK_CUR))
return -1; return -1;
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;
this->setg(0, 0, 0); this->setg(0, 0, 0);
__cm_ = 0; __cm_ = 0;
} }
@@ -1040,8 +1019,8 @@ basic_ifstream<_CharT, _Traits>::basic_ifstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs) basic_ifstream<_CharT, _Traits>::basic_ifstream(basic_ifstream&& __rhs)
: basic_istream<char_type, traits_type>(_VSTD::move(__rhs)), : basic_istream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1051,8 +1030,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ifstream<_CharT, _Traits>& basic_ifstream<_CharT, _Traits>&
basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs) basic_ifstream<_CharT, _Traits>::operator=(basic_ifstream&& __rhs)
{ {
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -1185,8 +1164,8 @@ basic_ofstream<_CharT, _Traits>::basic_ofstream(const string& __s, ios_base::ope
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs) basic_ofstream<_CharT, _Traits>::basic_ofstream(basic_ofstream&& __rhs)
: basic_ostream<char_type, traits_type>(_VSTD::move(__rhs)), : basic_ostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1196,8 +1175,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ofstream<_CharT, _Traits>& basic_ofstream<_CharT, _Traits>&
basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs) basic_ofstream<_CharT, _Traits>::operator=(basic_ofstream&& __rhs)
{ {
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -1330,8 +1309,8 @@ basic_fstream<_CharT, _Traits>::basic_fstream(const string& __s, ios_base::openm
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs) basic_fstream<_CharT, _Traits>::basic_fstream(basic_fstream&& __rhs)
: basic_iostream<char_type, traits_type>(_VSTD::move(__rhs)), : basic_iostream<char_type, traits_type>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
this->set_rdbuf(&__sb_); this->set_rdbuf(&__sb_);
} }
@@ -1341,8 +1320,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_fstream<_CharT, _Traits>& basic_fstream<_CharT, _Traits>&
basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs) basic_fstream<_CharT, _Traits>::operator=(basic_fstream&& __rhs)
{ {
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -29,15 +29,15 @@ public:
typedef const E* iterator; typedef const E* iterator;
typedef const E* const_iterator; typedef const E* const_iterator;
initializer_list() noexcept; initializer_list();
size_t size() const noexcept; size_t size() const;
const E* begin() const noexcept; const E* begin() const;
const E* end() const noexcept; const E* end() const;
}; };
template<class E> const E* begin(initializer_list<E> il) noexcept; template<class E> const E* begin(initializer_list<E> il);
template<class E> const E* end(initializer_list<E> il) noexcept; template<class E> const E* end(initializer_list<E> il);
} // std } // std
@@ -46,60 +46,54 @@ template<class E> const E* end(initializer_list<E> il) noexcept;
#include <__config> #include <__config>
#include <cstddef> #include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not versioned namespace std // purposefully not versioned
{ {
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS template<class _E>
template<class _Ep>
class _LIBCPP_VISIBLE initializer_list class _LIBCPP_VISIBLE initializer_list
{ {
const _Ep* __begin_; const _E* __begin_;
size_t __size_; size_t __size_;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT initializer_list(const _E* __b, size_t __s)
: __begin_(__b), : __begin_(__b),
__size_(__s) __size_(__s)
{} {}
public: public:
typedef _Ep value_type; typedef _E value_type;
typedef const _Ep& reference; typedef const _E& reference;
typedef const _Ep& const_reference; typedef const _E& const_reference;
typedef size_t size_type; typedef size_t size_type;
typedef const _Ep* iterator; typedef const _E* iterator;
typedef const _Ep* const_iterator; typedef const _E* const_iterator;
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {} _LIBCPP_ALWAYS_INLINE initializer_list() : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;} _LIBCPP_ALWAYS_INLINE size_t size() const {return __size_;}
_LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;} _LIBCPP_ALWAYS_INLINE const _E* begin() const {return __begin_;}
_LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;} _LIBCPP_ALWAYS_INLINE const _E* end() const {return __begin_ + __size_;}
}; };
template<class _Ep> template<class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
const _Ep* const _E*
begin(initializer_list<_Ep> __il) _NOEXCEPT begin(initializer_list<_E> __il)
{ {
return __il.begin(); return __il.begin();
} }
template<class _Ep> template<class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
const _Ep* const _E*
end(initializer_list<_Ep> __il) _NOEXCEPT end(initializer_list<_E> __il)
{ {
return __il.end(); return __il.end();
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
} // std } // std
#endif // _LIBCPP_INITIALIZER_LIST #endif // _LIBCPP_INITIALIZER_LIST

View File

@@ -33,9 +33,7 @@ template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
#include <__config> #include <__config>
#include <istream> #include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -277,10 +275,10 @@ public:
__iom_t7(_MoneyT& __mon, bool __intl) __iom_t7(_MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {} : __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _Mp> template <class _CharT, class _Traits, class _M>
friend friend
basic_istream<_CharT, _Traits>& basic_istream<_CharT, _Traits>&
operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_Mp>& __x); operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_M>& __x);
}; };
template <class _CharT, class _Traits, class _MoneyT> template <class _CharT, class _Traits, class _MoneyT>
@@ -294,11 +292,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t7<_MoneyT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is); typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef money_get<_CharT, _Ip> _Fp; typedef money_get<_CharT, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
const _Fp& __mf = use_facet<_Fp>(__is.getloc()); const _F& __mf = use_facet<_F>(__is.getloc());
__mf.get(_Ip(__is), _Ip(), __x.__intl_, __is, __err, __x.__mon_); __mf.get(_I(__is), _I(), __x.__intl_, __is, __err, __x.__mon_);
__is.setstate(__err); __is.setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -337,10 +335,10 @@ public:
__iom_t8(const _MoneyT& __mon, bool __intl) __iom_t8(const _MoneyT& __mon, bool __intl)
: __mon_(__mon), __intl_(__intl) {} : __mon_(__mon), __intl_(__intl) {}
template <class _CharT, class _Traits, class _Mp> template <class _CharT, class _Traits, class _M>
friend friend
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_Mp>& __x); operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_M>& __x);
}; };
template <class _CharT, class _Traits, class _MoneyT> template <class _CharT, class _Traits, class _MoneyT>
@@ -354,10 +352,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t8<_MoneyT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
typedef money_put<_CharT, _Op> _Fp; typedef money_put<_CharT, _O> _F;
const _Fp& __mf = use_facet<_Fp>(__os.getloc()); const _F& __mf = use_facet<_F>(__os.getloc());
if (__mf.put(_Op(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed()) if (__mf.put(_O(__os), __x.__intl_, __os, __os.fill(), __x.__mon_).failed())
__os.setstate(ios_base::badbit); __os.setstate(ios_base::badbit);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -396,10 +394,10 @@ public:
__iom_t9(tm* __tm, const _CharT* __fmt) __iom_t9(tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {} : __tm_(__tm), __fmt_(__fmt) {}
template <class _Cp, class _Traits> template <class _C, class _Traits>
friend friend
basic_istream<_Cp, _Traits>& basic_istream<_C, _Traits>&
operator>>(basic_istream<_Cp, _Traits>& __is, const __iom_t9<_Cp>& __x); operator>>(basic_istream<_C, _Traits>& __is, const __iom_t9<_C>& __x);
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -413,11 +411,11 @@ operator>>(basic_istream<_CharT, _Traits>& __is, const __iom_t9<_CharT>& __x)
typename basic_istream<_CharT, _Traits>::sentry __s(__is); typename basic_istream<_CharT, _Traits>::sentry __s(__is);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef time_get<_CharT, _Ip> _Fp; typedef time_get<_CharT, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
const _Fp& __tf = use_facet<_Fp>(__is.getloc()); const _F& __tf = use_facet<_F>(__is.getloc());
__tf.get(_Ip(__is), _Ip(), __is, __err, __x.__tm_, __tf.get(_I(__is), _I(), __is, __err, __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)); __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_));
__is.setstate(__err); __is.setstate(__err);
} }
@@ -457,10 +455,10 @@ public:
__iom_t10(const tm* __tm, const _CharT* __fmt) __iom_t10(const tm* __tm, const _CharT* __fmt)
: __tm_(__tm), __fmt_(__fmt) {} : __tm_(__tm), __fmt_(__fmt) {}
template <class _Cp, class _Traits> template <class _C, class _Traits>
friend friend
basic_ostream<_Cp, _Traits>& basic_ostream<_C, _Traits>&
operator<<(basic_ostream<_Cp, _Traits>& __os, const __iom_t10<_Cp>& __x); operator<<(basic_ostream<_C, _Traits>& __os, const __iom_t10<_C>& __x);
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -474,10 +472,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const __iom_t10<_CharT>& __x)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
typedef time_put<_CharT, _Op> _Fp; typedef time_put<_CharT, _O> _F;
const _Fp& __tf = use_facet<_Fp>(__os.getloc()); const _F& __tf = use_facet<_F>(__os.getloc());
if (__tf.put(_Op(__os), __os, __os.fill(), __x.__tm_, if (__tf.put(_O(__os), __os, __os.fill(), __x.__tm_,
__x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed()) __x.__fmt_, __x.__fmt_ + _Traits::length(__x.__fmt_)).failed())
__os.setstate(ios_base::badbit); __os.setstate(ios_base::badbit);
} }

View File

@@ -29,43 +29,43 @@ public:
class failure; class failure;
typedef T1 fmtflags; typedef T1 fmtflags;
static constexpr fmtflags boolalpha; static const fmtflags boolalpha;
static constexpr fmtflags dec; static const fmtflags dec;
static constexpr fmtflags fixed; static const fmtflags fixed;
static constexpr fmtflags hex; static const fmtflags hex;
static constexpr fmtflags internal; static const fmtflags internal;
static constexpr fmtflags left; static const fmtflags left;
static constexpr fmtflags oct; static const fmtflags oct;
static constexpr fmtflags right; static const fmtflags right;
static constexpr fmtflags scientific; static const fmtflags scientific;
static constexpr fmtflags showbase; static const fmtflags showbase;
static constexpr fmtflags showpoint; static const fmtflags showpoint;
static constexpr fmtflags showpos; static const fmtflags showpos;
static constexpr fmtflags skipws; static const fmtflags skipws;
static constexpr fmtflags unitbuf; static const fmtflags unitbuf;
static constexpr fmtflags uppercase; static const fmtflags uppercase;
static constexpr fmtflags adjustfield; static const fmtflags adjustfield;
static constexpr fmtflags basefield; static const fmtflags basefield;
static constexpr fmtflags floatfield; static const fmtflags floatfield;
typedef T2 iostate; typedef T2 iostate;
static constexpr iostate badbit; static const iostate badbit;
static constexpr iostate eofbit; static const iostate eofbit;
static constexpr iostate failbit; static const iostate failbit;
static constexpr iostate goodbit; static const iostate goodbit;
typedef T3 openmode; typedef T3 openmode;
static constexpr openmode app; static const openmode app;
static constexpr openmode ate; static const openmode ate;
static constexpr openmode binary; static const openmode binary;
static constexpr openmode in; static const openmode in;
static constexpr openmode out; static const openmode out;
static constexpr openmode trunc; static const openmode trunc;
typedef T4 seekdir; typedef T4 seekdir;
static constexpr seekdir beg; static const seekdir beg;
static constexpr seekdir cur; static const seekdir cur;
static constexpr seekdir end; static const seekdir end;
class Init; class Init;
@@ -160,7 +160,7 @@ protected:
basic_ios(); basic_ios();
void init(basic_streambuf<charT,traits>* sb); void init(basic_streambuf<charT,traits>* sb);
void move(basic_ios& rhs); void move(basic_ios& rhs);
void swap(basic_ios& rhs) noexcept; void swap(basic_ios& rhs);
void set_rdbuf(basic_streambuf<charT, traits>* sb); void set_rdbuf(basic_streambuf<charT, traits>* sb);
}; };
@@ -216,9 +216,7 @@ storage-class-specifier const error_category& iostream_category;
#include <__locale> #include <__locale>
#include <system_error> #include <system_error>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -227,7 +225,7 @@ typedef ptrdiff_t streamsize;
class _LIBCPP_VISIBLE ios_base class _LIBCPP_VISIBLE ios_base
{ {
public: public:
class _LIBCPP_VISIBLE failure; class failure;
typedef unsigned int fmtflags; typedef unsigned int fmtflags;
static const fmtflags boolalpha = 0x0001; static const fmtflags boolalpha = 0x0001;
@@ -268,10 +266,10 @@ public:
enum seekdir {beg, cur, end}; enum seekdir {beg, cur, end};
typedef seekdir seek_dir; typedef seekdir seek_dir;
typedef _VSTD::streamoff streamoff; typedef _STD::streamoff streamoff;
typedef _VSTD::streampos streampos; typedef _STD::streampos streampos;
class _LIBCPP_VISIBLE Init; class Init;
// 27.5.2.2 fmtflags state: // 27.5.2.2 fmtflags state:
_LIBCPP_INLINE_VISIBILITY fmtflags flags() const; _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
@@ -342,7 +340,7 @@ protected:
void __call_callbacks(event); void __call_callbacks(event);
void copyfmt(const ios_base&); void copyfmt(const ios_base&);
void move(ios_base&); void move(ios_base&);
void swap(ios_base&) _NOEXCEPT; void swap(ios_base&);
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void set_rdbuf(void* __sb) void set_rdbuf(void* __sb)
@@ -373,19 +371,21 @@ private:
}; };
//enum class io_errc //enum class io_errc
_LIBCPP_DECLARE_STRONG_ENUM(io_errc) struct _LIBCPP_VISIBLE io_errc
{ {
enum _ {
stream = 1 stream = 1
}; };
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc) _ __v_;
_LIBCPP_ALWAYS_INLINE io_errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;}
};
template <> template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { }; struct _LIBCPP_VISIBLE is_error_code_enum<io_errc> : public true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <> template <>
struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::__lx> : public true_type { }; struct _LIBCPP_VISIBLE is_error_code_enum<io_errc::_> : public true_type { };
#endif
_LIBCPP_VISIBLE _LIBCPP_VISIBLE
const error_category& iostream_category(); const error_category& iostream_category();
@@ -572,8 +572,7 @@ public:
typedef typename traits_type::pos_type pos_type; typedef typename traits_type::pos_type pos_type;
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE // explicit
_LIBCPP_EXPLICIT
operator bool() const {return !fail();} operator bool() const {return !fail();}
_LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();} _LIBCPP_ALWAYS_INLINE bool operator!() const {return fail();}
_LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();} _LIBCPP_ALWAYS_INLINE iostate rdstate() const {return ios_base::rdstate();}
@@ -632,12 +631,12 @@ protected:
void move(basic_ios&& __rhs) {move(__rhs);} void move(basic_ios&& __rhs) {move(__rhs);}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(basic_ios& __rhs) _NOEXCEPT; void swap(basic_ios& __rhs);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb); void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
private: private:
basic_ostream<char_type, traits_type>* __tie_; basic_ostream<char_type, traits_type>* __tie_;
mutable int_type __fill_; char_type __fill_;
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -659,7 +658,7 @@ basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
{ {
ios_base::init(__sb); ios_base::init(__sb);
__tie_ = 0; __tie_ = 0;
__fill_ = traits_type::eof(); __fill_ = widen(' ');
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -731,8 +730,6 @@ inline _LIBCPP_INLINE_VISIBILITY
_CharT _CharT
basic_ios<_CharT, _Traits>::fill() const basic_ios<_CharT, _Traits>::fill() const
{ {
if (traits_type::eq_int_type(traits_type::eof(), __fill_))
__fill_ = widen(' ');
return __fill_; return __fill_;
} }
@@ -776,11 +773,11 @@ basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs)
{ {
ios_base::swap(__rhs); ios_base::swap(__rhs);
_VSTD::swap(__tie_, __rhs.__tie_); _STD::swap(__tie_, __rhs.__tie_);
_VSTD::swap(__fill_, __rhs.__fill_); _STD::swap(__fill_, __rhs.__fill_);
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>

View File

@@ -20,7 +20,6 @@ namespace std
template<class charT> struct char_traits; template<class charT> struct char_traits;
template<class T> class allocator; template<class T> class allocator;
class ios_base;
template <class charT, class traits = char_traits<charT> > class basic_ios; template <class charT, class traits = char_traits<charT> > class basic_ios;
template <class charT, class traits = char_traits<charT> > class basic_streambuf; template <class charT, class traits = char_traits<charT> > class basic_streambuf;
@@ -89,13 +88,11 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
#include <__config> #include <__config>
#include <wchar.h> // for mbstate_t #include <wchar.h> // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_VISIBLE ios_base; class ios_base;
template<class _CharT> struct _LIBCPP_VISIBLE char_traits; template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_VISIBLE allocator; template<class _Tp> class _LIBCPP_VISIBLE allocator;

View File

@@ -40,9 +40,7 @@ extern wostream wclog;
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD

View File

@@ -155,11 +155,7 @@ template <class charT, class traits, class T>
#include <__config> #include <__config>
#include <ostream> #include <ostream>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -181,20 +177,18 @@ public:
virtual ~basic_istream(); virtual ~basic_istream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_istream(basic_istream&& __rhs); basic_istream(basic_istream&& __rhs);
#endif #endif
// 27.7.1.1.2 Assign/swap: // 27.7.1.1.2 Assign/swap:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_istream& operator=(basic_istream&& __rhs); basic_istream& operator=(basic_istream&& __rhs);
#endif #endif
void swap(basic_istream& __rhs); void swap(basic_istream& __rhs);
public: public:
// 27.7.1.1.3 Prefix/suffix: // 27.7.1.1.3 Prefix/suffix:
class _LIBCPP_VISIBLE sentry; class sentry;
// 27.7.1.2 Formatted input: // 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)); basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -256,7 +250,7 @@ public:
// ~sentry() = default; // ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT // explicit
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -271,10 +265,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.tie()->flush(); __is.tie()->flush();
if (!__noskipws && (__is.flags() & ios_base::skipws)) if (!__noskipws && (__is.flags() & ios_base::skipws))
{ {
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_Ip __i(__is); _I __i(__is);
_Ip __eof; _I __eof;
for (; __i != __eof; ++__i) for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i)) if (!__ct.is(__ct.space, *__i))
break; break;
@@ -327,7 +321,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs) basic_istream<_CharT, _Traits>::swap(basic_istream& __rhs)
{ {
_VSTD::swap(__gc_, __rhs.__gc_); _STD::swap(__gc_, __rhs.__gc_);
basic_ios<char_type, traits_type>::swap(__rhs); basic_ios<char_type, traits_type>::swap(__rhs);
} }
@@ -342,10 +336,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -369,10 +363,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -396,10 +390,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -423,10 +417,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -450,10 +444,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -477,10 +471,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -504,10 +498,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -531,10 +525,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -558,10 +552,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -585,10 +579,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -612,10 +606,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -639,11 +633,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<short>::min()) if (__temp < numeric_limits<short>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -679,11 +673,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<int>::min()) if (__temp < numeric_limits<int>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -746,29 +740,26 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT* __s)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is); typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) if (__sen)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width(); streamsize __n = __is.width();
if (__n <= 0) if (__n == 0)
__n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1; __n = numeric_limits<streamsize>::max() / sizeof(_CharT) - 1;
streamsize __c = 0; streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit; _I __i(__is);
while (__c < __n-1) _I __eof;
for (; __i != __eof && __c < __n-1; ++__i, ++__s, ++__c)
{ {
typename _Traits::int_type __i = __is.rdbuf()->sgetc(); _CharT __ch = *__i;
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (__ct.is(__ct.space, __ch)) if (__ct.is(__ct.space, __ch))
break; break;
*__s++ = __ch; *__s = __ch;
++__c;
__is.rdbuf()->sbumpc();
} }
*__s = _CharT(); *__s = _CharT();
__is.width(0); __is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -810,11 +801,25 @@ operator>>(basic_istream<_CharT, _Traits>& __is, _CharT& __c)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is); typename basic_istream<_CharT, _Traits>::sentry __sen(__is);
if (__sen) if (__sen)
{ {
#if 1
typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); typename _Traits::int_type __i = __is.rdbuf()->sbumpc();
if (_Traits::eq_int_type(__i, _Traits::eof())) if (_Traits::eq_int_type(__i, _Traits::eof()))
__is.setstate(ios_base::eofbit | ios_base::failbit); __is.setstate(ios_base::eofbit | ios_base::failbit);
else else
__c = _Traits::to_char_type(__i); __c = _Traits::to_char_type(__i);
#else
typedef istreambuf_iterator<_CharT, _Traits> _I;
_I __i(__is);
_I __eof;
if (__i != __eof)
{
__c = *__i;
if (++__i == __eof)
__is.setstate(ios_base::eofbit);
}
else
__is.setstate(ios_base::eofbit | ios_base::failbit);
#endif
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -854,42 +859,42 @@ basic_istream<_CharT, _Traits>::operator>>(basic_streambuf<char_type, traits_typ
sentry __s(*this, true); sentry __s(*this, true);
if (__s) if (__s)
{ {
streamsize __c = 0;
if (__sb) if (__sb)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
ios_base::iostate __err = ios_base::goodbit; typedef istreambuf_iterator<char_type, traits_type> _I;
while (true) typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
typename traits_type::int_type __i = this->rdbuf()->sgetc(); *__o = *__i;
if (traits_type::eq_int_type(__i, _Traits::eof())) if (__o.failed())
{
__err |= ios_base::eofbit;
break;
}
if (traits_type::eq_int_type(
__sb->sputc(traits_type::to_char_type(__i)),
traits_type::eof()))
break; break;
++__gc_;
this->rdbuf()->sbumpc();
} }
if (__gc_ == 0) ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
{ {
if (__gc_ == 0) if (__c == 0)
this->__set_failbit_and_consider_rethrow(); this->__set_failbit_and_consider_rethrow();
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -914,11 +919,22 @@ basic_istream<_CharT, _Traits>::get()
sentry __s(*this, true); sentry __s(*this, true);
if (__s) if (__s)
{ {
__r = this->rdbuf()->sbumpc(); streamsize __c = 0;
if (traits_type::eq_int_type(__r, traits_type::eof())) typedef istreambuf_iterator<char_type, traits_type> _I;
this->setstate(ios_base::failbit | ios_base::eofbit); _I __i(*this);
_I __eof;
ios_base::iostate __err = ios_base::goodbit;
if (__i != __eof)
{
__r = traits_type::to_int_type(*__i);
++__c;
if (++__i == __eof)
__err |= ios_base::eofbit;
}
else else
__gc_ = 1; __err |= ios_base::failbit | ios_base::eofbit;
this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -953,31 +969,30 @@ basic_istream<_CharT, _Traits>::get(char_type* __s, streamsize __n, char_type __
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0;
if (__n > 0) if (__n > 0)
{ {
ios_base::iostate __err = ios_base::goodbit; typedef istreambuf_iterator<char_type, traits_type> _I;
while (__gc_ < __n-1) _I __i(*this);
_I __eof;
for (; __i != __eof && __n > 1; ++__i, ++__s, ++__c)
{ {
int_type __i = this->rdbuf()->sgetc(); char_type __ch = *__i;
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, __dlm))
break; break;
*__s++ = __ch; *__s = __ch;
++__gc_;
this->rdbuf()->sbumpc();
} }
*__s = char_type(); *__s = char_type();
if (__gc_ == 0) ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1010,36 +1025,38 @@ basic_istream<_CharT, _Traits>::get(basic_streambuf<char_type, traits_type>& __s
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
while (true) typedef istreambuf_iterator<char_type, traits_type> _I;
typedef ostreambuf_iterator<char_type, traits_type> _O;
_I __i(*this);
_I __eof;
_O __o(&__sb);
for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
typename traits_type::int_type __i = this->rdbuf()->sgetc(); char_type __ch = *__i;
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, __dlm))
break; break;
if (traits_type::eq_int_type(__sb.sputc(__ch), traits_type::eof())) *__o = __ch;
if (__o.failed())
break; break;
++__gc_;
this->rdbuf()->sbumpc();
} }
if (__i == __eof)
__err |= ios_base::eofbit;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
{ {
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
if (__gc_ == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1071,36 +1088,33 @@ basic_istream<_CharT, _Traits>::getline(char_type* __s, streamsize __n, char_typ
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
ios_base::iostate __err = ios_base::goodbit; streamsize __c = 0;
while (true) typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof; ++__s, --__n)
{ {
typename traits_type::int_type __i = this->rdbuf()->sgetc(); char_type __ch = *__i;
if (traits_type::eq_int_type(__i, traits_type::eof())) ++__i;
{ ++__c;
__err |= ios_base::eofbit;
break;
}
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, __dlm)) if (traits_type::eq(__ch, __dlm))
break;
if (__n < 2)
{ {
this->rdbuf()->sbumpc(); this->setstate(ios_base::failbit);
++__gc_;
break; break;
} }
if (__gc_ >= __n-1) *__s = __ch;
{
__err |= ios_base::failbit;
break;
}
*__s++ = __ch;
this->rdbuf()->sbumpc();
++__gc_;
} }
if (__n > 0) if (__n)
*__s = char_type(); *__s = char_type();
if (__gc_ == 0) ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
this->setstate(__err); this->setstate(__err);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1132,40 +1146,35 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
ios_base::iostate __err = ios_base::goodbit; streamsize __c = 0;
if (__n == numeric_limits<streamsize>::max()) typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
if (__n != numeric_limits<streamsize>::max())
{ {
while (true) for (; __n > 0 && __i != __eof; --__n)
{ {
typename traits_type::int_type __i = this->rdbuf()->sbumpc(); char_type __ch = *__i;
if (traits_type::eq_int_type(__i, traits_type::eof())) ++__i;
{ ++__c;
__err |= ios_base::eofbit; if (traits_type::eq(__ch, __dlm))
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
else else
{ {
while (__gc_ < __n) while (__i != __eof)
{ {
typename traits_type::int_type __i = this->rdbuf()->sbumpc(); char_type __ch = *__i;
if (traits_type::eq_int_type(__i, traits_type::eof())) ++__i;
{ ++__c;
__err |= ios_base::eofbit; if (traits_type::eq(__ch, __dlm))
break;
}
++__gc_;
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break; break;
} }
} }
this->setstate(__err); if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1189,11 +1198,7 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{
__r = this->rdbuf()->sgetc(); __r = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
@@ -1216,16 +1221,20 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
for (; __gc_ < __n; ++__gc_) streamsize __c = 0;
typedef istreambuf_iterator<char_type, traits_type> _I;
_I __i(*this);
_I __eof;
for (; __i != __eof && __n > 0; ++__i, ++__s, ++__c, --__n)
*__s = *__i;
if (__i == __eof)
{ {
typename traits_type::int_type __i = this->rdbuf()->sbumpc(); ios_base::iostate __err = ios_base::eofbit;
if (traits_type::eq_int_type(__i, traits_type::eof())) if (__n > 0)
{ __err |= ios_base::failbit;
this->setstate(ios_base::failbit | ios_base::eofbit); this->setstate(__err);
break;
}
*__s++ = traits_type::to_char_type(__i);
} }
__gc_ = __c;
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
@@ -1243,19 +1252,45 @@ template<class _CharT, class _Traits>
streamsize streamsize
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{ {
streamsize __c = this->rdbuf()->in_avail(); __gc_ = 0;
switch (__c) streamsize __c = 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{ {
case -1: #endif // _LIBCPP_NO_EXCEPTIONS
this->setstate(ios_base::eofbit); sentry __sen(*this, true);
break; if (__sen)
case 0: {
break; typedef istreambuf_iterator<char_type, traits_type> _I;
default: _I __i(*this);
read(__s, _VSTD::min(__c, __n)); _I __eof;
break; __c = this->rdbuf()->in_avail();
switch (__c)
{
case -1:
__i = __eof;
break;
case 0:
break;
default:
__c = _STD::min(__c, __n);
for (streamsize __k = 0; __k < __c; ++__k, ++__s, ++__i)
*__s = *__i;
}
if (__i == __eof)
this->setstate(ios_base::eofbit);
__gc_ = __c;
}
else
this->setstate(ios_base::failbit);
#ifndef _LIBCPP_NO_EXCEPTIONS
} }
return __gc_; catch (...)
{
this->__set_badbit_and_consider_rethrow();
}
#endif // _LIBCPP_NO_EXCEPTIONS
return __c;
} }
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
@@ -1267,7 +1302,6 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1295,7 +1329,6 @@ basic_istream<_CharT, _Traits>::unget()
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1374,7 +1407,6 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
@@ -1421,19 +1453,15 @@ ws(basic_istream<_CharT, _Traits>& __is)
typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true); typename basic_istream<_CharT, _Traits>::sentry __sen(__is, true);
if (__sen) if (__sen)
{ {
typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
while (true) _I __i(__is);
{ _I __eof;
typename _Traits::int_type __i = __is.rdbuf()->sgetc(); for (; __i != __eof; ++__i)
if (_Traits::eq_int_type(__i, _Traits::eof())) if (!__ct.is(__ct.space, *__i))
{
__is.setstate(ios_base::eofbit);
break;
}
if (!__ct.is(__ct.space, _Traits::to_char_type(__i)))
break; break;
__is.rdbuf()->sbumpc(); if (__i == __eof)
} __is.setstate(ios_base::failbit | ios_base::eofbit);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1476,13 +1504,11 @@ public:
virtual ~basic_iostream(); virtual ~basic_iostream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_iostream(basic_iostream&& __rhs); basic_iostream(basic_iostream&& __rhs);
#endif #endif
// assign/swap // assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_iostream& operator=(basic_iostream&& __rhs); basic_iostream& operator=(basic_iostream&& __rhs);
#endif #endif
void swap(basic_iostream& __rhs); void swap(basic_iostream& __rhs);
@@ -1501,7 +1527,7 @@ basic_iostream<_CharT, _Traits>::basic_iostream(basic_streambuf<char_type, trait
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs) basic_iostream<_CharT, _Traits>::basic_iostream(basic_iostream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)) : basic_istream<_CharT, _Traits>(_STD::move(__rhs))
{ {
} }
@@ -1542,30 +1568,27 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
if (__sen) if (__sen)
{ {
__str.clear(); __str.clear();
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __n = __is.width(); streamsize __n = __is.width();
if (__n <= 0) if (__n == 0)
__n = __str.max_size(); __n = __str.max_size();
if (__n <= 0) if (__n < 0)
__n = numeric_limits<streamsize>::max(); __n = numeric_limits<streamsize>::max();
streamsize __c = 0; streamsize __c = 0;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
ios_base::iostate __err = ios_base::goodbit; _I __i(__is);
while (__c < __n) _I __eof;
for (; __i != __eof && __c < __n; ++__i, ++__c)
{ {
typename _Traits::int_type __i = __is.rdbuf()->sgetc(); _CharT __ch = *__i;
if (_Traits::eq_int_type(__i, _Traits::eof()))
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (__ct.is(__ct.space, __ch)) if (__ct.is(__ct.space, __ch))
break; break;
__str.push_back(__ch); __str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
} }
__is.width(0); __is.width(0);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -1595,28 +1618,31 @@ getline(basic_istream<_CharT, _Traits>& __is,
if (__sen) if (__sen)
{ {
__str.clear(); __str.clear();
ios_base::iostate __err = ios_base::goodbit; streamsize __c = 0;
streamsize __extr = 0; typedef istreambuf_iterator<_CharT, _Traits> _I;
while (true) _I __i(__is);
_I __eof;
streamsize __n = __str.max_size();
if (__n < 0)
__n = numeric_limits<streamsize>::max();
for (; __i != __eof;)
{ {
typename _Traits::int_type __i = __is.rdbuf()->sbumpc(); _CharT __ch = *__i;
if (_Traits::eq_int_type(__i, _Traits::eof())) ++__i;
{ ++__c;
__err |= ios_base::eofbit;
break;
}
++__extr;
_CharT __ch = _Traits::to_char_type(__i);
if (_Traits::eq(__ch, __dlm)) if (_Traits::eq(__ch, __dlm))
break; break;
__str.push_back(__ch); if (__c == __n)
if (__str.size() == __str.max_size())
{ {
__err |= ios_base::failbit; __is.setstate(ios_base::failbit);
break; break;
} }
__str.push_back(__ch);
} }
if (__extr == 0) ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
} }
@@ -1674,26 +1700,24 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
{ {
basic_string<_CharT, _Traits> __str; basic_string<_CharT, _Traits> __str;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
typedef istreambuf_iterator<_CharT, _Traits> _I;
streamsize __c = 0; streamsize __c = 0;
ios_base::iostate __err = ios_base::goodbit;
_CharT __zero = __ct.widen('0'); _CharT __zero = __ct.widen('0');
_CharT __one = __ct.widen('1'); _CharT __one = __ct.widen('1');
while (__c < _Size) _I __i(__is);
_I __eof;
for (; __i != __eof && __c < _Size; ++__i, ++__c)
{ {
typename _Traits::int_type __i = __is.rdbuf()->sgetc(); _CharT __ch = *__i;
if (_Traits::eq_int_type(__i, _Traits::eof())) if (__ch != __zero && __ch != __one)
{
__err |= ios_base::eofbit;
break;
}
_CharT __ch = _Traits::to_char_type(__i);
if (!_Traits::eq(__ch, __zero) && !_Traits::eq(__ch, __one))
break; break;
__str.push_back(__ch); __str.push_back(__ch);
++__c;
__is.rdbuf()->sbumpc();
} }
__is.width(0);
__x = bitset<_Size>(__str); __x = bitset<_Size>(__str);
ios_base::iostate __err = ios_base::goodbit;
if (__i == __eof)
__err |= ios_base::eofbit;
if (__c == 0) if (__c == 0)
__err |= ios_base::failbit; __err |= ios_base::failbit;
__is.setstate(__err); __is.setstate(__err);
@@ -1710,9 +1734,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is; return __is;
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>) extern template class basic_istream<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>) extern template class basic_istream<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>) extern template class basic_iostream<char>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -263,10 +263,10 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_istream<charT,traits> istream_type; typedef basic_istream<charT,traits> istream_type;
istreambuf_iterator() noexcept; istreambuf_iterator() throw();
istreambuf_iterator(istream_type& s) noexcept; istreambuf_iterator(istream_type& s) throw();
istreambuf_iterator(streambuf_type* s) noexcept; istreambuf_iterator(streambuf_type* s) throw();
istreambuf_iterator(a-private-type) noexcept; istreambuf_iterator(a-private-type) throw();
charT operator*() const; charT operator*() const;
pointer operator->() const; pointer operator->() const;
@@ -293,13 +293,13 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_ostream<charT,traits> ostream_type; typedef basic_ostream<charT,traits> ostream_type;
ostreambuf_iterator(ostream_type& s) noexcept; ostreambuf_iterator(ostream_type& s) throw();
ostreambuf_iterator(streambuf_type* s) noexcept; ostreambuf_iterator(streambuf_type* s) throw();
ostreambuf_iterator& operator=(charT c); ostreambuf_iterator& operator=(charT c);
ostreambuf_iterator& operator*(); ostreambuf_iterator& operator*();
ostreambuf_iterator& operator++(); ostreambuf_iterator& operator++();
ostreambuf_iterator& operator++(int); ostreambuf_iterator& operator++(int);
bool failed() const noexcept; bool failed() const throw();
}; };
template <class C> auto begin(C& c) -> decltype(c.begin()); template <class C> auto begin(C& c) -> decltype(c.begin());
@@ -321,9 +321,7 @@ template <class T, size_t N> T* end(T (&array)[N]);
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -337,7 +335,7 @@ template <class _Tp>
struct __has_iterator_category struct __has_iterator_category
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
template <class _Up> static __two __test(...); 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* = 0);
public: public:
@@ -490,7 +488,7 @@ next(_ForwardIter __x,
typename iterator_traits<_ForwardIter>::difference_type __n = 1, typename iterator_traits<_ForwardIter>::difference_type __n = 1,
typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0) typename enable_if<__is_forward_iterator<_ForwardIter>::value>::type* = 0)
{ {
_VSTD::advance(__x, __n); _STD::advance(__x, __n);
return __x; return __x;
} }
@@ -501,7 +499,7 @@ prev(_BidiretionalIter __x,
typename iterator_traits<_BidiretionalIter>::difference_type __n = 1, typename iterator_traits<_BidiretionalIter>::difference_type __n = 1,
typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0) typename enable_if<__is_bidirectional_iterator<_BidiretionalIter>::value>::type* = 0)
{ {
_VSTD::advance(__x, -__n); _STD::advance(__x, -__n);
return __x; return __x;
} }
@@ -626,11 +624,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_back(__value_); return *this;} {container->push_back(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_back(_VSTD::move(__value_)); return *this;} {container->push_back(_STD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
@@ -659,11 +657,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_front(__value_); return *this;} {container->push_front(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_front(_VSTD::move(__value_)); return *this;} {container->push_front(_STD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
@@ -694,11 +692,11 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {} : container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
{iter = container->insert(iter, __value_); ++iter; return *this;} {iter = container->insert(iter, __value); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} {iter = container->insert(iter, _STD::move(__value)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
@@ -769,9 +767,9 @@ public:
: __out_stream_(&__s), __delim_(0) {} : __out_stream_(&__s), __delim_(0) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
: __out_stream_(&__s), __delim_(__delimiter) {} : __out_stream_(&__s), __delim_(__delimiter) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value)
{ {
*__out_stream_ << __value_; *__out_stream_ << __value;
if (__delim_) if (__delim_)
*__out_stream_ << __delim_; *__out_stream_ << __delim_;
return *this; return *this;
@@ -815,16 +813,15 @@ private:
__sbuf_ = 0; __sbuf_ = 0;
} }
public: public:
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw()
: __sbuf_(__s.rdbuf()) {__test_for_eof();} : __sbuf_(__s.rdbuf()) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw()
: __sbuf_(__s) {__test_for_eof();} : __sbuf_(__s) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {} : __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY char_type operator*() const _LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
{return static_cast<char_type>(__sbuf_->sgetc());}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{ {
@@ -867,9 +864,9 @@ public:
private: private:
streambuf_type* __sbuf_; streambuf_type* __sbuf_;
public: public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw()
: __sbuf_(__s.rdbuf()) {} : __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw()
: __sbuf_(__s) {} : __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
{ {
@@ -880,15 +877,7 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {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 ostreambuf_iterator& operator++(int) {return *this;}
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} _LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;}
template <class _Ch, class _Tr>
friend
_LIBCPP_HIDDEN
ostreambuf_iterator<_Ch, _Tr>
__pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
ios_base& __iob, _Ch __fl);
}; };
template <class _Iter> template <class _Iter>
@@ -1017,52 +1006,43 @@ make_move_iterator(const _Iter& __i)
template <class _Iter> class __wrap_iter; template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter> template <class _Iter>
_LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter> __wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; operator+(typename __wrap_iter<_Iter>::difference_type, const __wrap_iter<_Iter>&);
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); template <class _I, class _O> _O copy(_I, _I, _O);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); template <class _I, class _O> _O move(_I, _I, _O);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if typename enable_if
< <
is_trivially_copy_assignable<_Tp>::value, is_trivially_copy_assignable<_Tp>::value,
@@ -1083,108 +1063,33 @@ public:
private: private:
iterator_type __i; iterator_type __i;
public: public:
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __wrap_iter() {}
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
#endif
}
template <class _Up> _LIBCPP_INLINE_VISIBILITY __wrap_iter(const __wrap_iter<_Up>& __u, template <class _Up> _LIBCPP_INLINE_VISIBILITY __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* = 0)
: __i(__u.base()) : __i(__u.base()) {}
{ _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__i;}
#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
__get_db()->__iterator_copy(this, &__u); _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() {++__i; return *this;}
#endif _LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int)
} {__wrap_iter __tmp(*this); ++__i; return __tmp;}
#if _LIBCPP_DEBUG_LEVEL >= 2 _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() {--__i; return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int)
__wrap_iter(const __wrap_iter& __x) {__wrap_iter __tmp(*this); --__i; return __tmp;}
: __i(__x.base()) _LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const
{ {return __wrap_iter(__i + __n);}
__get_db()->__iterator_copy(this, &__x); _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n)
} {__i += __n; return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const
__wrap_iter& operator=(const __wrap_iter& __x) {return __wrap_iter(__i - __n);}
{ _LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n)
if (this != &__x) {__i -= __n; return *this;}
{ _LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
__get_db()->__iterator_copy(this, &__x); {return __i[__n];}
__i = __x.__i;
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY
~__wrap_iter()
{
__get_db()->__erase_i(this);
}
#endif
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable iterator");
#endif
return *__i;
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to increment non-incrementable iterator");
#endif
++__i;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator++(int) _NOEXCEPT
{__wrap_iter __tmp(*this); ++(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator--() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__decrementable(this),
"Attempted to decrement non-decrementable iterator");
#endif
--__i;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator--(int) _NOEXCEPT
{__wrap_iter __tmp(*this); --(*this); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator+ (difference_type __n) const _NOEXCEPT
{__wrap_iter __w(*this); __w += __n; return __w;}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator+=(difference_type __n) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__addable(this, __n),
"Attempted to add/subtract iterator outside of valid range");
#endif
__i += __n;
return *this;
}
_LIBCPP_INLINE_VISIBILITY __wrap_iter operator- (difference_type __n) const _NOEXCEPT
{return *this + (-__n);}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator-=(difference_type __n) _NOEXCEPT
{*this += -__n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__subscriptable(this, __n),
"Attempted to subscript iterator outside of valid range");
#endif
return __i[__n];
}
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;} _LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;}
private: private:
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {} _LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) : __i(__x) {}
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_INLINE_VISIBILITY __wrap_iter(const void* __p, iterator_type __x) : __i(__x)
{
__get_db()->__insert_ic(this, __p);
}
#endif
template <class _Up> friend class __wrap_iter; template <class _Up> friend class __wrap_iter;
template <class _CharT, class _Traits, class _Alloc> friend class basic_string; template <class _CharT, class _Traits, class _Alloc> friend class basic_string;
@@ -1193,46 +1098,46 @@ private:
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
bool bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
friend friend
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&);
template <class _Iter1> template <class _Iter1>
friend friend
__wrap_iter<_Iter1> __wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; operator+(typename __wrap_iter<_Iter1>::difference_type, const __wrap_iter<_Iter1>&);
template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); template <class _I, class _O> friend _O copy(_I, _I, _O);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); template <class _I, class _O> friend _O move(_I, _I, _O);
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
@@ -1248,100 +1153,56 @@ private:
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() == __y.base(); return __x.base() == __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() < __y.base(); return __x.base() < __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
return !(__x == __y); return __x.base() != __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
return __y < __x; return __x.base() > __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
return !(__x < __y); return __x.base() >= __y.base();
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
return !(__y < __x); return __x.base() <= __y.base();
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x == __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return __y < __x;
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x < __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__y < __x);
} }
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y)
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to subtract incompatible iterators");
#endif
return __x.base() - __y.base(); return __x.base() - __y.base();
} }
@@ -1349,10 +1210,9 @@ template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter> __wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type __n, operator+(typename __wrap_iter<_Iter>::difference_type __n,
__wrap_iter<_Iter> __x) _NOEXCEPT const __wrap_iter<_Iter>& __x)
{ {
__x += __n; return __wrap_iter<_Iter>(__x.base() + __n);
return __x;
} }
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
@@ -1362,42 +1222,34 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
template <class _Container, class _Iter> class __debug_iter; template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter> template <class _Container, class _Iter>
_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter> __debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&); operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
@@ -1773,88 +1625,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(_Cp& __c) -> decltype(__c.begin()) begin(_C& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(const _Cp& __c) -> decltype(__c.begin()) begin(const _C& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(_Cp& __c) -> decltype(__c.end()) end(_C& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(const _Cp& __c) -> decltype(__c.end()) end(const _C& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::iterator typename _C::iterator
begin(_Cp& __c) begin(_C& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::const_iterator typename _C::const_iterator
begin(const _Cp& __c) begin(const _C& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::iterator typename _C::iterator
end(_Cp& __c) end(_C& __c)
{ {
return __c.end(); return __c.end();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::const_iterator typename _C::const_iterator
end(const _Cp& __c) end(const _C& __c)
{ {
return __c.end(); return __c.end();
} }
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Tp, size_t _Np> template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_Tp* _T*
begin(_Tp (&__array)[_Np]) begin(_T (&__array)[_N])
{ {
return __array; return __array;
} }
template <class _Tp, size_t _Np> template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_Tp* _T*
end(_Tp (&__array)[_Np]) end(_T (&__array)[_N])
{ {
return __array + _Np; return __array + _N;
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ namespace std
class mutex class mutex
{ {
public: public:
constexpr mutex() noexcept; mutex();
~mutex(); ~mutex();
mutex(const mutex&) = delete; mutex(const mutex&) = delete;
@@ -44,7 +44,7 @@ public:
recursive_mutex& operator=(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete;
void lock(); void lock();
bool try_lock() noexcept; bool try_lock();
void unlock(); void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
@@ -79,7 +79,7 @@ public:
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void lock(); void lock();
bool try_lock() noexcept; bool try_lock();
template <class Rep, class Period> template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time); bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -114,9 +114,9 @@ class unique_lock
{ {
public: public:
typedef Mutex mutex_type; typedef Mutex mutex_type;
unique_lock() noexcept; unique_lock();
explicit unique_lock(mutex_type& m); explicit unique_lock(mutex_type& m);
unique_lock(mutex_type& m, defer_lock_t) noexcept; unique_lock(mutex_type& m, defer_lock_t);
unique_lock(mutex_type& m, try_to_lock_t); unique_lock(mutex_type& m, try_to_lock_t);
unique_lock(mutex_type& m, adopt_lock_t); unique_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -128,8 +128,8 @@ public:
unique_lock(unique_lock const&) = delete; unique_lock(unique_lock const&) = delete;
unique_lock& operator=(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete;
unique_lock(unique_lock&& u) noexcept; unique_lock(unique_lock&& u);
unique_lock& operator=(unique_lock&& u) noexcept; unique_lock& operator=(unique_lock&& u);
void lock(); void lock();
bool try_lock(); bool try_lock();
@@ -141,16 +141,16 @@ public:
void unlock(); void unlock();
void swap(unique_lock& u) noexcept; void swap(unique_lock& u);
mutex_type* release() noexcept; mutex_type* release();
bool owns_lock() const noexcept; bool owns_lock() const;
explicit operator bool () const noexcept; explicit operator bool () const;
mutex_type* mutex() const noexcept; mutex_type* mutex() const;
}; };
template <class Mutex> template <class Mutex>
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept; void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
template <class L1, class L2, class... L3> template <class L1, class L2, class... L3>
int try_lock(L1&, L2&, L3&...); int try_lock(L1&, L2&, L3&...);
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
struct once_flag struct once_flag
{ {
constexpr once_flag() noexcept; constexpr once_flag();
once_flag(const once_flag&) = delete; once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete;
@@ -175,15 +175,8 @@ template<class Callable, class ...Args>
#include <__config> #include <__config>
#include <__mutex_base> #include <__mutex_base>
#include <functional> #include <functional>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -201,8 +194,8 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
void unlock() _NOEXCEPT; void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -224,14 +217,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock();
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -267,14 +260,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock();
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -425,27 +418,25 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_VISIBLE once_flag; struct once_flag;
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Callable, class... _Args> template<class _Callable, class... _Args>
_LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...);
void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable> template<class _Callable>
_LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable);
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_VISIBLE once_flag struct _LIBCPP_VISIBLE once_flag
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR // constexpr
once_flag() _NOEXCEPT : __state_(0) {} once_flag() {}
private: private:
once_flag(const once_flag&); // = delete; once_flag(const once_flag&); // = delete;
@@ -464,50 +455,17 @@ private:
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
}; };
#ifndef _LIBCPP_HAS_NO_VARIADICS template <class _F>
template <class _Fp>
class __call_once_param class __call_once_param
{ {
_Fp __f_; _F __f_;
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {} explicit __call_once_param(_F&& __f) : __f_(_STD::move(__f)) {}
#else #else
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _Fp& __f) : __f_(__f) {} explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif
_LIBCPP_INLINE_VISIBILITY
void operator()()
{
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index;
__execute(_Index());
}
private:
template <size_t ..._Indices>
_LIBCPP_INLINE_VISIBILITY
void __execute(__tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__f_)), _VSTD::move(_VSTD::get<_Indices>(__f_))...);
}
};
#else
template <class _Fp>
class __call_once_param
{
_Fp __f_;
public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {}
#else
_LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _Fp& __f) : __f_(__f) {}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -517,13 +475,11 @@ public:
} }
}; };
#endif template <class _F>
template <class _Fp>
void void
__call_once_proxy(void* __vp) __call_once_proxy(void* __vp)
{ {
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); __call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
(*__p)(); (*__p)();
} }
@@ -536,12 +492,13 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{ {
if (__flag.__state_ != ~0ul) if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{ {
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp; typedef decltype(std::bind(std::forward<_Callable>(__func),
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)), std::forward<_Args>(__args)...)) _G;
__decay_copy(_VSTD::forward<_Args>(__args))...)); __call_once_param<_G> __p(std::bind(std::forward<_Callable>(__func),
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); std::forward<_Args>(__args)...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
} }
} }

View File

@@ -21,34 +21,35 @@ class bad_alloc
: public exception : public exception
{ {
public: public:
bad_alloc() noexcept; bad_alloc() throw();
bad_alloc(const bad_alloc&) noexcept; bad_alloc(const bad_alloc&) throw();
bad_alloc& operator=(const bad_alloc&) noexcept; bad_alloc& operator=(const bad_alloc&) throw();
virtual const char* what() const noexcept; virtual ~bad_alloc() throw();
virtual const char* what() const throw();
}; };
struct nothrow_t {}; struct nothrow_t {};
extern const nothrow_t nothrow; extern const nothrow_t nothrow;
typedef void (*new_handler)(); typedef void (*new_handler)();
new_handler set_new_handler(new_handler new_p) noexcept; new_handler set_new_handler(new_handler new_p) throw();
new_handler get_new_handler() noexcept; new_handler get_new_handler() throw();
} // std } // std
void* operator new(std::size_t size); // replaceable void* operator new(std::size_t size) throw(std::bad_alloc); // replaceable
void* operator new(std::size_t size, const std::nothrow_t&) noexcept; // replaceable void* operator new(std::size_t size, const std::nothrow_t&) throw(); // replaceable
void operator delete(void* ptr) noexcept; // replaceable void operator delete(void* ptr) throw(); // replaceable
void operator delete(void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete(void* ptr, const std::nothrow_t&) throw(); // replaceable
void* operator new[](std::size_t size); // replaceable void* operator new[](std::size_t size) throw(std::bad_alloc); // replaceable
void* operator new[](std::size_t size, const std::nothrow_t&) noexcept; // replaceable void* operator new[](std::size_t size, const std::nothrow_t&) throw(); // replaceable
void operator delete[](void* ptr) noexcept; // replaceable void operator delete[](void* ptr) throw(); // replaceable
void operator delete[](void* ptr, const std::nothrow_t&) noexcept; // replaceable void operator delete[](void* ptr, const std::nothrow_t&) throw(); // replaceable
void* operator new (std::size_t size, void* ptr) noexcept; void* operator new (std::size_t size, void* ptr) throw();
void* operator new[](std::size_t size, void* ptr) noexcept; void* operator new[](std::size_t size, void* ptr) throw();
void operator delete (void* ptr, void*) noexcept; void operator delete (void* ptr, void*) throw();
void operator delete[](void* ptr, void*) noexcept; void operator delete[](void* ptr, void*) throw();
*/ */
@@ -56,9 +57,7 @@ void operator delete[](void* ptr, void*) noexcept;
#include <exception> #include <exception>
#include <cstddef> #include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -67,18 +66,18 @@ class _LIBCPP_EXCEPTION_ABI bad_alloc
: public exception : public exception
{ {
public: public:
bad_alloc() _NOEXCEPT; bad_alloc() throw();
virtual ~bad_alloc() _NOEXCEPT; virtual ~bad_alloc() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
class _LIBCPP_EXCEPTION_ABI bad_array_new_length class _LIBCPP_EXCEPTION_ABI bad_array_new_length
: public bad_alloc : public bad_alloc
{ {
public: public:
bad_array_new_length() _NOEXCEPT; bad_array_new_length() throw();
virtual ~bad_array_new_length() _NOEXCEPT; virtual ~bad_array_new_length() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
void __throw_bad_alloc(); // not in C++ spec void __throw_bad_alloc(); // not in C++ spec
@@ -86,32 +85,24 @@ void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_VISIBLE nothrow_t {}; struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_VISIBLE const nothrow_t nothrow; extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)(); typedef void (*new_handler)();
_LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT; _LIBCPP_VISIBLE new_handler set_new_handler(new_handler) throw();
_LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT; _LIBCPP_VISIBLE new_handler get_new_handler() throw();
} // std } // std
_LIBCPP_VISIBLE void* operator new(std::size_t __sz) _LIBCPP_VISIBLE void* operator new(std::size_t) throw(std::bad_alloc);
#if !__has_feature(cxx_noexcept) _LIBCPP_VISIBLE void* operator new(std::size_t, const std::nothrow_t&) throw();
throw(std::bad_alloc) _LIBCPP_VISIBLE void operator delete(void*) throw();
#endif _LIBCPP_VISIBLE void operator delete(void*, const std::nothrow_t&) throw();
;
_LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz) _LIBCPP_VISIBLE void* operator new[](std::size_t) throw(std::bad_alloc);
#if !__has_feature(cxx_noexcept) _LIBCPP_VISIBLE void* operator new[](std::size_t, const std::nothrow_t&) throw();
throw(std::bad_alloc) _LIBCPP_VISIBLE void operator delete[](void*) throw();
#endif _LIBCPP_VISIBLE void operator delete[](void*, const std::nothrow_t&) throw();
;
_LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) throw() {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) throw() {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) throw() {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) throw() {}
#endif // _LIBCPP_NEW #endif // _LIBCPP_NEW

View File

@@ -60,9 +60,7 @@ template <class ForwardIterator, class T>
#include <__config> #include <__config>
#include <iterator> #include <iterator>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -186,10 +184,10 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value_) iota(_ForwardIterator __first, _ForwardIterator __last, _Tp __value)
{ {
for (; __first != __last; ++__first, ++__value_) for (; __first != __last; ++__first, ++__value)
*__first = __value_; *__first = __value;
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -133,9 +133,7 @@ template <class charT, class traits, class T>
#include <iterator> #include <iterator>
#include <bitset> #include <bitset>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -156,20 +154,18 @@ public:
virtual ~basic_ostream(); virtual ~basic_ostream();
protected: protected:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream(basic_ostream&& __rhs); basic_ostream(basic_ostream&& __rhs);
#endif #endif
// 27.7.2.3 Assign/swap // 27.7.2.3 Assign/swap
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs); basic_ostream& operator=(basic_ostream&& __rhs);
#endif #endif
void swap(basic_ostream& __rhs); void swap(basic_ostream& __rhs);
public: public:
// 27.7.2.4 Prefix/suffix: // 27.7.2.4 Prefix/suffix:
class _LIBCPP_VISIBLE sentry; class sentry;
// 27.7.2.6 Formatted output: // 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
@@ -220,7 +216,7 @@ public:
~sentry(); ~sentry();
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT // explicit
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -342,11 +338,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
_Ip __i(__sb); _I __i(__sb);
_Ip __eof; _I __eof;
_Op __o(*this); _O __o(*this);
size_t __c = 0; size_t __c = 0;
for (; __i != __eof; ++__i, ++__o, ++__c) for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
@@ -388,8 +384,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -415,8 +411,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) : static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -444,8 +440,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -471,8 +467,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) : static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -500,8 +496,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -526,8 +522,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -552,8 +548,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -578,8 +574,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -604,8 +600,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -630,8 +626,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -656,8 +652,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -682,8 +678,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -708,8 +704,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -734,8 +730,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -767,8 +763,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
if (__s) if (__s)
{ {
_CharT __c = __os.widen(__cn); _CharT __c = __os.widen(__cn);
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -799,8 +795,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -831,8 +827,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -863,8 +859,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -895,9 +891,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -928,7 +924,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = char_traits<char>::length(__strn); size_t __len = char_traits<char>::length(__strn);
const int __bs = 100; const int __bs = 100;
_CharT __wbb[__bs]; _CharT __wbb[__bs];
@@ -943,7 +939,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
} }
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn); *__p = __os.widen(*__strn);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__wb, __wb,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__wb + __len : __wb + __len :
@@ -974,9 +970,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -1007,9 +1003,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1040,9 +1036,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1073,8 +1069,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
_Op __o(*this); _O __o(*this);
*__o = __c; *__o = __c;
if (__o.failed()) if (__o.failed())
this->setstate(ios_base::badbit); this->setstate(ios_base::badbit);
@@ -1100,8 +1096,8 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
sentry __sen(*this); sentry __sen(*this);
if (__sen && __n) if (__sen && __n)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
_Op __o(*this); _O __o(*this);
for (; __n; --__n, ++__o, ++__s) for (; __n; --__n, ++__o, ++__s)
{ {
*__o = *__s; *__o = *__s;
@@ -1218,12 +1214,12 @@ typename enable_if
< <
!is_lvalue_reference<_Stream>::value && !is_lvalue_reference<_Stream>::value &&
is_base_of<ios_base, _Stream>::value, is_base_of<ios_base, _Stream>::value,
_Stream&& _Stream&
>::type >::type
operator<<(_Stream&& __os, const _Tp& __x) operator<<(_Stream&& __os, const _Tp& __x)
{ {
__os << __x; __os << __x;
return _VSTD::move(__os); return __os;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1240,9 +1236,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = __str.size(); size_t __len = __str.size();
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str.data(), __str.data(),
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str.data() + __len : __str.data() + __len :
@@ -1270,10 +1266,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
return __os << __ec.category().name() << ':' << __ec.value(); return __os << __ec.category().name() << ':' << __ec.value();
} }
template<class _CharT, class _Traits, class _Yp> template<class _CharT, class _Traits, class _Y>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
{ {
return __os << __p.get(); return __os << __p.get();
} }
@@ -1287,8 +1283,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>) extern template class basic_ostream<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>) extern template class basic_ostream<wchar_t>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -31,28 +31,21 @@ protected:
container_type c; container_type c;
public: public:
queue() = default; queue();
~queue() = default;
queue(const queue& q) = default;
queue(queue&& q) = default;
queue& operator=(const queue& q) = default;
queue& operator=(queue&& q) = default;
explicit queue(const container_type& c); explicit queue(const container_type& c);
explicit queue(container_type&& c) explicit queue(container_type&& c);
queue(queue&& q);
template <class Alloc> template <class Alloc>
explicit queue(const Alloc& a); explicit queue(const Alloc& a);
template <class Alloc> template <class Alloc>
queue(const container_type& c, const Alloc& a); queue(const container_type& c, const Alloc& a);
template <class Alloc> template <class Alloc>
queue(container_type&& c, const Alloc& a); queue(container_type&& c, const Alloc& a);
template <class Alloc>
queue(const queue& q, const Alloc& a);
template <class Alloc> template <class Alloc>
queue(queue&& q, const Alloc& a); queue(queue&& q, const Alloc& a);
queue& operator=(queue&& q);
bool empty() const; bool empty() const;
size_type size() const; size_type size() const;
@@ -66,7 +59,7 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(queue& q) noexcept(noexcept(swap(c, q.c))); void swap(queue& q);
}; };
template <class T, class Container> template <class T, class Container>
@@ -88,8 +81,7 @@ template <class T, class Container>
bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y); bool operator<=(const queue<T, Container>& x,const queue<T, Container>& y);
template <class T, class Container> template <class T, class Container>
void swap(queue<T, Container>& x, queue<T, Container>& y) void swap(queue<T, Container>& x, queue<T, Container>& y);
noexcept(noexcept(x.swap(y)));
template <class T, class Container = vector<T>, template <class T, class Container = vector<T>,
class Compare = less<typename Container::value_type>> class Compare = less<typename Container::value_type>>
@@ -107,16 +99,7 @@ protected:
Compare comp; Compare comp;
public: public:
priority_queue() = default; explicit priority_queue(const Compare& comp = Compare());
~priority_queue() = default;
priority_queue(const priority_queue& q) = default;
priority_queue(priority_queue&& q) = default;
priority_queue& operator=(const priority_queue& q) = default;
priority_queue& operator=(priority_queue&& q) = default;
explicit priority_queue(const Compare& comp);
priority_queue(const Compare& comp, const container_type& c); priority_queue(const Compare& comp, const container_type& c);
explicit priority_queue(const Compare& comp, container_type&& c); explicit priority_queue(const Compare& comp, container_type&& c);
template <class InputIterator> template <class InputIterator>
@@ -128,6 +111,8 @@ public:
template <class InputIterator> template <class InputIterator>
priority_queue(InputIterator first, InputIterator last, priority_queue(InputIterator first, InputIterator last,
const Compare& comp, container_type&& c); const Compare& comp, container_type&& c);
priority_queue(priority_queue&& q);
priority_queue& operator=(priority_queue&& q);
template <class Alloc> template <class Alloc>
explicit priority_queue(const Alloc& a); explicit priority_queue(const Alloc& a);
template <class Alloc> template <class Alloc>
@@ -138,8 +123,6 @@ public:
template <class Alloc> template <class Alloc>
priority_queue(const Compare& comp, container_type&& c, priority_queue(const Compare& comp, container_type&& c,
const Alloc& a); const Alloc& a);
template <class Alloc>
priority_queue(const priority_queue& q, const Alloc& a);
template <class Alloc> template <class Alloc>
priority_queue(priority_queue&& q, const Alloc& a); priority_queue(priority_queue&& q, const Alloc& a);
@@ -152,14 +135,12 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(priority_queue& q) void swap(priority_queue& q);
noexcept(noexcept(swap(c, q.c)) && noexcept(swap(comp.q.comp)));
}; };
template <class T, class Container, class Compare> template <class T, class Container, class Compare>
void swap(priority_queue<T, Container, Compare>& x, void swap(priority_queue<T, Container, Compare>& x,
priority_queue<T, Container, Compare>& y) priority_queue<T, Container, Compare>& y);
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -171,21 +152,17 @@ template <class T, class Container, class Compare>
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_VISIBLE queue; template <class _Tp, class _Container> class queue;
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
@@ -204,35 +181,14 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
queue() queue() : c() {}
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
queue(const queue& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(const queue& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit queue(const container_type& __c) : c(__c) {} explicit queue(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit queue(container_type&& __c) : c(_VSTD::move(__c)) {} explicit queue(container_type&& __c) : c(_STD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
queue(queue&& __q) : c(_STD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -258,14 +214,20 @@ public:
queue(container_type&& __c, const _Alloc& __a, queue(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_VSTD::move(__c), __a) {} : c(_STD::move(__c), __a) {}
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
queue(queue&& __q, const _Alloc& __a, queue(queue&& __q, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_VSTD::move(__q.c), __a) {} : c(_STD::move(__q.c), __a) {}
_LIBCPP_INLINE_VISIBILITY
queue& operator=(queue&& __q)
{
c = _STD::move(__q.c);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -286,12 +248,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);} void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args) void emplace(_Args&&... __args)
{c.emplace_back(_VSTD::forward<_Args>(__args)...);} {c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -299,9 +261,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(queue& __q) void swap(queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(c, __q.c); swap(c, __q.c);
} }
@@ -370,7 +331,6 @@ template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y) swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -399,36 +359,7 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
priority_queue() explicit priority_queue(const value_compare& __comp = value_compare())
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value &&
is_nothrow_default_constructible<value_compare>::value)
: c(), comp() {}
_LIBCPP_INLINE_VISIBILITY
priority_queue(const priority_queue& __q) : c(__q.c), comp(__q.comp) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value &&
is_nothrow_move_constructible<value_compare>::value)
: c(_VSTD::move(__q.c)), comp(_VSTD::move(__q.comp)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(const priority_queue& __q)
{c = __q.c; comp = __q.comp; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
priority_queue& operator=(priority_queue&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value &&
is_nothrow_move_assignable<value_compare>::value)
{c = _VSTD::move(__q.c); comp = _VSTD::move(__q.comp); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
explicit priority_queue(const value_compare& __comp)
: c(), comp(__comp) {} : c(), comp(__comp) {}
priority_queue(const value_compare& __comp, const container_type& __c); priority_queue(const value_compare& __comp, const container_type& __c);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -444,6 +375,8 @@ public:
template <class _InputIter> template <class _InputIter>
priority_queue(_InputIter __f, _InputIter __l, priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, container_type&& __c); const value_compare& __comp, container_type&& __c);
priority_queue(priority_queue&& __q);
priority_queue& operator=(priority_queue&& __q);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
explicit priority_queue(const _Alloc& __a, explicit priority_queue(const _Alloc& __a,
@@ -490,9 +423,7 @@ public:
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void pop(); void pop();
void swap(priority_queue& __q) void swap(priority_queue& __q);
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value);
}; };
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -502,7 +433,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const _Compare& __comp
: c(__c), : c(__c),
comp(__comp) comp(__comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -511,10 +442,10 @@ template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp, priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& __comp,
container_type&& __c) container_type&& __c)
: c(_VSTD::move(__c)), : c(_STD::move(__c)),
comp(__comp) comp(__comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -527,7 +458,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
: c(__f, __l), : c(__f, __l),
comp(__comp) comp(__comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -540,7 +471,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _Input
comp(__comp) comp(__comp)
{ {
c.insert(c.end(), __f, __l); c.insert(c.end(), __f, __l);
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -551,11 +482,28 @@ inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l, priority_queue<_Tp, _Container, _Compare>::priority_queue(_InputIter __f, _InputIter __l,
const value_compare& __comp, const value_compare& __comp,
container_type&& __c) container_type&& __c)
: c(_VSTD::move(__c)), : c(_STD::move(__c)),
comp(__comp) comp(__comp)
{ {
c.insert(c.end(), __f, __l); c.insert(c.end(), __f, __l);
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
}
template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY
priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q)
: c(_STD::move(__q.c)),
comp(_STD::move(__q.comp))
{
}
template <class _Tp, class _Container, class _Compare>
priority_queue<_Tp, _Container, _Compare>&
priority_queue<_Tp, _Container, _Compare>::operator=(priority_queue&& __q)
{
c = _STD::move(__q.c);
comp = _STD::move(__q.comp);
return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -593,7 +541,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
: c(__c, __a), : c(__c, __a),
comp(__comp) comp(__comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -606,7 +554,7 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const priority_queue&
: c(__q.c, __a), : c(__q.c, __a),
comp(__q.comp) comp(__q.comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -619,10 +567,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(const value_compare& _
const _Alloc& __a, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*) _Alloc>::value>::type*)
: c(_VSTD::move(__c), __a), : c(_STD::move(__c), __a),
comp(__comp) comp(__comp)
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
template <class _Tp, class _Container, class _Compare> template <class _Tp, class _Container, class _Compare>
@@ -632,10 +580,10 @@ priority_queue<_Tp, _Container, _Compare>::priority_queue(priority_queue&& __q,
const _Alloc& __a, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type*) _Alloc>::value>::type*)
: c(_VSTD::move(__q.c), __a), : c(_STD::move(__q.c), __a),
comp(_VSTD::move(__q.comp)) comp(_STD::move(__q.comp))
{ {
_VSTD::make_heap(c.begin(), c.end(), comp); _STD::make_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -646,7 +594,7 @@ void
priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v) priority_queue<_Tp, _Container, _Compare>::push(const value_type& __v)
{ {
c.push_back(__v); c.push_back(__v);
_VSTD::push_heap(c.begin(), c.end(), comp); _STD::push_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -656,8 +604,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v) priority_queue<_Tp, _Container, _Compare>::push(value_type&& __v)
{ {
c.push_back(_VSTD::move(__v)); c.push_back(_STD::move(__v));
_VSTD::push_heap(c.begin(), c.end(), comp); _STD::push_heap(c.begin(), c.end(), comp);
} }
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -668,8 +616,8 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args) priority_queue<_Tp, _Container, _Compare>::emplace(_Args&&... __args)
{ {
c.emplace_back(_VSTD::forward<_Args>(__args)...); c.emplace_back(_STD::forward<_Args>(__args)...);
_VSTD::push_heap(c.begin(), c.end(), comp); _STD::push_heap(c.begin(), c.end(), comp);
} }
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
@@ -680,7 +628,7 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::pop() priority_queue<_Tp, _Container, _Compare>::pop()
{ {
_VSTD::pop_heap(c.begin(), c.end(), comp); _STD::pop_heap(c.begin(), c.end(), comp);
c.pop_back(); c.pop_back();
} }
@@ -688,10 +636,8 @@ template <class _Tp, class _Container, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q) priority_queue<_Tp, _Container, _Compare>::swap(priority_queue& __q)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value &&
__is_nothrow_swappable<value_compare>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(c, __q.c); swap(c, __q.c);
swap(comp, __q.comp); swap(comp, __q.comp);
} }
@@ -701,7 +647,6 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(priority_queue<_Tp, _Container, _Compare>& __x, swap(priority_queue<_Tp, _Container, _Compare>& __x,
priority_queue<_Tp, _Container, _Compare>& __y) priority_queue<_Tp, _Container, _Compare>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -70,11 +70,7 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits> #include <climits>
#include <type_traits> #include <type_traits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -92,12 +88,6 @@ struct __static_gcd<_Xp, 0>
static const intmax_t value = _Xp; static const intmax_t value = _Xp;
}; };
template <>
struct __static_gcd<0, 0>
{
static const intmax_t value = 1;
};
// __static_lcm // __static_lcm
template <intmax_t _Xp, intmax_t _Yp> template <intmax_t _Xp, intmax_t _Yp>
@@ -284,19 +274,10 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_multiply
= typename __ratio_multiply<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_multiply struct _LIBCPP_VISIBLE ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {}; : public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_divide struct __ratio_divide
{ {
@@ -311,19 +292,10 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_divide
= typename __ratio_divide<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_divide struct _LIBCPP_VISIBLE ratio_divide
: public __ratio_divide<_R1, _R2>::type {}; : public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_add struct __ratio_add
{ {
@@ -346,19 +318,10 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_add
= typename __ratio_add<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_add struct _LIBCPP_VISIBLE ratio_add
: public __ratio_add<_R1, _R2>::type {}; : public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct __ratio_subtract struct __ratio_subtract
{ {
@@ -381,19 +344,10 @@ public:
>::type type; >::type type;
}; };
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> using ratio_subtract
= typename __ratio_subtract<_R1, _R2>::type;
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_VISIBLE ratio_subtract struct _LIBCPP_VISIBLE ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {}; : public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
// ratio_equal // ratio_equal
template <class _R1, class _R2> template <class _R1, class _R2>
@@ -414,27 +368,27 @@ struct __ratio_less1
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2; static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp> template <class _R1, class _R2, bool _Odd, intmax_t _Q>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
{ {
static const bool value = false; static const bool value = false;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2> template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
{ {
static const bool value = !_Odd; static const bool value = !_Odd;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1> template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
{ {
static const bool value = _Odd; static const bool value = _Odd;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1, template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
intmax_t _M2> intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
{ {
static const bool value = __ratio_less1<ratio<_R1::den, _M1>, static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
ratio<_R2::den, _M2>, !_Odd>::value; ratio<_R2::den, _M2>, !_Odd>::value;

File diff suppressed because it is too large Load Diff

View File

@@ -49,25 +49,24 @@ public:
scoped_allocator_adaptor(); scoped_allocator_adaptor();
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(OuterA2&& outerAlloc, scoped_allocator_adaptor(OuterA2&& outerAlloc,
const InnerAllocs&... innerAllocs) noexcept; const InnerAllocs&... innerAllocs);
scoped_allocator_adaptor(const scoped_allocator_adaptor& other) noexcept; scoped_allocator_adaptor(const scoped_allocator_adaptor& other);
scoped_allocator_adaptor(scoped_allocator_adaptor&& other) noexcept;
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other) noexcept; scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& other);
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other) noexcept; scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2, InnerAllocs...>&& other);
~scoped_allocator_adaptor(); ~scoped_allocator_adaptor();
inner_allocator_type& inner_allocator() noexcept; inner_allocator_type& inner_allocator();
const inner_allocator_type& inner_allocator() const noexcept; const inner_allocator_type& inner_allocator() const;
outer_allocator_type& outer_allocator() noexcept; outer_allocator_type& outer_allocator();
const outer_allocator_type& outer_allocator() const noexcept; const outer_allocator_type& outer_allocator() const;
pointer allocate(size_type n); pointer allocate(size_type n);
pointer allocate(size_type n, const_void_pointer hint); pointer allocate(size_type n, const_void_pointer hint);
void deallocate(pointer p, size_type n) noexcept; void deallocate(pointer p, size_type n);
size_type max_size() const; size_type max_size() const;
template <class T, class... Args> void construct(T* p, Args&& args); template <class T, class... Args> void construct(T* p, Args&& args);
@@ -84,20 +83,18 @@ public:
void construct(pair<T1, T2>* p, pair<U, V>&& x); void construct(pair<T1, T2>* p, pair<U, V>&& x);
template <class T> void destroy(T* p); template <class T> void destroy(T* p);
template <class T> void destroy(T* p) noexcept; scoped_allocator_adaptor select_on_container_copy_construction() const;
scoped_allocator_adaptor select_on_container_copy_construction() const noexcept;
}; };
template <class OuterA1, class OuterA2, class... InnerAllocs> template <class OuterA1, class OuterA2, class... InnerAllocs>
bool bool
operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, operator==(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept; const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
template <class OuterA1, class OuterA2, class... InnerAllocs> template <class OuterA1, class OuterA2, class... InnerAllocs>
bool bool
operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a, operator!=(const scoped_allocator_adaptor<OuterA1, InnerAllocs...>& a,
const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b) noexcept; const scoped_allocator_adaptor<OuterA2, InnerAllocs...>& b);
} // std } // std
@@ -106,9 +103,7 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
#include <__config> #include <__config>
#include <memory> #include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -187,7 +182,7 @@ private:
protected: protected:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() _NOEXCEPT {} __scoped_allocator_storage() {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -195,8 +190,8 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc, __scoped_allocator_storage(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT const _InnerAllocs& ...__innerAllocs)
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)), : outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)),
__inner_(__innerAllocs...) {} __inner_(__innerAllocs...) {}
template <class _OuterA2, template <class _OuterA2,
@@ -205,7 +200,7 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT const __scoped_allocator_storage<_OuterA2, _InnerAllocs...>& __other)
: outer_allocator_type(__other.outer_allocator()), : outer_allocator_type(__other.outer_allocator()),
__inner_(__other.inner_allocator()) {} __inner_(__other.inner_allocator()) {}
@@ -215,9 +210,9 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT __scoped_allocator_storage<_OuterA2, _InnerAllocs...>&& __other)
: outer_allocator_type(_VSTD::move(__other.outer_allocator())), : outer_allocator_type(_STD::move(__other.outer_allocator())),
__inner_(_VSTD::move(__other.inner_allocator())) {} __inner_(_STD::move(__other.inner_allocator())) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -225,27 +220,27 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __o, __scoped_allocator_storage(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT const inner_allocator_type& __i)
: outer_allocator_type(_VSTD::forward<_OuterA2>(__o)), : outer_allocator_type(_STD::forward<_OuterA2>(__o)),
__inner_(__i) __inner_(__i)
{ {
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT {return __inner_;} inner_allocator_type& inner_allocator() {return __inner_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT {return __inner_;} const inner_allocator_type& inner_allocator() const {return __inner_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);} {return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);} {return static_cast<const outer_allocator_type&>(*this);}
scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
select_on_container_copy_construction() const _NOEXCEPT select_on_container_copy_construction() const
{ {
return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...> return scoped_allocator_adaptor<outer_allocator_type, _InnerAllocs...>
( (
@@ -268,15 +263,15 @@ protected:
typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type; typedef scoped_allocator_adaptor<_OuterAlloc> inner_allocator_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage() _NOEXCEPT {} __scoped_allocator_storage() {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value is_constructible<outer_allocator_type, _OuterA2>::value
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage(_OuterA2&& __outerAlloc) _NOEXCEPT __scoped_allocator_storage(_OuterA2&& __outerAlloc)
: outer_allocator_type(_VSTD::forward<_OuterA2>(__outerAlloc)) {} : outer_allocator_type(_STD::forward<_OuterA2>(__outerAlloc)) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -284,7 +279,7 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
const __scoped_allocator_storage<_OuterA2>& __other) _NOEXCEPT const __scoped_allocator_storage<_OuterA2>& __other)
: outer_allocator_type(__other.outer_allocator()) {} : outer_allocator_type(__other.outer_allocator()) {}
template <class _OuterA2, template <class _OuterA2,
@@ -293,33 +288,33 @@ protected:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__scoped_allocator_storage( __scoped_allocator_storage(
__scoped_allocator_storage<_OuterA2>&& __other) _NOEXCEPT __scoped_allocator_storage<_OuterA2>&& __other)
: outer_allocator_type(_VSTD::move(__other.outer_allocator())) {} : outer_allocator_type(_STD::move(__other.outer_allocator())) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT inner_allocator_type& inner_allocator()
{return static_cast<inner_allocator_type&>(*this);} {return static_cast<inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT const inner_allocator_type& inner_allocator() const
{return static_cast<const inner_allocator_type&>(*this);} {return static_cast<const inner_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT outer_allocator_type& outer_allocator()
{return static_cast<outer_allocator_type&>(*this);} {return static_cast<outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT const outer_allocator_type& outer_allocator() const
{return static_cast<const outer_allocator_type&>(*this);} {return static_cast<const outer_allocator_type&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor<outer_allocator_type> scoped_allocator_adaptor<outer_allocator_type>
select_on_container_copy_construction() const _NOEXCEPT select_on_container_copy_construction() const
{return scoped_allocator_adaptor<outer_allocator_type>( {return scoped_allocator_adaptor<outer_allocator_type>(
allocator_traits<outer_allocator_type>:: allocator_traits<outer_allocator_type>::
select_on_container_copy_construction(outer_allocator()) select_on_container_copy_construction(outer_allocator())
);} );}
__scoped_allocator_storage(const outer_allocator_type& __o, __scoped_allocator_storage(const outer_allocator_type& __o,
const inner_allocator_type& __i) _NOEXCEPT; const inner_allocator_type& __i);
template <class...> friend class __scoped_allocator_storage; template <class...> friend class __scoped_allocator_storage;
}; };
@@ -348,7 +343,7 @@ struct __outermost
{ {
typedef _Alloc type; typedef _Alloc type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
type& operator()(type& __a) const _NOEXCEPT {return __a;} type& operator()(type& __a) const {return __a;}
}; };
template <class _Alloc> template <class _Alloc>
@@ -356,11 +351,11 @@ struct __outermost<_Alloc, true>
{ {
typedef typename remove_reference typedef typename remove_reference
< <
decltype(_VSTD::declval<_Alloc>().outer_allocator()) decltype(_STD::declval<_Alloc>().outer_allocator())
>::type _OuterAlloc; >::type _OuterAlloc;
typedef typename __outermost<_OuterAlloc>::type type; typedef typename __outermost<_OuterAlloc>::type type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
type& operator()(_Alloc& __a) const _NOEXCEPT type& operator()(_Alloc& __a) const
{return __outermost<_OuterAlloc>()(__a.outer_allocator());} {return __outermost<_OuterAlloc>()(__a.outer_allocator());}
}; };
@@ -408,15 +403,15 @@ public:
}; };
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor() _NOEXCEPT {} scoped_allocator_adaptor() {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
is_constructible<outer_allocator_type, _OuterA2>::value is_constructible<outer_allocator_type, _OuterA2>::value
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __outerAlloc, scoped_allocator_adaptor(_OuterA2&& __outerAlloc,
const _InnerAllocs& ...__innerAllocs) _NOEXCEPT const _InnerAllocs& ...__innerAllocs)
: base(_VSTD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {} : base(_STD::forward<_OuterA2>(__outerAlloc), __innerAllocs...) {}
// scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default; // scoped_allocator_adaptor(const scoped_allocator_adaptor& __other) = default;
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -424,7 +419,7 @@ public:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor( scoped_allocator_adaptor(
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other) _NOEXCEPT const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __other)
: base(__other) {} : base(__other) {}
template <class _OuterA2, template <class _OuterA2,
class = typename enable_if< class = typename enable_if<
@@ -432,23 +427,23 @@ public:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor( scoped_allocator_adaptor(
scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other) _NOEXCEPT scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>&& __other)
: base(_VSTD::move(__other)) {} : base(_STD::move(__other)) {}
// ~scoped_allocator_adaptor() = default; // ~scoped_allocator_adaptor() = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
inner_allocator_type& inner_allocator() _NOEXCEPT inner_allocator_type& inner_allocator()
{return base::inner_allocator();} {return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const inner_allocator_type& inner_allocator() const _NOEXCEPT const inner_allocator_type& inner_allocator() const
{return base::inner_allocator();} {return base::inner_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
outer_allocator_type& outer_allocator() _NOEXCEPT outer_allocator_type& outer_allocator()
{return base::outer_allocator();} {return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const outer_allocator_type& outer_allocator() const _NOEXCEPT const outer_allocator_type& outer_allocator() const
{return base::outer_allocator();} {return base::outer_allocator();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -461,7 +456,7 @@ public:
allocate(outer_allocator(), __n, __hint);} allocate(outer_allocator(), __n, __hint);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void deallocate(pointer __p, size_type __n) _NOEXCEPT void deallocate(pointer __p, size_type __n)
{allocator_traits<outer_allocator_type>:: {allocator_traits<outer_allocator_type>::
deallocate(outer_allocator(), __p, __n);} deallocate(outer_allocator(), __p, __n);}
@@ -473,7 +468,7 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void construct(_Tp* __p, _Args&& ...__args) void construct(_Tp* __p, _Args&& ...__args)
{__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(), {__construct(__uses_alloc_ctor<_Tp, inner_allocator_type, _Args...>(),
__p, _VSTD::forward<_Args>(__args)...);} __p, _STD::forward<_Args>(__args)...);}
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void destroy(_Tp* __p) void destroy(_Tp* __p)
@@ -484,7 +479,7 @@ public:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor select_on_container_copy_construction() const _NOEXCEPT scoped_allocator_adaptor select_on_container_copy_construction() const
{return base::select_on_container_copy_construction();} {return base::select_on_container_copy_construction();}
private: private:
@@ -495,8 +490,8 @@ private:
>::type> >::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
scoped_allocator_adaptor(_OuterA2&& __o, scoped_allocator_adaptor(_OuterA2&& __o,
const inner_allocator_type& __i) _NOEXCEPT const inner_allocator_type& __i)
: base(_VSTD::forward<_OuterA2>(__o), __i) {} : base(_STD::forward<_OuterA2>(__o), __i) {}
template <class _Tp, class... _Args> template <class _Tp, class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -507,7 +502,7 @@ private:
( (
_OM()(outer_allocator()), _OM()(outer_allocator()),
__p, __p,
_VSTD::forward<_Args>(__args)... _STD::forward<_Args>(__args)...
); );
} }
@@ -522,7 +517,7 @@ private:
__p, __p,
allocator_arg, allocator_arg,
inner_allocator(), inner_allocator(),
_VSTD::forward<_Args>(__args)... _STD::forward<_Args>(__args)...
); );
} }
@@ -535,7 +530,7 @@ private:
( (
_OM()(outer_allocator()), _OM()(outer_allocator()),
__p, __p,
_VSTD::forward<_Args>(__args)..., _STD::forward<_Args>(__args)...,
inner_allocator() inner_allocator()
); );
} }
@@ -547,16 +542,16 @@ template <class _OuterA1, class _OuterA2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const scoped_allocator_adaptor<_OuterA1>& __a, operator==(const scoped_allocator_adaptor<_OuterA1>& __a,
const scoped_allocator_adaptor<_OuterA2>& __b) _NOEXCEPT const scoped_allocator_adaptor<_OuterA2>& __b)
{ {
return __a.outer_allocator() == __b.outer_allocator(); return __a.outer_allocator() == __b.outer_allocator();
} }
template <class _OuterA1, class _OuterA2, class _InnerA0, class... _InnerAllocs> template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const scoped_allocator_adaptor<_OuterA1, _InnerA0, _InnerAllocs...>& __a, operator==(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerA0, _InnerAllocs...>& __b) _NOEXCEPT const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
{ {
return __a.outer_allocator() == __b.outer_allocator() && return __a.outer_allocator() == __b.outer_allocator() &&
__a.inner_allocator() == __b.inner_allocator(); __a.inner_allocator() == __b.inner_allocator();
@@ -566,7 +561,7 @@ template <class _OuterA1, class _OuterA2, class... _InnerAllocs>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a, operator!=(const scoped_allocator_adaptor<_OuterA1, _InnerAllocs...>& __a,
const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b) _NOEXCEPT const scoped_allocator_adaptor<_OuterA2, _InnerAllocs...>& __b)
{ {
return !(__a == __b); return !(__a == __b);
} }

View File

@@ -42,12 +42,7 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
set() explicit set(const value_compare& comp = value_compare());
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit set(const value_compare& comp);
set(const value_compare& comp, const allocator_type& a); set(const value_compare& comp, const allocator_type& a);
template <class InputIterator> template <class InputIterator>
set(InputIterator first, InputIterator last, set(InputIterator first, InputIterator last,
@@ -56,10 +51,7 @@ public:
set(InputIterator first, InputIterator last, const value_compare& comp, set(InputIterator first, InputIterator last, const value_compare& comp,
const allocator_type& a); const allocator_type& a);
set(const set& s); set(const set& s);
set(set&& s) set(set&& s);
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit set(const allocator_type& a); explicit set(const allocator_type& a);
set(const set& s, const allocator_type& a); set(const set& s, const allocator_type& a);
set(set&& s, const allocator_type& a); set(set&& s, const allocator_type& a);
@@ -69,33 +61,29 @@ public:
~set(); ~set();
set& operator=(const set& s); set& operator=(const set& s);
set& operator=(set&& s) set& operator=(set&& s);
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
set& operator=(initializer_list<value_type> il); set& operator=(initializer_list<value_type> il);
// iterators: // iterators:
iterator begin() noexcept; iterator begin();
const_iterator begin() const noexcept; const_iterator begin() const;
iterator end() noexcept; iterator end();
const_iterator end() const noexcept; const_iterator end() const;
reverse_iterator rbegin() noexcept; reverse_iterator rbegin();
const_reverse_iterator rbegin() const noexcept; const_reverse_iterator rbegin() const;
reverse_iterator rend() noexcept; reverse_iterator rend();
const_reverse_iterator rend() const noexcept; const_reverse_iterator rend() const;
const_iterator cbegin() const noexcept; const_iterator cbegin() const;
const_iterator cend() const noexcept; const_iterator cend() const;
const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const noexcept; const_reverse_iterator crend() const;
// capacity: // capacity:
bool empty() const noexcept; bool empty() const;
size_type size() const noexcept; size_type size() const;
size_type max_size() const noexcept; size_type max_size() const;
// modifiers: // modifiers:
template <class... Args> template <class... Args>
@@ -113,16 +101,12 @@ public:
iterator erase(const_iterator position); iterator erase(const_iterator position);
size_type erase(const key_type& k); size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last); iterator erase(const_iterator first, const_iterator last);
void clear() noexcept; void clear();
void swap(set& s) void swap(set& s);
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers: // observers:
allocator_type get_allocator() const noexcept; allocator_type get_allocator() const;
key_compare key_comp() const; key_compare key_comp() const;
value_compare value_comp() const; value_compare value_comp() const;
@@ -171,8 +155,7 @@ operator<=(const set<Key, Compare, Allocator>& x,
// specialized algorithms: // specialized algorithms:
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
void void
swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y) swap(set<Key, Compare, Allocator>& x, set<Key, Compare, Allocator>& y);
noexcept(noexcept(x.swap(y)));
template <class Key, class Compare = less<Key>, template <class Key, class Compare = less<Key>,
class Allocator = allocator<Key>> class Allocator = allocator<Key>>
@@ -198,12 +181,7 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator; typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
multiset() explicit multiset(const value_compare& comp = value_compare());
noexcept(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value);
explicit multiset(const value_compare& comp);
multiset(const value_compare& comp, const allocator_type& a); multiset(const value_compare& comp, const allocator_type& a);
template <class InputIterator> template <class InputIterator>
multiset(InputIterator first, InputIterator last, multiset(InputIterator first, InputIterator last,
@@ -212,10 +190,7 @@ public:
multiset(InputIterator first, InputIterator last, multiset(InputIterator first, InputIterator last,
const value_compare& comp, const allocator_type& a); const value_compare& comp, const allocator_type& a);
multiset(const multiset& s); multiset(const multiset& s);
multiset(multiset&& s) multiset(multiset&& s);
noexcept(
is_nothrow_move_constructible<allocator_type>::value &&
is_nothrow_move_constructible<key_compare>::value);
explicit multiset(const allocator_type& a); explicit multiset(const allocator_type& a);
multiset(const multiset& s, const allocator_type& a); multiset(const multiset& s, const allocator_type& a);
multiset(multiset&& s, const allocator_type& a); multiset(multiset&& s, const allocator_type& a);
@@ -225,33 +200,29 @@ public:
~multiset(); ~multiset();
multiset& operator=(const multiset& s); multiset& operator=(const multiset& s);
multiset& operator=(multiset&& s) multiset& operator=(multiset&& s);
noexcept(
allocator_type::propagate_on_container_move_assignment::value &&
is_nothrow_move_assignable<allocator_type>::value &&
is_nothrow_move_assignable<key_compare>::value);
multiset& operator=(initializer_list<value_type> il); multiset& operator=(initializer_list<value_type> il);
// iterators: // iterators:
iterator begin() noexcept; iterator begin();
const_iterator begin() const noexcept; const_iterator begin() const;
iterator end() noexcept; iterator end();
const_iterator end() const noexcept; const_iterator end() const;
reverse_iterator rbegin() noexcept; reverse_iterator rbegin();
const_reverse_iterator rbegin() const noexcept; const_reverse_iterator rbegin() const;
reverse_iterator rend() noexcept; reverse_iterator rend();
const_reverse_iterator rend() const noexcept; const_reverse_iterator rend() const;
const_iterator cbegin() const noexcept; const_iterator cbegin() const;
const_iterator cend() const noexcept; const_iterator cend() const;
const_reverse_iterator crbegin() const noexcept; const_reverse_iterator crbegin() const;
const_reverse_iterator crend() const noexcept; const_reverse_iterator crend() const;
// capacity: // capacity:
bool empty() const noexcept; bool empty() const;
size_type size() const noexcept; size_type size() const;
size_type max_size() const noexcept; size_type max_size() const;
// modifiers: // modifiers:
template <class... Args> template <class... Args>
@@ -269,16 +240,12 @@ public:
iterator erase(const_iterator position); iterator erase(const_iterator position);
size_type erase(const key_type& k); size_type erase(const key_type& k);
iterator erase(const_iterator first, const_iterator last); iterator erase(const_iterator first, const_iterator last);
void clear() noexcept; void clear();
void swap(multiset& s) void swap(multiset& s);
noexcept(
__is_nothrow_swappable<key_compare>::value &&
(!allocator_type::propagate_on_container_swap::value ||
__is_nothrow_swappable<allocator_type>::value));
// observers: // observers:
allocator_type get_allocator() const noexcept; allocator_type get_allocator() const;
key_compare key_comp() const; key_compare key_comp() const;
value_compare value_comp() const; value_compare value_comp() const;
@@ -327,8 +294,7 @@ operator<=(const multiset<Key, Compare, Allocator>& x,
// specialized algorithms: // specialized algorithms:
template <class Key, class Compare, class Allocator> template <class Key, class Compare, class Allocator>
void void
swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y) swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y);
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -338,9 +304,7 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
#include <__tree> #include <__tree>
#include <functional> #include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -372,15 +336,11 @@ public:
typedef typename __base::difference_type difference_type; typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator; typedef typename __base::const_iterator const_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit set(const value_compare& __comp = value_compare()) explicit set(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {} : __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(const value_compare& __comp, const allocator_type& __a) set(const value_compare& __comp, const allocator_type& __a)
@@ -410,18 +370,10 @@ public:
insert(__s.begin(), __s.end()); insert(__s.begin(), __s.end());
} }
_LIBCPP_INLINE_VISIBILITY
set& operator=(const set& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(set&& __s) set(set&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_STD::move(__s.__tree_)) {}
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -439,7 +391,6 @@ public:
set(set&& __s, const allocator_type& __a); set(set&& __s, const allocator_type& __a);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) set(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp) : __tree_(__comp)
@@ -461,66 +412,60 @@ public:
__tree_.__assign_unique(__il.begin(), __il.end()); __tree_.__assign_unique(__il.begin(), __il.end());
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
set& operator=(set&& __s) set& operator=(set&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{ {
__tree_ = _VSTD::move(__s.__tree_); __tree_ = _STD::move(__s.__tree_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();} iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return __tree_.begin();} const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return __tree_.end();} iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return __tree_.end();} const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() _NOEXCEPT reverse_iterator rbegin() {return reverse_iterator(end());}
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT reverse_iterator rend() {return reverse_iterator(begin());}
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
{return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT {return begin();} const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return end();} const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();} const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return __tree_.size() == 0;} bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type size() const _NOEXCEPT {return __tree_.size();} size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT {return __tree_.max_size();} size_type max_size() const {return __tree_.max_size();}
// modifiers: // modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> emplace(_Args&&... __args) pair<iterator, bool> emplace(_Args&&... __args)
{return __tree_.__emplace_unique(_VSTD::forward<_Args>(__args)...);} {return __tree_.__emplace_unique(_STD::forward<_Args>(__args)...);}
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args) iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_unique(__p, _VSTD::forward<_Args>(__args)...);} {return __tree_.__emplace_hint_unique(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(const value_type& __v) pair<iterator,bool> insert(const value_type& __v)
@@ -528,7 +473,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator,bool> insert(value_type&& __v) pair<iterator,bool> insert(value_type&& __v)
{return __tree_.__insert_unique(_VSTD::move(__v));} {return __tree_.__insert_unique(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v) iterator insert(const_iterator __p, const value_type& __v)
@@ -536,7 +481,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v) iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_unique(__p, _VSTD::move(__v));} {return __tree_.__insert_unique(__p, _STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -546,11 +491,9 @@ public:
__tree_.__insert_unique(__e, *__f); __tree_.__insert_unique(__e, *__f);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il) void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());} {insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);} iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -561,14 +504,13 @@ public:
iterator erase(const_iterator __f, const_iterator __l) iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);} {return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();} void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(set& __s) _NOEXCEPT_(__is_nothrow_swappable<__base>::value) void swap(set& __s) {__tree_.swap(__s.__tree_);}
{__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();} key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -606,13 +548,13 @@ public:
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a) set<_Key, _Compare, _Allocator>::set(set&& __s, const allocator_type& __a)
: __tree_(_VSTD::move(__s.__tree_), __a) : __tree_(_STD::move(__s.__tree_), __a)
{ {
if (__a != __s.get_allocator()) if (__a != __s.get_allocator())
{ {
const_iterator __e = cend(); const_iterator __e = cend();
while (!__s.empty()) while (!__s.empty())
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
} }
} }
@@ -624,7 +566,7 @@ bool
operator==(const set<_Key, _Compare, _Allocator>& __x, operator==(const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y) const set<_Key, _Compare, _Allocator>& __y)
{ {
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -633,7 +575,7 @@ bool
operator< (const set<_Key, _Compare, _Allocator>& __x, operator< (const set<_Key, _Compare, _Allocator>& __x,
const set<_Key, _Compare, _Allocator>& __y) const set<_Key, _Compare, _Allocator>& __y)
{ {
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -678,7 +620,6 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(set<_Key, _Compare, _Allocator>& __x, swap(set<_Key, _Compare, _Allocator>& __x,
set<_Key, _Compare, _Allocator>& __y) set<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }
@@ -711,16 +652,12 @@ public:
typedef typename __base::difference_type difference_type; typedef typename __base::difference_type difference_type;
typedef typename __base::const_iterator iterator; typedef typename __base::const_iterator iterator;
typedef typename __base::const_iterator const_iterator; typedef typename __base::const_iterator const_iterator;
typedef _VSTD::reverse_iterator<iterator> reverse_iterator; typedef _STD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; typedef _STD::reverse_iterator<const_iterator> const_reverse_iterator;
// construct/copy/destroy: // construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit multiset(const value_compare& __comp = value_compare()) explicit multiset(const value_compare& __comp = value_compare())
_NOEXCEPT_(
is_nothrow_default_constructible<allocator_type>::value &&
is_nothrow_default_constructible<key_compare>::value &&
is_nothrow_copy_constructible<key_compare>::value)
: __tree_(__comp) {} : __tree_(__comp) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(const value_compare& __comp, const allocator_type& __a) multiset(const value_compare& __comp, const allocator_type& __a)
@@ -751,18 +688,10 @@ public:
insert(__s.begin(), __s.end()); insert(__s.begin(), __s.end());
} }
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(const multiset& __s)
{
__tree_ = __s.__tree_;
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(multiset&& __s) multiset(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_constructible<__base>::value) : __tree_(_STD::move(__s.__tree_)) {}
: __tree_(_VSTD::move(__s.__tree_)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit multiset(const allocator_type& __a) explicit multiset(const allocator_type& __a)
@@ -777,7 +706,6 @@ public:
multiset(multiset&& __s, const allocator_type& __a); multiset(multiset&& __s, const allocator_type& __a);
#endif #endif
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare()) multiset(initializer_list<value_type> __il, const value_compare& __comp = value_compare())
: __tree_(__comp) : __tree_(__comp)
@@ -799,66 +727,60 @@ public:
__tree_.__assign_multi(__il.begin(), __il.end()); __tree_.__assign_multi(__il.begin(), __il.end());
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
multiset& operator=(multiset&& __s) multiset& operator=(multiset&& __s)
_NOEXCEPT_(is_nothrow_move_assignable<__base>::value)
{ {
__tree_ = _VSTD::move(__s.__tree_); __tree_ = _STD::move(__s.__tree_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator begin() _NOEXCEPT {return __tree_.begin();} iterator begin() {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator begin() const _NOEXCEPT {return __tree_.begin();} const_iterator begin() const {return __tree_.begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator end() _NOEXCEPT {return __tree_.end();} iterator end() {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT {return __tree_.end();} const_iterator end() const {return __tree_.end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rbegin() _NOEXCEPT reverse_iterator rbegin() {return reverse_iterator(end());}
{return reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rbegin() const _NOEXCEPT const_reverse_iterator rbegin() const {return const_reverse_iterator(end());}
{return const_reverse_iterator(end());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
reverse_iterator rend() _NOEXCEPT reverse_iterator rend() {return reverse_iterator(begin());}
{return reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator rend() const _NOEXCEPT const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
{return const_reverse_iterator(begin());}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cbegin() const _NOEXCEPT {return begin();} const_iterator cbegin() const {return begin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_iterator cend() const _NOEXCEPT {return end();} const_iterator cend() const {return end();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crbegin() const _NOEXCEPT {return rbegin();} const_reverse_iterator crbegin() const {return rbegin();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
const_reverse_iterator crend() const _NOEXCEPT {return rend();} const_reverse_iterator crend() const {return rend();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool empty() const _NOEXCEPT {return __tree_.size() == 0;} bool empty() const {return __tree_.size() == 0;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type size() const _NOEXCEPT {return __tree_.size();} size_type size() const {return __tree_.size();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type max_size() const _NOEXCEPT {return __tree_.max_size();} size_type max_size() const {return __tree_.max_size();}
// modifiers: // modifiers:
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace(_Args&&... __args) iterator emplace(_Args&&... __args)
{return __tree_.__emplace_multi(_VSTD::forward<_Args>(__args)...);} {return __tree_.__emplace_multi(_STD::forward<_Args>(__args)...);}
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator emplace_hint(const_iterator __p, _Args&&... __args) iterator emplace_hint(const_iterator __p, _Args&&... __args)
{return __tree_.__emplace_hint_multi(__p, _VSTD::forward<_Args>(__args)...);} {return __tree_.__emplace_hint_multi(__p, _STD::forward<_Args>(__args)...);}
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const value_type& __v) iterator insert(const value_type& __v)
@@ -866,7 +788,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(value_type&& __v) iterator insert(value_type&& __v)
{return __tree_.__insert_multi(_VSTD::move(__v));} {return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, const value_type& __v) iterator insert(const_iterator __p, const value_type& __v)
@@ -874,7 +796,7 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __p, value_type&& __v) iterator insert(const_iterator __p, value_type&& __v)
{return __tree_.__insert_multi(_VSTD::move(__v));} {return __tree_.__insert_multi(_STD::move(__v));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator> template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -884,11 +806,9 @@ public:
__tree_.__insert_multi(__e, *__f); __tree_.__insert_multi(__e, *__f);
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void insert(initializer_list<value_type> __il) void insert(initializer_list<value_type> __il)
{insert(__il.begin(), __il.end());} {insert(__il.begin(), __il.end());}
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator erase(const_iterator __p) {return __tree_.erase(__p);} iterator erase(const_iterator __p) {return __tree_.erase(__p);}
@@ -898,15 +818,13 @@ public:
iterator erase(const_iterator __f, const_iterator __l) iterator erase(const_iterator __f, const_iterator __l)
{return __tree_.erase(__f, __l);} {return __tree_.erase(__f, __l);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void clear() _NOEXCEPT {__tree_.clear();} void clear() {__tree_.clear();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(multiset& __s) void swap(multiset& __s) {__tree_.swap(__s.__tree_);}
_NOEXCEPT_(__is_nothrow_swappable<__base>::value)
{__tree_.swap(__s.__tree_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type get_allocator() const _NOEXCEPT {return __tree_.__alloc();} allocator_type get_allocator() const {return __tree_.__alloc();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
key_compare key_comp() const {return __tree_.value_comp();} key_compare key_comp() const {return __tree_.value_comp();}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -944,13 +862,13 @@ public:
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a) multiset<_Key, _Compare, _Allocator>::multiset(multiset&& __s, const allocator_type& __a)
: __tree_(_VSTD::move(__s.__tree_), __a) : __tree_(_STD::move(__s.__tree_), __a)
{ {
if (__a != __s.get_allocator()) if (__a != __s.get_allocator())
{ {
const_iterator __e = cend(); const_iterator __e = cend();
while (!__s.empty()) while (!__s.empty())
insert(__e, _VSTD::move(__s.__tree_.remove(__s.begin())->__value_)); insert(__e, _STD::move(__s.__tree_.remove(__s.begin())->__value_));
} }
} }
@@ -962,7 +880,7 @@ bool
operator==(const multiset<_Key, _Compare, _Allocator>& __x, operator==(const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y) const multiset<_Key, _Compare, _Allocator>& __y)
{ {
return __x.size() == __y.size() && _VSTD::equal(__x.begin(), __x.end(), __y.begin()); return __x.size() == __y.size() && _STD::equal(__x.begin(), __x.end(), __y.begin());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -971,7 +889,7 @@ bool
operator< (const multiset<_Key, _Compare, _Allocator>& __x, operator< (const multiset<_Key, _Compare, _Allocator>& __x,
const multiset<_Key, _Compare, _Allocator>& __y) const multiset<_Key, _Compare, _Allocator>& __y)
{ {
return _VSTD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end()); return _STD::lexicographical_compare(__x.begin(), __x.end(), __y.begin(), __y.end());
} }
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
@@ -1015,7 +933,6 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
swap(multiset<_Key, _Compare, _Allocator>& __x, swap(multiset<_Key, _Compare, _Allocator>& __x,
multiset<_Key, _Compare, _Allocator>& __y) multiset<_Key, _Compare, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -175,11 +175,7 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream> #include <istream>
#include <string> #include <string>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -265,7 +261,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&&
ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase(); ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase(); ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase(); ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__str_ = _VSTD::move(__rhs.__str_); __str_ = _STD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp); this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout); this->setp(__p, __p + __eout);
@@ -288,7 +284,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase(); ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase(); ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
__mode_ = __rhs.__mode_; __mode_ = __rhs.__mode_;
__str_ = _VSTD::move(__rhs.__str_); __str_ = _STD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp); this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout); this->setp(__p, __p + __eout);
@@ -318,7 +314,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
ptrdiff_t __lnout = this->pptr() - this->pbase(); ptrdiff_t __lnout = this->pptr() - this->pbase();
ptrdiff_t __leout = this->epptr() - this->pbase(); ptrdiff_t __leout = this->epptr() - this->pbase();
ptrdiff_t __lhm = this->__hm_ - this->pbase(); ptrdiff_t __lhm = this->__hm_ - this->pbase();
_VSTD::swap(__mode_, __rhs.__mode_); _STD::swap(__mode_, __rhs.__mode_);
__str_.swap(__rhs.__str_); __str_.swap(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __rninp, __p + __reinp); this->setg(__p, __p + __rninp, __p + __reinp);
@@ -455,7 +451,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::overflow(int_type __c)
} }
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
} }
__hm_ = _VSTD::max(this->pptr() + 1, __hm_); __hm_ = _STD::max(this->pptr() + 1, __hm_);
if (__mode_ & ios_base::in) if (__mode_ & ios_base::in)
{ {
char_type* __p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
@@ -586,8 +582,8 @@ basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(const stri
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs) basic_istringstream<_CharT, _Traits, _Allocator>::basic_istringstream(basic_istringstream&& __rhs)
: basic_istream<_CharT, _Traits>(_VSTD::move(__rhs)), : basic_istream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -596,8 +592,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_istringstream<_CharT, _Traits, _Allocator>& basic_istringstream<_CharT, _Traits, _Allocator>&
basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs) basic_istringstream<_CharT, _Traits, _Allocator>::operator=(basic_istringstream&& __rhs)
{ {
basic_istream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_istream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -705,8 +701,8 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(const stri
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs) basic_ostringstream<_CharT, _Traits, _Allocator>::basic_ostringstream(basic_ostringstream&& __rhs)
: basic_ostream<_CharT, _Traits>(_VSTD::move(__rhs)), : basic_ostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_ostream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -715,8 +711,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_ostringstream<_CharT, _Traits, _Allocator>& basic_ostringstream<_CharT, _Traits, _Allocator>&
basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs) basic_ostringstream<_CharT, _Traits, _Allocator>::operator=(basic_ostringstream&& __rhs)
{ {
basic_ostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_ostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
@@ -824,8 +820,8 @@ basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(const string
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs) basic_stringstream<_CharT, _Traits, _Allocator>::basic_stringstream(basic_stringstream&& __rhs)
: basic_iostream<_CharT, _Traits>(_VSTD::move(__rhs)), : basic_iostream<_CharT, _Traits>(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_); basic_istream<_CharT, _Traits>::set_rdbuf(&__sb_);
} }
@@ -834,8 +830,8 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringstream<_CharT, _Traits, _Allocator>& basic_stringstream<_CharT, _Traits, _Allocator>&
basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs) basic_stringstream<_CharT, _Traits, _Allocator>::operator=(basic_stringstream&& __rhs)
{ {
basic_iostream<char_type, traits_type>::operator=(_VSTD::move(__rhs)); basic_iostream<char_type, traits_type>::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }

View File

@@ -31,21 +31,14 @@ protected:
container_type c; container_type c;
public: public:
stack() = default; explicit stack();
~stack() = default;
stack(const stack& q) = default;
stack(stack&& q) = default;
stack& operator=(const stack& q) = default;
stack& operator=(stack&& q) = default;
explicit stack(const container_type& c); explicit stack(const container_type& c);
explicit stack(container_type&& c); explicit stack(container_type&& c);
stack(stack&& s);
stack& operator=(stack&& s);
template <class Alloc> explicit stack(const Alloc& a); template <class Alloc> explicit stack(const Alloc& a);
template <class Alloc> stack(const container_type& c, const Alloc& a); template <class Alloc> stack(const container_type& c, const Alloc& a);
template <class Alloc> stack(container_type&& c, const Alloc& a); template <class Alloc> stack(container_type&& c, const Alloc& a);
template <class Alloc> stack(const stack& c, const Alloc& a);
template <class Alloc> stack(stack&& c, const Alloc& a); template <class Alloc> stack(stack&& c, const Alloc& a);
bool empty() const; bool empty() const;
@@ -58,7 +51,7 @@ public:
template <class... Args> void emplace(Args&&... args); template <class... Args> void emplace(Args&&... args);
void pop(); void pop();
void swap(stack& c) noexcept(noexcept(swap(c, q.c))); void swap(stack& c);
}; };
template <class T, class Container> template <class T, class Container>
@@ -75,8 +68,7 @@ template <class T, class Container>
bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y); bool operator<=(const stack<T, Container>& x, const stack<T, Container>& y);
template <class T, class Container> template <class T, class Container>
void swap(stack<T, Container>& x, stack<T, Container>& y) void swap(stack<T, Container>& x, stack<T, Container>& y);
noexcept(noexcept(x.swap(y)));
} // std } // std
@@ -85,21 +77,17 @@ template <class T, class Container>
#include <__config> #include <__config>
#include <deque> #include <deque>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_VISIBLE stack; template <class _Tp, class _Container> class stack;
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
@@ -118,35 +106,16 @@ protected:
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
stack() stack() : c() {}
_NOEXCEPT_(is_nothrow_default_constructible<container_type>::value)
: c() {}
_LIBCPP_INLINE_VISIBILITY
stack(const stack& __q) : c(__q.c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __q)
_NOEXCEPT_(is_nothrow_move_constructible<container_type>::value)
: c(_VSTD::move(__q.c)) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(const stack& __q) {c = __q.c; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __q)
_NOEXCEPT_(is_nothrow_move_assignable<container_type>::value)
{c = _VSTD::move(__q.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit stack(const container_type& __c) : c(__c) {} explicit stack(const container_type& __c) : c(__c) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit stack(container_type&& __c) : c(_VSTD::move(__c)) {} explicit stack(container_type&& __c) : c(_STD::move(__c)) {}
_LIBCPP_INLINE_VISIBILITY
stack(stack&& __s) : c(_STD::move(__s.c)) {}
_LIBCPP_INLINE_VISIBILITY
stack& operator=(stack&& __s) {c = _STD::move(__s.c); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -172,13 +141,13 @@ public:
stack(container_type&& __c, const _Alloc& __a, stack(container_type&& __c, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_VSTD::move(__c), __a) {} : c(_STD::move(__c), __a) {}
template <class _Alloc> template <class _Alloc>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
stack(stack&& __s, const _Alloc& __a, stack(stack&& __s, const _Alloc& __a,
typename enable_if<uses_allocator<container_type, typename enable_if<uses_allocator<container_type,
_Alloc>::value>::type* = 0) _Alloc>::value>::type* = 0)
: c(_VSTD::move(__s.c), __a) {} : c(_STD::move(__s.c), __a) {}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -194,12 +163,12 @@ public:
void push(const value_type& __v) {c.push_back(__v);} void push(const value_type& __v) {c.push_back(__v);}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void push(value_type&& __v) {c.push_back(_VSTD::move(__v));} void push(value_type&& __v) {c.push_back(_STD::move(__v));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class... _Args> template <class... _Args>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void emplace(_Args&&... __args) void emplace(_Args&&... __args)
{c.emplace_back(_VSTD::forward<_Args>(__args)...);} {c.emplace_back(_STD::forward<_Args>(__args)...);}
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -207,9 +176,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(stack& __s) void swap(stack& __s)
_NOEXCEPT_(__is_nothrow_swappable<container_type>::value)
{ {
using _VSTD::swap; using _STD::swap;
swap(c, __s.c); swap(c, __s.c);
} }
@@ -276,7 +244,6 @@ template <class _Tp, class _Container>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y) swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))
{ {
__x.swap(__y); __x.swap(__y);
} }

View File

@@ -33,9 +33,9 @@ class xxx_error : public exception // at least indirectly
{ {
public: public:
explicit xxx_error(const string& what_arg); explicit xxx_error(const string& what_arg);
explicit xxx_error(const char* what_arg); explicit xxx_error(const char* what_arg); // extension
virtual const char* what() const noexcept // returns what_arg virtual const char* what() const // returns what_arg
}; };
} // std } // std
@@ -46,9 +46,7 @@ public:
#include <exception> #include <exception>
#include <iosfwd> // for string forward decl #include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -62,12 +60,12 @@ public:
explicit logic_error(const string&); explicit logic_error(const string&);
explicit logic_error(const char*); explicit logic_error(const char*);
logic_error(const logic_error&) _NOEXCEPT; logic_error(const logic_error&) throw();
logic_error& operator=(const logic_error&) _NOEXCEPT; logic_error& operator=(const logic_error&) throw();
virtual ~logic_error() _NOEXCEPT; virtual ~logic_error() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
class _LIBCPP_EXCEPTION_ABI runtime_error class _LIBCPP_EXCEPTION_ABI runtime_error
@@ -79,12 +77,12 @@ public:
explicit runtime_error(const string&); explicit runtime_error(const string&);
explicit runtime_error(const char*); explicit runtime_error(const char*);
runtime_error(const runtime_error&) _NOEXCEPT; runtime_error(const runtime_error&) throw();
runtime_error& operator=(const runtime_error&) _NOEXCEPT; runtime_error& operator=(const runtime_error&) throw();
virtual ~runtime_error() _NOEXCEPT; virtual ~runtime_error() throw();
virtual const char* what() const _NOEXCEPT; virtual const char* what() const throw();
}; };
class _LIBCPP_EXCEPTION_ABI domain_error class _LIBCPP_EXCEPTION_ABI domain_error
@@ -94,7 +92,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit domain_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit domain_error(const char* __s) : logic_error(__s) {}
virtual ~domain_error() _NOEXCEPT; virtual ~domain_error() throw();
}; };
class _LIBCPP_EXCEPTION_ABI invalid_argument class _LIBCPP_EXCEPTION_ABI invalid_argument
@@ -104,7 +102,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit invalid_argument(const char* __s) : logic_error(__s) {}
virtual ~invalid_argument() _NOEXCEPT; virtual ~invalid_argument() throw();
}; };
class _LIBCPP_EXCEPTION_ABI length_error class _LIBCPP_EXCEPTION_ABI length_error
@@ -114,7 +112,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit length_error(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit length_error(const char* __s) : logic_error(__s) {}
virtual ~length_error() _NOEXCEPT; virtual ~length_error() throw();
}; };
class _LIBCPP_EXCEPTION_ABI out_of_range class _LIBCPP_EXCEPTION_ABI out_of_range
@@ -124,7 +122,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const string& __s) : logic_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit out_of_range(const char* __s) : logic_error(__s) {}
virtual ~out_of_range() _NOEXCEPT; virtual ~out_of_range() throw();
}; };
class _LIBCPP_EXCEPTION_ABI range_error class _LIBCPP_EXCEPTION_ABI range_error
@@ -134,7 +132,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit range_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit range_error(const char* __s) : runtime_error(__s) {}
virtual ~range_error() _NOEXCEPT; virtual ~range_error() throw();
}; };
class _LIBCPP_EXCEPTION_ABI overflow_error class _LIBCPP_EXCEPTION_ABI overflow_error
@@ -144,7 +142,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit overflow_error(const char* __s) : runtime_error(__s) {}
virtual ~overflow_error() _NOEXCEPT; virtual ~overflow_error() throw();
}; };
class _LIBCPP_EXCEPTION_ABI underflow_error class _LIBCPP_EXCEPTION_ABI underflow_error
@@ -154,7 +152,7 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const string& __s) : runtime_error(__s) {}
_LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {} _LIBCPP_INLINE_VISIBILITY explicit underflow_error(const char* __s) : runtime_error(__s) {}
virtual ~underflow_error() _NOEXCEPT; virtual ~underflow_error() throw();
}; };
} // std } // std

View File

@@ -112,9 +112,7 @@ protected:
#include <iosfwd> #include <iosfwd>
#include <ios> #include <ios>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -401,13 +399,13 @@ template <class _CharT, class _Traits>
void void
basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb) basic_streambuf<_CharT, _Traits>::swap(basic_streambuf& __sb)
{ {
_VSTD::swap(__loc_, __sb.__loc_); _STD::swap(__loc_, __sb.__loc_);
_VSTD::swap(__binp_, __sb.__binp_); _STD::swap(__binp_, __sb.__binp_);
_VSTD::swap(__ninp_, __sb.__ninp_); _STD::swap(__ninp_, __sb.__ninp_);
_VSTD::swap(__einp_, __sb.__einp_); _STD::swap(__einp_, __sb.__einp_);
_VSTD::swap(__bout_, __sb.__bout_); _STD::swap(__bout_, __sb.__bout_);
_VSTD::swap(__nout_, __sb.__nout_); _STD::swap(__nout_, __sb.__nout_);
_VSTD::swap(__eout_, __sb.__eout_); _STD::swap(__eout_, __sb.__eout_);
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -461,15 +459,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode) ios_base::openmode __which)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
@@ -540,7 +538,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
{ {
if (__nout_ < __eout_) if (__nout_ < __eout_)
*__nout_++ = *__s; *__nout_++ = *__s;
else if (overflow(traits_type::to_int_type(*__s)) == __eof) else if (overflow(*__s) == __eof)
break; break;
} }
return __i; return __i;
@@ -548,16 +546,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::overflow(int_type) basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
{ {
return traits_type::eof(); return traits_type::eof();
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>) extern template class basic_streambuf<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>) extern template class basic_streambuf<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>) extern template class basic_ios<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>) extern template class basic_ios<wchar_t>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -131,9 +131,7 @@ private:
#include <ostream> #include <ostream>
#include <istream> #include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -152,9 +150,7 @@ public:
strstreambuf(const unsigned char* __gnext, streamsize __n); strstreambuf(const unsigned char* __gnext, streamsize __n);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
strstreambuf(strstreambuf&& __rhs); strstreambuf(strstreambuf&& __rhs);
_LIBCPP_INLINE_VISIBILITY
strstreambuf& operator=(strstreambuf&& __rhs); strstreambuf& operator=(strstreambuf&& __rhs);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -191,43 +187,6 @@ private:
void __init(char* __gnext, streamsize __n, char* __pbeg); void __init(char* __gnext, streamsize __n, char* __pbeg);
}; };
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf::strstreambuf(strstreambuf&& __rhs)
: streambuf(__rhs),
__strmode_(__rhs.__strmode_),
__alsize_(__rhs.__alsize_),
__palloc_(__rhs.__palloc_),
__pfree_(__rhs.__pfree_)
{
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
}
inline _LIBCPP_INLINE_VISIBILITY
strstreambuf&
strstreambuf::operator=(strstreambuf&& __rhs)
{
if (eback() && (__strmode_ & __allocated) != 0 && (__strmode_ & __frozen) == 0)
{
if (__pfree_)
__pfree_(eback());
else
delete [] eback();
}
streambuf::operator=(__rhs);
__strmode_ = __rhs.__strmode_;
__alsize_ = __rhs.__alsize_;
__palloc_ = __rhs.__palloc_;
__pfree_ = __rhs.__pfree_;
__rhs.setg(nullptr, nullptr, nullptr);
__rhs.setp(nullptr, nullptr);
return *this;
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
class _LIBCPP_VISIBLE istrstream class _LIBCPP_VISIBLE istrstream
: public istream : public istream
{ {
@@ -248,8 +207,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
istrstream(istrstream&& __rhs) istrstream(istrstream&& __rhs)
: istream(_VSTD::move(__rhs)), : istream(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
istream::set_rdbuf(&__sb_); istream::set_rdbuf(&__sb_);
} }
@@ -257,8 +216,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
istrstream& operator=(istrstream&& __rhs) istrstream& operator=(istrstream&& __rhs)
{ {
istream::operator=(_VSTD::move(__rhs)); istream::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -297,8 +256,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
ostrstream(ostrstream&& __rhs) ostrstream(ostrstream&& __rhs)
: ostream(_VSTD::move(__rhs)), : ostream(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
ostream::set_rdbuf(&__sb_); ostream::set_rdbuf(&__sb_);
} }
@@ -306,8 +265,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
ostrstream& operator=(ostrstream&& __rhs) ostrstream& operator=(ostrstream&& __rhs)
{ {
ostream::operator=(_VSTD::move(__rhs)); ostream::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -357,8 +316,8 @@ public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
strstream(strstream&& __rhs) strstream(strstream&& __rhs)
: iostream(_VSTD::move(__rhs)), : iostream(_STD::move(__rhs)),
__sb_(_VSTD::move(__rhs.__sb_)) __sb_(_STD::move(__rhs.__sb_))
{ {
iostream::set_rdbuf(&__sb_); iostream::set_rdbuf(&__sb_);
} }
@@ -366,8 +325,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
strstream& operator=(strstream&& __rhs) strstream& operator=(strstream&& __rhs)
{ {
iostream::operator=(_VSTD::move(__rhs)); iostream::operator=(_STD::move(__rhs));
__sb_ = _VSTD::move(__rhs.__sb_); __sb_ = _STD::move(__rhs.__sb_);
return *this; return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@@ -1,5 +0,0 @@
#define atof sun_atof
#define strtod sun_strtod
#include_next "floatingpoint.h"
#undef atof
#undef strtod

View File

@@ -1,38 +0,0 @@
#define iswalpha sun_iswalpha
#define iswupper sun_iswupper
#define iswlower sun_iswlower
#define iswdigit sun_iswdigit
#define iswxdigit sun_iswxdigit
#define iswalnum sun_iswalnum
#define iswspace sun_iswspace
#define iswpunct sun_iswpunct
#define iswprint sun_iswprint
#define iswgraph sun_iswgraph
#define iswcntrl sun_iswcntrl
#define iswctype sun_iswctype
#define towlower sun_towlower
#define towupper sun_towupper
#define wcswcs sun_wcswcs
#define wcswidth sun_wcswidth
#define wcwidth sun_wcwidth
#define wctype sun_wctype
#define _WCHAR_T 1
#include_next "wchar.h"
#undef iswalpha
#undef iswupper
#undef iswlower
#undef iswdigit
#undef iswxdigit
#undef iswalnum
#undef iswspace
#undef iswpunct
#undef iswprint
#undef iswgraph
#undef iswcntrl
#undef iswctype
#undef towlower
#undef towupper
#undef wcswcs
#undef wcswidth
#undef wcwidth
#undef wctype

View File

@@ -1,146 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Minimal xlocale implementation for Solaris. This implements the subset of
// the xlocale APIs that libc++ depends on.
////////////////////////////////////////////////////////////////////////////////
#ifndef __XLOCALE_H_INCLUDED
#define __XLOCALE_H_INCLUDED
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _LC_locale_t* locale_t;
#define LC_COLLATE_MASK (1<<0)
#define LC_CTYPE_MASK (1<<1)
#define LC_MESSAGES_MASK (1<<2)
#define LC_MONETARY_MASK (1<<3)
#define LC_NUMERIC_MASK (1<<4)
#define LC_TIME_MASK (1<<5)
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | LC_MESSAGES_MASK | \
LC_MONETARY_MASK | LC_NUMERIC_MASK | LC_TIME_MASK)
#define LC_GLOBAL_LOCALE ((locale_t)-1)
size_t __mb_cur_max(locale_t l);
#define MB_CUR_MAX_L(l) __mb_cur_max(l)
locale_t newlocale(int mask, const char * locale, locale_t base);
void freelocale(locale_t loc);
wint_t btowc_l(int __c, locale_t __l);
int wctob_l(wint_t __c, locale_t __l);
size_t wcrtomb_l(char *__s, wchar_t __wc, mbstate_t *__ps, locale_t __l);
size_t mbrtowc_l(wchar_t *__pwc, const char *__s, size_t __n,
mbstate_t *__ps, locale_t __l);
int mbtowc_l(wchar_t *__pwc, const char *__pmb, size_t __max, locale_t __l);
size_t mbrlen_l(const char *__s, size_t __n, mbstate_t *__ps, locale_t __l);
struct lconv *localeconv_l(locale_t __l);
size_t mbsrtowcs_l(wchar_t *__dest, const char **__src, size_t __len,
mbstate_t *__ps, locale_t __l);
int sprintf_l(char *__s, locale_t __l, const char *__format, ...);
int snprintf_l(char *__s, size_t __n, locale_t __l, const char *__format, ...);
int asprintf_l(char **__s, locale_t __l, const char *__format, ...);
int sscanf_l(const char *__s, locale_t __l, const char *__format, ...);
int isalnum_l(int,locale_t);
int isalpha_l(int,locale_t);
int isblank_l(int,locale_t);
int iscntrl_l(int,locale_t);
int isdigit_l(int,locale_t);
int isgraph_l(int,locale_t);
int islower_l(int,locale_t);
int isprint_l(int,locale_t);
int ispunct_l(int,locale_t);
int isspace_l(int,locale_t);
int isupper_l(int,locale_t);
int isxdigit_l(int,locale_t);
int iswalnum_l(wchar_t,locale_t);
int iswalpha_l(wchar_t,locale_t);
int iswblank_l(wchar_t,locale_t);
int iswcntrl_l(wchar_t,locale_t);
int iswdigit_l(wchar_t,locale_t);
int iswgraph_l(wchar_t,locale_t);
int iswlower_l(wchar_t,locale_t);
int iswprint_l(wchar_t,locale_t);
int iswpunct_l(wchar_t,locale_t);
int iswspace_l(wchar_t,locale_t);
int iswupper_l(wchar_t,locale_t);
int iswxdigit_l(wchar_t,locale_t);
int iswctype_l(wint_t, wctype_t, locale_t);
int toupper_l(int __c, locale_t __l);
int tolower_l(int __c, locale_t __l);
wint_t towupper_l(wint_t __c, locale_t __l);
wint_t towlower_l(wint_t __c, locale_t __l);
int strcoll_l(const char *__s1, const char *__s2, locale_t __l);
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t __l);
size_t strftime_l(char *__s, size_t __size, const char *__fmt, const struct tm
*__tm, locale_t __l);
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t __l);
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
locale_t __l);
size_t
mbsnrtowcs_l(wchar_t * __restrict dst, const char ** __restrict src,
size_t nms, size_t len, mbstate_t * __restrict ps, locale_t loc);
size_t
wcsnrtombs_l(char * __restrict dst, const wchar_t ** __restrict src,
size_t nwc, size_t len, mbstate_t * __restrict ps, locale_t loc);
locale_t __cloc(void);
// FIXME: These are quick-and-dirty hacks to make things pretend to work
static inline
long long strtoll_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoll(__nptr, __endptr, __base);
}
static inline
long strtol_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtol(__nptr, __endptr, __base);
}
static inline
long double strtold_l(const char *__nptr, char **__endptr,
locale_t __loc) {
return strtold(__nptr, __endptr);
}
static inline
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoull(__nptr, __endptr, __base);
}
static inline
unsigned long strtoul_l(const char *__nptr, char **__endptr,
int __base, locale_t __loc) {
return strtoul(__nptr, __endptr, __base);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -1,79 +0,0 @@
// -*- C++ -*-
//===--------------------- support/win32/limits_win32.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // ymath.h works correctly
#include <float.h> // limit constants
#define __FLT_MANT_DIG__ FLT_MANT_DIG
#define __FLT_DIG__ FLT_DIG
#define __FLT_RADIX__ FLT_RADIX
#define __FLT_MIN_EXP__ FLT_MIN_EXP
#define __FLT_MIN_10_EXP__ FLT_MIN_10_EXP
#define __FLT_MAX_EXP__ FLT_MAX_EXP
#define __FLT_MAX_10_EXP__ FLT_MAX_10_EXP
#define __FLT_MIN__ FLT_MIN
#define __FLT_MAX__ FLT_MAX
#define __FLT_EPSILON__ FLT_EPSILON
// predefined by MinGW GCC
#define __FLT_DENORM_MIN__ 1.40129846432481707092e-45F
#define __DBL_MANT_DIG__ DBL_MANT_DIG
#define __DBL_DIG__ DBL_DIG
#define __DBL_RADIX__ DBL_RADIX
#define __DBL_MIN_EXP__ DBL_MIN_EXP
#define __DBL_MIN_10_EXP__ DBL_MIN_10_EXP
#define __DBL_MAX_EXP__ DBL_MAX_EXP
#define __DBL_MAX_10_EXP__ DBL_MAX_10_EXP
#define __DBL_MIN__ DBL_MIN
#define __DBL_MAX__ DBL_MAX
#define __DBL_EPSILON__ DBL_EPSILON
// predefined by MinGW GCC
#define __DBL_DENORM_MIN__ double(4.94065645841246544177e-324L)
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
#define __LDBL_DIG__ LDBL_DIG
#define __LDBL_RADIX__ LDBL_RADIX
#define __LDBL_MIN_EXP__ LDBL_MIN_EXP
#define __LDBL_MIN_10_EXP__ LDBL_MIN_10_EXP
#define __LDBL_MAX_EXP__ LDBL_MAX_EXP
#define __LDBL_MAX_10_EXP__ LDBL_MAX_10_EXP
#define __LDBL_MIN__ LDBL_MIN
#define __LDBL_MAX__ LDBL_MAX
#define __LDBL_EPSILON__ LDBL_EPSILON
// predefined by MinGW GCC
#define __LDBL_DENORM_MIN__ 3.64519953188247460253e-4951L
// __builtin replacements/workarounds
#include <math.h> // HUGE_VAL
#include <ymath.h> // internal MSVC header providing the needed functionality
#define __builtin_huge_val() HUGE_VAL
#define __builtin_huge_valf() _FInf._Float
#define __builtin_huge_vall() _LInf._Long_double
#define __builtin_nan(__dummy) _Nan._Double
#define __builtin_nanf(__dummy) _FNan._Float
#define __builtin_nanl(__dummmy) _LNan._Long_double
#define __builtin_nans(__dummy) _Snan._Double
#define __builtin_nansf(__dummy) _FSnan._Float
#define __builtin_nansl(__dummy) _LSnan._Long_double
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H

View File

@@ -1,116 +0,0 @@
// -*- C++ -*-
//===--------------------- support/win32/locale_win32.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H
// ctype mask table defined in msvcrt.dll
extern "C" unsigned short __declspec(dllimport) _ctype[];
#include "support/win32/support.h"
#include <memory>
#include <xlocinfo.h> // _locale_t
#define locale_t _locale_t
#define LC_COLLATE_MASK _M_COLLATE
#define LC_CTYPE_MASK _M_CTYPE
#define LC_MONETARY_MASK _M_MONETARY
#define LC_NUMERIC_MASK _M_NUMERIC
#define LC_TIME_MASK _M_TIME
#define LC_MESSAGES_MASK _M_MESSAGES
#define LC_ALL_MASK ( LC_COLLATE_MASK \
| LC_CTYPE_MASK \
| LC_MESSAGES_MASK \
| LC_MONETARY_MASK \
| LC_NUMERIC_MASK \
| LC_TIME_MASK )
#define freelocale _free_locale
// FIXME: base currently unused. Needs manual work to construct the new locale
locale_t newlocale( int mask, const char * locale, locale_t base );
locale_t uselocale( locale_t newloc );
lconv *localeconv_l( locale_t loc );
size_t mbrlen_l( const char *__restrict__ s, size_t n,
mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t len, mbstate_t *__restrict__ ps, locale_t loc );
size_t wcrtomb_l( char *__restrict__ s, wchar_t wc, mbstate_t *__restrict__ ps,
locale_t loc);
size_t mbrtowc_l( wchar_t *__restrict__ pwc, const char *__restrict__ s,
size_t n, mbstate_t *__restrict__ ps, locale_t loc);
size_t mbsnrtowcs_l( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nms, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
size_t wcsnrtombs_l( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict__ ps, locale_t loc);
wint_t btowc_l( int c, locale_t loc );
int wctob_l( wint_t c, locale_t loc );
typedef _VSTD::remove_pointer<locale_t>::type __locale_struct;
typedef _VSTD::unique_ptr<__locale_struct, decltype(&uselocale)> __locale_raii;
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
{
__locale_raii __current( uselocale(__l), uselocale );
return MB_CUR_MAX;
}
// the *_l functions are prefixed on Windows, only available for msvcr80+, VS2005+
#include <stdio.h>
#define mbtowc_l _mbtowc_l
#define strtoll_l _strtoi64_l
#define strtoull_l _strtoui64_l
// FIXME: current msvcrt does not know about long double
#define strtold_l _strtod_l
#define islower_l _islower_l
#define isupper_l _isupper_l
#define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l
#define strxfrm_l _strxfrm_l
#define wcscoll_l _wcscoll_l
#define wcsxfrm_l _wcsxfrm_l
#define toupper_l _toupper_l
#define tolower_l _tolower_l
#define iswspace_l _iswspace_l
#define iswprint_l _iswprint_l
#define iswcntrl_l _iswcntrl_l
#define iswupper_l _iswupper_l
#define iswlower_l _iswlower_l
#define iswalpha_l _iswalpha_l
#define iswdigit_l _iswdigit_l
#define iswpunct_l _iswpunct_l
#define iswxdigit_l _iswxdigit_l
#define towupper_l _towupper_l
#define towlower_l _towlower_l
#define strftime_l _strftime_l
#define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
#define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ )
#define snprintf_l( __s, __n, __l, __f, ... ) _snprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
#define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, __VA_ARGS__ )
#define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, __l, __VA_ARGS__ )
int asprintf_l( char **ret, locale_t loc, const char *format, ... );
int vasprintf_l( char **ret, locale_t loc, const char *format, va_list ap );
// not-so-pressing FIXME: use locale to determine blank characters
inline int isblank_l( int c, locale_t /*loc*/ )
{
return ( c == ' ' || c == '\t' );
}
inline int iswblank_l( wint_t c, locale_t /*loc*/ )
{
return ( c == L' ' || c == L'\t' );
}
#ifdef _MSC_VER
inline int isblank( int c, locale_t /*loc*/ )
{ return ( c == ' ' || c == '\t' ); }
inline int iswblank( wint_t c, locale_t /*loc*/ )
{ return ( c == L' ' || c == L'\t' ); }
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

@@ -1,113 +0,0 @@
// -*- C++ -*-
//===---------------------- support/win32/math_win32.h --------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#include <math.h>
typedef float float_t;
typedef double double_t;
_LIBCPP_ALWAYS_INLINE bool isfinite( double num )
{
return _finite(num) != 0;
}
_LIBCPP_ALWAYS_INLINE bool isinf( double num )
{
return !isfinite(num) && !_isnan(num);
}
_LIBCPP_ALWAYS_INLINE bool isnan( double num )
{
return _isnan(num) != 0;
}
_LIBCPP_ALWAYS_INLINE bool isnormal( double num )
{
int class_ = _fpclass(num);
return class_ == _FPCLASS_NN || class_ == _FPCLASS_PN;
}
_LIBCPP_ALWAYS_INLINE bool isgreater( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x > y;
}
_LIBCPP_ALWAYS_INLINE bool isgreaterequal( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x >= y;
}
_LIBCPP_ALWAYS_INLINE bool isless( double x, double y )
{
if(_fpclass(x) == _FPCLASS_SNAN || _fpclass(y) == _FPCLASS_SNAN) return false;
else return x < y;
}
_LIBCPP_ALWAYS_INLINE bool islessequal( double x, double y )
{
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
else return x <= y;
}
_LIBCPP_ALWAYS_INLINE bool islessgreater( double x, double y )
{
if(::_fpclass(x) == _FPCLASS_SNAN || ::_fpclass(y) == _FPCLASS_SNAN) return false;
else return x < y || x > y;
}
_LIBCPP_ALWAYS_INLINE bool isunordered( double x, double y )
{
return isnan(x) || isnan(y);
}
_LIBCPP_ALWAYS_INLINE bool signbit( double num )
{
switch(_fpclass(num))
{
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
case _FPCLASS_NINF:
case _FPCLASS_NN:
case _FPCLASS_ND:
case _FPCLASS_NZ:
return true;
case _FPCLASS_PZ:
case _FPCLASS_PD:
case _FPCLASS_PN:
case _FPCLASS_PINF:
return false;
}
return false;
}
_LIBCPP_ALWAYS_INLINE float copysignf( float x, float y )
{
return (signbit (x) != signbit (y) ? - x : x);
}
_LIBCPP_ALWAYS_INLINE double copysign( double x, double y )
{
return ::_copysign(x,y);
}
_LIBCPP_ALWAYS_INLINE double copysignl( long double x, long double y )
{
return ::_copysignl(x,y);
}
_LIBCPP_ALWAYS_INLINE int fpclassify( double num )
{
return _fpclass(num);
}
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H

View File

@@ -1,115 +0,0 @@
// -*- C++ -*-
//===----------------------- support/win32/support.h ----------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_WIN32_SUPPORT_H
#define _LIBCPP_SUPPORT_WIN32_SUPPORT_H
/*
Functions and constants used in libc++ that are missing from the Windows C library.
*/
#include <__config>
#include <wchar.h> // mbstate_t
#include <stdio.h> // _snwprintf
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
#define vfscnaf fscanf
int vasprintf( char **sptr, const char *__restrict fmt , va_list ap );
int asprintf( char **sptr, const char *__restrict fmt, ...);
//int vfscanf( FILE *__restrict stream, const char *__restrict format,
// va_list arg);
size_t mbsnrtowcs( wchar_t *__restrict dst, const char **__restrict src,
size_t nmc, size_t len, mbstate_t *__restrict ps );
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src,
size_t nwc, size_t len, mbstate_t *__restrict ps );
#if defined(_MSC_VER)
#define snprintf _snprintf
#include <xlocinfo.h>
#define atoll _atoi64
#define strtoll _strtoi64
#define strtoull _strtoui64
#define wcstoll _wcstoi64
#define wcstoull _wcstoui64
_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
{ return _Stof(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
{ return _Stod(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
{ return _Stold(nptr, endptr, 0); }
#define _Exit _exit
#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
#include <intrin.h>
_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
static const unsigned int m1 = 0x55555555; //binary: 0101...
static const unsigned int m2 = 0x33333333; //binary: 00110011..
static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
return __builtin_popcount(static_cast<int>(x));
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
}
_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
{
DWORD r = 0;
_BitScanReverse(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
{ return __builtin_ctz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
{
DWORD r = 0;
_BitScanReverse64(&r, x);
return static_cast<int>(r);
}
_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
{
DWORD r = 0;
_BitScanForward(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
{ return __builtin_clz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
{
DWORD r = 0;
_BitScanForward64(&r, x);
return static_cast<int>(r);
}
#endif // !__clang__
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -20,24 +20,24 @@ namespace std
class error_category class error_category
{ {
public: public:
virtual ~error_category() noexcept; virtual ~error_category();
error_category(const error_category&) = delete; error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete; error_category& operator=(const error_category&) = delete;
virtual const char* name() const noexcept = 0; virtual const char* name() const = 0;
virtual error_condition default_error_condition(int ev) const noexcept; virtual error_condition default_error_condition(int ev) const;
virtual bool equivalent(int code, const error_condition& condition) const noexcept; virtual bool equivalent(int code, const error_condition& condition) const;
virtual bool equivalent(const error_code& code, int condition) const noexcept; virtual bool equivalent(const error_code& code, int condition) const;
virtual string message(int ev) const = 0; virtual string message(int ev) const = 0;
bool operator==(const error_category& rhs) const noexcept; bool operator==(const error_category& rhs) const;
bool operator!=(const error_category& rhs) const noexcept; bool operator!=(const error_category& rhs) const;
bool operator<(const error_category& rhs) const noexcept; bool operator<(const error_category& rhs) const;
}; };
const error_category& generic_category() noexcept; const error_category& generic_category();
const error_category& system_category() noexcept; const error_category& system_category();
template <class T> struct is_error_code_enum template <class T> struct is_error_code_enum
: public false_type {}; : public false_type {};
@@ -49,27 +49,27 @@ class error_code
{ {
public: public:
// constructors: // constructors:
error_code() noexcept; error_code();
error_code(int val, const error_category& cat) noexcept; error_code(int val, const error_category& cat);
template <class ErrorCodeEnum> template <class ErrorCodeEnum>
error_code(ErrorCodeEnum e) noexcept; error_code(ErrorCodeEnum e);
// modifiers: // modifiers:
void assign(int val, const error_category& cat) noexcept; void assign(int val, const error_category& cat);
template <class ErrorCodeEnum> template <class ErrorCodeEnum>
error_code& operator=(ErrorCodeEnum e) noexcept; error_code& operator=(ErrorCodeEnum e);
void clear() noexcept; void clear();
// observers: // observers:
int value() const noexcept; int value() const;
const error_category& category() const noexcept; const error_category& category() const;
error_condition default_error_condition() const noexcept; error_condition default_error_condition() const;
string message() const; string message() const;
explicit operator bool() const noexcept; explicit operator bool() const;
}; };
// non-member functions: // non-member functions:
bool operator<(const error_code& lhs, const error_code& rhs) noexcept; bool operator<(const error_code& lhs, const error_code& rhs);
template <class charT, class traits> template <class charT, class traits>
basic_ostream<charT,traits>& basic_ostream<charT,traits>&
operator<<(basic_ostream<charT,traits>& os, const error_code& ec); operator<<(basic_ostream<charT,traits>& os, const error_code& ec);
@@ -78,25 +78,25 @@ class error_condition
{ {
public: public:
// constructors: // constructors:
error_condition() noexcept; error_condition();
error_condition(int val, const error_category& cat) noexcept; error_condition(int val, const error_category& cat);
template <class ErrorConditionEnum> template <class ErrorConditionEnum>
error_condition(ErrorConditionEnum e) noexcept; error_condition(ErrorConditionEnum e);
// modifiers: // modifiers:
void assign(int val, const error_category& cat) noexcept; void assign(int val, const error_category& cat);
template <class ErrorConditionEnum> template <class ErrorConditionEnum>
error_condition& operator=(ErrorConditionEnum e) noexcept; error_condition& operator=(ErrorConditionEnum e);
void clear() noexcept; void clear();
// observers: // observers:
int value() const noexcept; int value() const;
const error_category& category() const noexcept; const error_category& category() const;
string message() const noexcept; string message() const;
explicit operator bool() const noexcept; explicit operator bool() const;
}; };
bool operator<(const error_condition& lhs, const error_condition& rhs) noexcept; bool operator<(const error_condition& lhs, const error_condition& rhs);
class system_error class system_error
: public runtime_error : public runtime_error
@@ -109,8 +109,8 @@ public:
system_error(int ev, const error_category& ecat, const char* what_arg); system_error(int ev, const error_category& ecat, const char* what_arg);
system_error(int ev, const error_category& ecat); system_error(int ev, const error_category& ecat);
const error_code& code() const noexcept; const error_code& code() const throw();
const char* what() const noexcept; const char* what() const throw();
}; };
enum class errc enum class errc
@@ -198,18 +198,18 @@ enum class errc
template <> struct is_error_condition_enum<errc> template <> struct is_error_condition_enum<errc>
: true_type { } : true_type { }
error_code make_error_code(errc e) noexcept; error_code make_error_code(errc e);
error_condition make_error_condition(errc e) noexcept; error_condition make_error_condition(errc e);
// Comparison operators: // Comparison operators:
bool operator==(const error_code& lhs, const error_code& rhs) noexcept; bool operator==(const error_code& lhs, const error_code& rhs);
bool operator==(const error_code& lhs, const error_condition& rhs) noexcept; bool operator==(const error_code& lhs, const error_condition& rhs);
bool operator==(const error_condition& lhs, const error_code& rhs) noexcept; bool operator==(const error_condition& lhs, const error_code& rhs);
bool operator==(const error_condition& lhs, const error_condition& rhs) noexcept; bool operator==(const error_condition& lhs, const error_condition& rhs);
bool operator!=(const error_code& lhs, const error_code& rhs) noexcept; bool operator!=(const error_code& lhs, const error_code& rhs);
bool operator!=(const error_code& lhs, const error_condition& rhs) noexcept; bool operator!=(const error_code& lhs, const error_condition& rhs);
bool operator!=(const error_condition& lhs, const error_code& rhs) noexcept; bool operator!=(const error_condition& lhs, const error_code& rhs);
bool operator!=(const error_condition& lhs, const error_condition& rhs) noexcept; bool operator!=(const error_condition& lhs, const error_condition& rhs);
template <> struct hash<std::error_code>; template <> struct hash<std::error_code>;
@@ -223,9 +223,7 @@ template <> struct hash<std::error_code>;
#include <stdexcept> #include <stdexcept>
#include <__functional_base> #include <__functional_base>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -245,8 +243,9 @@ struct _LIBCPP_VISIBLE is_error_condition_enum
// for them: // for them:
//enum class errc //enum class errc
_LIBCPP_DECLARE_STRONG_ENUM(errc) struct errc
{ {
enum _ {
address_family_not_supported = EAFNOSUPPORT, address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE, address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL, address_not_available = EADDRNOTAVAIL,
@@ -342,52 +341,58 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
value_too_large = EOVERFLOW, value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE wrong_protocol_type = EPROTOTYPE
}; };
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <> template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc> struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { }; : true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <> template <>
struct _LIBCPP_VISIBLE is_error_condition_enum<errc::__lx> struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { }; : true_type { };
#endif
class _LIBCPP_VISIBLE error_condition; class error_condition;
class _LIBCPP_VISIBLE error_code; class error_code;
// class error_category // class error_category
class _LIBCPP_HIDDEN __do_message; class __do_message;
class _LIBCPP_VISIBLE error_category class _LIBCPP_VISIBLE error_category
{ {
public: public:
virtual ~error_category() _NOEXCEPT; virtual ~error_category();
error_category() _NOEXCEPT;
private: private:
error_category();
error_category(const error_category&);// = delete; error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete; error_category& operator=(const error_category&);// = delete;
public: public:
virtual const char* name() const _NOEXCEPT = 0; virtual const char* name() const = 0;
virtual error_condition default_error_condition(int __ev) const _NOEXCEPT; virtual error_condition default_error_condition(int __ev) const;
virtual bool equivalent(int __code, const error_condition& __condition) const _NOEXCEPT; virtual bool equivalent(int __code, const error_condition& __condition) const;
virtual bool equivalent(const error_code& __code, int __condition) const _NOEXCEPT; virtual bool equivalent(const error_code& __code, int __condition) const;
virtual string message(int __ev) const = 0; virtual string message(int __ev) const = 0;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator==(const error_category& __rhs) const _NOEXCEPT {return this == &__rhs;} bool operator==(const error_category& __rhs) const {return this == &__rhs;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator!=(const error_category& __rhs) const _NOEXCEPT {return !(*this == __rhs);} bool operator!=(const error_category& __rhs) const {return !(*this == __rhs);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} bool operator< (const error_category& __rhs) const {return this < &__rhs;}
friend class _LIBCPP_HIDDEN __do_message; friend class __do_message;
}; };
class _LIBCPP_HIDDEN __do_message class _LIBCPP_HIDDEN __do_message
@@ -397,8 +402,8 @@ public:
virtual string message(int ev) const; virtual string message(int ev) const;
}; };
const error_category& generic_category() _NOEXCEPT; const error_category& generic_category();
const error_category& system_category() _NOEXCEPT; const error_category& system_category();
class _LIBCPP_VISIBLE error_condition class _LIBCPP_VISIBLE error_condition
{ {
@@ -406,68 +411,66 @@ class _LIBCPP_VISIBLE error_condition
const error_category* __cat_; const error_category* __cat_;
public: public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition() _NOEXCEPT : __val_(0), __cat_(&generic_category()) {} error_condition() : __val_(0), __cat_(&generic_category()) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition(int __val, const error_category& __cat) _NOEXCEPT error_condition(int __val, const error_category& __cat)
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition(_Ep __e, error_condition(_E __e, typename enable_if<is_error_condition_enum<_E>::value>::type* = 0)
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_condition(__e);} {*this = make_error_condition(__e);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat) _NOEXCEPT void assign(int __val, const error_category& __cat)
{ {
__val_ = __val; __val_ = __val;
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_condition_enum<_Ep>::value, is_error_condition_enum<_E>::value,
error_condition& error_condition&
>::type >::type
operator=(_Ep __e) _NOEXCEPT operator=(_E __e)
{*this = make_error_condition(__e); return *this;} {*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void clear() _NOEXCEPT void clear()
{ {
__val_ = 0; __val_ = 0;
__cat_ = &generic_category(); __cat_ = &generic_category();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int value() const _NOEXCEPT {return __val_;} int value() const {return __val_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_category& category() const _NOEXCEPT {return *__cat_;} const error_category& category() const {return *__cat_;}
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT //explicit
operator bool() const _NOEXCEPT {return __val_ != 0;} operator bool() const {return __val_ != 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
error_condition error_condition
make_error_condition(errc __e) _NOEXCEPT make_error_condition(errc __e)
{ {
return error_condition(static_cast<int>(__e), generic_category()); return error_condition(static_cast<int>(__e), generic_category());
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT operator<(const error_condition& __x, const error_condition& __y)
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| (__x.category() == __y.category() && __x.value() < __y.value()); || __x.category() == __y.category() && __x.value() < __y.value();
} }
// error_code // error_code
@@ -478,85 +481,83 @@ class _LIBCPP_VISIBLE error_code
const error_category* __cat_; const error_category* __cat_;
public: public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code() _NOEXCEPT : __val_(0), __cat_(&system_category()) {} error_code() : __val_(0), __cat_(&system_category()) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code(int __val, const error_category& __cat) _NOEXCEPT error_code(int __val, const error_category& __cat)
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code(_Ep __e, error_code(_E __e, typename enable_if<is_error_code_enum<_E>::value>::type* = 0)
typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0
) _NOEXCEPT
{*this = make_error_code(__e);} {*this = make_error_code(__e);}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void assign(int __val, const error_category& __cat) _NOEXCEPT void assign(int __val, const error_category& __cat)
{ {
__val_ = __val; __val_ = __val;
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_code_enum<_Ep>::value, is_error_code_enum<_E>::value,
error_code& error_code&
>::type >::type
operator=(_Ep __e) _NOEXCEPT operator=(_E __e)
{*this = make_error_code(__e); return *this;} {*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
void clear() _NOEXCEPT void clear()
{ {
__val_ = 0; __val_ = 0;
__cat_ = &system_category(); __cat_ = &system_category();
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
int value() const _NOEXCEPT {return __val_;} int value() const {return __val_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_category& category() const _NOEXCEPT {return *__cat_;} const error_category& category() const {return *__cat_;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition default_error_condition() const _NOEXCEPT error_condition default_error_condition() const
{return __cat_->default_error_condition(__val_);} {return __cat_->default_error_condition(__val_);}
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT //explicit
operator bool() const _NOEXCEPT {return __val_ != 0;} operator bool() const {return __val_ != 0;}
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
error_code error_code
make_error_code(errc __e) _NOEXCEPT make_error_code(errc __e)
{ {
return error_code(static_cast<int>(__e), generic_category()); return error_code(static_cast<int>(__e), generic_category());
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT operator<(const error_code& __x, const error_code& __y)
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| (__x.category() == __y.category() && __x.value() < __y.value()); || __x.category() == __y.category() && __x.value() < __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_code& __x, const error_code& __y) _NOEXCEPT operator==(const error_code& __x, const error_code& __y)
{ {
return __x.category() == __y.category() && __x.value() == __y.value(); return __x.category() == __y.category() && __x.value() == __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT operator==(const error_code& __x, const error_condition& __y)
{ {
return __x.category().equivalent(__x.value(), __y) return __x.category().equivalent(__x.value(), __y)
|| __y.category().equivalent(__x, __y.value()); || __y.category().equivalent(__x, __y.value());
@@ -564,44 +565,40 @@ operator==(const error_code& __x, const error_condition& __y) _NOEXCEPT
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_condition& __x, const error_code& __y) _NOEXCEPT operator==(const error_condition& __x, const error_code& __y)
{ {
return __y == __x; return __y == __x;
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const error_condition& __x, const error_condition& __y) _NOEXCEPT operator==(const error_condition& __x, const error_condition& __y)
{ {
return __x.category() == __y.category() && __x.value() == __y.value(); return __x.category() == __y.category() && __x.value() == __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_code& __x, const error_code& __y) _NOEXCEPT operator!=(const error_code& __x, const error_code& __y) {return !(__x == __y);}
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_code& __x, const error_condition& __y) _NOEXCEPT operator!=(const error_code& __x, const error_condition& __y) {return !(__x == __y);}
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_condition& __x, const error_code& __y) _NOEXCEPT operator!=(const error_condition& __x, const error_code& __y) {return !(__x == __y);}
{return !(__x == __y);}
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT operator!=(const error_condition& __x, const error_condition& __y) {return !(__x == __y);}
{return !(__x == __y);}
template <> template <>
struct _LIBCPP_VISIBLE hash<error_code> struct _LIBCPP_VISIBLE hash<error_code>
: public unary_function<error_code, size_t> : public unary_function<error_code, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t operator()(const error_code& __ec) const _NOEXCEPT size_t operator()(const error_code& __ec) const
{ {
return static_cast<size_t>(__ec.value()); return static_cast<size_t>(__ec.value());
} }
@@ -620,10 +617,10 @@ public:
system_error(int __ev, const error_category& __ecat, const string& __what_arg); system_error(int __ev, const error_category& __ecat, const string& __what_arg);
system_error(int __ev, const error_category& __ecat, const char* __what_arg); system_error(int __ev, const error_category& __ecat, const char* __what_arg);
system_error(int __ev, const error_category& __ecat); system_error(int __ev, const error_category& __ecat);
~system_error() _NOEXCEPT; ~system_error() throw();
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const error_code& code() const _NOEXCEPT {return __ec_;} const error_code& code() const throw() {return __ec_;}
private: private:
static string __init(const error_code&, string); static string __init(const error_code&, string);

View File

@@ -22,8 +22,6 @@
#include <complex.h> #include <complex.h>
#include <math.h> #include <math.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#endif // _LIBCPP_TGMATH_H #endif // _LIBCPP_TGMATH_H

View File

@@ -26,41 +26,41 @@ public:
class id; class id;
typedef pthread_t native_handle_type; typedef pthread_t native_handle_type;
thread() noexcept; thread();
template <class F, class ...Args> explicit thread(F&& f, Args&&... args); template <class F, class ...Args> explicit thread(F&& f, Args&&... args);
~thread(); ~thread();
thread(const thread&) = delete; thread(const thread&) = delete;
thread(thread&& t) noexcept; thread(thread&& t);
thread& operator=(const thread&) = delete; thread& operator=(const thread&) = delete;
thread& operator=(thread&& t) noexcept; thread& operator=(thread&& t);
void swap(thread& t) noexcept; void swap(thread& t);
bool joinable() const noexcept; bool joinable() const;
void join(); void join();
void detach(); void detach();
id get_id() const noexcept; id get_id() const;
native_handle_type native_handle(); native_handle_type native_handle();
static unsigned hardware_concurrency() noexcept; static unsigned hardware_concurrency();
}; };
void swap(thread& x, thread& y) noexcept; void swap(thread& x, thread& y);
class thread::id class thread::id
{ {
public: public:
id() noexcept; id();
}; };
bool operator==(thread::id x, thread::id y) noexcept; bool operator==(thread::id x, thread::id y);
bool operator!=(thread::id x, thread::id y) noexcept; bool operator!=(thread::id x, thread::id y);
bool operator< (thread::id x, thread::id y) noexcept; bool operator< (thread::id x, thread::id y);
bool operator<=(thread::id x, thread::id y) noexcept; bool operator<=(thread::id x, thread::id y);
bool operator> (thread::id x, thread::id y) noexcept; bool operator> (thread::id x, thread::id y);
bool operator>=(thread::id x, thread::id y) noexcept; bool operator>=(thread::id x, thread::id y);
template<class charT, class traits> template<class charT, class traits>
basic_ostream<charT, traits>& basic_ostream<charT, traits>&
@@ -69,9 +69,9 @@ operator<<(basic_ostream<charT, traits>& out, thread::id id);
namespace this_thread namespace this_thread
{ {
thread::id get_id() noexcept; thread::id get_id();
void yield() noexcept; void yield();
template <class Clock, class Duration> template <class Clock, class Duration>
void sleep_until(const chrono::time_point<Clock, Duration>& abs_time); void sleep_until(const chrono::time_point<Clock, Duration>& abs_time);
@@ -95,14 +95,9 @@ void sleep_for(const chrono::duration<Rep, Period>& rel_time);
#include <system_error> #include <system_error>
#include <chrono> #include <chrono>
#include <__mutex_base> #include <__mutex_base>
#ifndef _LIBCPP_HAS_NO_VARIADICS
#include <tuple>
#endif
#include <pthread.h> #include <pthread.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#define __STDCPP_THREADS__ __cplusplus #define __STDCPP_THREADS__ __cplusplus
@@ -137,55 +132,52 @@ template <class _Tp>
void void
__thread_specific_ptr<_Tp>::__at_thread_exit(void* __p) __thread_specific_ptr<_Tp>::__at_thread_exit(void* __p)
{ {
delete static_cast<pointer>(__p); delete static_cast<pointer>(__p);
} }
template <class _Tp> template <class _Tp>
__thread_specific_ptr<_Tp>::__thread_specific_ptr() __thread_specific_ptr<_Tp>::__thread_specific_ptr()
{ {
int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit); int __ec = pthread_key_create(&__key_, &__thread_specific_ptr::__at_thread_exit);
if (__ec) if (__ec)
throw system_error(error_code(__ec, system_category()), throw system_error(error_code(__ec, system_category()),
"__thread_specific_ptr construction failed"); "__thread_specific_ptr construction failed");
} }
template <class _Tp> template <class _Tp>
__thread_specific_ptr<_Tp>::~__thread_specific_ptr() __thread_specific_ptr<_Tp>::~__thread_specific_ptr()
{ {
pthread_key_delete(__key_); pthread_key_delete(__key_);
} }
template <class _Tp> template <class _Tp>
typename __thread_specific_ptr<_Tp>::pointer typename __thread_specific_ptr<_Tp>::pointer
__thread_specific_ptr<_Tp>::release() __thread_specific_ptr<_Tp>::release()
{ {
pointer __p = get(); pointer __p = get();
pthread_setspecific(__key_, 0); pthread_setspecific(__key_, 0);
return __p; return __p;
} }
template <class _Tp> template <class _Tp>
void void
__thread_specific_ptr<_Tp>::reset(pointer __p) __thread_specific_ptr<_Tp>::reset(pointer __p)
{ {
pointer __p_old = get(); pointer __p_old = get();
pthread_setspecific(__key_, __p); pthread_setspecific(__key_, __p);
delete __p_old; delete __p_old;
} }
class _LIBCPP_VISIBLE thread; class thread;
class _LIBCPP_VISIBLE __thread_id; class __thread_id;
namespace this_thread namespace this_thread
{ {
_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; __thread_id get_id();
} // this_thread } // this_thread
class _LIBCPP_VISIBLE __thread_id;
template<> struct _LIBCPP_VISIBLE hash<__thread_id>;
class _LIBCPP_VISIBLE __thread_id class _LIBCPP_VISIBLE __thread_id
{ {
// FIXME: pthread_t is a pointer on Darwin but a long on Linux. // FIXME: pthread_t is a pointer on Darwin but a long on Linux.
@@ -195,25 +187,25 @@ class _LIBCPP_VISIBLE __thread_id
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__thread_id() _NOEXCEPT : __id_(0) {} __thread_id() : __id_(0) {}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT bool operator==(__thread_id __x, __thread_id __y)
{return __x.__id_ == __y.__id_;} {return __x.__id_ == __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT bool operator!=(__thread_id __x, __thread_id __y)
{return !(__x == __y);} {return !(__x == __y);}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT bool operator< (__thread_id __x, __thread_id __y)
{return __x.__id_ < __y.__id_;} {return __x.__id_ < __y.__id_;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT bool operator<=(__thread_id __x, __thread_id __y)
{return !(__y < __x);} {return !(__y < __x);}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT bool operator> (__thread_id __x, __thread_id __y)
{return __y < __x ;} {return __y < __x ;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT bool operator>=(__thread_id __x, __thread_id __y)
{return !(__x < __y);} {return !(__x < __y);}
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
@@ -227,11 +219,12 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__thread_id(pthread_t __id) : __id_(__id) {} __thread_id(pthread_t __id) : __id_(__id) {}
friend __thread_id this_thread::get_id() _NOEXCEPT; friend __thread_id this_thread::get_id();
friend class _LIBCPP_VISIBLE thread; friend class _LIBCPP_VISIBLE thread;
friend struct _LIBCPP_VISIBLE hash<__thread_id>;
}; };
template<class _Tp> struct hash;
template<> template<>
struct _LIBCPP_VISIBLE hash<__thread_id> struct _LIBCPP_VISIBLE hash<__thread_id>
: public unary_function<__thread_id, size_t> : public unary_function<__thread_id, size_t>
@@ -239,7 +232,8 @@ struct _LIBCPP_VISIBLE hash<__thread_id>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_t operator()(__thread_id __v) const size_t operator()(__thread_id __v) const
{ {
return hash<pthread_t>()(__v.__id_); const size_t* const __p = reinterpret_cast<const size_t*>(&__v);
return *__p;
} }
}; };
@@ -248,7 +242,7 @@ namespace this_thread
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__thread_id __thread_id
get_id() _NOEXCEPT get_id()
{ {
return pthread_self(); return pthread_self();
} }
@@ -266,39 +260,39 @@ public:
typedef pthread_t native_handle_type; typedef pthread_t native_handle_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
thread() _NOEXCEPT : __t_(0) {} thread() : __t_(0) {}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp, class ..._Args, template <class _F, class ..._Args,
class = typename enable_if class = typename enable_if
< <
!is_same<typename decay<_Fp>::type, thread>::value !is_same<typename decay<_F>::type, thread>::value
>::type >::type
> >
explicit thread(_Fp&& __f, _Args&&... __args); explicit thread(_F&& __f, _Args&&... __args);
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
template <class _Fp> explicit thread(_Fp __f); template <class _F> explicit thread(_F __f);
#endif #endif
~thread(); ~thread();
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
thread(thread&& __t) _NOEXCEPT : __t_(__t.__t_) {__t.__t_ = 0;} thread(thread&& __t) : __t_(__t.__t_) {__t.__t_ = 0;}
thread& operator=(thread&& __t) _NOEXCEPT; thread& operator=(thread&& __t);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void swap(thread& __t) _NOEXCEPT {_VSTD::swap(__t_, __t.__t_);} void swap(thread& __t) {_STD::swap(__t_, __t.__t_);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool joinable() const _NOEXCEPT {return __t_ != 0;} bool joinable() const {return __t_ != 0;}
void join(); void join();
void detach(); void detach();
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
id get_id() const _NOEXCEPT {return __t_;} id get_id() const {return __t_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() _NOEXCEPT {return __t_;} native_handle_type native_handle() {return __t_;}
static unsigned hardware_concurrency() _NOEXCEPT; static unsigned hardware_concurrency();
}; };
class __assoc_sub_state; class __assoc_sub_state;
@@ -321,36 +315,27 @@ public:
__thread_specific_ptr<__thread_struct>& __thread_local_data(); __thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS template <class _F>
template <class _Fp, class ..._Args, size_t ..._Indices>
inline _LIBCPP_INLINE_VISIBILITY
void
__threaad_execute(tuple<_Fp, _Args...>& __t, __tuple_indices<_Indices...>)
{
__invoke(_VSTD::move(_VSTD::get<0>(__t)), _VSTD::move(_VSTD::get<_Indices>(__t))...);
}
template <class _Fp>
void* void*
__thread_proxy(void* __vp) __thread_proxy(void* __vp)
{ {
__thread_local_data().reset(new __thread_struct); __thread_local_data().reset(new __thread_struct);
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); std::unique_ptr<_F> __p(static_cast<_F*>(__vp));
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index; (*__p)();
__threaad_execute(*__p, _Index());
return nullptr; return nullptr;
} }
template <class _Fp, class ..._Args, #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _F, class ..._Args,
class class
> >
thread::thread(_Fp&& __f, _Args&&... __args) thread::thread(_F&& __f, _Args&&... __args)
{ {
typedef tuple<typename decay<_Fp>::type, typename decay<_Args>::type...> _Gp; typedef decltype(bind(std::forward<_F>(__f), std::forward<_Args>(__args)...)) _G;
_VSTD::unique_ptr<_Gp> __p(new _Gp(__decay_copy(_VSTD::forward<_Fp>(__f)), std::unique_ptr<_G> __p(new _G(bind(std::forward<_F>(__f),
__decay_copy(_VSTD::forward<_Args>(__args))...)); std::forward<_Args>(__args)...)));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Gp>, __p.get()); int __ec = pthread_create(&__t_, 0, &__thread_proxy<_G>, __p.get());
if (__ec == 0) if (__ec == 0)
__p.release(); __p.release();
else else
@@ -359,21 +344,11 @@ thread::thread(_Fp&& __f, _Args&&... __args)
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
template <class _Fp> template <class _F>
void* thread::thread(_F __f)
__thread_proxy(void* __vp)
{ {
__thread_local_data().reset(new __thread_struct); std::unique_ptr<_F> __p(new _F(__f));
std::unique_ptr<_Fp> __p(static_cast<_Fp*>(__vp)); int __ec = pthread_create(&__t_, 0, &__thread_proxy<_F>, __p.get());
(*__p)();
return nullptr;
}
template <class _Fp>
thread::thread(_Fp __f)
{
std::unique_ptr<_Fp> __p(new _Fp(__f));
int __ec = pthread_create(&__t_, 0, &__thread_proxy<_Fp>, __p.get());
if (__ec == 0) if (__ec == 0)
__p.release(); __p.release();
else else
@@ -386,7 +361,7 @@ thread::thread(_Fp __f)
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
thread& thread&
thread::operator=(thread&& __t) _NOEXCEPT thread::operator=(thread&& __t)
{ {
if (__t_ != 0) if (__t_ != 0)
terminate(); terminate();
@@ -398,7 +373,7 @@ thread::operator=(thread&& __t) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);} void swap(thread& __x, thread& __y) {__x.swap(__y);}
namespace this_thread namespace this_thread
{ {
@@ -410,20 +385,10 @@ void
sleep_for(const chrono::duration<_Rep, _Period>& __d) sleep_for(const chrono::duration<_Rep, _Period>& __d)
{ {
using namespace chrono; using namespace chrono;
if (__d > duration<_Rep, _Period>::zero()) nanoseconds __ns = duration_cast<nanoseconds>(__d);
{ if (__ns < __d)
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max(); ++__ns;
nanoseconds __ns; sleep_for(__ns);
if (__d < _Max)
{
__ns = duration_cast<nanoseconds>(__d);
if (__ns < __d)
++__ns;
}
else
__ns = nanoseconds::max();
sleep_for(__ns);
}
} }
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -448,7 +413,7 @@ sleep_until(const chrono::time_point<chrono::steady_clock, _Duration>& __t)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void yield() _NOEXCEPT {sched_yield();} void yield() {sched_yield();}
} // this_thread } // this_thread

Some files were not shown because too many files have changed in this diff Show More