Compare commits

..

1 Commits

Author SHA1 Message Date
Bill Wendling
db2b81bf90 Creating the libcxx release 3.3 branch.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_33@181278 91177308-0d34-0410-b5e6-96231b3b80d8
2013-05-07 00:25:14 +00:00
1348 changed files with 6650 additions and 58231 deletions

View File

@@ -14,9 +14,9 @@ set(PACKAGE_BUGREPORT "llvmbugs@cs.uiuc.edu")
# Add path for custom modules
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules"
${CMAKE_MODULE_PATH}
)
# Require out of source build.
@@ -26,10 +26,6 @@ MACRO_ENSURE_OUT_OF_SOURCE_BUILD(
build directory and run 'cmake /path/to/${PROJECT_NAME} [options]' there."
)
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LIBCXX_BUILT_STANDALONE 1)
endif()
#===============================================================================
# Setup CMake Options
#===============================================================================
@@ -42,15 +38,14 @@ option(LIBCXX_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
option(LIBCXX_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
option(LIBCXX_ENABLE_CXX0X "Enable -std=c++0x and use of c++0x language features if the compiler supports it." ON)
option(LIBCXX_ENABLE_SHARED "Build libc++ as a shared library." ON)
option(LIBCXX_INSTALL_SUPPORT_HEADERS "Install libc++ support headers." ON)
set(CXXABIS none libcxxabi libcxxrt libstdc++ libsupc++)
set(CXXABIS none libcxxabi libcxxrt libsupc++)
if (NOT DEFINED LIBCXX_CXX_ABI)
set(LIBCXX_CXX_ABI "none")
endif()
set(LIBCXX_CXX_ABI "${LIBCXX_CXX_ABI}" CACHE STRING
"Specify C++ ABI library to use." FORCE)
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS ;${CXXABIS})
set_property(CACHE LIBCXX_CXX_ABI PROPERTY STRINGS "";${CXXABIS})
#===============================================================================
# Configure System
@@ -133,26 +128,17 @@ macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs)
)
endmacro()
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++" OR
"${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
if ("${LIBCXX_CXX_ABI}" STREQUAL "libsupc++")
set(_LIBSUPCXX_INCLUDE_FILES
cxxabi.h bits/c++config.h bits/os_defines.h bits/cpu_defines.h
bits/cxxabi_tweaks.h bits/cxxabi_forced.h
)
if ("${LIBCXX_CXX_ABI}" STREQUAL "libstdc++")
set(_LIBSUPCXX_DEFINES "-DLIBSTDCXX")
set(_LIBSUPCXX_LIBNAME stdc++)
else()
set(_LIBSUPCXX_DEFINES "")
set(_LIBSUPCXX_LIBNAME supc++)
endif()
setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS"
"-D__GLIBCXX__ ${_LIBSUPCXX_DEFINES}"
"${_LIBSUPCXX_LIBNAME}" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
setup_abi_lib("LIBCXX_LIBSUPCXX_INCLUDE_PATHS" "-D__GLIBCXX__"
"supc++" "${_LIBSUPCXX_INCLUDE_FILES}" "bits"
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxabi")
setup_abi_lib("LIBCXX_LIBCXXABI_INCLUDE_PATHS" ""
"c++abi" "cxxabi.h" ""
"c++abi" "cxxabi.h;cxa_demangle.h" ""
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
@@ -160,7 +146,7 @@ elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
)
elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
message(FATAL_ERROR
"Currently libstdc++, libsupc++, libcxxabi, libcxxrt and none are "
"Currently libsupc++, libcxxabi, libcxxrt and none are "
"supported for c++ abi."
)
endif ()
@@ -194,11 +180,7 @@ macro(append_if list condition var)
endmacro()
# Get warning flags
if (NOT MSVC)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
set(LIBCXX_CXX_REQUIRED_FLAGS, -Werror=return-type)
endif()
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_CXX_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_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
@@ -206,9 +188,6 @@ append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
else()
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_ERROR_FLAG -Wno-error)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_NO_WX_FLAG -WX-)
endif()
if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
@@ -255,10 +234,6 @@ if (NOT LIBCXX_ENABLE_SHARED)
endif()
# This is the _ONLY_ place where add_definitions is called.
if (MSVC)
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()
add_definitions(
${LIBCXX_CXX_REQUIRED_FLAGS}
${LIBCXX_CXX_WARNING_FLAGS}
@@ -270,7 +245,6 @@ add_definitions(
#===============================================================================
include_directories(include)
add_subdirectory(include)
# Add source code. This also contains all of the logic for deciding linker flags
# soname, etc...

View File

@@ -31,14 +31,6 @@ D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com
D: C++14 support, patches and bug fixes.
N: Bill Fisher
E: william.w.fisher@gmail.com
D: Regex bug fixes.
N: Matthew Dempsky
E: matthew@dempsky.org
D: Minor patches and bug fixes.
N: Google Inc.
@@ -76,10 +68,6 @@ N: Bjorn Reese
E: breese@users.sourceforge.net
D: Initial regex prototype
N: Nico Rieck
E: nico.rieck@gmail.com
D: Windows fixes
N: Jonathan Sauer
D: Minor patches, mostly related to constexpr
@@ -109,14 +97,6 @@ N: Zhang Xiongpang
E: zhangxiongpang@gmail.com
D: Minor patches and bug fixes.
N: Xing Xue
E: xingxue@ca.ibm.com
D: AIX port
N: Zhihao Yuan
E: lichray@gmail.com
D: Standard compatibility fixes.
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com

View File

@@ -39,8 +39,6 @@ installheaders::
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
chmod 755 $(HEADER_DIR)/c++/v1/experimental
chmod 644 $(HEADER_DIR)/c++/v1/experimental/*
install::

View File

@@ -13,11 +13,9 @@ check_cxx_compiler_flag(-Wwrite-strings LIBCXX_HAS_WWRITE_STRINGS_FLAG)
check_cxx_compiler_flag(-Wno-long-long LIBCXX_HAS_WNO_LONG_LONG_FLAG)
check_cxx_compiler_flag(-pedantic LIBCXX_HAS_PEDANTIC_FLAG)
check_cxx_compiler_flag(-Werror LIBCXX_HAS_WERROR_FLAG)
check_cxx_compiler_flag(-Wno-error LIBCXX_HAS_WNO_ERROR_FLAG)
check_cxx_compiler_flag(-fno-exceptions LIBCXX_HAS_FNO_EXCEPTIONS_FLAG)
check_cxx_compiler_flag(-fno-rtti LIBCXX_HAS_FNO_RTTI_FLAG)
check_cxx_compiler_flag(/WX LIBCXX_HAS_WX_FLAG)
check_cxx_compiler_flag(/WX- LIBCXX_HAS_NO_WX_FLAG)
check_cxx_compiler_flag(/EHsc LIBCXX_HAS_EHSC_FLAG)
check_cxx_compiler_flag(/EHs- LIBCXX_HAS_NO_EHS_FLAG)
check_cxx_compiler_flag(/EHa- LIBCXX_HAS_NO_EHA_FLAG)

View File

@@ -1,16 +0,0 @@
if (NOT LIBCXX_INSTALL_SUPPORT_HEADERS)
set(LIBCXX_SUPPORT_HEADER_PATTERN PATTERN "support" EXCLUDE)
endif()
file(COPY .
DESTINATION "${CMAKE_BINARY_DIR}/include/c++/v1"
FILES_MATCHING
PATTERN "*"
PATTERN "CMakeLists.txt" EXCLUDE
PATTERN ".svn" EXCLUDE
${LIBCXX_SUPPORT_HEADER_PATTERN}
)
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/c++/v1/"
DESTINATION include/c++/v1/
)

View File

@@ -40,7 +40,7 @@ class __bit_reference
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
#if defined(__clang__)
friend typename _Cp::__self;
#else
friend class _Cp::__self;
@@ -82,7 +82,7 @@ class __bit_reference<_Cp, false>
};
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
@@ -92,7 +92,7 @@ swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT
}
template <class _Cp, class _Dp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
{
@@ -102,7 +102,7 @@ swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
{
@@ -112,7 +112,7 @@ swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
@@ -130,7 +130,7 @@ class __bit_const_reference
__storage_pointer __seg_;
__storage_type __mask_;
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
#if defined(__clang__)
friend typename _Cp::__self;
#else
friend class _Cp::__self;
@@ -173,8 +173,6 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
__storage_type __b = *__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
__n -= __dn;
++__first.__seg_;
}
@@ -209,8 +207,6 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
__storage_type __b = ~*__first.__seg_ & __m;
if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
if (__n == __dn)
return _It(__first.__seg_, __first.__ctz_ + __n);
__n -= __dn;
++__first.__seg_;
}
@@ -337,7 +333,7 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), 0, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, 0, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -367,7 +363,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
// do middle whole words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memset(_VSTD::__to_raw_pointer(__first.__seg_), -1, __nw * sizeof(__storage_type));
_VSTD::memset(__first.__seg_, -1, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last partial word
if (__n > 0)
@@ -379,7 +375,7 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_)
{
@@ -434,9 +430,7 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
// __first.__ctz_ == 0;
// do middle words
__storage_type __nw = __n / __bits_per_word;
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
_VSTD::__to_raw_pointer(__first.__seg_),
__nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __first.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
__result.__seg_ += __nw;
// do last word
@@ -575,9 +569,7 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
__storage_type __nw = __n / __bits_per_word;
__result.__seg_ -= __nw;
__last.__seg_ -= __nw;
_VSTD::memmove(_VSTD::__to_raw_pointer(__result.__seg_),
_VSTD::__to_raw_pointer(__last.__seg_),
__nw * sizeof(__storage_type));
_VSTD::memmove(__result.__seg_, __last.__seg_, __nw * sizeof(__storage_type));
__n -= __nw * __bits_per_word;
// do last word
if (__n > 0)
@@ -878,7 +870,6 @@ struct __bit_array
{
typedef typename _Cp::difference_type difference_type;
typedef typename _Cp::__storage_type __storage_type;
typedef typename _Cp::__storage_pointer __storage_pointer;
typedef typename _Cp::iterator iterator;
static const unsigned __bits_per_word = _Cp::__bits_per_word;
static const unsigned _Np = 4;
@@ -889,15 +880,9 @@ struct __bit_array
_LIBCPP_INLINE_VISIBILITY static difference_type capacity()
{return static_cast<difference_type>(_Np * __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
_LIBCPP_INLINE_VISIBILITY iterator begin()
{
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]), 0);
}
_LIBCPP_INLINE_VISIBILITY iterator end()
{
return iterator(pointer_traits<__storage_pointer>::pointer_to(__word_[0]) + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));
}
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));}
};
template <class _Cp>
@@ -1108,11 +1093,7 @@ private:
unsigned __ctz_;
public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __seg_(nullptr), __ctz_(0)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT
@@ -1222,7 +1203,7 @@ private:
__bit_iterator(__storage_pointer __s, unsigned __ctz) _NOEXCEPT
: __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__) || defined(__IBMCPP__) || defined(_LIBCPP_MSVC)
#if defined(__clang__)
friend typename _Cp::__self;
#else
friend class _Cp::__self;

View File

@@ -11,7 +11,7 @@
#ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG
#if !defined(_MSC_VER) || defined(__clang__)
#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header
#endif
@@ -56,42 +56,19 @@
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
#ifdef __NetBSD__
# include <sys/endian.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_HAS_QUICK_EXIT
#endif // __NetBSD__
#ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC)
# if defined(__clang__) \
|| (defined(_MSC_VER) && _MSC_VER >= 1400) \
# if (defined(_MSC_VER) && _MSC_VER >= 1400) \
|| (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCPP_HAS_IS_BASE_OF
# endif
# if defined(_MSC_VER) && !defined(__clang__)
# define _LIBCPP_MSVC // Using Microsoft Visual C++ compiler
# define _LIBCPP_TOSTRING2(x) #x
# define _LIBCPP_TOSTRING(x) _LIBCPP_TOSTRING2(x)
# define _LIBCPP_WARNING(x) __pragma(message(__FILE__ "(" _LIBCPP_TOSTRING(__LINE__) ") : warning note: " x))
# endif
# // If mingw not explicitly detected, assume using MS C runtime only.
# ifndef __MINGW32__
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif // _WIN32
#ifdef __linux__
# if defined(__GNUC__) && _GNUC_VER >= 403
# define _LIBCPP_HAS_IS_BASE_OF
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif
@@ -138,11 +115,8 @@
# define _LIBCPP_TYPE_VIS
#endif
#define _LIBCPP_TYPE_VIS_ONLY
#define _LIBCPP_FUNC_VIS_ONLY
#ifndef _LIBCPP_INLINE_VISIBILITY
# ifdef _LIBCPP_MSVC
# ifdef _MSC_VER
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
@@ -154,7 +128,7 @@
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# ifdef _LIBCPP_MSVC
# ifdef _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
@@ -174,21 +148,13 @@
#endif
#ifndef _LIBCPP_TYPE_VIS
# if __has_attribute(__type_visibility__)
# if __has_attribute(type_visibility)
# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default")))
# else
# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default")))
# endif
#endif
#ifndef _LIBCPP_TYPE_VIS_ONLY
# define _LIBCPP_TYPE_VIS_ONLY _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_FUNC_VIS_ONLY
# define _LIBCPP_FUNC_VIS_ONLY _LIBCPP_FUNC_VIS
#endif
#ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
@@ -197,6 +163,10 @@
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
@@ -291,7 +261,7 @@ typedef __char32_t char32_t;
#endif
#if __has_feature(is_base_of)
# define _LIBCPP_HAS_IS_BASE_OF
# define _LIBCP_HAS_IS_BASE_OF
#endif
// Objective-C++ features (opt-in)
@@ -308,19 +278,9 @@ typedef __char32_t char32_t;
#define _LIBCPP_HAS_NO_CONSTEXPR
#endif
#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#elif defined(__linux__)
#include <features.h>
#if __GLIBC_PREREQ(2, 15)
#define _LIBCPP_HAS_QUICK_EXIT
#endif
#if __GLIBC_PREREQ(2, 17)
#define _LIBCPP_HAS_C11_FEATURES
#endif
#endif
#endif
#if (__has_feature(cxx_noexcept))
@@ -414,14 +374,13 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
}
#elif defined(_LIBCPP_MSVC)
#elif defined(_MSC_VER)
#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 _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
@@ -434,43 +393,10 @@ using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
# define _LIBCPP_WEAK
namespace std {
}
#elif defined(__IBMCPP__)
#define _ALIGNAS(x) __attribute__((__aligned__(x)))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _ATTRIBUTE(x) __attribute__((x))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#define _LIBCPP_HAS_NO_NULLPTR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_HAS_IS_BASE_OF
#if defined(_AIX)
#define __MULTILOCALE_API
#endif
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {inline namespace _LIBCPP_NAMESPACE {
#define _LIBCPP_END_NAMESPACE_STD } }
#define _VSTD std::_LIBCPP_NAMESPACE
namespace std {
inline namespace _LIBCPP_NAMESPACE {
}
}
#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
#endif // __clang__ || __GNUC___ || _MSC_VER
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t;
@@ -533,26 +459,11 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#ifdef _LIBCPP_DEBUG
# if _LIBCPP_DEBUG == 0
# define _LIBCPP_DEBUG_LEVEL 1
# elif _LIBCPP_DEBUG == 1
# define _LIBCPP_DEBUG_LEVEL 2
# else
# error Supported values for _LIBCPP_DEBUG are 0 and 1
# endif
# define _LIBCPP_EXTERN_TEMPLATE(...)
#endif
#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...)
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#endif
#ifndef _LIBCPP_EXTERN_TEMPLATE2
#define _LIBCPP_EXTERN_TEMPLATE2(...) extern template __VA_ARGS__;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__) || defined(__NetBSD__)
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif
#ifdef __FreeBSD__
@@ -567,54 +478,20 @@ template <unsigned> struct __static_assert_check {};
#define _LIBCPP_WCTYPE_IS_MASK
#endif
#if defined(__APPLE__)
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 0
#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
#ifndef _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
# define _LIBCPP_TRIVIAL_PAIR_COPY_CTOR 1
#endif
#ifndef _LIBCPP_STD_VER
# if __cplusplus <= 201103L
# define _LIBCPP_STD_VER 11
# else
# define _LIBCPP_STD_VER 13 // current year, or date of c++14 ratification
# endif
#endif // _LIBCPP_STD_VER
#if _LIBCPP_STD_VER > 11
#define _LIBCPP_DEPRECATED [[deprecated]]
#ifdef _LIBCPP_DEBUG2
# include <__debug>
#else
#define _LIBCPP_DEPRECATED
#endif
#if _LIBCPP_STD_VER <= 11
#define _LIBCPP_CONSTEXPR_AFTER_CXX11
#define _LIBCPP_EXPLICIT_AFTER_CXX11
#define _LIBCPP_DEPRECATED_AFTER_CXX11
#else
#define _LIBCPP_CONSTEXPR_AFTER_CXX11 constexpr
#define _LIBCPP_EXPLICIT_AFTER_CXX11 explicit
#define _LIBCPP_DEPRECATED_AFTER_CXX11 [[deprecated]]
#endif
// Try to find out if RTTI is disabled.
// g++ and cl.exe have RTTI on by default and define a macro when it is.
// g++ only defines the macro in 4.3.2 and onwards.
#if !defined(_LIBCPP_NO_RTTI)
# if defined(__GNUG__) && (__GNUC__ >= 4 && \
(__GNUC_MINOR__ >= 3 || __GNUC_PATCHLEVEL__ >= 2)) && !defined(__GXX_RTTI)
# define _LIBCPP_NO_RTTI
# elif (defined(_MSC_VER) && !defined(__clang__)) && !defined(_CPPRTTI)
# define _LIBCPP_NO_RTTI
# endif
#endif
#ifndef _LIBCPP_WEAK
# define _LIBCPP_WEAK __attribute__((__weak__))
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#endif // _LIBCPP_CONFIG

View File

@@ -11,10 +11,6 @@
#ifndef _LIBCPP_DEBUG_H
#define _LIBCPP_DEBUG_H
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#if _LIBCPP_DEBUG_LEVEL >= 1
# include <cstdlib>
@@ -38,15 +34,8 @@ struct _LIBCPP_TYPE_VIS __i_node
__i_node* __next_;
__c_node* __c_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
__i_node(const __i_node&) = delete;
__i_node& operator=(const __i_node&) = delete;
#else
private:
__i_node(const __i_node&);
__i_node& operator=(const __i_node&);
public:
#endif
_LIBCPP_INLINE_VISIBILITY
__i_node(void* __i, __i_node* __next, __c_node* __c)
: __i_(__i), __next_(__next), __c_(__c) {}
@@ -61,15 +50,8 @@ struct _LIBCPP_TYPE_VIS __c_node
__i_node** end_;
__i_node** cap_;
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
__c_node(const __c_node&) = delete;
__c_node& operator=(const __c_node&) = delete;
#else
private:
__c_node(const __c_node&);
__c_node& operator=(const __c_node&);
public:
#endif
_LIBCPP_INLINE_VISIBILITY
__c_node(void* __c, __c_node* __next)
: __c_(__c), __next_(__next), beg_(nullptr), end_(nullptr), cap_(nullptr) {}
@@ -148,15 +130,8 @@ class _LIBCPP_TYPE_VIS __libcpp_db
__libcpp_db();
public:
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
__libcpp_db(const __libcpp_db&) = delete;
__libcpp_db& operator=(const __libcpp_db&) = delete;
#else
private:
__libcpp_db(const __libcpp_db&);
__libcpp_db& operator=(const __libcpp_db&);
public:
#endif
~__libcpp_db();
class __db_c_iterator;
@@ -196,7 +171,7 @@ public:
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 __less_than_comparable(const void* __i, const void* __j) const;
bool __comparable(const void* __i, const void* __j) const;
private:
_LIBCPP_HIDDEN
__i_node* __insert_iterator(void* __i);

View File

@@ -102,98 +102,98 @@ mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2))
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const>
__mem_fn<_Rp (_Tp::*)()>
mem_fn(_Rp (_Tp::* __pm)() const)
{
return __mem_fn<_Rp (_Tp::*)() const>(__pm);
return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const>
__mem_fn<_Rp (_Tp::*)(_A0)>
mem_fn(_Rp (_Tp::* __pm)(_A0) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const>
__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() volatile>
__mem_fn<_Rp (_Tp::*)()>
mem_fn(_Rp (_Tp::* __pm)() volatile)
{
return __mem_fn<_Rp (_Tp::*)() volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) volatile>
__mem_fn<_Rp (_Tp::*)(_A0)>
mem_fn(_Rp (_Tp::* __pm)(_A0) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>
__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
template<class _Rp, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)() const volatile>
__mem_fn<_Rp (_Tp::*)()>
mem_fn(_Rp (_Tp::* __pm)() const volatile)
{
return __mem_fn<_Rp (_Tp::*)() const volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)()>(__pm);
}
template<class _Rp, class _Tp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0) const volatile>
__mem_fn<_Rp (_Tp::*)(_A0)>
mem_fn(_Rp (_Tp::* __pm)(_A0) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0) const volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>
__mem_fn<_Rp (_Tp::*)(_A0, _A1)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1) const volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1)>(__pm);
}
template<class _Rp, class _Tp, class _A0, class _A1, class _A2>
inline _LIBCPP_INLINE_VISIBILITY
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>
__mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>
mem_fn(_Rp (_Tp::* __pm)(_A0, _A1, _A2) const volatile)
{
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2) const volatile>(__pm);
return __mem_fn<_Rp (_Tp::*)(_A0, _A1, _A2)>(__pm);
}
// bad_function_call
@@ -203,7 +203,7 @@ class _LIBCPP_EXCEPTION_ABI bad_function_call
{
};
template<class _Fp> class _LIBCPP_TYPE_VIS_ONLY function; // undefined
template<class _Fp> class _LIBCPP_TYPE_VIS function; // undefined
namespace __function
{
@@ -644,7 +644,7 @@ __func<_Fp, _Alloc, _Rp(_A0, _A1, _A2)>::target_type() const
} // __function
template<class _Rp>
class _LIBCPP_TYPE_VIS_ONLY function<_Rp()>
class _LIBCPP_TYPE_VIS function<_Rp()>
{
typedef __function::__base<_Rp()> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
@@ -928,7 +928,7 @@ function<_Rp()>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _Rp, class _A0>
class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0)>
class _LIBCPP_TYPE_VIS function<_Rp(_A0)>
: public unary_function<_A0, _Rp>
{
typedef __function::__base<_Rp(_A0)> __base;
@@ -1230,7 +1230,7 @@ function<_Rp(_A0)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _Rp, class _A0, class _A1>
class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1)>
class _LIBCPP_TYPE_VIS function<_Rp(_A0, _A1)>
: public binary_function<_A0, _A1, _Rp>
{
typedef __function::__base<_Rp(_A0, _A1)> __base;
@@ -1532,7 +1532,7 @@ function<_Rp(_A0, _A1)>::target() const
#endif // _LIBCPP_NO_RTTI
template<class _Rp, class _A0, class _A1, class _A2>
class _LIBCPP_TYPE_VIS_ONLY function<_Rp(_A0, _A1, _A2)>
class _LIBCPP_TYPE_VIS function<_Rp(_A0, _A1, _A2)>
{
typedef __function::__base<_Rp(_A0, _A1, _A2)> __base;
aligned_storage<3*sizeof(void*)>::type __buf_;
@@ -1860,11 +1860,11 @@ swap(function<_Fp>& __x, function<_Fp>& __y)
{return __x.swap(__y);}
template<class _Tp> struct __is_bind_expression : public false_type {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_bind_expression
template<class _Tp> struct _LIBCPP_TYPE_VIS is_bind_expression
: public __is_bind_expression<typename remove_cv<_Tp>::type> {};
template<class _Tp> struct __is_placeholder : public integral_constant<int, 0> {};
template<class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_placeholder
template<class _Tp> struct _LIBCPP_TYPE_VIS is_placeholder
: public __is_placeholder<typename remove_cv<_Tp>::type> {};
namespace placeholders

View File

@@ -15,7 +15,6 @@
#include <type_traits>
#include <typeinfo>
#include <exception>
#include <new>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -24,21 +23,21 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result>
struct _LIBCPP_TYPE_VIS_ONLY unary_function
struct _LIBCPP_TYPE_VIS unary_function
{
typedef _Arg argument_type;
typedef _Result result_type;
};
template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_TYPE_VIS_ONLY binary_function
struct _LIBCPP_TYPE_VIS binary_function
{
typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type;
typedef _Result result_type;
};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
template <class _Tp> struct _LIBCPP_TYPE_VIS hash;
template <class _Tp>
struct __has_result_type
@@ -51,80 +50,13 @@ public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
#if _LIBCPP_STD_VER > 11
template <class _Tp = void>
#else
template <class _Tp>
#endif
struct _LIBCPP_TYPE_VIS_ONLY less : binary_function<_Tp, _Tp, bool>
struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Tp& __y) const
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#if _LIBCPP_STD_VER > 11
template <>
struct _LIBCPP_TYPE_VIS_ONLY less<void>
{
template <class _T1, class _T2>
_LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
auto operator()(_T1&& __t, _T2&& __u) const
{ return _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
typedef void is_transparent;
};
#endif
// addressof
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__strong _Tp*
addressof(__strong _Tp& __x) _NOEXCEPT
{
return &__x;
}
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__weak _Tp*
addressof(__weak _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__autoreleasing _Tp*
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
{
return &__x;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__unsafe_unretained _Tp*
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03>
@@ -360,8 +292,7 @@ struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile>
// bullets 1 and 2
template <class _Fp, class _A0, class ..._Args,
class>
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
@@ -370,8 +301,7 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
}
template <class _Fp, class _A0, class ..._Args,
class>
template <class _Fp, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
@@ -382,8 +312,7 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
// bullets 3 and 4
template <class _Fp, class _A0,
class>
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
@@ -392,8 +321,7 @@ __invoke(_Fp&& __f, _A0&& __a0)
return _VSTD::forward<_A0>(__a0).*__f;
}
template <class _Fp, class _A0,
class>
template <class _Fp, class _A0>
inline _LIBCPP_INLINE_VISIBILITY
auto
__invoke(_Fp&& __f, _A0&& __a0)
@@ -420,7 +348,7 @@ struct __invoke_return
};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
class _LIBCPP_TYPE_VIS reference_wrapper
: public __weak_result_type<_Tp>
{
public:
@@ -431,8 +359,7 @@ private:
public:
// construct/copy/destroy
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT
: __f_(_VSTD::addressof(__f)) {}
_LIBCPP_INLINE_VISIBILITY reference_wrapper(type& __f) _NOEXCEPT : __f_(&__f) {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
private: reference_wrapper(type&&); public: // = delete; // do not bind to temps
#endif
@@ -505,111 +432,6 @@ template <class _Tp> void cref(const _Tp&&);// = delete;
#endif // _LIBCPP_HAS_NO_VARIADICS
#if _LIBCPP_STD_VER > 11
template <class _Tp1, class _Tp2 = void>
struct __is_transparent
{
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::is_transparent* = 0);
public:
static const bool value = sizeof(__test<_Tp1>(0)) == 1;
};
#endif
// allocator_arg_t
struct _LIBCPP_TYPE_VIS_ONLY allocator_arg_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
#else
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
#endif
// uses_allocator
template <class _Tp>
struct __has_allocator_type
{
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
struct __uses_allocator
: public integral_constant<bool,
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
{
};
template <class _Tp, class _Alloc>
struct __uses_allocator<_Tp, _Alloc, false>
: public false_type
{
};
template <class _Tp, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator
: public __uses_allocator<_Tp, _Alloc>
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
// allocator construction
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor_imp
{
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
static const bool __ic =
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
static const int value = __ua ? 2 - __ic : 0;
};
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
{};
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 0>, _Tp *__storage, const _Allocator &, _Args &&... __args )
{
new (__storage) _Tp (_VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 1>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
{
new (__storage) _Tp (allocator_arg, __a, _VSTD::forward<_Args>(__args)...);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct_impl (integral_constant<int, 2>, _Tp *__storage, const _Allocator &__a, _Args &&... __args )
{
new (__storage) _Tp (_VSTD::forward<_Args>(__args)..., __a);
}
template <class _Tp, class _Allocator, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
void __user_alloc_construct (_Tp *__storage, const _Allocator &__a, _Args &&... __args)
{
__user_alloc_construct_impl(
__uses_alloc_ctor<_Tp, _Allocator>(),
__storage, __a, _VSTD::forward<_Args>(__args)...
);
}
#endif // _LIBCPP_HAS_NO_VARIADICS
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_FUNCTIONAL_BASE

View File

@@ -996,7 +996,7 @@ struct __invoke_return2
};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY reference_wrapper
class _LIBCPP_TYPE_VIS reference_wrapper
: public __weak_result_type<_Tp>
{
public:

File diff suppressed because it is too large Load Diff

View File

@@ -19,13 +19,11 @@
#include <cstdint>
#include <cctype>
#include <locale.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
# include <support/win32/locale_win32.h>
#elif _AIX
# include <support/ibm/xlocale.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(__EMSCRIPTEN__) || defined(__IBMCPP__)
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN)
# include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || __EMSCRIPTEN__ || __IBMCPP__
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || EMSCRIPTEN
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -177,7 +175,7 @@ use_facet(const locale& __l)
// template <class _CharT> class collate;
template <class _CharT>
class _LIBCPP_TYPE_VIS_ONLY collate
class _LIBCPP_TYPE_VIS collate
: public locale::facet
{
public:
@@ -256,12 +254,12 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
return static_cast<long>(__h);
}
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<char>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS collate<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<wchar_t>)
// template <class CharT> class collate_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY collate_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS collate_byname;
template <>
class _LIBCPP_TYPE_VIS collate_byname<char>
@@ -341,12 +339,12 @@ public:
static const mask punct = _PUNCT;
static const mask xdigit = _HEX;
static const mask blank = _BLANK;
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif (defined(__APPLE__) || defined(__FreeBSD__)) || defined(EMSCRIPTEN)
#ifdef __APPLE__
typedef __uint32_t mask;
#elif defined(__FreeBSD__)
typedef unsigned long mask;
#elif defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(EMSCRIPTEN)
typedef unsigned short mask;
#endif
static const mask space = _CTYPE_S;
@@ -358,12 +356,8 @@ public:
static const mask digit = _CTYPE_D;
static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X;
# if defined(__NetBSD__)
static const mask blank = _CTYPE_BL;
# else
static const mask blank = _CTYPE_B;
# endif
#elif defined(__sun__) || defined(_AIX)
#elif defined(__sun__)
typedef unsigned int mask;
static const mask space = _ISSPACE;
static const mask print = _ISPRINT;
@@ -375,7 +369,7 @@ public:
static const mask punct = _ISPUNCT;
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || __EMSCRIPTEN__ || __sun__
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || EMSCRIPTEN || __sun__
typedef unsigned long mask;
static const mask space = 1<<0;
static const mask print = 1<<1;
@@ -394,7 +388,7 @@ public:
_LIBCPP_ALWAYS_INLINE ctype_base() {}
};
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype;
template <class _CharT> class _LIBCPP_TYPE_VIS ctype;
template <>
class _LIBCPP_TYPE_VIS ctype<wchar_t>
@@ -512,7 +506,7 @@ public:
_LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const
{
return isascii(__c) ? (__tab_[static_cast<int>(__c)] & __m) !=0 : false;
return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false;
}
_LIBCPP_ALWAYS_INLINE
@@ -598,14 +592,10 @@ public:
#endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(__EMSCRIPTEN__)
#if defined(__GLIBC__) || defined(EMSCRIPTEN)
static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT;
#endif
#if defined(__NetBSD__)
static const short* __classic_upper_table() _NOEXCEPT;
static const short* __classic_lower_table() _NOEXCEPT;
#endif
protected:
~ctype();
@@ -621,7 +611,7 @@ protected:
// template <class CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY ctype_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS ctype_byname;
template <>
class _LIBCPP_TYPE_VIS ctype_byname<char>
@@ -782,7 +772,7 @@ public:
// template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS_ONLY codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS codecvt;
// template <> class codecvt<char, char, mbstate_t>
@@ -1128,7 +1118,7 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT>
class _LIBCPP_TYPE_VIS_ONLY codecvt_byname
class _LIBCPP_TYPE_VIS codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT>
{
public:
@@ -1147,10 +1137,10 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{
}
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<wchar_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char16_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE2(class _LIBCPP_TYPE_VIS codecvt_byname<char32_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>)
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>)
_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*);
@@ -1336,7 +1326,7 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct
template <class _CharT> class _LIBCPP_TYPE_VIS_ONLY numpunct;
template <class _CharT> class _LIBCPP_TYPE_VIS numpunct;
template <>
class _LIBCPP_TYPE_VIS numpunct<char>
@@ -1402,7 +1392,7 @@ protected:
// template <class charT> class numpunct_byname
template <class charT> class _LIBCPP_TYPE_VIS_ONLY numpunct_byname;
template <class charT> class _LIBCPP_TYPE_VIS numpunct_byname;
template <>
class _LIBCPP_TYPE_VIS numpunct_byname<char>

View File

@@ -20,6 +20,16 @@
#pragma GCC system_header
#endif
#ifdef _LIBCPP_SHARED_LOCK
namespace ting {
template <class _Mutex> class shared_lock;
template <class _Mutex> class upgrade_lock;
}
#endif // _LIBCPP_SHARED_LOCK
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS mutex
@@ -67,7 +77,7 @@ constexpr adopt_lock_t adopt_lock = adopt_lock_t();
#endif
template <class _Mutex>
class _LIBCPP_TYPE_VIS_ONLY lock_guard
class _LIBCPP_TYPE_VIS lock_guard
{
public:
typedef _Mutex mutex_type;
@@ -91,7 +101,7 @@ private:
};
template <class _Mutex>
class _LIBCPP_TYPE_VIS_ONLY unique_lock
class _LIBCPP_TYPE_VIS unique_lock
{
public:
typedef _Mutex mutex_type;
@@ -152,6 +162,27 @@ public:
return *this;
}
#ifdef _LIBCPP_SHARED_LOCK
unique_lock(ting::shared_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::shared_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
explicit unique_lock(ting::upgrade_lock<mutex_type>&&);
unique_lock(ting::upgrade_lock<mutex_type>&&, try_to_lock_t);
template <class _Clock, class _Duration>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::time_point<_Clock, _Duration>&);
template <class _Rep, class _Period>
unique_lock(ting::upgrade_lock<mutex_type>&&,
const chrono::duration<_Rep, _Period>&);
#endif // _LIBCPP_SHARED_LOCK
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
void lock();

View File

@@ -285,16 +285,16 @@ __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _F
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{
while (__begin_ != __new_begin)
__alloc_traits::destroy(__alloc(), __to_raw_pointer(__begin_++));
__alloc_traits::destroy(__alloc(), __begin_++);
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_type)
{
@@ -302,16 +302,16 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, true_t
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), __to_raw_pointer(--__end_));
__alloc_traits::destroy(__alloc(), --__end_);
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type) _NOEXCEPT
{
@@ -320,7 +320,7 @@ __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, true_type
template <class _Tp, class _Allocator>
__split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __start, __alloc_rr& __a)
: __end_cap_(nullptr, __a)
: __end_cap_(0, __a)
{
__first_ = __cap != 0 ? __alloc_traits::allocate(__alloc(), __cap) : nullptr;
__begin_ = __end_ = __first_ + __start;
@@ -328,24 +328,24 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(size_type __cap, size_type __sta
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(__alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__split_buffer<_Tp, _Allocator>::__split_buffer(const __alloc_rr& __a)
: __first_(nullptr), __begin_(nullptr), __end_(nullptr), __end_cap_(nullptr, __a)
: __first_(0), __begin_(0), __end_(0), __end_cap_(0, __a)
{
}
@@ -541,7 +541,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
{
@@ -640,7 +640,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(__split_buffer<_Tp, _Allocator>& __x, __split_buffer<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))

View File

@@ -55,8 +55,6 @@ private:
const codecvt<char_type, char, state_type>* __cv_;
state_type* __st_;
int __encoding_;
int_type __last_consumed_;
bool __last_consumed_is_next_;
bool __always_noconv_;
__stdinbuf(const __stdinbuf&);
@@ -68,9 +66,7 @@ private:
template <class _CharT>
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st)
: __file_(__fp),
__st_(__st),
__last_consumed_(traits_type::eof()),
__last_consumed_is_next_(false)
__st_(__st)
{
imbue(this->getloc());
}
@@ -104,16 +100,6 @@ template <class _CharT>
typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::__getchar(bool __consume)
{
if (__last_consumed_is_next_)
{
int_type __result = __last_consumed_;
if (__consume)
{
__last_consumed_ = traits_type::eof();
__last_consumed_is_next_ = false;
}
return __result;
}
char __extbuf[__limit];
int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i)
@@ -168,8 +154,6 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
return traits_type::eof();
}
}
else
__last_consumed_ = traits_type::to_int_type(__1buf);
return traits_type::to_int_type(__1buf);
}
@@ -178,41 +162,28 @@ typename __stdinbuf<_CharT>::int_type
__stdinbuf<_CharT>::pbackfail(int_type __c)
{
if (traits_type::eq_int_type(__c, traits_type::eof()))
{
if (!__last_consumed_is_next_)
{
__c = __last_consumed_;
__last_consumed_is_next_ = !traits_type::eq_int_type(__last_consumed_,
traits_type::eof());
}
return __c;
}
if (__last_consumed_is_next_)
char __extbuf[__limit];
char* __enxt;
const char_type __ci = traits_type::to_char_type(__c);
const char_type* __inxt;
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
{
char __extbuf[__limit];
char* __enxt;
const char_type __ci = traits_type::to_char_type(__last_consumed_);
const char_type* __inxt;
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt))
{
case _VSTD::codecvt_base::ok:
break;
case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__last_consumed_);
__enxt = __extbuf + 1;
break;
case codecvt_base::partial:
case codecvt_base::error:
return traits_type::eof();
}
while (__enxt > __extbuf)
if (ungetc(*--__enxt, __file_) == EOF)
return traits_type::eof();
case _VSTD::codecvt_base::ok:
break;
case _VSTD::codecvt_base::noconv:
__extbuf[0] = static_cast<char>(__c);
__enxt = __extbuf + 1;
break;
case codecvt_base::partial:
case codecvt_base::error:
return traits_type::eof();
}
__last_consumed_ = __c;
__last_consumed_is_next_ = true;
return __c;
while (__enxt > __extbuf)
if (ungetc(*--__enxt, __file_) == EOF)
return traits_type::eof();
return traits_type::not_eof(__c);
}
// __stdoutbuf
@@ -233,7 +204,6 @@ public:
protected:
virtual int_type overflow (int_type __c = traits_type::eof());
virtual streamsize xsputn(const char_type* __s, streamsize __n);
virtual int sync();
virtual void imbue(const locale& __loc);
@@ -264,31 +234,30 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
char_type __1buf;
if (!traits_type::eq_int_type(__c, traits_type::eof()))
{
__1buf = traits_type::to_char_type(__c);
this->setp(&__1buf, &__1buf+1);
*this->pptr() = traits_type::to_char_type(__c);
this->pbump(1);
if (__always_noconv_)
{
if (fwrite(&__1buf, sizeof(char_type), 1, __file_) != 1)
if (fwrite(this->pbase(), sizeof(char_type), 1, __file_) != 1)
return traits_type::eof();
}
else
{
char* __extbe = __extbuf;
codecvt_base::result __r;
char_type* pbase = &__1buf;
char_type* pptr = pbase + 1;
char_type* epptr = pptr;
do
{
const char_type* __e;
__r = __cv_->out(*__st_, pbase, pptr, __e,
__r = __cv_->out(*__st_, this->pbase(), this->pptr(), __e,
__extbuf,
__extbuf + sizeof(__extbuf),
__extbe);
if (__e == pbase)
if (__e == this->pbase())
return traits_type::eof();
if (__r == codecvt_base::noconv)
{
if (fwrite(pbase, 1, 1, __file_) != 1)
if (fwrite(this->pbase(), 1, 1, __file_) != 1)
return traits_type::eof();
}
else if (__r == codecvt_base::ok || __r == codecvt_base::partial)
@@ -298,30 +267,19 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
return traits_type::eof();
if (__r == codecvt_base::partial)
{
pbase = (char_type*)__e;
this->setp((char_type*)__e, this->pptr());
this->pbump(static_cast<int>(this->epptr() - this->pbase()));
}
}
else
return traits_type::eof();
} while (__r == codecvt_base::partial);
}
this->setp(0, 0);
}
return traits_type::not_eof(__c);
}
template <class _CharT>
streamsize
__stdoutbuf<_CharT>::xsputn(const char_type* __s, streamsize __n)
{
if (__always_noconv_)
return fwrite(__s, sizeof(char_type), __n, __file_);
streamsize __i = 0;
for (; __i < __n; ++__i, ++__s)
if (overflow(traits_type::to_int_type(*__s)) == traits_type::eof())
break;
return __i;
}
template <class _CharT>
int
__stdoutbuf<_CharT>::sync()

View File

@@ -25,17 +25,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator;
class _LIBCPP_TYPE_VIS __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
class _LIBCPP_TYPE_VIS __tree_const_iterator;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY map;
class _LIBCPP_TYPE_VIS map;
template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY multimap;
class _LIBCPP_TYPE_VIS multimap;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY set;
class _LIBCPP_TYPE_VIS set;
template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY multiset;
class _LIBCPP_TYPE_VIS multiset;
/*
@@ -614,11 +614,11 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
};
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_iterator
class _LIBCPP_TYPE_VIS __tree_iterator
{
typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -641,15 +641,10 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __tree_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_iterator& operator++()
@@ -678,20 +673,20 @@ private:
_LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
template <class, class, class> friend class _LIBCPP_TYPE_VIS __tree_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __map_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset;
};
template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS_ONLY __tree_const_iterator
class _LIBCPP_TYPE_VIS __tree_const_iterator
{
typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node;
typedef typename __node::base __node_base;
typedef const typename __node::base __node_base;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__node_base>
@@ -716,12 +711,7 @@ public:
#endif
pointer;
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __tree_const_iterator() {}
private:
typedef typename remove_const<__node>::type __non_const_node;
typedef typename pointer_traits<__node_pointer>::template
@@ -739,8 +729,7 @@ public:
: __ptr_(__p.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const
{return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__tree_const_iterator& operator++()
@@ -770,11 +759,11 @@ private:
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
: __ptr_(__p) {}
template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multiset;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __map_const_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset;
template <class> friend class _LIBCPP_TYPE_VIS __map_const_iterator;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -790,10 +779,8 @@ public:
typedef typename __alloc_traits::size_type size_type;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::void_pointer __void_pointer;
typedef __tree_node<value_type, __void_pointer> __node;
typedef __tree_node_base<__void_pointer> __node_base;
typedef __tree_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef __tree_node_base<typename __alloc_traits::void_pointer> __node_base;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node>
@@ -803,9 +790,9 @@ public:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
typedef typename __node_base::pointer __node_base_pointer;
typedef typename __node_base::pointer __node_base_const_pointer;
typedef typename __node_base::const_pointer __node_base_const_pointer;
private:
typedef typename __node_base::base __end_node_t;
typedef typename pointer_traits<__node_pointer>::template
@@ -817,9 +804,9 @@ private:
__end_node_ptr;
typedef typename pointer_traits<__node_pointer>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__end_node_t>
rebind<const __end_node_t>
#else
rebind<__end_node_t>::other
rebind<const __end_node_t>::other
#endif
__end_node_const_ptr;
@@ -841,7 +828,7 @@ public:
{
return static_cast<__node_const_pointer>
(
pointer_traits<__end_node_const_ptr>::pointer_to(const_cast<__end_node_t&>(__pair1_.first()))
pointer_traits<__end_node_const_ptr>::pointer_to(__pair1_.first())
);
}
_LIBCPP_INLINE_VISIBILITY
@@ -878,7 +865,7 @@ public:
{return static_cast<__node_const_pointer>(__end_node()->__left_);}
typedef __tree_iterator<value_type, __node_pointer, difference_type> iterator;
typedef __tree_const_iterator<value_type, __node_pointer, difference_type> const_iterator;
typedef __tree_const_iterator<value_type, __node_const_pointer, difference_type> const_iterator;
explicit __tree(const value_compare& __comp)
_NOEXCEPT_(
@@ -1115,9 +1102,6 @@ private:
__node_pointer __detach();
static __node_pointer __detach(__node_pointer);
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY multimap;
};
template <class _Tp, class _Compare, class _Allocator>
@@ -1177,7 +1161,7 @@ __tree<_Tp, _Compare, _Allocator>::__detach(__node_pointer __cache)
{
if (__cache->__parent_ == nullptr)
return nullptr;
if (__tree_is_left_child(static_cast<__node_base_pointer>(__cache)))
if (__tree_is_left_child(__cache))
{
__cache->__parent_->__left_ = nullptr;
__cache = static_cast<__node_pointer>(__cache->__parent_);
@@ -1310,7 +1294,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t)
__begin_node() = __end_node();
else
{
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1330,7 +1314,7 @@ __tree<_Tp, _Compare, _Allocator>::__tree(__tree&& __t, const allocator_type& __
{
__begin_node() = __t.__begin_node();
__end_node()->__left_ = __t.__end_node()->__left_;
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
size() = __t.size();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
@@ -1358,7 +1342,7 @@ __tree<_Tp, _Compare, _Allocator>::__move_assign(__tree& __t, true_type)
__begin_node() = __end_node();
else
{
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
__t.__begin_node() = __t.__end_node();
__t.__end_node()->__left_ = nullptr;
__t.size() = 0;
@@ -1463,11 +1447,11 @@ __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t)
if (size() == 0)
__begin_node() = __end_node();
else
__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__end_node());
__end_node()->__left_->__parent_ = __end_node();
if (__t.size() == 0)
__t.__begin_node() = __t.__end_node();
else
__t.__end_node()->__left_->__parent_ = static_cast<__node_base_pointer>(__t.__end_node());
__t.__end_node()->__left_->__parent_ = __t.__end_node();
}
template <class _Tp, class _Compare, class _Allocator>
@@ -1499,7 +1483,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
@@ -1509,13 +1493,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_low(typename __node_base::pointer
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1538,7 +1522,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
@@ -1548,13 +1532,13 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf_high(typename __node_base::pointe
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1579,12 +1563,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_leaf(const_iterator __hint,
// *prev(__hint) <= __v <= *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__left_;
}
else
{
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1616,7 +1600,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
__nd = static_cast<__node_pointer>(__nd->__left_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__left_;
}
}
@@ -1626,18 +1610,18 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(typename __node_base::pointer& _
__nd = static_cast<__node_pointer>(__nd->__right_);
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent->__right_;
}
}
else
{
__parent = static_cast<__node_base_pointer>(__nd);
__parent = __nd;
return __parent;
}
}
}
__parent = static_cast<__node_base_pointer>(__end_node());
__parent = __end_node();
return __parent->__left_;
}
@@ -1664,12 +1648,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
// *prev(__hint) < __v < *__hint
if (__hint.__ptr_->__left_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__left_;
}
else
{
__parent = static_cast<__node_base_pointer>(__prior.__ptr_);
__parent = const_cast<__node_pointer&>(__prior.__ptr_);
return __parent->__right_;
}
}
@@ -1685,12 +1669,12 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
// *__hint < __v < *_VSTD::next(__hint)
if (__hint.__ptr_->__right_ == nullptr)
{
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent->__right_;
}
else
{
__parent = static_cast<__node_base_pointer>(__next.__ptr_);
__parent = const_cast<__node_pointer&>(__next.__ptr_);
return __parent->__left_;
}
}
@@ -1698,7 +1682,7 @@ __tree<_Tp, _Compare, _Allocator>::__find_equal(const_iterator __hint,
return __find_equal(__parent, __v);
}
// else __v == *__hint
__parent = static_cast<__node_base_pointer>(__hint.__ptr_);
__parent = const_cast<__node_pointer&>(__hint.__ptr_);
return __parent;
}
@@ -1745,7 +1729,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_unique(_Args&&... __args)
bool __inserted = false;
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
@@ -1763,7 +1747,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_unique(const_iterator __p, _Ar
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
@@ -1777,7 +1761,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_multi(_Args&&... __args)
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(static_cast<__node_pointer>(__h.release()));
}
@@ -1790,7 +1774,7 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...);
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(static_cast<__node_pointer>(__h.release()));
}
@@ -1828,7 +1812,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1840,7 +1824,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v)
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v));
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1854,7 +1838,7 @@ __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _VSTD::move(__h);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1870,7 +1854,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const value_type& __v)
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
__inserted = true;
}
@@ -1887,7 +1871,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, const val
if (__child == nullptr)
{
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
__r = __h.release();
}
return iterator(__r);
@@ -1900,7 +1884,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const value_type& __v)
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __v);
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1911,7 +1895,7 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, const valu
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __v);
__node_holder __h = __construct_node(__v);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__h.get()));
__insert_node_at(__parent, __child, __h.get());
return iterator(__h.release());
}
@@ -1925,7 +1909,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(__node_pointer __nd)
bool __inserted = false;
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
__r = __nd;
__inserted = true;
}
@@ -1942,7 +1926,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_unique(const_iterator __p,
__node_pointer __r = static_cast<__node_pointer>(__child);
if (__child == nullptr)
{
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
__r = __nd;
}
return iterator(__r);
@@ -1954,7 +1938,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(__node_pointer __nd)
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __nd->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
return iterator(__nd);
}
@@ -1965,7 +1949,7 @@ __tree<_Tp, _Compare, _Allocator>::__node_insert_multi(const_iterator __p,
{
__node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __nd->__value_);
__insert_node_at(__parent, __child, static_cast<__node_base_pointer>(__nd));
__insert_node_at(__parent, __child, __nd);
return iterator(__nd);
}
@@ -1973,7 +1957,7 @@ template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::erase(const_iterator __p)
{
__node_pointer __np = __p.__ptr_;
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
iterator __r(__np);
++__r;
if (__begin_node() == __np)
@@ -1993,7 +1977,7 @@ __tree<_Tp, _Compare, _Allocator>::erase(const_iterator __f, const_iterator __l)
{
while (__f != __l)
__f = erase(__f);
return iterator(__l.__ptr_);
return iterator(const_cast<__node_pointer>(__l.__ptr_));
}
template <class _Tp, class _Compare, class _Allocator>
@@ -2280,7 +2264,7 @@ template <class _Tp, class _Compare, class _Allocator>
typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
{
__node_pointer __np = __p.__ptr_;
__node_pointer __np = const_cast<__node_pointer>(__p.__ptr_);
if (__begin_node() == __np)
{
if (__np->__right_ != nullptr)

View File

@@ -27,46 +27,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size;
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const _Tp>
class _LIBCPP_TYPE_VIS tuple_size<const _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<volatile _Tp>
class _LIBCPP_TYPE_VIS tuple_size<volatile _Tp>
: public tuple_size<_Tp> {};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const volatile _Tp>
class _LIBCPP_TYPE_VIS tuple_size<const volatile _Tp>
: public tuple_size<_Tp> {};
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS tuple_element;
template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const _Tp>
{
public:
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, volatile _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, volatile _Tp>
{
public:
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const volatile _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const volatile _Tp>
{
public:
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
};
template <class ..._Tp> class _LIBCPP_TYPE_VIS_ONLY tuple;
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS_ONLY pair;
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY array;
template <class ..._Tp> class _LIBCPP_TYPE_VIS tuple;
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS pair;
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS array;
template <class _Tp> struct __tuple_like : false_type {};
@@ -79,47 +79,47 @@ 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 <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_Tp&
get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT;
@@ -154,7 +154,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<> >
{
public:
static_assert(_Ip == 0, "tuple_element index out of range");
@@ -162,21 +162,21 @@ public:
};
template <class _Hp, class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, __tuple_types<_Hp, _Tp...> >
class _LIBCPP_TYPE_VIS tuple_element<0, __tuple_types<_Hp, _Tp...> >
{
public:
typedef _Hp type;
};
template <size_t _Ip, class _Hp, class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
{
public:
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
};
template <class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<__tuple_types<_Tp...> >
class _LIBCPP_TYPE_VIS tuple_size<__tuple_types<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};

View File

@@ -19,8 +19,8 @@
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS_ONLY tuple_element;
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS tuple_element;
_LIBCPP_END_NAMESPACE_STD

View File

@@ -9,21 +9,11 @@
//===----------------------------------------------------------------------===//
#ifdef min
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("macro min is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing min")
#else
#warning: macro min is incompatible with C++. #undefing min
#endif
#undef min
#endif
#ifdef max
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("macro max is incompatible with C++. Try #define NOMINMAX "
"before any Windows header. #undefing max")
#else
#warning: macro max is incompatible with C++. #undefing max
#endif
#undef max
#endif

View File

@@ -87,63 +87,30 @@ template <class InputIterator1, class InputIterator2>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
template <class InputIterator1, class InputIterator2>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2); // **C++14**
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, BinaryPredicate pred);
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
pair<InputIterator1, InputIterator2>
mismatch(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
BinaryPredicate pred); // **C++14**
template <class InputIterator1, class InputIterator2>
bool
equal(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2);
template <class InputIterator1, class InputIterator2>
bool
equal(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2); // **C++14**
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
bool
equal(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, BinaryPredicate pred);
template <class InputIterator1, class InputIterator2, class BinaryPredicate>
bool
equal(InputIterator1 first1, InputIterator1 last1,
InputIterator2 first2, InputIterator2 last2,
BinaryPredicate pred); // **C++14**
template<class ForwardIterator1, class ForwardIterator2>
bool
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2);
template<class ForwardIterator1, class ForwardIterator2>
bool
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2); // **C++14**
template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
bool
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, BinaryPredicate pred);
template<class ForwardIterator1, class ForwardIterator2, class BinaryPredicate>
bool
is_permutation(ForwardIterator1 first1, ForwardIterator1 last1,
ForwardIterator2 first2, ForwardIterator2 last2,
BinaryPredicate pred); // **C++14**
template <class ForwardIterator1, class ForwardIterator2>
ForwardIterator1
search(ForwardIterator1 first1, ForwardIterator1 last1,
@@ -628,13 +595,6 @@ template <class BidirectionalIterator, class Compare>
#include <iterator>
#include <cstddef>
#if defined(__IBMCPP__)
#include "support/ibm/support.h"
#endif
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include "support/win32/support.h"
#endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -717,7 +677,7 @@ public:
bool operator()(const _T1& __x, const _T2& __y) {return !__p_(__x, __y);}
};
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
template <class _Compare>
struct __debug_less
@@ -734,7 +694,7 @@ struct __debug_less
}
};
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
// Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY
@@ -832,7 +792,7 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
{
for (; __first != __last; ++__first)
__f(*__first);
return _VSTD::move(__f); // explicitly moved for (emulated) C++03
return _VSTD::move(__f);
}
// find
@@ -1127,32 +1087,6 @@ mismatch(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __fi
return _VSTD::mismatch(__first1, __last1, __first2, __equal_to<__v1, __v2>());
}
#if _LIBCPP_STD_VER > 11
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
inline _LIBCPP_INLINE_VISIBILITY
pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2,
_BinaryPredicate __pred)
{
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
if (!__pred(*__first1, *__first2))
break;
return pair<_InputIterator1, _InputIterator2>(__first1, __first2);
}
template <class _InputIterator1, class _InputIterator2>
inline _LIBCPP_INLINE_VISIBILITY
pair<_InputIterator1, _InputIterator2>
mismatch(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
{
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
return _VSTD::mismatch(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>());
}
#endif
// equal
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
@@ -1176,60 +1110,6 @@ equal(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first
return _VSTD::equal(__first1, __last1, __first2, __equal_to<__v1, __v2>());
}
#if _LIBCPP_STD_VER > 11
template <class _BinaryPredicate, class _InputIterator1, class _InputIterator2>
inline _LIBCPP_INLINE_VISIBILITY
bool
__equal(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred,
input_iterator_tag, input_iterator_tag )
{
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
if (!__pred(*__first1, *__first2))
return false;
return __first1 == __last1 && __first2 == __last2;
}
template <class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
inline _LIBCPP_INLINE_VISIBILITY
bool
__equal(_RandomAccessIterator1 __first1, _RandomAccessIterator1 __last1,
_RandomAccessIterator2 __first2, _RandomAccessIterator2 __last2, _BinaryPredicate __pred,
random_access_iterator_tag, random_access_iterator_tag )
{
if ( _VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2))
return false;
return _VSTD::equal<_RandomAccessIterator1, _RandomAccessIterator2,
typename add_lvalue_reference<_BinaryPredicate>::type>
(__first1, __last1, __first2, __pred );
}
template <class _InputIterator1, class _InputIterator2, class _BinaryPredicate>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _BinaryPredicate __pred )
{
return _VSTD::__equal<typename add_lvalue_reference<_BinaryPredicate>::type>
(__first1, __last1, __first2, __last2, __pred,
typename iterator_traits<_InputIterator1>::iterator_category(),
typename iterator_traits<_InputIterator2>::iterator_category());
}
template <class _InputIterator1, class _InputIterator2>
inline _LIBCPP_INLINE_VISIBILITY
bool
equal(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2)
{
typedef typename iterator_traits<_InputIterator1>::value_type __v1;
typedef typename iterator_traits<_InputIterator2>::value_type __v2;
return _VSTD::__equal(__first1, __last1, __first2, __last2, __equal_to<__v1, __v2>(),
typename iterator_traits<_InputIterator1>::iterator_category(),
typename iterator_traits<_InputIterator2>::iterator_category());
}
#endif
// is_permutation
template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
@@ -1289,100 +1169,6 @@ is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
return _VSTD::is_permutation(__first1, __last1, __first2, __equal_to<__v1, __v2>());
}
#if _LIBCPP_STD_VER > 11
template<class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
bool
__is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
_BinaryPredicate __pred,
forward_iterator_tag, forward_iterator_tag )
{
// shorten sequences as much as possible by lopping of any equal parts
for (; __first1 != __last1 && __first2 != __last2; ++__first1, ++__first2)
if (!__pred(*__first1, *__first2))
goto __not_done;
return __first1 == __last1 && __first2 == __last2;
__not_done:
// __first1 != __last1 && __first2 != __last2 && *__first1 != *__first2
typedef typename iterator_traits<_ForwardIterator1>::difference_type _D1;
_D1 __l1 = _VSTD::distance(__first1, __last1);
typedef typename iterator_traits<_ForwardIterator2>::difference_type _D2;
_D2 __l2 = _VSTD::distance(__first2, __last2);
if (__l1 != __l2)
return false;
// For each element in [f1, l1) see if there are the same number of
// equal elements in [f2, l2)
for (_ForwardIterator1 __i = __first1; __i != __last1; ++__i)
{
// Have we already counted the number of *__i in [f1, l1)?
for (_ForwardIterator1 __j = __first1; __j != __i; ++__j)
if (__pred(*__j, *__i))
goto __next_iter;
{
// Count number of *__i in [f2, l2)
_D1 __c2 = 0;
for (_ForwardIterator2 __j = __first2; __j != __last2; ++__j)
if (__pred(*__i, *__j))
++__c2;
if (__c2 == 0)
return false;
// Count number of *__i in [__i, l1) (we can start with 1)
_D1 __c1 = 1;
for (_ForwardIterator1 __j = _VSTD::next(__i); __j != __last1; ++__j)
if (__pred(*__i, *__j))
++__c1;
if (__c1 != __c2)
return false;
}
__next_iter:;
}
return true;
}
template<class _BinaryPredicate, class _RandomAccessIterator1, class _RandomAccessIterator2>
bool
__is_permutation(_RandomAccessIterator1 __first1, _RandomAccessIterator2 __last1,
_RandomAccessIterator1 __first2, _RandomAccessIterator2 __last2,
_BinaryPredicate __pred,
random_access_iterator_tag, random_access_iterator_tag )
{
if ( _VSTD::distance(__first1, __last1) != _VSTD::distance(__first2, __last2))
return false;
return _VSTD::is_permutation<_RandomAccessIterator1, _RandomAccessIterator2,
typename add_lvalue_reference<_BinaryPredicate>::type>
(__first1, __last1, __first2, __pred );
}
template<class _ForwardIterator1, class _ForwardIterator2, class _BinaryPredicate>
inline _LIBCPP_INLINE_VISIBILITY
bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2,
_BinaryPredicate __pred )
{
return _VSTD::__is_permutation<typename add_lvalue_reference<_BinaryPredicate>::type>
(__first1, __last1, __first2, __last2, __pred,
typename iterator_traits<_ForwardIterator1>::iterator_category(),
typename iterator_traits<_ForwardIterator2>::iterator_category());
}
template<class _ForwardIterator1, class _ForwardIterator2>
inline _LIBCPP_INLINE_VISIBILITY
bool
is_permutation(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
_ForwardIterator2 __first2, _ForwardIterator2 __last2)
{
typedef typename iterator_traits<_ForwardIterator1>::value_type __v1;
typedef typename iterator_traits<_ForwardIterator2>::value_type __v2;
return _VSTD::__is_permutation(__first1, __last1, __first2, __last2,
__equal_to<__v1, __v2>(),
typename iterator_traits<_ForwardIterator1>::iterator_category(),
typename iterator_traits<_ForwardIterator2>::iterator_category());
}
#endif
// search
template <class _BinaryPredicate, class _ForwardIterator1, class _ForwardIterator2>
@@ -1695,8 +1481,6 @@ __unwrap_iter(move_iterator<_Tp*> __i)
return __i.base();
}
#if _LIBCPP_DEBUG_LEVEL < 2
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
@@ -1709,8 +1493,6 @@ __unwrap_iter(__wrap_iter<_Tp*> __i)
return __i.base();
}
#endif // _LIBCPP_DEBUG_LEVEL < 2
template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
@@ -1998,23 +1780,17 @@ replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator _
template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, false_type)
{
for (; __n > 0; ++__first, --__n)
*__first = __value_;
return __first;
}
template <class _Tp, class _Size, class _Up>
template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value && sizeof(_Tp) == 1 &&
!is_same<_Tp, bool>::value &&
is_integral<_Up>::value && sizeof(_Up) == 1,
_Tp*
>::type
__fill_n(_Tp* __first, _Size __n,_Up __value_)
_OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, true_type)
{
if (__n > 0)
_VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n));
@@ -2026,7 +1802,10 @@ inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
{
return _VSTD::__fill_n(__first, __n, __value_);
return _VSTD::__fill_n(__first, __n, __value_, integral_constant<bool,
is_pointer<_OutputIterator>::value &&
is_trivially_copy_assignable<_Tp>::value &&
sizeof(_Tp) == 1>());
}
// fill
@@ -2975,11 +2754,11 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
return static_cast<result_type>(__u + __p.a());
}
class _LIBCPP_TYPE_VIS __rs_default;
class __rs_default;
_LIBCPP_FUNC_VIS __rs_default __rs_get();
__rs_default __rs_get();
class _LIBCPP_TYPE_VIS __rs_default
class __rs_default
{
static unsigned __c_;
@@ -2998,10 +2777,10 @@ public:
static _LIBCPP_CONSTEXPR result_type min() {return _Min;}
static _LIBCPP_CONSTEXPR result_type max() {return _Max;}
friend _LIBCPP_FUNC_VIS __rs_default __rs_get();
friend __rs_default __rs_get();
};
_LIBCPP_FUNC_VIS __rs_default __rs_get();
__rs_default __rs_get();
template <class _RandomAccessIterator>
void
@@ -3956,14 +3735,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -3999,46 +3778,46 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
}
#ifdef _LIBCPP_MSVC
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4231)
#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<int>&, int*>(int*, int*, __less<int>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long>&, long*>(long*, long*, __less<long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<float>&, float*>(float*, float*, __less<float>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<double>&, double*>(double*, double*, __less<double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
#endif // _MSC_VER
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<short>&, short*>(short*, short*, __less<short>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<int>&, int*>(int*, int*, __less<int>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long>&, long*>(long*, long*, __less<long>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<float>&, float*>(float*, float*, __less<float>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<double>&, double*>(double*, double*, __less<double>&))
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<short>&, short*>(short*, short*, __less<short>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<int>&, int*>(int*, int*, __less<int>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long>&, long*>(long*, long*, __less<long>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long long>&, long long*>(long long*, long long*, __less<long long>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<unsigned long long>&, unsigned long long*>(unsigned long long*, unsigned long long*, __less<unsigned long long>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<float>&, float*>(float*, float*, __less<float>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<double>&, double*>(double*, double*, __less<double>&))
_LIBCPP_EXTERN_TEMPLATE(bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
#ifdef _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&))
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _LIBCPP_MSVC
#endif // _MSC_VER
// lower_bound
@@ -4069,14 +3848,14 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lower_bound<_Comp_ref>(__first, __last, __value_, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _ForwardIterator, class _Tp>
@@ -4117,14 +3896,14 @@ inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __upper_bound<_Comp_ref>(__first, __last, __value_, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _ForwardIterator, class _Tp>
@@ -4177,14 +3956,14 @@ inline _LIBCPP_INLINE_VISIBILITY
pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __equal_range<_Comp_ref>(__first, __last, __value_, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __equal_range<_Comp_ref>(__first, __last, __value_, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _ForwardIterator, class _Tp>
@@ -4212,14 +3991,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __binary_search<_Comp_ref>(__first, __last, __value_, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __binary_search<_Comp_ref>(__first, __last, __value_, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _ForwardIterator, class _Tp>
@@ -4262,14 +4041,14 @@ _OutputIterator
merge(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _VSTD::__merge<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -4436,16 +4215,16 @@ inplace_merge(_BidirectionalIterator __first, _BidirectionalIterator __middle, _
__buf = _VSTD::get_temporary_buffer<value_type>(__buf_size);
__h.reset(__buf.first);
}
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __c, __len1, __len2,
__buf.first, __buf.second);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return _VSTD::__inplace_merge<_Comp_ref>(__first, __middle, __last, __comp, __len1, __len2,
__buf.first, __buf.second);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _BidirectionalIterator>
@@ -4647,14 +4426,14 @@ stable_sort(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compar
__buf = _VSTD::get_temporary_buffer<value_type>(__len);
__h.reset(__buf.first);
}
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__stable_sort<_Comp_ref>(__first, __last, __c, __len, __buf.first, __buf.second);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__stable_sort<_Comp_ref>(__first, __last, __comp, __len, __buf.first, __buf.second);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -4796,14 +4575,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
push_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__push_heap_back<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__push_heap_back<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -4834,14 +4613,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
pop_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__pop_heap<_Comp_ref>(__first, __last, __c, __last - __first);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__pop_heap<_Comp_ref>(__first, __last, __comp, __last - __first);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -4874,14 +4653,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
make_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__make_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__make_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -4908,14 +4687,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__sort_heap<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__sort_heap<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -4952,14 +4731,14 @@ void
partial_sort(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__partial_sort<_Comp_ref>(__first, __middle, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__partial_sort<_Comp_ref>(__first, __middle, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -5002,14 +4781,14 @@ _RandomAccessIterator
partial_sort_copy(_InputIterator __first, _InputIterator __last,
_RandomAccessIterator __result_first, _RandomAccessIterator __result_last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __partial_sort_copy<_Comp_ref>(__first, __last, __result_first, __result_last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator, class _RandomAccessIterator>
@@ -5216,14 +4995,14 @@ inline _LIBCPP_INLINE_VISIBILITY
void
nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _RandomAccessIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
__nth_element<_Comp_ref>(__first, __nth, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
__nth_element<_Comp_ref>(__first, __nth, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _RandomAccessIterator>
@@ -5257,14 +5036,14 @@ bool
includes(_InputIterator1 __first1, _InputIterator1 __last1, _InputIterator2 __first2, _InputIterator2 __last2,
_Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __includes<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2>
@@ -5310,14 +5089,14 @@ _OutputIterator
set_union(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_union<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5362,14 +5141,14 @@ _OutputIterator
set_intersection(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_intersection<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5416,14 +5195,14 @@ _OutputIterator
set_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5475,14 +5254,14 @@ _OutputIterator
set_symmetric_difference(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _OutputIterator __result, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __set_symmetric_difference<_Comp_ref>(__first1, __last1, __first2, __last2, __result, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2, class _OutputIterator>
@@ -5519,14 +5298,14 @@ bool
lexicographical_compare(_InputIterator1 __first1, _InputIterator1 __last1,
_InputIterator2 __first2, _InputIterator2 __last2, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lexicographical_compare<_Comp_ref>(__first1, __last1, __first2, __last2, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _InputIterator1, class _InputIterator2>
@@ -5574,14 +5353,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
next_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __next_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __next_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _BidirectionalIterator>
@@ -5627,14 +5406,14 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
prev_permutation(_BidirectionalIterator __first, _BidirectionalIterator __last, _Compare __comp)
{
#ifdef _LIBCPP_DEBUG
#ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp);
return __prev_permutation<_Comp_ref>(__first, __last, __c);
#else // _LIBCPP_DEBUG
#else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __prev_permutation<_Comp_ref>(__first, __last, __comp);
#endif // _LIBCPP_DEBUG
#endif // _LIBCPP_DEBUG2
}
template <class _BidirectionalIterator>

View File

@@ -59,14 +59,14 @@ struct array
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const; // constexpr in C++14
const_reference at(size_type n) const; // constexpr in C++14
const_reference operator[](size_type n) const;
const_reference at(size_type n) const;
reference at(size_type n);
reference front();
const_reference front() const; // constexpr in C++14
const_reference front() const;
reference back();
const_reference back() const; // constexpr in C++14
const_reference back() const;
T* data() noexcept;
const T* data() const noexcept;
@@ -92,9 +92,9 @@ template <class T> class tuple_size;
template <int I, class T> class tuple_element;
template <class T, size_t N> struct tuple_size<array<T, N>>;
template <int I, class T, size_t N> struct tuple_element<I, array<T, N>>;
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexpr in C++14
template <int I, class T, size_t N> T& get(array<T, N>&) noexcept;
template <int I, class T, size_t N> const T& get(const array<T, N>&) noexcept;
template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
} // std
@@ -118,7 +118,7 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept; // constexp
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size>
struct _LIBCPP_TYPE_VIS_ONLY array
struct _LIBCPP_TYPE_VIS array
{
// types:
typedef array __self;
@@ -181,14 +181,14 @@ struct _LIBCPP_TYPE_VIS_ONLY array
// element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference operator[](size_type __n) const {return __elems_[__n];}
_LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const {return __elems_[__n];}
reference at(size_type __n);
_LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference at(size_type __n) const;
const_reference at(size_type __n) const;
_LIBCPP_INLINE_VISIBILITY reference front() {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const_reference front() const {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY const_reference front() const {return __elems_[0];}
_LIBCPP_INLINE_VISIBILITY reference back() {return __elems_[_Size > 0 ? _Size-1 : 0];}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 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
value_type* data() _NOEXCEPT {return __elems_;}
@@ -210,7 +210,6 @@ array<_Tp, _Size>::at(size_type __n)
}
template <class _Tp, size_t _Size>
_LIBCPP_CONSTEXPR_AFTER_CXX11
typename array<_Tp, _Size>::const_reference
array<_Tp, _Size>::at(size_type __n) const
{
@@ -224,7 +223,7 @@ array<_Tp, _Size>::at(size_type __n) const
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -232,7 +231,7 @@ operator==(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -240,7 +239,7 @@ operator!=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -248,7 +247,7 @@ operator<(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -256,7 +255,7 @@ operator>(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -264,7 +263,7 @@ operator<=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
{
@@ -272,7 +271,7 @@ operator>=(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename enable_if
<
__is_swappable<_Tp>::value,
@@ -285,54 +284,54 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
}
template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, array<_Tp, _Size> >
{
public:
typedef _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, const array<_Tp, _Size> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const array<_Tp, _Size> >
{
public:
typedef const _Tp type;
};
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
_Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
return __a.__elems_[_Ip];
return __a[_Ip];
}
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
const _Tp&
get(const array<_Tp, _Size>& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
return __a.__elems_[_Ip];
return __a[_Ip];
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _Tp, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
_Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT
{
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
return _VSTD::move(__a.__elems_[_Ip]);
return _VSTD::move(__a[_Ip]);
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@@ -632,11 +632,11 @@ __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{
}
template <size_t _Size> class _LIBCPP_TYPE_VIS_ONLY bitset;
template <size_t _Size> struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >;
template <size_t _Size> class _LIBCPP_TYPE_VIS bitset;
template <size_t _Size> struct _LIBCPP_TYPE_VIS hash<bitset<_Size> >;
template <size_t _Size>
class _LIBCPP_TYPE_VIS_ONLY bitset
class _LIBCPP_TYPE_VIS bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{
public:
@@ -1060,7 +1060,7 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
}
template <size_t _Size>
struct _LIBCPP_TYPE_VIS_ONLY hash<bitset<_Size> >
struct _LIBCPP_TYPE_VIS hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t>
{
_LIBCPP_INLINE_VISIBILITY

View File

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

View File

@@ -111,16 +111,16 @@ private:
duration d_; // exposition only
public:
time_point(); // has value "epoch" // constexpr in C++14
explicit time_point(const duration& d); // same as time_point() + d // constexpr in C++14
time_point(); // has value "epoch"
explicit time_point(const duration& d); // same as time_point() + d
// conversions
template <class Duration2>
time_point(const time_point<clock, Duration2>& t); // constexpr in C++14
time_point(const time_point<clock, Duration2>& t);
// observer
duration time_since_epoch() const; // constexpr in C++14
duration time_since_epoch() const;
// arithmetic
@@ -194,7 +194,7 @@ template <class Rep1, class Period1, class Rep2, class Period2>
template <class ToDuration, class Rep, class Period>
ToDuration duration_cast(const duration<Rep, Period>& d);
// time_point arithmetic (all constexpr in C++14)
// time_point arithmetic
template <class Clock, class Duration1, class Rep2, class Period2>
time_point<Clock, typename common_type<Duration1, duration<Rep2, Period2>>::type>
operator+(const time_point<Clock, Duration1>& lhs, const duration<Rep2, Period2>& rhs);
@@ -208,7 +208,7 @@ template <class Clock, class Duration1, class Duration2>
typename common_type<Duration1, Duration2>::type
operator-(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
// time_point comparisons (all constexpr in C++14)
// time_point comparisons
template <class Clock, class Duration1, class Duration2>
bool operator==(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
template <class Clock, class Duration1, class Duration2>
@@ -222,7 +222,7 @@ template <class Clock, class Duration1, class Duration2>
template <class Clock, class Duration1, class Duration2>
bool operator>=(const time_point<Clock, Duration1>& lhs, const time_point<Clock, Duration2>& rhs);
// time_point_cast (constexpr in C++14)
// time_point_cast
template <class ToDuration, class Clock, class Duration>
time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t);
@@ -236,7 +236,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static const bool is_steady = false; // constexpr in C++14
static const bool is_steady = false;
static time_point now() noexcept;
static time_t to_time_t (const time_point& __t) noexcept;
@@ -250,7 +250,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static const bool is_steady = true; // constexpr in C++14
static const bool is_steady = true;
static time_point now() noexcept;
};
@@ -259,19 +259,6 @@ typedef steady_clock high_resolution_clock;
} // chrono
constexpr chrono::hours operator "" h(unsigned long long); // C++14
constexpr chrono::duration<unspecified , ratio<3600,1>> operator "" h(long double); // C++14
constexpr chrono::minutes operator "" min(unsigned long long); // C++14
constexpr chrono::duration<unspecified , ratio<60,1>> operator "" min(long double); // C++14
constexpr chrono::seconds operator "" s(unsigned long long); // C++14
constexpr chrono::duration<unspecified > operator "" s(long double); // C++14
constexpr chrono::milliseconds operator "" ms(unsigned long long); // C++14
constexpr chrono::duration<unspecified , milli> operator "" ms(long double); // C++14
constexpr chrono::microseconds operator "" us(unsigned long long); // C++14
constexpr chrono::duration<unspecified , micro> operator "" us(long double); // C++14
constexpr chrono::nanoseconds operator "" ns(unsigned long long); // C++14
constexpr chrono::duration<unspecified , nano> operator "" ns(long double); // C++14
} // std
*/
@@ -292,7 +279,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono
{
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS_ONLY duration;
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS duration;
template <class _Tp>
struct __is_duration : false_type {};
@@ -312,8 +299,8 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
struct _LIBCPP_TYPE_VIS common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> >
{
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
typename __ratio_gcd<_Period1, _Period2>::type> type;
@@ -390,10 +377,10 @@ duration_cast(const duration<_Rep, _Period>& __fd)
}
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY treat_as_floating_point : is_floating_point<_Rep> {};
struct _LIBCPP_TYPE_VIS treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep>
struct _LIBCPP_TYPE_VIS_ONLY duration_values
struct _LIBCPP_TYPE_VIS duration_values
{
public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);}
@@ -404,42 +391,11 @@ public:
// duration
template <class _Rep, class _Period>
class _LIBCPP_TYPE_VIS_ONLY duration
class _LIBCPP_TYPE_VIS duration
{
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a duration");
static_assert(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
static_assert(_Period::num > 0, "duration period must be positive");
template <class _R1, class _R2>
struct __no_overflow
{
private:
static const intmax_t __gcd_n1_n2 = __static_gcd<_R1::num, _R2::num>::value;
static const intmax_t __gcd_d1_d2 = __static_gcd<_R1::den, _R2::den>::value;
static const intmax_t __n1 = _R1::num / __gcd_n1_n2;
static const intmax_t __d1 = _R1::den / __gcd_d1_d2;
static const intmax_t __n2 = _R2::num / __gcd_n1_n2;
static const intmax_t __d2 = _R2::den / __gcd_d1_d2;
static const intmax_t max = -((intmax_t(1) << (sizeof(intmax_t) * CHAR_BIT - 1)) + 1);
template <intmax_t _Xp, intmax_t _Yp, bool __overflow>
struct __mul // __overflow == false
{
static const intmax_t value = _Xp * _Yp;
};
template <intmax_t _Xp, intmax_t _Yp>
struct __mul<_Xp, _Yp, true>
{
static const intmax_t value = 1;
};
public:
static const bool value = (__n1 <= max / __d2) && (__n2 <= max / __d1);
typedef ratio<__mul<__n1, __d2, !value>::value,
__mul<__n2, __d1, !value>::value> type;
};
public:
typedef _Rep rep;
typedef _Period period;
@@ -447,13 +403,7 @@ private:
rep __rep_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
duration() = default;
#else
duration() {}
#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default;
template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
explicit duration(const _Rep2& __r,
@@ -471,10 +421,9 @@ public:
duration(const duration<_Rep2, _Period2>& __d,
typename enable_if
<
__no_overflow<_Period2, period>::value && (
treat_as_floating_point<rep>::value ||
(__no_overflow<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value))
(ratio_divide<_Period2, period>::type::den == 1 &&
!treat_as_floating_point<_Rep2>::value)
>::type* = 0)
: __rep_(_VSTD::chrono::duration_cast<duration>(__d).count()) {}
@@ -519,7 +468,7 @@ template <class _LhsDuration, class _RhsDuration>
struct __duration_eq
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
return _Ct(__lhs).count() == _Ct(__rhs).count();
@@ -530,7 +479,7 @@ template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();}
};
@@ -560,7 +509,7 @@ template <class _LhsDuration, class _RhsDuration>
struct __duration_lt
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) const
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
return _Ct(__lhs).count() < _Ct(__rhs).count();
@@ -571,7 +520,7 @@ template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration>
{
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) const
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();}
};
@@ -747,7 +696,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
//////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration>
class _LIBCPP_TYPE_VIS_ONLY time_point
class _LIBCPP_TYPE_VIS time_point
{
static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration");
@@ -760,12 +709,12 @@ private:
duration __d_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 time_point() : __d_(duration::zero()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 explicit time_point(const duration& __d) : __d_(__d) {}
_LIBCPP_INLINE_VISIBILITY time_point() : __d_(duration::zero()) {}
_LIBCPP_INLINE_VISIBILITY explicit time_point(const duration& __d) : __d_(__d) {}
// conversions
template <class _Duration2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
time_point(const time_point<clock, _Duration2>& t,
typename enable_if
<
@@ -775,12 +724,12 @@ public:
// observer
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 duration time_since_epoch() const {return __d_;}
_LIBCPP_INLINE_VISIBILITY duration time_since_epoch() const {return __d_;}
// 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; return *this;}
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;}
// special values
@@ -791,8 +740,8 @@ public:
} // chrono
template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
struct _LIBCPP_TYPE_VIS common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> >
{
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
};
@@ -800,7 +749,7 @@ struct _LIBCPP_TYPE_VIS_ONLY common_type<chrono::time_point<_Clock, _Duration1>,
namespace chrono {
template <class _ToDuration, class _Clock, class _Duration>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, _ToDuration>
time_point_cast(const time_point<_Clock, _Duration>& __t)
{
@@ -810,7 +759,7 @@ time_point_cast(const time_point<_Clock, _Duration>& __t)
// time_point ==
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -820,7 +769,7 @@ operator==(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point !=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -830,7 +779,7 @@ operator!=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -840,7 +789,7 @@ operator<(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point >
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -850,7 +799,7 @@ operator>(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point <=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -860,7 +809,7 @@ operator<=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point >=
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -870,18 +819,20 @@ operator>=(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
// time_point operator+(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
operator+(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
typedef time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type> _Tr;
return _Tr (__lhs.time_since_epoch() + __rhs);
_Tr __r(__lhs.time_since_epoch());
__r += __rhs;
return __r;
}
// time_point operator+(duration x, time_point y);
template <class _Rep1, class _Period1, class _Clock, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<duration<_Rep1, _Period1>, _Duration2>::type>
operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -891,7 +842,7 @@ operator+(const duration<_Rep1, _Period1>& __lhs, const time_point<_Clock, _Dura
// time_point operator-(time_point x, duration y);
template <class _Clock, class _Duration1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
time_point<_Clock, typename common_type<_Duration1, duration<_Rep2, _Period2> >::type>
operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{
@@ -901,7 +852,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const duration<_Rep2, _Pe
// duration operator-(time_point x, time_point y);
template <class _Clock, class _Duration1, class _Duration2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename common_type<_Duration1, _Duration2>::type
operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock, _Duration2>& __rhs)
{
@@ -919,7 +870,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<system_clock> time_point;
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = false;
static const bool is_steady = false;
static time_point now() _NOEXCEPT;
static time_t to_time_t (const time_point& __t) _NOEXCEPT;
@@ -933,7 +884,7 @@ public:
typedef duration::rep rep;
typedef duration::period period;
typedef chrono::time_point<steady_clock, duration> time_point;
static _LIBCPP_CONSTEXPR_AFTER_CXX11 const bool is_steady = true;
static const bool is_steady = true;
static time_point now() _NOEXCEPT;
};
@@ -942,86 +893,6 @@ typedef steady_clock high_resolution_clock;
} // chrono
#if _LIBCPP_STD_VER > 11
// Suffixes for duration literals [time.duration.literals]
inline namespace literals
{
inline namespace chrono_literals
{
constexpr chrono::hours operator"" h(unsigned long long __h)
{
return chrono::hours(static_cast<chrono::hours::rep>(__h));
}
constexpr chrono::duration<long double, ratio<3600,1>> operator"" h(long double __h)
{
return chrono::duration<long double, ratio<3600,1>>(__h);
}
constexpr chrono::minutes operator"" min(unsigned long long __m)
{
return chrono::minutes(static_cast<chrono::minutes::rep>(__m));
}
constexpr chrono::duration<long double, ratio<60,1>> operator"" min(long double __m)
{
return chrono::duration<long double, ratio<60,1>> (__m);
}
constexpr chrono::seconds operator"" s(unsigned long long __s)
{
return chrono::seconds(static_cast<chrono::seconds::rep>(__s));
}
constexpr chrono::duration<long double> operator"" s(long double __s)
{
return chrono::duration<long double> (__s);
}
constexpr chrono::milliseconds operator"" ms(unsigned long long __ms)
{
return chrono::milliseconds(static_cast<chrono::milliseconds::rep>(__ms));
}
constexpr chrono::duration<long double, milli> operator"" ms(long double __ms)
{
return chrono::duration<long double, milli>(__ms);
}
constexpr chrono::microseconds operator"" us(unsigned long long __us)
{
return chrono::microseconds(static_cast<chrono::microseconds::rep>(__us));
}
constexpr chrono::duration<long double, micro> operator"" us(long double __us)
{
return chrono::duration<long double, micro> (__us);
}
constexpr chrono::nanoseconds operator"" ns(unsigned long long __ns)
{
return chrono::nanoseconds(static_cast<chrono::nanoseconds::rep>(__ns));
}
constexpr chrono::duration<long double, nano> operator"" ns(long double __ns)
{
return chrono::duration<long double, nano> (__ns);
}
}}
namespace chrono { // hoist the literals into namespace std::chrono
using namespace literals::chrono_literals;
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_CHRONO

View File

@@ -301,7 +301,7 @@ long double truncl(long double x);
#include <math.h>
#include <type_traits>
#ifdef _LIBCPP_MSVCRT
#ifdef _MSC_VER
#include "support/win32/math_win32.h"
#endif
@@ -654,7 +654,6 @@ using ::double_t;
// abs
#if !defined(_AIX)
inline _LIBCPP_INLINE_VISIBILITY
float
abs(float __x) _NOEXCEPT {return fabsf(__x);}
@@ -666,7 +665,6 @@ abs(double __x) _NOEXCEPT {return fabs(__x);}
inline _LIBCPP_INLINE_VISIBILITY
long double
abs(long double __x) _NOEXCEPT {return fabsl(__x);}
#endif // !defined(_AIX)
#ifndef __sun__
@@ -675,7 +673,7 @@ abs(long double __x) _NOEXCEPT {return fabsl(__x);}
using ::acos;
using ::acosf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float acos(float __x) _NOEXCEPT {return acosf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double acos(long double __x) _NOEXCEPT {return acosl(__x);}
#endif
@@ -690,7 +688,7 @@ acos(_A1 __x) _NOEXCEPT {return acos((double)__x);}
using ::asin;
using ::asinf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float asin(float __x) _NOEXCEPT {return asinf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double asin(long double __x) _NOEXCEPT {return asinl(__x);}
#endif
@@ -705,7 +703,7 @@ asin(_A1 __x) _NOEXCEPT {return asin((double)__x);}
using ::atan;
using ::atanf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float atan(float __x) _NOEXCEPT {return atanf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan(long double __x) _NOEXCEPT {return atanl(__x);}
#endif
@@ -720,7 +718,7 @@ atan(_A1 __x) _NOEXCEPT {return atan((double)__x);}
using ::atan2;
using ::atan2f;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float atan2(float __y, float __x) _NOEXCEPT {return atan2f(__y, __x);}
inline _LIBCPP_INLINE_VISIBILITY long double atan2(long double __y, long double __x) _NOEXCEPT {return atan2l(__y, __x);}
#endif
@@ -746,7 +744,7 @@ atan2(_A1 __y, _A2 __x) _NOEXCEPT
using ::ceil;
using ::ceilf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float ceil(float __x) _NOEXCEPT {return ceilf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double ceil(long double __x) _NOEXCEPT {return ceill(__x);}
#endif
@@ -761,13 +759,13 @@ ceil(_A1 __x) _NOEXCEPT {return ceil((double)__x);}
using ::cos;
using ::cosf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float cos(float __x) _NOEXCEPT {return cosf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double cos(long double __x) _NOEXCEPT {return cosl(__x);}
#endif
template <class _A1>
inline _LIBCPP_INLINE_VISIBILITY
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
@@ -776,7 +774,7 @@ cos(_A1 __x) _NOEXCEPT {return cos((double)__x);}
using ::cosh;
using ::coshf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float cosh(float __x) _NOEXCEPT {return coshf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double cosh(long double __x) _NOEXCEPT {return coshl(__x);}
#endif
@@ -794,7 +792,7 @@ using ::expf;
#ifndef __sun__
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float exp(float __x) _NOEXCEPT {return expf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double exp(long double __x) _NOEXCEPT {return expl(__x);}
#endif
@@ -810,7 +808,7 @@ exp(_A1 __x) _NOEXCEPT {return exp((double)__x);}
using ::fabs;
using ::fabsf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float fabs(float __x) _NOEXCEPT {return fabsf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double fabs(long double __x) _NOEXCEPT {return fabsl(__x);}
#endif
@@ -825,7 +823,7 @@ fabs(_A1 __x) _NOEXCEPT {return fabs((double)__x);}
using ::floor;
using ::floorf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float floor(float __x) _NOEXCEPT {return floorf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double floor(long double __x) _NOEXCEPT {return floorl(__x);}
#endif
@@ -842,7 +840,7 @@ using ::fmod;
using ::fmodf;
#ifndef __sun__
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float fmod(float __x, float __y) _NOEXCEPT {return fmodf(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double fmod(long double __x, long double __y) _NOEXCEPT {return fmodl(__x, __y);}
#endif
@@ -869,7 +867,7 @@ fmod(_A1 __x, _A2 __y) _NOEXCEPT
using ::frexp;
using ::frexpf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float frexp(float __x, int* __e) _NOEXCEPT {return frexpf(__x, __e);}
inline _LIBCPP_INLINE_VISIBILITY long double frexp(long double __x, int* __e) _NOEXCEPT {return frexpl(__x, __e);}
#endif
@@ -884,7 +882,7 @@ frexp(_A1 __x, int* __e) _NOEXCEPT {return frexp((double)__x, __e);}
using ::ldexp;
using ::ldexpf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float ldexp(float __x, int __e) _NOEXCEPT {return ldexpf(__x, __e);}
inline _LIBCPP_INLINE_VISIBILITY long double ldexp(long double __x, int __e) _NOEXCEPT {return ldexpl(__x, __e);}
#endif
@@ -901,7 +899,7 @@ using ::log;
using ::logf;
#ifndef __sun__
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float log(float __x) _NOEXCEPT {return logf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double log(long double __x) _NOEXCEPT {return logl(__x);}
#endif
@@ -917,7 +915,7 @@ log(_A1 __x) _NOEXCEPT {return log((double)__x);}
using ::log10;
using ::log10f;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float log10(float __x) _NOEXCEPT {return log10f(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double log10(long double __x) _NOEXCEPT {return log10l(__x);}
#endif
@@ -932,7 +930,7 @@ log10(_A1 __x) _NOEXCEPT {return log10((double)__x);}
using ::modf;
using ::modff;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float modf(float __x, float* __y) _NOEXCEPT {return modff(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double modf(long double __x, long double* __y) _NOEXCEPT {return modfl(__x, __y);}
#endif
@@ -945,7 +943,7 @@ using ::powf;
#ifndef __sun__
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float pow(float __x, float __y) _NOEXCEPT {return powf(__x, __y);}
inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __y) _NOEXCEPT {return powl(__x, __y);}
#endif
@@ -972,7 +970,7 @@ pow(_A1 __x, _A2 __y) _NOEXCEPT
using ::sin;
using ::sinf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float sin(float __x) _NOEXCEPT {return sinf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sin(long double __x) _NOEXCEPT {return sinl(__x);}
#endif
@@ -987,7 +985,7 @@ sin(_A1 __x) _NOEXCEPT {return sin((double)__x);}
using ::sinh;
using ::sinhf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float sinh(float __x) _NOEXCEPT {return sinhf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sinh(long double __x) _NOEXCEPT {return sinhl(__x);}
#endif
@@ -1004,7 +1002,7 @@ using ::sqrt;
using ::sqrtf;
#if !(defined(_LIBCPP_MSVCRT) || defined(__sun__) || defined(_AIX))
#if !(defined(_MSC_VER) || defined(__sun__))
inline _LIBCPP_INLINE_VISIBILITY float sqrt(float __x) _NOEXCEPT {return sqrtf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double sqrt(long double __x) _NOEXCEPT {return sqrtl(__x);}
#endif
@@ -1020,7 +1018,7 @@ using ::tan;
using ::tanf;
#ifndef __sun__
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float tan(float __x) _NOEXCEPT {return tanf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double tan(long double __x) _NOEXCEPT {return tanl(__x);}
#endif
@@ -1035,7 +1033,7 @@ tan(_A1 __x) _NOEXCEPT {return tan((double)__x);}
using ::tanh;
using ::tanhf;
#if !(defined(_LIBCPP_MSVCRT) || defined(_AIX))
#ifndef _MSC_VER
inline _LIBCPP_INLINE_VISIBILITY float tanh(float __x) _NOEXCEPT {return tanhf(__x);}
inline _LIBCPP_INLINE_VISIBILITY long double tanh(long double __x) _NOEXCEPT {return tanhl(__x);}
#endif
@@ -1047,7 +1045,7 @@ tanh(_A1 __x) _NOEXCEPT {return tanh((double)__x);}
// acosh
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::acosh;
using ::acoshf;
@@ -1062,7 +1060,7 @@ acosh(_A1 __x) _NOEXCEPT {return acosh((double)__x);}
// asinh
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::asinh;
using ::asinhf;
@@ -1077,7 +1075,7 @@ asinh(_A1 __x) _NOEXCEPT {return asinh((double)__x);}
// atanh
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::atanh;
using ::atanhf;
@@ -1092,7 +1090,7 @@ atanh(_A1 __x) _NOEXCEPT {return atanh((double)__x);}
// cbrt
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::cbrt;
using ::cbrtf;
@@ -1129,7 +1127,7 @@ copysign(_A1 __x, _A2 __y) _NOEXCEPT
return copysign((__result_type)__x, (__result_type)__y);
}
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
// erf
@@ -1428,18 +1426,13 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, long>::type
lround(_A1 __x) _NOEXCEPT {return lround((double)__x);}
#endif // _LIBCPP_MSVCRT
#endif // __sun__
// nan
#ifndef _LIBCPP_MSVCRT
#endif // _MSC_VER
#endif // __sun__
using ::nan;
using ::nanf;
#endif // _LIBCPP_MSVCRT
#ifndef __sun__
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
// nearbyint
@@ -1617,7 +1610,7 @@ inline _LIBCPP_INLINE_VISIBILITY
typename enable_if<is_integral<_A1>::value, double>::type
trunc(_A1 __x) _NOEXCEPT {return trunc((double)__x);}
#endif // !_LIBCPP_MSVCRT
#endif // !_MSC_VER
using ::acosl;
using ::asinl;
@@ -1640,15 +1633,15 @@ using ::sinl;
using ::sinhl;
using ::sqrtl;
using ::tanl;
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::tanhl;
using ::acoshl;
using ::asinhl;
using ::atanhl;
using ::cbrtl;
#endif // !_LIBCPP_MSVCRT
#endif // !_MSC_VER
using ::copysignl;
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::erfl;
using ::erfcl;
using ::exp2l;
@@ -1679,7 +1672,7 @@ using ::scalblnl;
using ::scalbnl;
using ::tgammal;
using ::truncl;
#endif // !_LIBCPP_MSVCRT
#endif // !_MSC_VER
#else
using ::lgamma;

View File

@@ -29,8 +29,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf8
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf8(size_t refs = 0);
~codecvt_utf8();
// unspecified
};
template <class Elem, unsigned long Maxcode = 0x10ffff,
@@ -38,8 +37,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf16
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf16(size_t refs = 0);
~codecvt_utf16();
// unspecified
};
template <class Elem, unsigned long Maxcode = 0x10ffff,
@@ -47,8 +45,7 @@ template <class Elem, unsigned long Maxcode = 0x10ffff,
class codecvt_utf8_utf16
: public codecvt<Elem, char, mbstate_t>
{
explicit codecvt_utf8_utf16(size_t refs = 0);
~codecvt_utf8_utf16();
// unspecified
};
} // std
@@ -76,7 +73,7 @@ enum codecvt_mode
template <class _Elem> class __codecvt_utf8;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<wchar_t>
class __codecvt_utf8<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -111,7 +108,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<char16_t>
class __codecvt_utf8<char16_t>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -146,7 +143,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8<char32_t>
class __codecvt_utf8<char32_t>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -182,7 +179,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8
class _LIBCPP_TYPE_VIS codecvt_utf8
: public __codecvt_utf8<_Elem>
{
public:
@@ -199,7 +196,7 @@ public:
template <class _Elem, bool _LittleEndian> class __codecvt_utf16;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, false>
class __codecvt_utf16<wchar_t, false>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -234,7 +231,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<wchar_t, true>
class __codecvt_utf16<wchar_t, true>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -269,7 +266,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, false>
class __codecvt_utf16<char16_t, false>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -304,7 +301,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char16_t, true>
class __codecvt_utf16<char16_t, true>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -339,7 +336,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, false>
class __codecvt_utf16<char32_t, false>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -374,7 +371,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf16<char32_t, true>
class __codecvt_utf16<char32_t, true>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -410,7 +407,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf16
class _LIBCPP_TYPE_VIS codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian>
{
public:
@@ -427,7 +424,7 @@ public:
template <class _Elem> class __codecvt_utf8_utf16;
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<wchar_t>
class __codecvt_utf8_utf16<wchar_t>
: public codecvt<wchar_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -462,7 +459,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char32_t>
class __codecvt_utf8_utf16<char32_t>
: public codecvt<char32_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -497,7 +494,7 @@ protected:
};
template <>
class _LIBCPP_TYPE_VIS __codecvt_utf8_utf16<char16_t>
class __codecvt_utf8_utf16<char16_t>
: public codecvt<char16_t, char, mbstate_t>
{
unsigned long _Maxcode_;
@@ -533,7 +530,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS_ONLY codecvt_utf8_utf16
class _LIBCPP_TYPE_VIS codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem>
{
public:

View File

@@ -23,12 +23,12 @@ class complex
public:
typedef T value_type;
complex(const T& re = T(), const T& im = T()); // constexpr in C++14
complex(const complex&); // constexpr in C++14
template<class X> complex(const complex<X>&); // constexpr in C++14
complex(const T& re = T(), const T& im = T());
complex(const complex&);
template<class X> complex(const complex<X>&);
T real() const; // constexpr in C++14
T imag() const; // constexpr in C++14
T real() const;
T imag() const;
void real(T);
void imag(T);
@@ -149,12 +149,12 @@ template<class T> complex<T> operator/(const complex<T>&, const T&);
template<class T> complex<T> operator/(const T&, const complex<T>&);
template<class T> complex<T> operator+(const complex<T>&);
template<class T> complex<T> operator-(const complex<T>&);
template<class T> bool operator==(const complex<T>&, const complex<T>&); // constexpr in C++14
template<class T> bool operator==(const complex<T>&, const T&); // constexpr in C++14
template<class T> bool operator==(const T&, const complex<T>&); // constexpr in C++14
template<class T> bool operator!=(const complex<T>&, const complex<T>&); // constexpr in C++14
template<class T> bool operator!=(const complex<T>&, const T&); // constexpr in C++14
template<class T> bool operator!=(const T&, const complex<T>&); // constexpr in C++14
template<class T> bool operator==(const complex<T>&, const complex<T>&);
template<class T> bool operator==(const complex<T>&, const T&);
template<class T> bool operator==(const T&, const complex<T>&);
template<class T> bool operator!=(const complex<T>&, const complex<T>&);
template<class T> bool operator!=(const complex<T>&, const T&);
template<class T> bool operator!=(const T&, const complex<T>&);
template<class T, class charT, class traits>
basic_istream<charT, traits>&
@@ -165,17 +165,17 @@ template<class T, class charT, class traits>
// 26.3.7 values:
template<class T> T real(const complex<T>&); // constexpr in C++14
long double real(long double); // constexpr in C++14
double real(double); // constexpr in C++14
template<Integral T> double real(T); // constexpr in C++14
float real(float); // constexpr in C++14
template<class T> T real(const complex<T>&);
long double real(long double);
double real(double);
template<Integral T> double real(T);
float real(float);
template<class T> T imag(const complex<T>&); // constexpr in C++14
long double imag(long double); // constexpr in C++14
double imag(double); // constexpr in C++14
template<Integral T> double imag(T); // constexpr in C++14
float imag(float); // constexpr in C++14
template<class T> T imag(const complex<T>&);
long double imag(long double);
double imag(double);
template<Integral T> double imag(T);
float imag(float);
template<class T> T abs(const complex<T>&);
@@ -255,13 +255,13 @@ template<class T, class charT, class traits>
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY complex;
template<class _Tp> class _LIBCPP_TYPE_VIS complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w);
template<class _Tp> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY complex
class _LIBCPP_TYPE_VIS complex
{
public:
typedef _Tp value_type;
@@ -269,15 +269,15 @@ private:
value_type __re_;
value_type __im_;
public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
complex(const value_type& __re = value_type(), const value_type& __im = value_type())
: __re_(__re), __im_(__im) {}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
template<class _Xp> _LIBCPP_INLINE_VISIBILITY
complex(const complex<_Xp>& __c)
: __re_(__c.real()), __im_(__c.imag()) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 value_type imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY value_type real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY value_type imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
@@ -309,21 +309,21 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<> class _LIBCPP_TYPE_VIS_ONLY complex<double>;
template<> class _LIBCPP_TYPE_VIS_ONLY complex<long double>;
template<> class _LIBCPP_TYPE_VIS complex<double>;
template<> class _LIBCPP_TYPE_VIS complex<long double>;
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<float>
class _LIBCPP_TYPE_VIS complex<float>
{
float __re_;
float __im_;
@@ -368,18 +368,18 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<double>
class _LIBCPP_TYPE_VIS complex<double>
{
double __re_;
double __im_;
@@ -424,18 +424,18 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
template<>
class _LIBCPP_TYPE_VIS_ONLY complex<long double>
class _LIBCPP_TYPE_VIS complex<long double>
{
long double __re_;
long double __im_;
@@ -480,12 +480,12 @@ public:
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator*=(const complex<_Xp>& __c)
{
*this = *this * complex(__c.real(), __c.imag());
*this = *this * __c;
return *this;
}
template<class _Xp> _LIBCPP_INLINE_VISIBILITY complex& operator/=(const complex<_Xp>& __c)
{
*this = *this / complex(__c.real(), __c.imag());
*this = *this / __c;
return *this;
}
};
@@ -740,7 +740,7 @@ operator-(const complex<_Tp>& __x)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
@@ -748,7 +748,7 @@ operator==(const complex<_Tp>& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const complex<_Tp>& __x, const _Tp& __y)
{
@@ -756,7 +756,7 @@ operator==(const complex<_Tp>& __x, const _Tp& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const _Tp& __x, const complex<_Tp>& __y)
{
@@ -764,7 +764,7 @@ operator==(const _Tp& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
{
@@ -772,7 +772,7 @@ operator!=(const complex<_Tp>& __x, const complex<_Tp>& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const complex<_Tp>& __x, const _Tp& __y)
{
@@ -780,7 +780,7 @@ operator!=(const complex<_Tp>& __x, const _Tp& __y)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const _Tp& __x, const complex<_Tp>& __y)
{
@@ -792,21 +792,21 @@ operator!=(const _Tp& __x, const complex<_Tp>& __y)
// real
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
_Tp
real(const complex<_Tp>& __c)
{
return __c.real();
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
long double
real(long double __re)
{
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
double
real(double __re)
{
@@ -814,7 +814,7 @@ real(double __re)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
@@ -825,7 +825,7 @@ real(_Tp __re)
return __re;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
float
real(float __re)
{
@@ -835,21 +835,21 @@ real(float __re)
// imag
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
_Tp
imag(const complex<_Tp>& __c)
{
return __c.imag();
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
long double
imag(long double __re)
{
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
double
imag(double __re)
{
@@ -857,7 +857,7 @@ imag(double __re)
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if
<
is_integral<_Tp>::value,
@@ -868,7 +868,7 @@ imag(_Tp __re)
return 0;
}
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
float
imag(float __re)
{
@@ -1521,47 +1521,6 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const complex<_Tp>& __x)
return __os << __s.str();
}
#if _LIBCPP_STD_VER > 11
// Literal suffix for complex number literals [complex.literals]
inline namespace literals
{
inline namespace complex_literals
{
constexpr complex<long double> operator""il(long double __im)
{
return { 0.0l, __im };
}
constexpr complex<long double> operator""il(unsigned long long __im)
{
return { 0.0l, static_cast<long double>(__im) };
}
constexpr complex<double> operator""i(long double __im)
{
return { 0.0, static_cast<double>(__im) };
}
constexpr complex<double> operator""i(unsigned long long __im)
{
return { 0.0, static_cast<double>(__im) };
}
constexpr complex<float> operator""if(long double __im)
{
return { 0.0f, static_cast<float>(__im) };
}
constexpr complex<float> operator""if(unsigned long long __im)
{
return { 0.0f, static_cast<float>(__im) };
}
}
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_COMPLEX

View File

@@ -56,7 +56,7 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_TYPE_VIS_ONLY nullptr_t
struct _LIBCPP_TYPE_VIS nullptr_t
{
void* __lx;

View File

@@ -74,7 +74,7 @@ int fputc(int c, FILE* stream);
int fputs(const char* restrict s, FILE* restrict stream);
int getc(FILE* stream);
int getchar(void);
char* gets(char* s); // removed in C++14
char* gets(char* s);
int putc(int c, FILE* stream);
int putchar(int c);
int puts(const char* s);
@@ -103,11 +103,6 @@ void perror(const char* s);
#pragma GCC system_header
#endif
// snprintf
#if defined(_LIBCPP_MSVCRT)
#include "support/win32/support.h"
#endif
#ifdef getc
inline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
#undef getc
@@ -143,12 +138,12 @@ using ::scanf;
using ::snprintf;
using ::sprintf;
using ::sscanf;
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::vfprintf;
using ::vfscanf;
using ::vscanf;
using ::vsscanf;
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
using ::vprintf;
using ::vsnprintf;
using ::vsprintf;
@@ -158,9 +153,7 @@ using ::fputc;
using ::fputs;
using ::getc;
using ::getchar;
#if _LIBCPP_STD_VER <= 11
using ::gets;
#endif
using ::putc;
using ::putchar;
using ::puts;

View File

@@ -84,9 +84,9 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config>
#include <stdlib.h>
#ifdef _LIBCPP_MSVCRT
#ifdef _MSC_VER
#include "support/win32/locale_win32.h"
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -154,8 +154,8 @@ using ::quick_exit;
using ::aligned_alloc;
#endif
// MSVCRT already has the correct prototype in <stdlib.h> #ifdef __cplusplus
#if !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_AIX)
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
#if !defined(_MSC_VER) && !defined(__sun__)
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
@@ -165,7 +165,7 @@ inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEX
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) _NOEXCEPT {return lldiv(__x, __y);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
_LIBCPP_END_NAMESPACE_STD

View File

@@ -93,8 +93,8 @@ using ::strspn;
using ::strstr;
// MSVCRT, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
#if !defined(__GLIBC__) && !defined(_LIBCPP_MSVCRT) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
// MSVC, GNU libc and its derivates already have the correct prototype in <string.h> #ifdef __cplusplus
#if !defined(__GLIBC__) && !defined(_MSC_VER) && !defined(__sun__) && !defined(_STRING_H_CPLUSPLUS_98_CONFORMANCE_)
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* strrchr( char* __s, int __c) {return ::strrchr(__s, __c);}

View File

@@ -106,9 +106,9 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config>
#include <cwctype>
#include <wchar.h>
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
#include <support/win32/support.h> // pull in *swprintf defines
#endif // _LIBCPP_MSVCRT
#endif // _WIN32
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
@@ -127,12 +127,12 @@ using ::swprintf;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::swscanf;
using ::vfwscanf;
using ::vswscanf;
using ::vwscanf;
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
using ::wprintf;
using ::wscanf;
using ::fgetwc;
@@ -146,10 +146,10 @@ using ::putwc;
using ::putwchar;
using ::ungetwc;
using ::wcstod;
#ifndef _LIBCPP_MSVCRT
#ifndef _MSC_VER
using ::wcstof;
using ::wcstold;
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
using ::wcstol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoll;

View File

@@ -41,7 +41,6 @@ public:
deque() noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit deque(const allocator_type& a);
explicit deque(size_type n);
explicit deque(size_type n, const allocator_type& a); // C++14
deque(size_type n, const value_type& v);
deque(size_type n, const value_type& v, const allocator_type& a);
template <class InputIterator>
@@ -171,7 +170,7 @@ template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
class _LIBCPP_TYPE_VIS __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -263,7 +262,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS_ONLY __deque_iterator
class _LIBCPP_TYPE_VIS __deque_iterator
{
typedef _MapPointer __map_iterator;
public:
@@ -279,11 +278,7 @@ public:
typedef random_access_iterator_tag iterator_category;
typedef _Reference reference;
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __m_iter_(nullptr), __ptr_(nullptr)
#endif
{}
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
template <class _Pp, class _Rp, class _MP>
_LIBCPP_INLINE_VISIBILITY
@@ -415,9 +410,9 @@ private:
: __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _Ap> friend class __deque_base;
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS_ONLY deque;
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS deque;
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp>
friend class _LIBCPP_TYPE_VIS_ONLY __deque_iterator;
friend class _LIBCPP_TYPE_VIS __deque_iterator;
template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -920,14 +915,7 @@ protected:
__pointer_allocator;
typedef allocator_traits<__pointer_allocator> __map_traits;
typedef typename __map_traits::pointer __map_pointer;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<const_pointer>
#else
rebind_alloc<const_pointer>::other
#endif
__const_pointer_allocator;
typedef typename allocator_traits<__const_pointer_allocator>::const_pointer __map_const_pointer;
typedef typename __map_traits::const_pointer __map_const_pointer;
typedef __split_buffer<pointer, __pointer_allocator> __map;
typedef __deque_iterator<value_type, pointer, reference, __map_pointer,
@@ -1065,7 +1053,7 @@ template <class _Tp, class _Allocator>
typename __deque_base<_Tp, _Allocator>::const_iterator
__deque_base<_Tp, _Allocator>::begin() const _NOEXCEPT
{
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __start_ / __block_size);
__map_const_pointer __mp = __map_.begin() + __start_ / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __start_ % __block_size);
}
@@ -1083,7 +1071,7 @@ typename __deque_base<_Tp, _Allocator>::const_iterator
__deque_base<_Tp, _Allocator>::end() const _NOEXCEPT
{
size_type __p = size() + __start_;
__map_const_pointer __mp = static_cast<__map_const_pointer>(__map_.begin() + __p / __block_size);
__map_const_pointer __mp = __map_.begin() + __p / __block_size;
return const_iterator(__mp, __map_.empty() ? 0 : *__mp + __p % __block_size);
}
@@ -1179,7 +1167,7 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY deque
class _LIBCPP_TYPE_VIS deque
: private __deque_base<_Tp, _Allocator>
{
public:
@@ -1210,9 +1198,6 @@ public:
{}
_LIBCPP_INLINE_VISIBILITY deque(const allocator_type& __a) : __base(__a) {}
explicit deque(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit deque(size_type __n, const _Allocator& __a);
#endif
deque(size_type __n, const value_type& __v);
deque(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIter>
@@ -1356,8 +1341,6 @@ public:
_LIBCPP_INLINE_VISIBILITY
bool __invariants() const {return __base::__invariants();}
private:
typedef typename __base::__map_const_pointer __map_const_pointer;
_LIBCPP_INLINE_VISIBILITY
static size_type __recommend_blocks(size_type __n)
{
@@ -1435,16 +1418,6 @@ deque<_Tp, _Allocator>::deque(size_type __n)
__append(__n);
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const _Allocator& __a)
: __base(__a)
{
if (__n > 0)
__append(__n);
}
#endif
template <class _Tp, class _Allocator>
deque<_Tp, _Allocator>::deque(size_type __n, const value_type& __v)
{
@@ -2532,9 +2505,9 @@ void
deque<_Tp, _Allocator>::pop_front()
{
allocator_type& __a = __base::__alloc();
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
__base::__start_ / __base::__block_size) +
__base::__start_ % __base::__block_size));
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
__base::__start_ / __base::__block_size) +
__base::__start_ % __base::__block_size);
--__base::size();
if (++__base::__start_ >= 2 * __base::__block_size)
{
@@ -2550,9 +2523,9 @@ deque<_Tp, _Allocator>::pop_back()
{
allocator_type& __a = __base::__alloc();
size_type __p = __base::size() + __base::__start_ - 1;
__alloc_traits::destroy(__a, __to_raw_pointer(*(__base::__map_.begin() +
__p / __base::__block_size) +
__p % __base::__block_size));
__alloc_traits::destroy(__a, *(__base::__map_.begin() +
__p / __base::__block_size) +
__p % __base::__block_size);
--__base::size();
if (__back_spare() >= 2 * __base::__block_size)
{
@@ -2583,7 +2556,7 @@ deque<_Tp, _Allocator>::__move_and_check(iterator __f, iterator __l, iterator __
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) -= __f - __r).__ptr_;
__vt = (const_iterator(__f.__m_iter_, __vt) -= __f - __r).__ptr_;
__r = _VSTD::move(__fb, __fe, __r);
__n -= __bs;
__f += __bs;
@@ -2614,7 +2587,7 @@ deque<_Tp, _Allocator>::__move_backward_and_check(iterator __f, iterator __l, it
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) += __r - __l - 1).__ptr_;
__vt = (const_iterator(__l.__m_iter_, __vt) += __r - __l - 1).__ptr_;
__r = _VSTD::move_backward(__lb, __le, __r);
__n -= __bs;
__l -= __bs - 1;
@@ -2645,7 +2618,7 @@ deque<_Tp, _Allocator>::__move_construct_and_check(iterator __f, iterator __l,
__fe = __fb + __bs;
}
if (__fb <= __vt && __vt < __fe)
__vt = (const_iterator(static_cast<__map_const_pointer>(__f.__m_iter_), __vt) += __r - __f).__ptr_;
__vt = (const_iterator(__f.__m_iter_, __vt) += __r - __f).__ptr_;
for (; __fb != __fe; ++__fb, ++__r, ++__base::size())
__alloc_traits::construct(__a, _VSTD::addressof(*__r), _VSTD::move(*__fb));
__n -= __bs;
@@ -2681,7 +2654,7 @@ deque<_Tp, _Allocator>::__move_construct_backward_and_check(iterator __f, iterat
__lb = __le - __bs;
}
if (__lb <= __vt && __vt < __le)
__vt = (const_iterator(static_cast<__map_const_pointer>(__l.__m_iter_), __vt) -= __l - __r + 1).__ptr_;
__vt = (const_iterator(__l.__m_iter_, __vt) -= __l - __r + 1).__ptr_;
while (__le != __lb)
{
__alloc_traits::construct(__a, _VSTD::addressof(*--__r), _VSTD::move(*--__le));
@@ -2811,7 +2784,7 @@ deque<_Tp, _Allocator>::clear() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2820,7 +2793,7 @@ operator==(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2828,7 +2801,7 @@ operator!=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2836,7 +2809,7 @@ operator< (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2844,7 +2817,7 @@ operator> (const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2852,7 +2825,7 @@ operator>=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
{
@@ -2860,7 +2833,7 @@ operator<=(const deque<_Tp, _Allocator>& __x, const deque<_Tp, _Allocator>& __y)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(deque<_Tp, _Allocator>& __x, deque<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))

View File

@@ -118,8 +118,8 @@ _LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT;
class _LIBCPP_TYPE_VIS exception_ptr;
_LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
exception_ptr current_exception() _NOEXCEPT;
_LIBCPP_NORETURN void rethrow_exception(exception_ptr);
class _LIBCPP_TYPE_VIS exception_ptr
{
@@ -142,8 +142,8 @@ public:
bool operator!=(const exception_ptr& __x, const exception_ptr& __y) _NOEXCEPT
{return !(__x == __y);}
friend _LIBCPP_FUNC_VIS exception_ptr current_exception() _NOEXCEPT;
friend _LIBCPP_FUNC_VIS void rethrow_exception(exception_ptr);
friend exception_ptr current_exception() _NOEXCEPT;
friend void rethrow_exception(exception_ptr);
};
template<class _Ep>

View File

@@ -1,314 +0,0 @@
// -*- C++ -*-
//===-------------------------- dynarray ----------------------------------===//
//
// 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_DYNARRAY
#define _LIBCPP_DYNARRAY
#include <__config>
#if _LIBCPP_STD_VER > 11
/*
dynarray synopsis
namespace std { namespace experimental {
template< typename T >
class dynarray
{
// types:
typedef T value_type;
typedef T& reference;
typedef const T& const_reference;
typedef T* pointer;
typedef const T* const_pointer;
typedef implementation-defined iterator;
typedef implementation-defined const_iterator;
typedef reverse_iterator<iterator> reverse_iterator;
typedef reverse_iterator<const_iterator> const_reverse_iterator;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
public:
// construct/copy/destroy:
explicit dynarray(size_type c);
template <typename Alloc>
dynarray(size_type c, const Alloc& alloc);
dynarray(size_type c, const T& v);
template <typename Alloc>
dynarray(size_type c, const T& v, const Alloc& alloc);
dynarray(const dynarray& d);
template <typename Alloc>
dynarray(const dynarray& d, const Alloc& alloc);
dynarray(initializer_list<T>);
template <typename Alloc>
dynarray(initializer_list<T>, const Alloc& alloc);
dynarray& operator=(const dynarray&) = delete;
~dynarray();
// iterators:
iterator begin() noexcept;
const_iterator begin() const noexcept;
const_iterator cbegin() const noexcept;
iterator end() noexcept;
const_iterator end() const noexcept;
const_iterator cend() const noexcept;
reverse_iterator rbegin() noexcept;
const_reverse_iterator rbegin() const noexcept;
const_reverse_iterator crbegin() const noexcept;
reverse_iterator rend() noexcept;
const_reverse_iterator rend() const noexcept;
const_reverse_iterator crend() const noexcept;
// capacity:
size_type size() const noexcept;
size_type max_size() const noexcept;
bool empty() const noexcept;
// element access:
reference operator[](size_type n);
const_reference operator[](size_type n) const;
reference front();
const_reference front() const;
reference back();
const_reference back() const;
const_reference at(size_type n) const;
reference at(size_type n);
// data access:
T* data() noexcept;
const T* data() const noexcept;
// mutating member functions:
void fill(const T& v);
};
}} // std::experimental
*/
#include <__functional_base>
#include <iterator>
#include <stdexcept>
#include <initializer_list>
#include <new>
#include <algorithm>
#if defined(_LIBCPP_NO_EXCEPTIONS)
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std { namespace experimental { inline namespace __array_extensions_v1 {
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY dynarray
{
public:
// types:
typedef dynarray __self;
typedef _Tp value_type;
typedef value_type& reference;
typedef const value_type& const_reference;
typedef value_type* iterator;
typedef const value_type* const_iterator;
typedef value_type* pointer;
typedef const value_type* const_pointer;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
typedef std::reverse_iterator<iterator> reverse_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
private:
size_t __size_;
value_type * __base_;
_LIBCPP_ALWAYS_INLINE dynarray () noexcept : __base_(nullptr), __size_(0) {}
static inline _LIBCPP_INLINE_VISIBILITY value_type* __allocate ( size_t count )
{
if ( numeric_limits<size_t>::max() / sizeof (value_type) <= count )
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw bad_array_length();
#else
assert(!"dynarray::allocation");
#endif
}
return static_cast<value_type *> (::operator new (sizeof(value_type) * count));
}
static inline _LIBCPP_INLINE_VISIBILITY void __deallocate ( value_type* __ptr ) noexcept
{
::operator delete (static_cast<void *> (__ptr));
}
public:
explicit dynarray(size_type __c);
dynarray(size_type __c, const value_type& __v);
dynarray(const dynarray& __d);
dynarray(initializer_list<value_type>);
// We're not implementing these right now.
// Waiting for the resolution of LWG issue #2235
// template <typename _Alloc>
// dynarray(size_type __c, const _Alloc& __alloc);
// template <typename _Alloc>
// dynarray(size_type __c, const value_type& __v, const _Alloc& __alloc);
// template <typename _Alloc>
// dynarray(const dynarray& __d, const _Alloc& __alloc);
// template <typename _Alloc>
// dynarray(initializer_list<value_type>, const _Alloc& __alloc);
dynarray& operator=(const dynarray&) = delete;
~dynarray();
// iterators:
inline _LIBCPP_INLINE_VISIBILITY iterator begin() noexcept { return iterator(data()); }
inline _LIBCPP_INLINE_VISIBILITY const_iterator begin() const noexcept { return const_iterator(data()); }
inline _LIBCPP_INLINE_VISIBILITY const_iterator cbegin() const noexcept { return const_iterator(data()); }
inline _LIBCPP_INLINE_VISIBILITY iterator end() noexcept { return iterator(data() + __size_); }
inline _LIBCPP_INLINE_VISIBILITY const_iterator end() const noexcept { return const_iterator(data() + __size_); }
inline _LIBCPP_INLINE_VISIBILITY const_iterator cend() const noexcept { return const_iterator(data() + __size_); }
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rbegin() const noexcept { return const_reverse_iterator(end()); }
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
inline _LIBCPP_INLINE_VISIBILITY reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
inline _LIBCPP_INLINE_VISIBILITY const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
// capacity:
inline _LIBCPP_INLINE_VISIBILITY size_type size() const noexcept { return __size_; }
inline _LIBCPP_INLINE_VISIBILITY size_type max_size() const noexcept { return __size_; }
inline _LIBCPP_INLINE_VISIBILITY bool empty() const noexcept { return __size_ == 0; }
// element access:
inline _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) { return data()[__n]; }
inline _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_type __n) const { return data()[__n]; }
inline _LIBCPP_INLINE_VISIBILITY reference front() { return data()[0]; }
inline _LIBCPP_INLINE_VISIBILITY const_reference front() const { return data()[0]; }
inline _LIBCPP_INLINE_VISIBILITY reference back() { return data()[__size_-1]; }
inline _LIBCPP_INLINE_VISIBILITY const_reference back() const { return data()[__size_-1]; }
inline _LIBCPP_INLINE_VISIBILITY const_reference at(size_type __n) const;
inline _LIBCPP_INLINE_VISIBILITY reference at(size_type __n);
// data access:
inline _LIBCPP_INLINE_VISIBILITY _Tp* data() noexcept { return __base_; }
inline _LIBCPP_INLINE_VISIBILITY const _Tp* data() const noexcept { return __base_; }
// mutating member functions:
inline _LIBCPP_INLINE_VISIBILITY void fill(const value_type& __v) { fill_n(begin(), __size_, __v); }
};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
dynarray<_Tp>::dynarray(size_type __c) : dynarray ()
{
__base_ = __allocate (__c);
value_type *__data = data ();
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
::new (__data) value_type;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
dynarray<_Tp>::dynarray(size_type __c, const value_type& __v) : dynarray ()
{
__base_ = __allocate (__c);
value_type *__data = data ();
for ( __size_ = 0; __size_ < __c; ++__size_, ++__data )
::new (__data) value_type (__v);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
dynarray<_Tp>::dynarray(initializer_list<value_type> __il) : dynarray ()
{
size_t sz = __il.size();
__base_ = __allocate (sz);
value_type *__data = data ();
auto src = __il.begin();
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
::new (__data) value_type (*src);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
dynarray<_Tp>::dynarray(const dynarray& __d) : dynarray ()
{
size_t sz = __d.size();
__base_ = __allocate (sz);
value_type *__data = data ();
auto src = __d.begin();
for ( __size_ = 0; __size_ < sz; ++__size_, ++__data, ++src )
::new (__data) value_type (*src);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
dynarray<_Tp>::~dynarray()
{
value_type *__data = data () + __size_;
for ( size_t i = 0; i < __size_; ++i )
(--__data)->value_type::~value_type();
__deallocate ( __base_ );
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename dynarray<_Tp>::reference
dynarray<_Tp>::at(size_type __n)
{
if (__n >= __size_)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw out_of_range("dynarray::at");
#else
assert(!"dynarray::at out_of_range");
#endif
}
return data()[__n];
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename dynarray<_Tp>::const_reference
dynarray<_Tp>::at(size_type __n) const
{
if (__n >= __size_)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
throw out_of_range("dynarray::at");
#else
assert(!"dynarray::at out_of_range");
#endif
}
return data()[__n];
}
}}}
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<std::experimental::dynarray<_Tp>, _Alloc> : true_type {};
_LIBCPP_END_NAMESPACE_STD
#endif // if _LIBCPP_STD_VER > 11
#endif // _LIBCPP_DYNARRAY

View File

@@ -1,699 +0,0 @@
// -*- C++ -*-
//===-------------------------- optional ----------------------------------===//
//
// 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_OPTIONAL
#define _LIBCPP_OPTIONAL
/*
optional synopsis
// C++1y
#include <initializer_list>
namespace std { namespace experimental {
// optional for object types
template <class T>
class optional
{
public:
typedef T value_type;
// constructors
constexpr optional() noexcept;
constexpr optional(nullopt_t) noexcept;
optional(const optional&);
optional(optional&&) noexcept(is_nothrow_move_constructible<T>::value);
constexpr optional(const T&);
constexpr optional(T&&);
template <class... Args> constexpr explicit optional(in_place_t, Args&&...);
template <class U, class... Args>
constexpr explicit optional(in_place_t, initializer_list<U>, Args&&...);
// destructor
~optional();
// assignment
optional& operator=(nullopt_t) noexcept;
optional& operator=(const optional&);
optional& operator=(optional&&)
noexcept(is_nothrow_move_assignable<T>::value &&
is_nothrow_move_constructible<T>::value);
template <class U> optional& operator=(U&&);
template <class... Args> void emplace(Args&&...);
template <class U, class... Args> void emplace(initializer_list<U>, Args&&...);
// swap
void swap(optional&)
noexcept(is_nothrow_move_constructible<T>::value &&
noexcept(swap(declval<T&>(), declval<T&>())));
// observers
constexpr T const* operator->() const;
T* operator->();
constexpr T const& operator*() const;
T& operator*();
constexpr explicit operator bool() const noexcept;
constexpr T const& value() const;
T& value();
template <class U> constexpr T value_or(U&&) const&;
template <class U> T value_or(U&&) &&;
};
// In-place construction
struct in_place_t{};
constexpr in_place_t in_place{};
// Disengaged state indicator
struct nullopt_t{see below};
constexpr nullopt_t nullopt(unspecified);
// class bad_optional_access
class bad_optional_access
: public logic_error
{
public:
explicit bad_optional_access(const string& what_arg);
explicit bad_optional_access(const char* what_arg);
};
// Relational operators
template <class T> constexpr bool operator==(const optional<T>&, const optional<T>&);
template <class T> constexpr bool operator< (const optional<T>&, const optional<T>&);
// Comparison with nullopt
template <class T> constexpr bool operator==(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator==(nullopt_t, const optional<T>&) noexcept;
template <class T> constexpr bool operator<(const optional<T>&, nullopt_t) noexcept;
template <class T> constexpr bool operator<(nullopt_t, const optional<T>&) noexcept;
// Comparison with T
template <class T> constexpr bool operator==(const optional<T>&, const T&);
template <class T> constexpr bool operator==(const T&, const optional<T>&);
template <class T> constexpr bool operator<(const optional<T>&, const T&);
template <class T> constexpr bool operator<(const T&, const optional<T>&);
// Specialized algorithms
template <class T> void swap(optional<T>&, optional<T>&) noexcept(see below);
template <class T> constexpr optional<typename decay<T>::type> make_optional(T&&);
// hash support
template <class T> struct hash;
template <class T> struct hash<optional<T>>;
}} // std::experimental
*/
#include <__config>
#include <functional>
#include <stdexcept>
namespace std { namespace experimental {
class _LIBCPP_EXCEPTION_ABI bad_optional_access
: public logic_error
{
public:
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const string& __arg)
: logic_error(__arg) {}
_LIBCPP_INLINE_VISIBILITY explicit bad_optional_access(const char* __arg)
: logic_error(__arg) {}
_LIBCPP_INLINE_VISIBILITY bad_optional_access(const bad_optional_access&) noexcept = default;
_LIBCPP_INLINE_VISIBILITY bad_optional_access& operator=(const bad_optional_access&) noexcept = default;
#else
private:
bad_optional_access(const bad_optional_access&);
bad_optional_access& operator=(const bad_optional_access&);
public:
#endif // _LIBCPP_STD_VER > 11
// Get the key function ~bad_optional_access() into the dylib even if not compiling for C++1y
virtual ~bad_optional_access() _NOEXCEPT;
};
}} // std::experimental
#if _LIBCPP_STD_VER > 11
#include <initializer_list>
#include <type_traits>
#include <new>
#include <__functional_base>
#include <__undef_min_max>
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std { namespace experimental { inline namespace __library_fundamentals_v1 {
struct in_place_t {};
constexpr in_place_t in_place{};
struct nullopt_t
{
explicit constexpr nullopt_t(int) noexcept {}
};
constexpr nullopt_t nullopt{0};
template <class _Tp, bool = is_trivially_destructible<_Tp>::value>
class __optional_storage
{
protected:
typedef _Tp value_type;
union
{
char __null_state_;
value_type __val_;
};
bool __engaged_ = false;
_LIBCPP_INLINE_VISIBILITY
~__optional_storage()
{
if (__engaged_)
__val_.~value_type();
}
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage() noexcept
: __null_state_('\0') {}
_LIBCPP_INLINE_VISIBILITY
__optional_storage(const __optional_storage& __x)
: __engaged_(__x.__engaged_)
{
if (__engaged_)
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
}
_LIBCPP_INLINE_VISIBILITY
__optional_storage(__optional_storage&& __x)
noexcept(is_nothrow_move_constructible<value_type>::value)
: __engaged_(__x.__engaged_)
{
if (__engaged_)
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
}
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage(const value_type& __v)
: __val_(__v),
__engaged_(true) {}
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage(value_type&& __v)
: __val_(_VSTD::move(__v)),
__engaged_(true) {}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
constexpr
explicit __optional_storage(in_place_t, _Args&&... __args)
: __val_(_VSTD::forward<_Args>(__args)...),
__engaged_(true) {}
};
template <class _Tp>
class __optional_storage<_Tp, true>
{
protected:
typedef _Tp value_type;
union
{
char __null_state_;
value_type __val_;
};
bool __engaged_ = false;
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage() noexcept
: __null_state_('\0') {}
_LIBCPP_INLINE_VISIBILITY
__optional_storage(const __optional_storage& __x)
: __engaged_(__x.__engaged_)
{
if (__engaged_)
::new(_VSTD::addressof(__val_)) value_type(__x.__val_);
}
_LIBCPP_INLINE_VISIBILITY
__optional_storage(__optional_storage&& __x)
noexcept(is_nothrow_move_constructible<value_type>::value)
: __engaged_(__x.__engaged_)
{
if (__engaged_)
::new(_VSTD::addressof(__val_)) value_type(_VSTD::move(__x.__val_));
}
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage(const value_type& __v)
: __val_(__v),
__engaged_(true) {}
_LIBCPP_INLINE_VISIBILITY
constexpr __optional_storage(value_type&& __v)
: __val_(_VSTD::move(__v)),
__engaged_(true) {}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
constexpr
explicit __optional_storage(in_place_t, _Args&&... __args)
: __val_(_VSTD::forward<_Args>(__args)...),
__engaged_(true) {}
};
template <class _Tp>
class optional
: private __optional_storage<_Tp>
{
typedef __optional_storage<_Tp> __base;
public:
typedef _Tp value_type;
static_assert(!is_reference<value_type>::value,
"Instantiation of optional with a reference type is ill-formed.");
static_assert(!is_same<typename remove_cv<value_type>::type, in_place_t>::value,
"Instantiation of optional with a in_place_t type is ill-formed.");
static_assert(!is_same<typename remove_cv<value_type>::type, nullopt_t>::value,
"Instantiation of optional with a nullopt_t type is ill-formed.");
static_assert(is_object<value_type>::value,
"Instantiation of optional with a non-object type is undefined behavior.");
static_assert(is_nothrow_destructible<value_type>::value,
"Instantiation of optional with an object type that is not noexcept destructible is undefined behavior.");
_LIBCPP_INLINE_VISIBILITY constexpr optional() noexcept {}
_LIBCPP_INLINE_VISIBILITY optional(const optional&) = default;
_LIBCPP_INLINE_VISIBILITY optional(optional&&) = default;
_LIBCPP_INLINE_VISIBILITY ~optional() = default;
_LIBCPP_INLINE_VISIBILITY constexpr optional(nullopt_t) noexcept {}
_LIBCPP_INLINE_VISIBILITY constexpr optional(const value_type& __v)
: __base(__v) {}
_LIBCPP_INLINE_VISIBILITY constexpr optional(value_type&& __v)
: __base(_VSTD::move(__v)) {}
template <class... _Args,
class = typename enable_if
<
is_constructible<value_type, _Args...>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
constexpr
explicit optional(in_place_t, _Args&&... __args)
: __base(in_place, _VSTD::forward<_Args>(__args)...) {}
template <class _Up, class... _Args,
class = typename enable_if
<
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
constexpr
explicit optional(in_place_t, initializer_list<_Up> __il, _Args&&... __args)
: __base(in_place, __il, _VSTD::forward<_Args>(__args)...) {}
_LIBCPP_INLINE_VISIBILITY
optional& operator=(nullopt_t) noexcept
{
if (this->__engaged_)
{
this->__val_.~value_type();
this->__engaged_ = false;
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY
optional&
operator=(const optional& __opt)
{
if (this->__engaged_ == __opt.__engaged_)
{
if (this->__engaged_)
this->__val_ = __opt.__val_;
}
else
{
if (this->__engaged_)
this->__val_.~value_type();
else
::new(_VSTD::addressof(this->__val_)) value_type(__opt.__val_);
this->__engaged_ = __opt.__engaged_;
}
return *this;
}
_LIBCPP_INLINE_VISIBILITY
optional&
operator=(optional&& __opt)
noexcept(is_nothrow_move_assignable<value_type>::value &&
is_nothrow_move_constructible<value_type>::value)
{
if (this->__engaged_ == __opt.__engaged_)
{
if (this->__engaged_)
this->__val_ = _VSTD::move(__opt.__val_);
}
else
{
if (this->__engaged_)
this->__val_.~value_type();
else
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
this->__engaged_ = __opt.__engaged_;
}
return *this;
}
template <class _Up,
class = typename enable_if
<
is_same<typename remove_reference<_Up>::type, value_type>::value &&
is_constructible<value_type, _Up>::value &&
is_assignable<value_type&, _Up>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
optional&
operator=(_Up&& __v)
{
if (this->__engaged_)
this->__val_ = _VSTD::forward<_Up>(__v);
else
{
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Up>(__v));
this->__engaged_ = true;
}
return *this;
}
template <class... _Args,
class = typename enable_if
<
is_constructible<value_type, _Args...>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
void
emplace(_Args&&... __args)
{
*this = nullopt;
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::forward<_Args>(__args)...);
this->__engaged_ = true;
}
template <class _Up, class... _Args,
class = typename enable_if
<
is_constructible<value_type, initializer_list<_Up>&, _Args...>::value
>::type
>
_LIBCPP_INLINE_VISIBILITY
void
emplace(initializer_list<_Up> __il, _Args&&... __args)
{
*this = nullopt;
::new(_VSTD::addressof(this->__val_)) value_type(__il, _VSTD::forward<_Args>(__args)...);
this->__engaged_ = true;
}
_LIBCPP_INLINE_VISIBILITY
void
swap(optional& __opt)
noexcept(is_nothrow_move_constructible<value_type>::value &&
__is_nothrow_swappable<value_type>::value)
{
using _VSTD::swap;
if (this->__engaged_ == __opt.__engaged_)
{
if (this->__engaged_)
swap(this->__val_, __opt.__val_);
}
else
{
if (this->__engaged_)
{
::new(_VSTD::addressof(__opt.__val_)) value_type(_VSTD::move(this->__val_));
this->__val_.~value_type();
}
else
{
::new(_VSTD::addressof(this->__val_)) value_type(_VSTD::move(__opt.__val_));
__opt.__val_.~value_type();
}
swap(this->__engaged_, __opt.__engaged_);
}
}
_LIBCPP_INLINE_VISIBILITY
constexpr
value_type const*
operator->() const
{
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
return __operator_arrow(__has_operator_addressof<value_type>{});
}
_LIBCPP_INLINE_VISIBILITY
value_type*
operator->()
{
_LIBCPP_ASSERT(this->__engaged_, "optional operator-> called for disengaged value");
return _VSTD::addressof(this->__val_);
}
_LIBCPP_INLINE_VISIBILITY
constexpr
const value_type&
operator*() const
{
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
return this->__val_;
}
_LIBCPP_INLINE_VISIBILITY
value_type&
operator*()
{
_LIBCPP_ASSERT(this->__engaged_, "optional operator* called for disengaged value");
return this->__val_;
}
_LIBCPP_INLINE_VISIBILITY
constexpr explicit operator bool() const noexcept {return this->__engaged_;}
_LIBCPP_INLINE_VISIBILITY
constexpr value_type const& value() const
{
if (!this->__engaged_)
throw bad_optional_access("optional<T>::value: not engaged");
return this->__val_;
}
_LIBCPP_INLINE_VISIBILITY
value_type& value()
{
if (!this->__engaged_)
throw bad_optional_access("optional<T>::value: not engaged");
return this->__val_;
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
constexpr value_type value_or(_Up&& __v) const&
{
static_assert(is_copy_constructible<value_type>::value,
"optional<T>::value_or: T must be copy constructible");
static_assert(is_convertible<_Up, value_type>::value,
"optional<T>::value_or: U must be convertible to T");
return this->__engaged_ ? this->__val_ :
static_cast<value_type>(_VSTD::forward<_Up>(__v));
}
template <class _Up>
_LIBCPP_INLINE_VISIBILITY
value_type value_or(_Up&& __v) &&
{
static_assert(is_move_constructible<value_type>::value,
"optional<T>::value_or: T must be move constructible");
static_assert(is_convertible<_Up, value_type>::value,
"optional<T>::value_or: U must be convertible to T");
return this->__engaged_ ? _VSTD::move(this->__val_) :
static_cast<value_type>(_VSTD::forward<_Up>(__v));
}
private:
_LIBCPP_INLINE_VISIBILITY
value_type const*
__operator_arrow(true_type) const
{
return _VSTD::addressof(this->__val_);
}
_LIBCPP_INLINE_VISIBILITY
constexpr
value_type const*
__operator_arrow(false_type) const
{
return &this->__val_;
}
};
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator==(const optional<_Tp>& __x, const optional<_Tp>& __y)
{
if (static_cast<bool>(__x) != static_cast<bool>(__y))
return false;
if (!static_cast<bool>(__x))
return true;
return *__x == *__y;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator<(const optional<_Tp>& __x, const optional<_Tp>& __y)
{
if (!static_cast<bool>(__y))
return false;
if (!static_cast<bool>(__x))
return true;
return less<_Tp>{}(*__x, *__y);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator==(const optional<_Tp>& __x, nullopt_t) noexcept
{
return !static_cast<bool>(__x);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator==(nullopt_t, const optional<_Tp>& __x) noexcept
{
return !static_cast<bool>(__x);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator<(const optional<_Tp>&, nullopt_t) noexcept
{
return false;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator<(nullopt_t, const optional<_Tp>& __x) noexcept
{
return static_cast<bool>(__x);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator==(const optional<_Tp>& __x, const _Tp& __v)
{
return static_cast<bool>(__x) ? *__x == __v : false;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator==(const _Tp& __v, const optional<_Tp>& __x)
{
return static_cast<bool>(__x) ? *__x == __v : false;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator<(const optional<_Tp>& __x, const _Tp& __v)
{
return static_cast<bool>(__x) ? less<_Tp>{}(*__x, __v) : true;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
bool
operator<(const _Tp& __v, const optional<_Tp>& __x)
{
return static_cast<bool>(__x) ? less<_Tp>{}(__v, *__x) : false;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(optional<_Tp>& __x, optional<_Tp>& __y) noexcept(noexcept(__x.swap(__y)))
{
__x.swap(__y);
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
constexpr
optional<typename decay<_Tp>::type>
make_optional(_Tp&& __v)
{
return optional<typename decay<_Tp>::type>(_VSTD::forward<_Tp>(__v));
}
}}} // namespace std::experimental::__library_fundamentals_v1
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY hash<std::experimental::optional<_Tp> >
{
typedef std::experimental::optional<_Tp> argument_type;
typedef size_t result_type;
_LIBCPP_INLINE_VISIBILITY
result_type operator()(const argument_type& __opt) const _NOEXCEPT
{
return static_cast<bool>(__opt) ? hash<_Tp>()(*__opt) : 0;
}
};
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
#endif // _LIBCPP_ARRAY

View File

@@ -19,10 +19,10 @@
namespace __gnu_cxx {
using namespace std;
template <typename _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash : public std::hash<_Tp>
template <typename T> struct _LIBCPP_TYPE_VIS hash : public std::hash<T>
{ };
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
template <> struct _LIBCPP_TYPE_VIS hash<const char*>
: public unary_function<const char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -32,7 +32,7 @@ template <> struct _LIBCPP_TYPE_VIS_ONLY hash<const char*>
}
};
template <> struct _LIBCPP_TYPE_VIS_ONLY hash<char *>
template <> struct _LIBCPP_TYPE_VIS hash<char *>
: public unary_function<char*, size_t>
{
_LIBCPP_INLINE_VISIBILITY

View File

@@ -206,11 +206,7 @@ template <class Key, class T, class Hash, class Pred, class Alloc>
#include <ext/__hash>
#if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>")
#else
# warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#warning Use of the header <ext/hash_map> is deprecated. Migrate to <unordered_map>
#endif
#pragma GCC system_header
@@ -365,7 +361,7 @@ public:
};
template <class _HashIterator>
class _LIBCPP_TYPE_VIS_ONLY __hash_map_iterator
class _LIBCPP_TYPE_VIS __hash_map_iterator
{
_HashIterator __i_;
@@ -408,15 +404,15 @@ public:
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator;
};
template <class _HashIterator>
class _LIBCPP_TYPE_VIS_ONLY __hash_map_const_iterator
class _LIBCPP_TYPE_VIS __hash_map_const_iterator
{
_HashIterator __i_;
@@ -467,15 +463,15 @@ public:
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS_ONLY hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY __hash_const_local_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator;
};
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS_ONLY hash_map
class _LIBCPP_TYPE_VIS hash_map
{
public:
// types
@@ -688,7 +684,7 @@ hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return _VSTD::move(__h); // explicitly moved for C++03
return _VSTD::move(__h);
}
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
@@ -754,7 +750,7 @@ operator!=(const hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x,
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS_ONLY hash_multimap
class _LIBCPP_TYPE_VIS hash_multimap
{
public:
// types

View File

@@ -199,11 +199,7 @@ template <class Value, class Hash, class Pred, class Alloc>
#include <ext/__hash>
#if __DEPRECATED
#if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>")
#else
# warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
#warning Use of the header <ext/hash_set> is deprecated. Migrate to <unordered_set>
#endif
namespace __gnu_cxx {
@@ -212,7 +208,7 @@ using namespace std;
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY hash_set
class _LIBCPP_TYPE_VIS hash_set
{
public:
// types
@@ -433,7 +429,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY hash_multiset
class _LIBCPP_TYPE_VIS hash_multiset
{
public:
// types

View File

@@ -38,7 +38,6 @@ public:
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit forward_list(const allocator_type& a);
explicit forward_list(size_type n);
explicit forward_list(size_type n, const allocator_type& a); // C++14
forward_list(size_type n, const value_type& v);
forward_list(size_type n, const value_type& v, const allocator_type& a);
template <class InputIterator>
@@ -213,11 +212,11 @@ struct __forward_list_node
value_type __value_;
};
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY forward_list;
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS forward_list;
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS __forward_list_const_iterator;
template <class _NodePtr>
class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
class _LIBCPP_TYPE_VIS __forward_list_iterator
{
typedef _NodePtr __node_pointer;
@@ -226,14 +225,14 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_iterator
_LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template<class, class> friend class _LIBCPP_TYPE_VIS_ONLY forward_list;
template<class> friend class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator;
template<class, class> friend class _LIBCPP_TYPE_VIS forward_list;
template<class> friend class _LIBCPP_TYPE_VIS __forward_list_const_iterator;
public:
typedef forward_iterator_tag iterator_category;
typedef typename pointer_traits<__node_pointer>::element_type::value_type
value_type;
typedef value_type& reference;
typedef value_type& reference;
typedef typename pointer_traits<__node_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_pointer>::template
@@ -250,7 +249,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_iterator& operator++()
@@ -277,7 +276,7 @@ public:
};
template <class _NodeConstPtr>
class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
class _LIBCPP_TYPE_VIS __forward_list_const_iterator
{
typedef _NodeConstPtr __node_const_pointer;
@@ -304,7 +303,7 @@ class _LIBCPP_TYPE_VIS_ONLY __forward_list_const_iterator
public:
typedef forward_iterator_tag iterator_category;
typedef typename __node::value_type value_type;
typedef const value_type& reference;
typedef const value_type& reference;
typedef typename pointer_traits<__node_const_pointer>::difference_type
difference_type;
typedef typename pointer_traits<__node_const_pointer>::template
@@ -324,7 +323,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
reference operator*() const {return __ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const {return pointer_traits<pointer>::pointer_to(__ptr_->__value_);}
pointer operator->() const {return &__ptr_->__value_;}
_LIBCPP_INLINE_VISIBILITY
__forward_list_const_iterator& operator++()
@@ -369,27 +368,18 @@ protected:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::pointer __node_const_pointer;
typedef typename allocator_traits<allocator_type>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__begin_node>
#else
rebind_alloc<__begin_node>::other
#endif
__begin_node_allocator;
typedef typename allocator_traits<__begin_node_allocator>::pointer __begin_node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer;
__compressed_pair<__begin_node, __node_allocator> __before_begin_;
_LIBCPP_INLINE_VISIBILITY
__node_pointer __before_begin() _NOEXCEPT
{return static_cast<__node_pointer>(pointer_traits<__begin_node_pointer>::
pointer_to(__before_begin_.first()));}
{return pointer_traits<__node_pointer>::pointer_to(
static_cast<__node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_const_pointer __before_begin() const _NOEXCEPT
{return static_cast<__node_const_pointer>(pointer_traits<__begin_node_pointer>::
pointer_to(const_cast<__begin_node&>(__before_begin_.first())));}
{return pointer_traits<__node_const_pointer>::pointer_to(
static_cast<const __node&>(__before_begin_.first()));}
_LIBCPP_INLINE_VISIBILITY
__node_allocator& __alloc() _NOEXCEPT
@@ -399,7 +389,7 @@ protected:
{return __before_begin_.second();}
typedef __forward_list_iterator<__node_pointer> iterator;
typedef __forward_list_const_iterator<__node_pointer> const_iterator;
typedef __forward_list_const_iterator<__node_const_pointer> const_iterator;
_LIBCPP_INLINE_VISIBILITY
__forward_list_base()
@@ -543,7 +533,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY forward_list
class _LIBCPP_TYPE_VIS forward_list
: private __forward_list_base<_Tp, _Alloc>
{
typedef __forward_list_base<_Tp, _Alloc> base;
@@ -572,9 +562,6 @@ public:
{} // = default;
explicit forward_list(const allocator_type& __a);
explicit forward_list(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit forward_list(size_type __n, const allocator_type& __a);
#endif
forward_list(size_type __n, const value_type& __v);
forward_list(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIterator>
@@ -798,28 +785,6 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
}
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const allocator_type& __a)
: base ( __a )
{
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_)
{
__h.reset(__node_traits::allocate(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_));
__h->__next_ = nullptr;
__p->__next_ = __h.release();
}
}
}
#endif
template <class _Tp, class _Alloc>
forward_list<_Tp, _Alloc>::forward_list(size_type __n, const value_type& __v)
{
@@ -1085,7 +1050,7 @@ template <class... _Args>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
@@ -1102,7 +1067,7 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
@@ -1118,7 +1083,7 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __v)
{
__node_pointer const __r = __p.__ptr_;
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1));
@@ -1133,7 +1098,7 @@ typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
const value_type& __v)
{
__node_pointer __r = __p.__ptr_;
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__n > 0)
{
__node_allocator& __a = base::__alloc();
@@ -1183,7 +1148,7 @@ typename enable_if
forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
_InputIterator __f, _InputIterator __l)
{
__node_pointer __r = __p.__ptr_;
__node_pointer __r = const_cast<__node_pointer>(__p.__ptr_);
if (__f != __l)
{
__node_allocator& __a = base::__alloc();
@@ -1227,7 +1192,7 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f)
{
__node_pointer __p = __f.__ptr_;
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
__p->__next_ = __n->__next_;
__node_allocator& __a = base::__alloc();
@@ -1240,10 +1205,10 @@ template <class _Tp, class _Alloc>
typename forward_list<_Tp, _Alloc>::iterator
forward_list<_Tp, _Alloc>::erase_after(const_iterator __f, const_iterator __l)
{
__node_pointer __e = __l.__ptr_;
__node_pointer __e = const_cast<__node_pointer>(__l.__ptr_);
if (__f != __l)
{
__node_pointer __p = __f.__ptr_;
__node_pointer __p = const_cast<__node_pointer>(__f.__ptr_);
__node_pointer __n = __p->__next_;
if (__n != __e)
{
@@ -1337,10 +1302,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
const_iterator __lm1 = __x.before_begin();
while (__lm1.__ptr_->__next_ != nullptr)
++__lm1;
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
}
__p.__ptr_->__next_ = __x.__before_begin()->__next_;
__x.__before_begin()->__next_ = nullptr;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__x.__before_begin())->__next_;
const_cast<__node_pointer>(__x.__before_begin())->__next_ = nullptr;
}
}
@@ -1353,9 +1320,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
const_iterator __lm1 = _VSTD::next(__i);
if (__p != __i && __p != __lm1)
{
__i.__ptr_->__next_ = __lm1.__ptr_->__next_;
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
__p.__ptr_->__next_ = __lm1.__ptr_;
const_cast<__node_pointer>(__i.__ptr_)->__next_ =
const_cast<__node_pointer>(__lm1.__ptr_)->__next_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__lm1.__ptr_);
}
}
@@ -1372,9 +1342,12 @@ forward_list<_Tp, _Alloc>::splice_after(const_iterator __p,
++__lm1;
if (__f != __lm1)
{
__lm1.__ptr_->__next_ = __p.__ptr_->__next_;
__p.__ptr_->__next_ = __f.__ptr_->__next_;
__f.__ptr_->__next_ = __l.__ptr_;
const_cast<__node_pointer>(__lm1.__ptr_)->__next_ =
const_cast<__node_pointer>(__p.__ptr_)->__next_;
const_cast<__node_pointer>(__p.__ptr_)->__next_ =
const_cast<__node_pointer>(__f.__ptr_)->__next_;
const_cast<__node_pointer>(__f.__ptr_)->__next_ =
const_cast<__node_pointer>(__l.__ptr_);
}
}
}

View File

@@ -180,7 +180,7 @@ typedef basic_fstream<wchar_t> wfstream;
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf
class _LIBCPP_TYPE_VIS basic_filebuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -994,7 +994,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream
class _LIBCPP_TYPE_VIS basic_ifstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -1139,7 +1139,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream
class _LIBCPP_TYPE_VIS basic_ofstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -1284,7 +1284,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_fstream
class _LIBCPP_TYPE_VIS basic_fstream
: public basic_iostream<_CharT, _Traits>
{
public:

File diff suppressed because it is too large Load Diff

View File

@@ -19,10 +19,10 @@ namespace std
enum class future_errc
{
future_already_retrieved = 1,
broken_promise,
future_already_retrieved,
promise_already_satisfied,
no_state,
broken_promise
no_state
};
enum class launch
@@ -309,11 +309,11 @@ public:
};
template <class F, class... Args>
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
future<typename result_of<F(Args...)>::type>
async(F&& f, Args&&... args);
template <class F, class... Args>
future<typename result_of<typename decay<F>::type(typename decay<Args>::type...)>::type>
future<typename result_of<F(Args...)>::type>
async(launch policy, F&& f, Args&&... args);
template <class> class packaged_task; // undefined
@@ -379,19 +379,19 @@ _LIBCPP_BEGIN_NAMESPACE_STD
//enum class future_errc
_LIBCPP_DECLARE_STRONG_ENUM(future_errc)
{
future_already_retrieved = 1,
broken_promise,
future_already_retrieved,
promise_already_satisfied,
no_state,
broken_promise
no_state
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(future_errc)
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<future_errc> : public true_type {};
struct _LIBCPP_TYPE_VIS is_error_code_enum<future_errc> : public true_type {};
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<future_errc::__lx> : public true_type { };
struct _LIBCPP_TYPE_VIS is_error_code_enum<future_errc::__lx> : public true_type { };
#endif
//enum class launch
@@ -403,72 +403,6 @@ _LIBCPP_DECLARE_STRONG_ENUM(launch)
};
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(launch)
#ifndef _LIBCPP_HAS_NO_STRONG_ENUMS
#ifdef _LIBCXX_UNDERLYING_TYPE
typedef underlying_type<launch>::type __launch_underlying_type;
#else
typedef int __launch_underlying_type;
#endif
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator&(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) &
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator|(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) |
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator^(launch __x, launch __y)
{
return static_cast<launch>(static_cast<__launch_underlying_type>(__x) ^
static_cast<__launch_underlying_type>(__y));
}
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
launch
operator~(launch __x)
{
return static_cast<launch>(~static_cast<__launch_underlying_type>(__x) & 3);
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator&=(launch& __x, launch __y)
{
__x = __x & __y; return __x;
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator|=(launch& __x, launch __y)
{
__x = __x | __y; return __x;
}
inline _LIBCPP_INLINE_VISIBILITY
launch&
operator^=(launch& __x, launch __y)
{
__x = __x ^ __y; return __x;
}
#endif // !_LIBCPP_HAS_NO_STRONG_ENUMS
//enum class future_status
_LIBCPP_DECLARE_STRONG_ENUM(future_status)
{
@@ -508,7 +442,7 @@ public:
virtual ~future_error() _NOEXCEPT;
};
class _LIBCPP_TYPE_VIS __assoc_sub_state
class __assoc_sub_state
: public __shared_count
{
protected:
@@ -542,14 +476,14 @@ public:
__state_ |= __future_attached;
}
_LIBCPP_INLINE_VISIBILITY
bool __has_future_attached() const {return (__state_ & __future_attached) != 0;}
bool __has_future_attached() const {return __state_ & __future_attached;}
_LIBCPP_INLINE_VISIBILITY
void __set_deferred() {__state_ |= deferred;}
void __make_ready();
_LIBCPP_INLINE_VISIBILITY
bool __is_ready() const {return (__state_ & ready) != 0;}
bool __is_ready() const {return __state_ & ready;}
void set_value();
void set_value_at_thread_exit();
@@ -727,7 +661,7 @@ __assoc_state<_Rp&>::set_value(_Rp& __arg)
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__value_ = _VSTD::addressof(__arg);
__value_ = &__arg;
this->__state_ |= base::__constructed | base::ready;
__lk.unlock();
__cv_.notify_all();
@@ -742,7 +676,7 @@ __assoc_state<_Rp&>::set_value_at_thread_exit(_Rp& __arg)
if (this->__has_value())
throw future_error(make_error_code(future_errc::promise_already_satisfied));
#endif
__value_ = _VSTD::addressof(__arg);
__value_ = &__arg;
this->__state_ |= base::__constructed;
__thread_local_data()->__make_ready_at_thread_exit(this);
__lk.unlock();
@@ -778,7 +712,7 @@ void
__assoc_state_alloc<_Rp, _Alloc>::__on_zero_shared() _NOEXCEPT
{
if (this->__state_ & base::__constructed)
reinterpret_cast<_Rp*>(_VSTD::addressof(this->__value_))->~_Rp();
reinterpret_cast<_Rp*>(&this->__value_)->~_Rp();
typename _Alloc::template rebind<__assoc_state_alloc>::other __a(__alloc_);
this->~__assoc_state_alloc();
__a.deallocate(this, 1);
@@ -1032,12 +966,12 @@ __async_assoc_state<void, _Fp>::__on_zero_shared() _NOEXCEPT
base::__on_zero_shared();
}
template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY promise;
template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY shared_future;
template <class _Rp> class _LIBCPP_TYPE_VIS promise;
template <class _Rp> class _LIBCPP_TYPE_VIS shared_future;
// future
template <class _Rp> class _LIBCPP_TYPE_VIS_ONLY future;
template <class _Rp> class _LIBCPP_TYPE_VIS future;
template <class _Rp, class _Fp>
future<_Rp>
@@ -1056,7 +990,7 @@ __make_async_assoc_state(_Fp __f);
#endif
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY future
class _LIBCPP_TYPE_VIS future
{
__assoc_state<_Rp>* __state_;
@@ -1160,7 +1094,7 @@ future<_Rp>::get()
}
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY future<_Rp&>
class _LIBCPP_TYPE_VIS future<_Rp&>
{
__assoc_state<_Rp&>* __state_;
@@ -1341,7 +1275,7 @@ swap(future<_Rp>& __x, future<_Rp>& __y) _NOEXCEPT
template <class _Callable> class packaged_task;
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY promise
class _LIBCPP_TYPE_VIS promise
{
__assoc_state<_Rp>* __state_;
@@ -1519,7 +1453,7 @@ promise<_Rp>::set_exception_at_thread_exit(exception_ptr __p)
// promise<R&>
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY promise<_Rp&>
class _LIBCPP_TYPE_VIS promise<_Rp&>
{
__assoc_state<_Rp&>* __state_;
@@ -1736,7 +1670,7 @@ swap(promise<_Rp>& __x, promise<_Rp>& __y) _NOEXCEPT
}
template <class _Rp, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<promise<_Rp>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<promise<_Rp>, _Alloc>
: public true_type {};
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2000,7 +1934,7 @@ __packaged_task_function<_Rp(_ArgTypes...)>::operator()(_ArgTypes... __arg) cons
}
template<class _Rp, class ..._ArgTypes>
class _LIBCPP_TYPE_VIS_ONLY packaged_task<_Rp(_ArgTypes...)>
class _LIBCPP_TYPE_VIS packaged_task<_Rp(_ArgTypes...)>
{
public:
typedef _Rp result_type;
@@ -2013,26 +1947,10 @@ public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() _NOEXCEPT : __p_(nullptr) {}
template <class _Fp,
class = typename enable_if
<
!is_same<
typename decay<_Fp>::type,
packaged_task
>::value
>::type
>
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
template <class _Fp, class _Allocator,
class = typename enable_if
<
!is_same<
typename decay<_Fp>::type,
packaged_task
>::value
>::type
>
template <class _Fp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
@@ -2131,7 +2049,7 @@ packaged_task<_Rp(_ArgTypes...)>::reset()
}
template<class ..._ArgTypes>
class _LIBCPP_TYPE_VIS_ONLY packaged_task<void(_ArgTypes...)>
class _LIBCPP_TYPE_VIS packaged_task<void(_ArgTypes...)>
{
public:
typedef void result_type;
@@ -2144,26 +2062,10 @@ public:
// construction and destruction
_LIBCPP_INLINE_VISIBILITY
packaged_task() _NOEXCEPT : __p_(nullptr) {}
template <class _Fp,
class = typename enable_if
<
!is_same<
typename decay<_Fp>::type,
packaged_task
>::value
>::type
>
template <class _Fp>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(_Fp&& __f) : __f_(_VSTD::forward<_Fp>(__f)) {}
template <class _Fp, class _Allocator,
class = typename enable_if
<
!is_same<
typename decay<_Fp>::type,
packaged_task
>::value
>::type
>
template <class _Fp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
explicit packaged_task(allocator_arg_t, const _Allocator& __a, _Fp&& __f)
: __f_(allocator_arg, __a, _VSTD::forward<_Fp>(__f)),
@@ -2272,7 +2174,7 @@ swap(packaged_task<_Callable>& __x, packaged_task<_Callable>& __y) _NOEXCEPT
}
template <class _Callable, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<packaged_task<_Callable>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<packaged_task<_Callable>, _Alloc>
: public true_type {};
template <class _Rp, class _Fp>
@@ -2331,32 +2233,20 @@ private:
}
};
inline _LIBCPP_INLINE_VISIBILITY bool __does_policy_contain(launch __policy, launch __value )
{ return (int(__policy) & int(__value)) != 0; }
template <class _Fp, class... _Args>
future<typename __invoke_of<typename decay<_Fp>::type, typename decay<_Args>::type...>::type>
async(launch __policy, _Fp&& __f, _Args&&... __args)
{
typedef __async_func<typename decay<_Fp>::type, typename decay<_Args>::type...> _BF;
typedef typename _BF::_Rp _Rp;
#ifndef _LIBCPP_NO_EXCEPTIONS
try
{
#endif
if (__does_policy_contain(__policy, launch::async))
return _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
future<_Rp> __r;
if (int(__policy) & int(launch::async))
__r = _VSTD::__make_async_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch ( ... ) { if (__policy == launch::async) throw ; }
#endif
if (__does_policy_contain(__policy, launch::deferred))
return _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
else if (int(__policy) & int(launch::deferred))
__r = _VSTD::__make_deferred_assoc_state<_Rp>(_BF(__decay_copy(_VSTD::forward<_Fp>(__f)),
__decay_copy(_VSTD::forward<_Args>(__args))...));
return future<_Rp>{};
return __r;
}
template <class _Fp, class... _Args>
@@ -2373,7 +2263,7 @@ async(_Fp&& __f, _Args&&... __args)
// shared_future
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY shared_future
class _LIBCPP_TYPE_VIS shared_future
{
__assoc_state<_Rp>* __state_;
@@ -2447,7 +2337,7 @@ shared_future<_Rp>::operator=(const shared_future& __rhs)
}
template <class _Rp>
class _LIBCPP_TYPE_VIS_ONLY shared_future<_Rp&>
class _LIBCPP_TYPE_VIS shared_future<_Rp&>
{
__assoc_state<_Rp&>* __state_;

View File

@@ -29,15 +29,15 @@ public:
typedef const E* iterator;
typedef const E* const_iterator;
initializer_list() noexcept; // constexpr in C++14
initializer_list() noexcept;
size_t size() const noexcept; // constexpr in C++14
const E* begin() const noexcept; // constexpr in C++14
const E* end() const noexcept; // constexpr in C++14
size_t size() const noexcept;
const E* begin() const noexcept;
const E* end() const noexcept;
};
template<class E> const E* begin(initializer_list<E> il) noexcept; // constexpr in C++14
template<class E> const E* end(initializer_list<E> il) noexcept; // constexpr in C++14
template<class E> const E* begin(initializer_list<E> il) noexcept;
template<class E> const E* end(initializer_list<E> il) noexcept;
} // std
@@ -56,13 +56,12 @@ namespace std // purposefully not versioned
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Ep>
class _LIBCPP_TYPE_VIS_ONLY initializer_list
class _LIBCPP_TYPE_VIS initializer_list
{
const _Ep* __begin_;
size_t __size_;
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11
initializer_list(const _Ep* __b, size_t __s) _NOEXCEPT
: __begin_(__b),
__size_(__s)
@@ -76,26 +75,15 @@ public:
typedef const _Ep* iterator;
typedef const _Ep* const_iterator;
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11
initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE initializer_list() _NOEXCEPT : __begin_(nullptr), __size_(0) {}
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11
size_t size() const _NOEXCEPT {return __size_;}
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep* begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
_LIBCPP_ALWAYS_INLINE size_t size() const _NOEXCEPT {return __size_;}
_LIBCPP_ALWAYS_INLINE const _Ep* begin() const _NOEXCEPT {return __begin_;}
_LIBCPP_ALWAYS_INLINE const _Ep* end() const _NOEXCEPT {return __begin_ + __size_;}
};
template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep*
begin(initializer_list<_Ep> __il) _NOEXCEPT
{
@@ -104,7 +92,6 @@ begin(initializer_list<_Ep> __il) _NOEXCEPT
template<class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
const _Ep*
end(initializer_list<_Ep> __il) _NOEXCEPT
{

View File

@@ -14,8 +14,6 @@
/*
iomanip synopsis
namespace std {
// types T1, T2, ... are unspecified implementation types
T1 resetiosflags(ios_base::fmtflags mask);
T2 setiosflags (ios_base::fmtflags mask);
@@ -28,17 +26,6 @@ template <class charT, class moneyT> T8 put_money(const moneyT& mon, bool intl =
template <class charT> T9 get_time(struct tm* tmb, const charT* fmt);
template <class charT> T10 put_time(const struct tm* tmb, const charT* fmt);
template <class charT>
T11 quoted(const charT* s, charT delim=charT('"'), charT escape=charT('\\')); // C++14
template <class charT, class traits, class Allocator>
T12 quoted(const basic_string<charT, traits, Allocator>& s,
charT delim=charT('"'), charT escape=charT('\\')); // C++14
template <class charT, class traits, class Allocator>
T13 quoted(basic_string<charT, traits, Allocator>& s,
charT delim=charT('"'), charT escape=charT('\\')); // C++14
} // std
*/
@@ -512,142 +499,6 @@ put_time(const tm* __tm, const _CharT* __fmt)
return __iom_t10<_CharT>(__tm, __fmt);
}
#if _LIBCPP_STD_VER > 11
template <class _CharT, class _Traits, class _ForwardIterator>
std::basic_ostream<_CharT, _Traits> &
__quoted_output ( basic_ostream<_CharT, _Traits> &__os,
_ForwardIterator __first, _ForwardIterator __last, _CharT __delim, _CharT __escape )
{
__os << __delim;
for ( ; __first != __last; ++ __first )
{
if (_Traits::eq (*__first, __escape) || _Traits::eq (*__first, __delim))
__os << __escape;
__os << *__first;
}
__os << __delim;
return __os;
}
template <class _CharT, class _Traits, class _String>
basic_istream<_CharT, _Traits> &
__quoted_input ( basic_istream<_CharT, _Traits> &__is, _String & __string, _CharT __delim, _CharT __escape )
{
__string.clear ();
_CharT __c;
__is >> __c;
if ( __is.fail ())
return __is;
if (!_Traits::eq (__c, __delim)) // no delimiter, read the whole string
{
__is.unget ();
__is >> __string;
return __is;
}
__save_flags<_CharT, _Traits> sf(__is);
noskipws (__is);
while (true)
{
__is >> __c;
if ( __is.fail ())
break;
if (_Traits::eq (__c, __escape))
{
__is >> __c;
if ( __is.fail ())
break;
}
else if (_Traits::eq (__c, __delim))
break;
__string.push_back ( __c );
}
return __is;
}
template <class _CharT, class _Iter, class _Traits=char_traits<_CharT>>
struct __quoted_output_proxy
{
_Iter __first;
_Iter __last;
_CharT __delim;
_CharT __escape;
__quoted_output_proxy(_Iter __f, _Iter __l, _CharT __d, _CharT __e)
: __first(__f), __last(__l), __delim(__d), __escape(__e) {}
// This would be a nice place for a string_ref
};
template <class _CharT, class _Traits, class _Iter>
basic_ostream<_CharT, _Traits>& operator<<(
basic_ostream<_CharT, _Traits>& __os,
const __quoted_output_proxy<_CharT, _Iter, _Traits> & __proxy)
{
return __quoted_output (__os, __proxy.__first, __proxy.__last, __proxy.__delim, __proxy.__escape);
}
template <class _CharT, class _Traits, class _Allocator>
struct __quoted_proxy
{
basic_string<_CharT, _Traits, _Allocator> &__string;
_CharT __delim;
_CharT __escape;
__quoted_proxy(basic_string<_CharT, _Traits, _Allocator> &__s, _CharT __d, _CharT __e)
: __string(__s), __delim(__d), __escape(__e) {}
};
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>& operator<<(
basic_ostream<_CharT, _Traits>& __os,
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
{
return __quoted_output (__os, __proxy.__string.cbegin (), __proxy.__string.cend (), __proxy.__delim, __proxy.__escape);
}
// extractor for non-const basic_string& proxies
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
basic_istream<_CharT, _Traits>& operator>>(
basic_istream<_CharT, _Traits>& __is,
const __quoted_proxy<_CharT, _Traits, _Allocator> & __proxy)
{
return __quoted_input ( __is, __proxy.__string, __proxy.__delim, __proxy.__escape );
}
template <class _CharT>
_LIBCPP_INLINE_VISIBILITY
__quoted_output_proxy<_CharT, const _CharT *>
quoted ( const _CharT *__s, _CharT __delim = _CharT('"'), _CharT __escape =_CharT('\\'))
{
const _CharT *__end = __s;
while ( *__end ) ++__end;
return __quoted_output_proxy<_CharT, const _CharT *> ( __s, __end, __delim, __escape );
}
template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY
__quoted_output_proxy<_CharT, typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
quoted ( const basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
{
return __quoted_output_proxy<_CharT,
typename basic_string <_CharT, _Traits, _Allocator>::const_iterator>
( __s.cbegin(), __s.cend (), __delim, __escape );
}
template <class _CharT, class _Traits, class _Allocator>
__quoted_proxy<_CharT, _Traits, _Allocator>
quoted ( basic_string <_CharT, _Traits, _Allocator> &__s, _CharT __delim = _CharT('"'), _CharT __escape=_CharT('\\'))
{
return __quoted_proxy<_CharT, _Traits, _Allocator>( __s, __delim, __escape );
}
#endif
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_IOMANIP

View File

@@ -203,9 +203,9 @@ enum class io_errc
};
concept_map ErrorCodeEnum<io_errc> { };
error_code make_error_code(io_errc e) noexcept;
error_condition make_error_condition(io_errc e) noexcept;
storage-class-specifier const error_category& iostream_category() noexcept;
error_code make_error_code(io_errc e);
error_condition make_error_condition(io_errc e);
storage-class-specifier const error_category& iostream_category;
} // std
@@ -216,10 +216,6 @@ storage-class-specifier const error_category& iostream_category() noexcept;
#include <__locale>
#include <system_error>
#if __has_feature(cxx_atomic)
#include <atomic> // for __xindex_
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -323,7 +319,7 @@ public:
_LIBCPP_INLINE_VISIBILITY bool bad() const;
_LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
_LIBCPP_INLINE_VISIBILITY void exceptions(iostate __except);
void __set_badbit_and_consider_rethrow();
void __set_failbit_and_consider_rethrow();
@@ -367,11 +363,7 @@ private:
int* __index_;
size_t __event_size_;
size_t __event_cap_;
#if __has_feature(cxx_atomic)
static atomic<int> __xindex_;
#else
static int __xindex_;
#endif
long* __iarray_;
size_t __iarray_size_;
size_t __iarray_cap_;
@@ -388,26 +380,26 @@ _LIBCPP_DECLARE_STRONG_ENUM(io_errc)
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc> : public true_type { };
struct _LIBCPP_TYPE_VIS is_error_code_enum<io_errc> : public true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum<io_errc::__lx> : public true_type { };
struct _LIBCPP_TYPE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };
#endif
_LIBCPP_FUNC_VIS
const error_category& iostream_category() _NOEXCEPT;
const error_category& iostream_category();
inline _LIBCPP_INLINE_VISIBILITY
error_code
make_error_code(io_errc __e) _NOEXCEPT
make_error_code(io_errc __e)
{
return error_code(static_cast<int>(__e), iostream_category());
}
inline _LIBCPP_INLINE_VISIBILITY
error_condition
make_error_condition(io_errc __e) _NOEXCEPT
make_error_condition(io_errc __e)
{
return error_condition(static_cast<int>(__e), iostream_category());
}
@@ -535,21 +527,21 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::eof() const
{
return (__rdstate_ & eofbit) != 0;
return __rdstate_ & eofbit;
}
inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::fail() const
{
return (__rdstate_ & (failbit | badbit)) != 0;
return __rdstate_ & (failbit | badbit);
}
inline _LIBCPP_INLINE_VISIBILITY
bool
ios_base::bad() const
{
return (__rdstate_ & badbit) != 0;
return __rdstate_ & badbit;
}
inline _LIBCPP_INLINE_VISIBILITY
@@ -561,14 +553,14 @@ ios_base::exceptions() const
inline _LIBCPP_INLINE_VISIBILITY
void
ios_base::exceptions(iostate __iostate)
ios_base::exceptions(iostate __except)
{
__exceptions_ = __iostate;
__exceptions_ = __except;
clear(__rdstate_);
}
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ios
class _LIBCPP_TYPE_VIS basic_ios
: public ios_base
{
public:
@@ -593,7 +585,7 @@ public:
_LIBCPP_ALWAYS_INLINE bool bad() const {return ios_base::bad();}
_LIBCPP_ALWAYS_INLINE iostate exceptions() const {return ios_base::exceptions();}
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
_LIBCPP_ALWAYS_INLINE void exceptions(iostate __except) {ios_base::exceptions(__except);}
// 27.5.4.1 Constructor/destructor:
_LIBCPP_INLINE_VISIBILITY
@@ -991,33 +983,6 @@ defaultfloat(ios_base& __str)
return __str;
}
template <class _CharT, class _Traits>
class __save_flags
{
typedef basic_ios<_CharT, _Traits> __stream_type;
typedef typename __stream_type::fmtflags fmtflags;
__stream_type& __stream_;
fmtflags __fmtflags_;
_CharT __fill_;
__save_flags(const __save_flags&);
__save_flags& operator=(const __save_flags&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit __save_flags(__stream_type& __stream)
: __stream_(__stream),
__fmtflags_(__stream.flags()),
__fill_(__stream.fill())
{}
_LIBCPP_INLINE_VISIBILITY
~__save_flags()
{
__stream_.flags(__fmtflags_);
__stream_.fill(__fill_);
}
};
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_IOS

View File

@@ -97,47 +97,47 @@ _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS ios_base;
template<class _CharT> struct _LIBCPP_TYPE_VIS_ONLY char_traits;
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY allocator;
template<class _CharT> struct _LIBCPP_TYPE_VIS char_traits;
template<class _Tp> class _LIBCPP_TYPE_VIS allocator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_ios;
class _LIBCPP_TYPE_VIS basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf;
class _LIBCPP_TYPE_VIS basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_istream;
class _LIBCPP_TYPE_VIS basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_ostream;
class _LIBCPP_TYPE_VIS basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_iostream;
class _LIBCPP_TYPE_VIS basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf;
class _LIBCPP_TYPE_VIS basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream;
class _LIBCPP_TYPE_VIS basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream;
class _LIBCPP_TYPE_VIS basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream;
class _LIBCPP_TYPE_VIS basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_filebuf;
class _LIBCPP_TYPE_VIS basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_ifstream;
class _LIBCPP_TYPE_VIS basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_ofstream;
class _LIBCPP_TYPE_VIS basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_fstream;
class _LIBCPP_TYPE_VIS basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator;
class _LIBCPP_TYPE_VIS istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator;
class _LIBCPP_TYPE_VIS ostreambuf_iterator;
typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios;
@@ -172,7 +172,7 @@ typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream;
template <class _State> class _LIBCPP_TYPE_VIS_ONLY fpos;
template <class _State> class _LIBCPP_TYPE_VIS fpos;
typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos;
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
@@ -185,7 +185,7 @@ typedef long long streamoff; // for char_traits in <string>
template <class _CharT, // for <stdexcept>
class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_string;
class _LIBCPP_TYPE_VIS basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;

View File

@@ -164,7 +164,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_istream
class _LIBCPP_TYPE_VIS basic_istream
: virtual public basic_ios<_CharT, _Traits>
{
streamsize __gc_;
@@ -194,7 +194,7 @@ protected:
public:
// 27.7.1.1.3 Prefix/suffix:
class _LIBCPP_TYPE_VIS_ONLY sentry;
class _LIBCPP_TYPE_VIS sentry;
// 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -244,7 +244,7 @@ public:
};
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_istream<_CharT, _Traits>::sentry
class _LIBCPP_TYPE_VIS basic_istream<_CharT, _Traits>::sentry
{
bool __ok_;
@@ -1144,7 +1144,8 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
break;
}
++__gc_;
if (traits_type::eq_int_type(__i, __dlm))
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break;
}
}
@@ -1159,7 +1160,8 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
break;
}
++__gc_;
if (traits_type::eq_int_type(__i, __dlm))
char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm)))
break;
}
}
@@ -1369,10 +1371,8 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true);
if (__sen)
{
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
this->setstate(ios_base::failbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1393,10 +1393,7 @@ basic_istream<_CharT, _Traits>::seekg(off_type __off, ios_base::seekdir __dir)
#endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true);
if (__sen)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::in) == pos_type(-1))
this->setstate(ios_base::failbit);
}
this->rdbuf()->pubseekoff(__off, __dir, ios_base::in);
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
@@ -1456,7 +1453,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_iostream
class _LIBCPP_TYPE_VIS basic_iostream
: public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits>
{
@@ -1707,9 +1704,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is;
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_istream<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_iostream<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>)
_LIBCPP_END_NAMESPACE_STD

View File

@@ -309,19 +309,6 @@ template <class C> auto end(const C& c) -> decltype(c.end());
template <class T, size_t N> T* begin(T (&array)[N]);
template <class T, size_t N> T* end(T (&array)[N]);
template <class C> auto cbegin(const C& c) -> decltype(std::begin(c)); // C++14
template <class C> auto cend(const C& c) -> decltype(std::end(c)); // C++14
template <class C> auto rbegin(C& c) -> decltype(c.rbegin()); // C++14
template <class C> auto rbegin(const C& c) -> decltype(c.rbegin()); // C++14
template <class C> auto rend(C& c) -> decltype(c.rend()); // C++14
template <class C> auto rend(const C& c) -> decltype(c.rend()); // C++14
template <class E> reverse_iterator<const E*> rbegin(initializer_list<E> il); // C++14
template <class E> reverse_iterator<const E*> rend(initializer_list<E> il); // C++14
template <class T, size_t N> reverse_iterator<T*> rbegin(T (&array)[N]); // C++14
template <class T, size_t N> reverse_iterator<T*> rend(T (&array)[N]); // C++14
template <class C> auto crbegin(const C& c) -> decltype(std::rbegin(c)); // C++14
template <class C> auto crend(const C& c) -> decltype(std::rend(c)); // C++14
} // std
*/
@@ -330,15 +317,12 @@ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); //
#include <type_traits>
#include <cstddef>
#include <iosfwd>
#include <initializer_list>
#ifdef __APPLE__
#include <Availability.h>
#endif
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#include <cassert>
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
@@ -347,11 +331,11 @@ template <class C> auto crend(const C& c) -> decltype(std::rend(c)); //
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS_ONLY input_iterator_tag {};
struct _LIBCPP_TYPE_VIS_ONLY output_iterator_tag {};
struct _LIBCPP_TYPE_VIS_ONLY forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TYPE_VIS_ONLY bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TYPE_VIS_ONLY random_access_iterator_tag : public bidirectional_iterator_tag {};
struct _LIBCPP_TYPE_VIS input_iterator_tag {};
struct _LIBCPP_TYPE_VIS output_iterator_tag {};
struct _LIBCPP_TYPE_VIS forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TYPE_VIS bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TYPE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp>
struct __has_iterator_category
@@ -394,11 +378,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time.
template <class _Iter>
struct _LIBCPP_TYPE_VIS_ONLY iterator_traits
struct _LIBCPP_TYPE_VIS iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY iterator_traits<_Tp*>
struct _LIBCPP_TYPE_VIS iterator_traits<_Tp*>
{
typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type;
@@ -429,7 +413,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&>
struct _LIBCPP_TYPE_VIS_ONLY iterator
struct _LIBCPP_TYPE_VIS iterator
{
typedef _Tp value_type;
typedef _Distance difference_type;
@@ -526,7 +510,7 @@ prev(_BidiretionalIter __x,
}
template <class _Iter>
class _LIBCPP_TYPE_VIS_ONLY reverse_iterator
class _LIBCPP_TYPE_VIS reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type,
@@ -633,7 +617,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
}
template <class _Container>
class _LIBCPP_TYPE_VIS_ONLY back_insert_iterator
class _LIBCPP_TYPE_VIS back_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -666,7 +650,7 @@ back_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_TYPE_VIS_ONLY front_insert_iterator
class _LIBCPP_TYPE_VIS front_insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -699,7 +683,7 @@ front_inserter(_Container& __x)
}
template <class _Container>
class _LIBCPP_TYPE_VIS_ONLY insert_iterator
class _LIBCPP_TYPE_VIS insert_iterator
: public iterator<output_iterator_tag,
void,
void,
@@ -735,7 +719,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_TYPE_VIS_ONLY istream_iterator
class _LIBCPP_TYPE_VIS istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{
public:
@@ -774,7 +758,7 @@ public:
};
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY ostream_iterator
class _LIBCPP_TYPE_VIS ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -803,7 +787,7 @@ public:
};
template<class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY istreambuf_iterator
class _LIBCPP_TYPE_VIS istreambuf_iterator
: public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*,
_CharT>
@@ -874,7 +858,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);}
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY ostreambuf_iterator
class _LIBCPP_TYPE_VIS ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void>
{
public:
@@ -915,7 +899,7 @@ public:
};
template <class _Iter>
class _LIBCPP_TYPE_VIS_ONLY move_iterator
class _LIBCPP_TYPE_VIS move_iterator
{
private:
_Iter __i;
@@ -1030,7 +1014,7 @@ operator+(typename move_iterator<_Iter>::difference_type __n, const move_iterato
template <class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
move_iterator<_Iter>
make_move_iterator(_Iter __i)
make_move_iterator(const _Iter& __i)
{
return move_iterator<_Iter>(__i);
}
@@ -1107,9 +1091,6 @@ private:
iterator_type __i;
public:
_LIBCPP_INLINE_VISIBILITY __wrap_iter() _NOEXCEPT
#if _LIBCPP_STD_VER > 11
: __i{}
#endif
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
@@ -1154,14 +1135,7 @@ public:
#endif
return *__i;
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable iterator");
#endif
return (pointer)&reinterpret_cast<const volatile char&>(*__i);
}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __wrap_iter& operator++() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1211,13 +1185,12 @@ public:
_LIBCPP_INLINE_VISIBILITY iterator_type base() const _NOEXCEPT {return __i;}
private:
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __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);
}
#else
_LIBCPP_INLINE_VISIBILITY __wrap_iter(iterator_type __x) _NOEXCEPT : __i(__x) {}
#endif
template <class _Up> friend class __wrap_iter;
@@ -1284,6 +1257,10 @@ inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() == __y.base();
}
@@ -1293,7 +1270,7 @@ bool
operator<(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare incomparable iterators");
#endif
return __x.base() < __y.base();
@@ -1369,7 +1346,7 @@ typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__less_than_comparable(&__x, &__y),
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to subtract incompatible iterators");
#endif
return __x.base() - __y.base();
@@ -1385,22 +1362,422 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
return __x;
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
begin(_Tp (&__array)[_Np])
#ifdef _LIBCPP_DEBUG
// __debug_iter
template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter>
_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
template <class _Container, class _Iter>
class __debug_iter
{
return __array;
public:
typedef _Iter iterator_type;
typedef _Container __container_type;
typedef typename iterator_traits<iterator_type>::iterator_category iterator_category;
typedef typename iterator_traits<iterator_type>::value_type value_type;
typedef typename iterator_traits<iterator_type>::difference_type difference_type;
typedef typename iterator_traits<iterator_type>::pointer pointer;
typedef typename iterator_traits<iterator_type>::reference reference;
private:
iterator_type __i;
__debug_iter* __next;
__container_type* __cont;
public:
_LIBCPP_INLINE_VISIBILITY __debug_iter() : __next(0), __cont(0) {}
_LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter& __x)
: __i(__x.base()), __next(0), __cont(0) {__set_owner(__x.__cont);}
__debug_iter& operator=(const __debug_iter& __x);
template <class _Up> _LIBCPP_INLINE_VISIBILITY __debug_iter(const __debug_iter<_Container, _Up>& __u,
typename enable_if<is_convertible<_Up, iterator_type>::value>::type* = 0)
: __i(__u.base()), __next(0), __cont(0) {__set_owner(__u.__cont);}
_LIBCPP_INLINE_VISIBILITY ~__debug_iter() {__remove_owner();}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {assert(__is_deref()); return *__i;}
_LIBCPP_INLINE_VISIBILITY pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY __debug_iter& operator++() {assert(__can_increment()); ++__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __debug_iter operator++(int)
{__debug_iter __tmp(*this); operator++(); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __debug_iter& operator--() {assert(__can_decrement()); --__i; return *this;}
_LIBCPP_INLINE_VISIBILITY __debug_iter operator--(int)
{__debug_iter __tmp(*this); operator--(); return __tmp;}
_LIBCPP_INLINE_VISIBILITY __debug_iter operator+ (difference_type __n) const
{__debug_iter __t(*this); __t += __n; return __t;}
__debug_iter& operator+=(difference_type __n);
_LIBCPP_INLINE_VISIBILITY __debug_iter operator- (difference_type __n) const
{__debug_iter __t(*this); __t -= __n; return __t;}
_LIBCPP_INLINE_VISIBILITY __debug_iter& operator-=(difference_type __n)
{*this += -__n; return *this;}
_LIBCPP_INLINE_VISIBILITY reference operator[](difference_type __n) const
{return *(*this + __n);}
private:
_LIBCPP_INLINE_VISIBILITY __debug_iter(const __container_type* __c, iterator_type __x)
: __i(__x), __next(0), __cont(0) {__set_owner(__c);}
_LIBCPP_INLINE_VISIBILITY iterator_type base() const {return __i;}
void __set_owner(const __container_type* __c);
void __remove_owner();
static void __remove_all(__container_type* __c);
static void swap(__container_type* __x, __container_type* __y);
_LIBCPP_INLINE_VISIBILITY bool __is_deref() const
{return __is_deref(__is_random_access_iterator<iterator_type>());}
bool __is_deref(false_type) const;
bool __is_deref(true_type) const;
_LIBCPP_INLINE_VISIBILITY bool __can_decrement() const
{return __can_decrement(integral_constant<int, is_pointer<iterator_type>::value ? 2:
__is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
bool __can_decrement(integral_constant<int, 0>) const;
bool __can_decrement(integral_constant<int, 1>) const;
bool __can_decrement(integral_constant<int, 2>) const;
_LIBCPP_INLINE_VISIBILITY bool __can_increment() const
{return __can_increment(integral_constant<int, is_pointer<iterator_type>::value ? 2:
__is_random_access_iterator<iterator_type>::value ? 1 : 0>());}
bool __can_increment(integral_constant<int, 0>) const;
bool __can_increment(integral_constant<int, 1>) const;
bool __can_increment(integral_constant<int, 2>) const;
_LIBCPP_INLINE_VISIBILITY bool __can_add(difference_type __n) const
{return __can_add(__n, is_pointer<iterator_type>());}
bool __can_add(difference_type __n, false_type) const;
bool __can_add(difference_type __n, true_type) const;
template <class _Cp, class _Up> friend class __debug_iter;
friend class _Container::__self;
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator==(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator!=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator>=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
bool
operator<=(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1, class _Iter2>
friend
typename __debug_iter<_Cp, _Iter1>::difference_type
operator-(const __debug_iter<_Cp, _Iter1>&, const __debug_iter<_Cp, _Iter2>&);
template <class _Cp, class _Iter1>
friend
__debug_iter<_Cp, _Iter1>
operator+(typename __debug_iter<_Cp, _Iter1>::difference_type, const __debug_iter<_Cp, _Iter1>&);
};
template <class _Container, class _Iter>
__debug_iter<_Container, _Iter>&
__debug_iter<_Container, _Iter>::operator=(const __debug_iter& __x)
{
if (this != &__x)
{
__remove_owner();
__i = __x.__i;
__set_owner(__x.__cont);
}
return *this;
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
end(_Tp (&__array)[_Np])
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::__set_owner(const __container_type* __c)
{
return __array + _Np;
__cont = const_cast<__container_type*>(__c);
__debug_iter*& __head = __cont->__get_iterator_list(this);
__next = __head;
__head = this;
}
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::__remove_owner()
{
if (__cont)
{
__debug_iter*& __head = __cont->__get_iterator_list(this);
if (__head == this)
__head = __next;
else
{
__debug_iter* __prev = __head;
for (__debug_iter* __p = __head->__next; __p != this; __p = __p->__next)
__prev = __p;
__prev->__next = __next;
}
__cont = 0;
}
}
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::__remove_all(__container_type* __c)
{
__debug_iter*& __head = __c->__get_iterator_list((__debug_iter*)0);
__debug_iter* __p = __head;
__head = 0;
while (__p)
{
__p->__cont = 0;
__debug_iter* __n = __p->__next;
__p->__next = 0;
__p = __n;
}
}
template <class _Container, class _Iter>
void
__debug_iter<_Container, _Iter>::swap(__container_type* __x, __container_type* __y)
{
__debug_iter*& __head_x = __x->__get_iterator_list((__debug_iter*)0);
__debug_iter*& __head_y = __y->__get_iterator_list((__debug_iter*)0);
__debug_iter* __p = __head_x;
__head_x = __head_y;
__head_y = __p;
for (__p = __head_x; __p; __p = __p->__next)
__p->__cont = __x;
for (__p = __head_y; __p; __p = __p->__next)
__p->__cont = __y;
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__is_deref(false_type) const
{
if (__cont == 0)
return false;
return __i != __cont->end().base();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__is_deref(true_type) const
{
if (__cont == 0)
return false;
return __i < __cont->end().base();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 0>) const
{
if (__cont == 0)
return false;
return __i != __cont->begin().base();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 1>) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
return __b < __i && __i <= __b + __cont->size();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_decrement(integral_constant<int, 2>) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
return __b < __i && __i <= __b + __cont->size();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 0>) const
{
if (__cont == 0)
return false;
return __i != __cont->end().base();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 1>) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
return __b <= __i && __i < __b + __cont->size();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_increment(integral_constant<int, 2>) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
return __b <= __i && __i < __b + __cont->size();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_add(difference_type __n, false_type) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
iterator_type __j = __i + __n;
return __b <= __j && __j <= __b + __cont->size();
}
template <class _Container, class _Iter>
bool
__debug_iter<_Container, _Iter>::__can_add(difference_type __n, true_type) const
{
if (__cont == 0)
return false;
iterator_type __b = __cont->begin().base();
iterator_type __j = __i + __n;
return __b <= __j && __j <= __b + __cont->size();
}
template <class _Container, class _Iter>
__debug_iter<_Container, _Iter>&
__debug_iter<_Container, _Iter>::operator+=(difference_type __n)
{
assert(__can_add(__n));
__i += __n;
return *this;
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
assert(__x.__cont && __x.__cont == __y.__cont);
return __x.base() == __y.base();
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
return !(__x == __y);
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
assert(__x.__cont && __x.__cont == __y.__cont);
return __x.base() < __y.base();
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
return __y < __x;
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
return !(__x < __y);
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
return !(__y < __x);
}
template <class _Container, class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>& __x, const __debug_iter<_Container, _Iter2>& __y)
{
assert(__x.__cont && __x.__cont == __y.__cont);
return __x.base() - __y.base();
}
template <class _Container, class _Iter>
inline _LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
const __debug_iter<_Container, _Iter>& __x)
{
return __x + __n;
}
#endif // _LIBCPP_DEBUG
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp>
@@ -1435,95 +1812,6 @@ end(const _Cp& __c) -> decltype(__c.end())
return __c.end();
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
reverse_iterator<_Tp*> rbegin(_Tp (&__array)[_Np])
{
return reverse_iterator<_Tp*>(__array + _Np);
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
reverse_iterator<_Tp*> rend(_Tp (&__array)[_Np])
{
return reverse_iterator<_Tp*>(__array);
}
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
reverse_iterator<const _Ep*> rbegin(initializer_list<_Ep> __il)
{
return reverse_iterator<const _Ep*>(__il.end());
}
template <class _Ep>
inline _LIBCPP_INLINE_VISIBILITY
reverse_iterator<const _Ep*> rend(initializer_list<_Ep> __il)
{
return reverse_iterator<const _Ep*>(__il.begin());
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto cbegin(const _Cp& __c) -> decltype(begin(__c))
{
return _VSTD::begin(__c);
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto cend(const _Cp& __c) -> decltype(end(__c))
{
return _VSTD::end(__c);
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto rbegin(_Cp& __c) -> decltype(__c.rbegin())
{
return __c.rbegin();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto rbegin(const _Cp& __c) -> decltype(__c.rbegin())
{
return __c.rbegin();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto rend(_Cp& __c) -> decltype(__c.rend())
{
return __c.rend();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto rend(const _Cp& __c) -> decltype(__c.rend())
{
return __c.rend();
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto crbegin(const _Cp& __c) -> decltype(rbegin(__c))
{
return rbegin(__c);
}
template <class _Cp>
inline _LIBCPP_INLINE_VISIBILITY
auto crend(const _Cp& __c) -> decltype(rend(__c))
{
return rend(__c);
}
#endif
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp>
@@ -1560,6 +1848,22 @@ end(const _Cp& __c)
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
begin(_Tp (&__array)[_Np])
{
return __array;
}
template <class _Tp, size_t _Np>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
end(_Tp (&__array)[_Np])
{
return __array + _Np;
}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_ITERATOR

View File

@@ -111,13 +111,9 @@ template<> class numeric_limits<cv long double>;
#include <__undef_min_max>
#if defined(_LIBCPP_MSVCRT)
#if defined(_MSC_VER)
#include "support/win32/limits_win32.h"
#endif // _LIBCPP_MSVCRT
#if defined(__IBMCPP__)
#include "support/ibm/limits.h"
#endif // __IBMCPP__
#endif // _MSC_VER
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -437,7 +433,7 @@ protected:
};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY numeric_limits
class _LIBCPP_TYPE_VIS numeric_limits
: private __libcpp_numeric_limits<typename remove_cv<_Tp>::type>
{
typedef __libcpp_numeric_limits<typename remove_cv<_Tp>::type> __base;
@@ -530,7 +526,7 @@ template <class _Tp>
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<_Tp>::round_style;
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const _Tp>
class _LIBCPP_TYPE_VIS numeric_limits<const _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -623,7 +619,7 @@ template <class _Tp>
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<const _Tp>::round_style;
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<volatile _Tp>
class _LIBCPP_TYPE_VIS numeric_limits<volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;
@@ -716,7 +712,7 @@ template <class _Tp>
_LIBCPP_CONSTEXPR const float_round_style numeric_limits<volatile _Tp>::round_style;
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY numeric_limits<const volatile _Tp>
class _LIBCPP_TYPE_VIS numeric_limits<const volatile _Tp>
: private numeric_limits<_Tp>
{
typedef numeric_limits<_Tp> __base;

View File

@@ -40,7 +40,6 @@ public:
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit list(const allocator_type& a);
explicit list(size_type n);
explicit list(size_type n, const allocator_type& a); // C++14
list(size_type n, const value_type& value);
list(size_type n, const value_type& value, const allocator_type& a);
template <class Iter>
@@ -179,12 +178,6 @@ template <class T, class Alloc>
#include <__undef_min_max>
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -203,20 +196,13 @@ struct __list_node_base
rebind<__list_node<_Tp, _VoidPtr> >::other pointer;
#endif
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node_base> __base_pointer;
#else
rebind<__list_node_base>::other __base_pointer;
#endif
pointer __prev_;
pointer __next_;
_LIBCPP_INLINE_VISIBILITY
__list_node_base()
: __prev_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this))),
__next_(static_cast<pointer>(pointer_traits<__base_pointer>::pointer_to(*this)))
: __prev_(static_cast<pointer>(this)),
__next_(static_cast<pointer>(this))
{}
};
@@ -227,12 +213,12 @@ struct __list_node
_Tp __value_;
};
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS_ONLY list;
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS list;
template <class _Tp, class _Alloc> class __list_imp;
template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator;
template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS __list_const_iterator;
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_iterator
class _LIBCPP_TYPE_VIS __list_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -274,7 +260,7 @@ public:
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_iterator() _NOEXCEPT : __ptr_(nullptr)
__list_iterator() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
@@ -319,14 +305,7 @@ public:
return __ptr_->__value_;
}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::iterator");
#endif
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
}
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_iterator& operator++()
@@ -357,6 +336,10 @@ public:
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_iterator& __x, const __list_iterator& __y)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare non-comparable list::iterator");
#endif
return __x.__ptr_ == __y.__ptr_;
}
friend _LIBCPP_INLINE_VISIBILITY
@@ -365,13 +348,13 @@ public:
};
template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS_ONLY __list_const_iterator
class _LIBCPP_TYPE_VIS __list_const_iterator
{
typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind<__list_node<_Tp, _VoidPtr> > __node_pointer;
rebind<const __list_node<_Tp, _VoidPtr> > __node_pointer;
#else
rebind<__list_node<_Tp, _VoidPtr> >::other __node_pointer;
rebind<const __list_node<_Tp, _VoidPtr> >::other __node_pointer;
#endif
__node_pointer __ptr_;
@@ -404,7 +387,7 @@ public:
typedef typename pointer_traits<pointer>::difference_type difference_type;
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator() _NOEXCEPT : __ptr_(nullptr)
__list_const_iterator() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_i(this);
@@ -456,14 +439,7 @@ public:
return __ptr_->__value_;
}
_LIBCPP_INLINE_VISIBILITY
pointer operator->() const
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__dereferenceable(this),
"Attempted to dereference a non-dereferenceable list::iterator");
#endif
return pointer_traits<pointer>::pointer_to(__ptr_->__value_);
}
pointer operator->() const {return &(operator*());}
_LIBCPP_INLINE_VISIBILITY
__list_const_iterator& operator++()
@@ -494,6 +470,10 @@ public:
friend _LIBCPP_INLINE_VISIBILITY
bool operator==(const __list_const_iterator& __x, const __list_const_iterator& __y)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__comparable(&__x, &__y),
"Attempted to compare non-comparable list::const_iterator");
#endif
return __x.__ptr_ == __y.__ptr_;
}
friend _LIBCPP_INLINE_VISIBILITY
@@ -525,20 +505,11 @@ protected:
__node_allocator;
typedef allocator_traits<__node_allocator> __node_alloc_traits;
typedef typename __node_alloc_traits::pointer __node_pointer;
typedef typename __node_alloc_traits::pointer __node_const_pointer;
typedef typename __node_alloc_traits::const_pointer __node_const_pointer;
typedef typename __alloc_traits::pointer pointer;
typedef typename __alloc_traits::const_pointer const_pointer;
typedef typename __alloc_traits::difference_type difference_type;
typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node_base>
#else
rebind_alloc<__node_base>::other
#endif
__node_base_allocator;
typedef typename allocator_traits<__node_base_allocator>::pointer __node_base_pointer;
__node_base __end_;
__compressed_pair<size_type, __node_allocator> __size_alloc_;
@@ -554,7 +525,7 @@ protected:
const __node_allocator& __node_alloc() const _NOEXCEPT
{return __size_alloc_.second();}
static void __unlink_nodes(__node_pointer __f, __node_pointer __l) _NOEXCEPT;
static void __unlink_nodes(__node_base& __f, __node_base& __l) _NOEXCEPT;
__list_imp()
_NOEXCEPT_(is_nothrow_default_constructible<__node_allocator>::value);
@@ -586,22 +557,18 @@ protected:
iterator end() _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)), this);
return iterator(static_cast<__node_pointer>(&__end_), this);
#else
return iterator(static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)));
return iterator(static_cast<__node_pointer>(&__end_));
#endif
}
_LIBCPP_INLINE_VISIBILITY
const_iterator end() const _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
return const_iterator(static_cast<__node_const_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))), this);
return const_iterator(static_cast<__node_const_pointer>(&__end_), this);
#else
return const_iterator(static_cast<__node_const_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(__end_))));
return const_iterator(static_cast<__node_const_pointer>(&__end_));
#endif
}
@@ -670,11 +637,11 @@ private:
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_pointer __f, __node_pointer __l)
__list_imp<_Tp, _Alloc>::__unlink_nodes(__node_base& __f, __node_base& __l)
_NOEXCEPT
{
__f->__prev_->__next_ = __l->__next_;
__l->__next_->__prev_ = __f->__prev_;
__f.__prev_->__next_ = __l.__next_;
__l.__next_->__prev_ = __f.__prev_;
}
template <class _Tp, class _Alloc>
@@ -709,16 +676,15 @@ __list_imp<_Tp, _Alloc>::clear() _NOEXCEPT
{
__node_allocator& __na = __node_alloc();
__node_pointer __f = __end_.__next_;
__node_pointer __l = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__unlink_nodes(__f, __l->__prev_);
__node_pointer __l = static_cast<__node_pointer>(&__end_);
__unlink_nodes(*__f, *__l->__prev_);
__sz() = 0;
while (__f != __l)
{
__node_pointer __n = __f;
__node& __n = *__f;
__f = __f->__next_;
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
}
#if _LIBCPP_DEBUG_LEVEL >= 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
@@ -753,20 +719,16 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
swap(__sz(), __c.__sz());
swap(__end_, __c.__end_);
if (__sz() == 0)
__end_.__next_ = __end_.__prev_ = static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
__end_.__next_ = __end_.__prev_ = &static_cast<__node&>(__end_);
else
__end_.__prev_->__next_ = __end_.__next_->__prev_
= static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_));
= &static_cast<__node&>(__end_);
if (__c.__sz() == 0)
__c.__end_.__next_ = __c.__end_.__prev_
= static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_));
= &static_cast<__node&>(__c.__end_);
else
__c.__end_.__prev_->__next_ = __c.__end_.__next_->__prev_
= static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_));
= &static_cast<__node&>(__c.__end_);
#if _LIBCPP_DEBUG_LEVEL >= 2
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@@ -778,8 +740,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
{
--__p;
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
if (__i->__ptr_ == static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ == static_cast<__node_pointer>(&__c.__end_))
{
__cn2->__add(*__p);
if (--__cn1->end_ != __p)
@@ -792,8 +753,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
{
--__p;
const_iterator* __i = static_cast<const_iterator*>((*__p)->__i_);
if (__i->__ptr_ == static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__end_)))
if (__i->__ptr_ == static_cast<__node_pointer>(&__end_))
{
__cn1->__add(*__p);
if (--__cn2->end_ != __p)
@@ -807,7 +767,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
}
template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY list
class _LIBCPP_TYPE_VIS list
: private __list_imp<_Tp, _Alloc>
{
typedef __list_imp<_Tp, _Alloc> base;
@@ -815,8 +775,6 @@ class _LIBCPP_TYPE_VIS_ONLY list
typedef typename base::__node_allocator __node_allocator;
typedef typename base::__node_pointer __node_pointer;
typedef typename base::__node_alloc_traits __node_alloc_traits;
typedef typename base::__node_base __node_base;
typedef typename base::__node_base_pointer __node_base_pointer;
public:
typedef _Tp value_type;
@@ -843,16 +801,13 @@ public:
#endif
}
_LIBCPP_INLINE_VISIBILITY
explicit list(const allocator_type& __a) : base(__a)
list(const allocator_type& __a) : base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
explicit list(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit list(size_type __n, const allocator_type& __a);
#endif
list(size_type __n);
list(size_type __n, const value_type& __x);
list(size_type __n, const value_type& __x, const allocator_type& __a);
template <class _InpIter>
@@ -1059,7 +1014,7 @@ public:
#endif // _LIBCPP_DEBUG_LEVEL >= 2
private:
static void __link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l);
static void __link_nodes(__node& __p, __node& __f, __node& __l);
iterator __iterator(size_type __n);
template <class _Comp>
static iterator __sort(iterator __f1, iterator __e2, size_type __n, _Comp& __comp);
@@ -1073,12 +1028,12 @@ private:
template <class _Tp, class _Alloc>
inline _LIBCPP_INLINE_VISIBILITY
void
list<_Tp, _Alloc>::__link_nodes(__node_pointer __p, __node_pointer __f, __node_pointer __l)
list<_Tp, _Alloc>::__link_nodes(__node& __p, __node& __f, __node& __l)
{
__p->__prev_->__next_ = __f;
__f->__prev_ = __p->__prev_;
__p->__prev_ = __l;
__l->__next_ = __p;
__p.__prev_->__next_ = &__f;
__f.__prev_ = __p.__prev_;
__p.__prev_ = &__l;
__l.__next_ = &__p;
}
template <class _Tp, class _Alloc>
@@ -1104,22 +1059,6 @@ list<_Tp, _Alloc>::list(size_type __n)
#endif
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(size_type __n, const allocator_type& __a) : base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
for (; __n > 0; --__n)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
emplace_back();
#else
push_back(value_type());
#endif
}
#endif
template <class _Tp, class _Alloc>
list<_Tp, _Alloc>::list(size_type __n, const value_type& __x)
{
@@ -1351,7 +1290,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
@@ -1368,9 +1307,9 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"list::insert(iterator, n, x) called with an iterator not"
" referring to this list");
iterator __r(__p.__ptr_, this);
iterator __r(const_cast<__node_pointer>(__p.__ptr_), this);
#else
iterator __r(__p.__ptr_);
iterator __r(const_cast<__node_pointer>(__p.__ptr_));
#endif
if (__n > 0)
{
@@ -1420,7 +1359,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
return __r;
@@ -1436,9 +1375,9 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"list::insert(iterator, range) called with an iterator not"
" referring to this list");
iterator __r(__p.__ptr_, this);
iterator __r(const_cast<__node_pointer>(__p.__ptr_), this);
#else
iterator __r(__p.__ptr_);
iterator __r(const_cast<__node_pointer>(__p.__ptr_));
#endif
if (__f != __l)
{
@@ -1488,7 +1427,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
__link_nodes(__p.__ptr_, __r.__ptr_, __e.__ptr_);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
return __r;
@@ -1502,7 +1441,7 @@ list<_Tp, _Alloc>::push_front(const value_type& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1515,8 +1454,7 @@ list<_Tp, _Alloc>::push_back(const value_type& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __hold.get(), __hold.get());
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1531,7 +1469,7 @@ list<_Tp, _Alloc>::push_front(value_type&& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1544,8 +1482,7 @@ list<_Tp, _Alloc>::push_back(value_type&& __x)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __hold.get(), __hold.get());
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1561,7 +1498,7 @@ list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(base::__end_.__next_, __hold.get(), __hold.get());
__link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1575,8 +1512,7 @@ list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
typedef __allocator_destructor<__node_allocator> _Dp;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __hold.get(), __hold.get());
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz();
__hold.release();
}
@@ -1596,7 +1532,7 @@ list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
@@ -1621,7 +1557,7 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1));
__hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(__p.__ptr_, __hold.get(), __hold.get());
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
@@ -1638,7 +1574,7 @@ list<_Tp, _Alloc>::pop_front()
{
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = base::__end_.__next_;
__node& __n = *base::__end_.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1647,7 +1583,7 @@ list<_Tp, _Alloc>::pop_front()
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ == __n)
if (__i->__ptr_ == &__n)
{
(*__p)->__c_ = nullptr;
if (--__c->end_ != __p)
@@ -1656,17 +1592,17 @@ list<_Tp, _Alloc>::pop_front()
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
}
template <class _Tp, class _Alloc>
void
list<_Tp, _Alloc>::pop_back()
{
_LIBCPP_ASSERT(!empty(), "list::pop_back() called with empty list");
_LIBCPP_ASSERT(!empty(), "list::pop_front() called with empty list");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = base::__end_.__prev_;
__node& __n = *base::__end_.__prev_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1675,7 +1611,7 @@ list<_Tp, _Alloc>::pop_back()
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ == __n)
if (__i->__ptr_ == &__n)
{
(*__p)->__c_ = nullptr;
if (--__c->end_ != __p)
@@ -1684,8 +1620,8 @@ list<_Tp, _Alloc>::pop_back()
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
}
template <class _Tp, class _Alloc>
@@ -1700,8 +1636,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
_LIBCPP_ASSERT(__p != end(),
"list::erase(iterator) called with a non-dereferenceable iterator");
__node_allocator& __na = base::__node_alloc();
__node_pointer __n = __p.__ptr_;
__node_pointer __r = __n->__next_;
__node& __n = const_cast<__node&>(*__p.__ptr_);
__node_pointer __r = __n.__next_;
base::__unlink_nodes(__n, __n);
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1710,7 +1646,7 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ == __n)
if (__i->__ptr_ == &__n)
{
(*__p)->__c_ = nullptr;
if (--__c->end_ != __p)
@@ -1719,8 +1655,8 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__r, this);
#else
@@ -1740,10 +1676,10 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
if (__f != __l)
{
__node_allocator& __na = base::__node_alloc();
base::__unlink_nodes(__f.__ptr_, __l.__ptr_->__prev_);
base::__unlink_nodes(const_cast<__node&>(*__f.__ptr_), *__l.__ptr_->__prev_);
while (__f != __l)
{
__node_pointer __n = __f.__ptr_;
__node& __n = const_cast<__node&>(*__f.__ptr_);
++__f;
--base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1752,7 +1688,7 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ == __n)
if (__i->__ptr_ == &__n)
{
(*__p)->__c_ = nullptr;
if (--__c->end_ != __p)
@@ -1761,14 +1697,14 @@ list<_Tp, _Alloc>::erase(const_iterator __f, const_iterator __l)
}
__get_db()->unlock();
#endif
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n->__value_));
__node_alloc_traits::deallocate(__na, __n, 1);
__node_alloc_traits::destroy(__na, _VSTD::addressof(__n.__value_));
__node_alloc_traits::deallocate(__na, _VSTD::addressof(__n), 1);
}
}
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__l.__ptr_, this);
return iterator(const_cast<__node_pointer>(__l.__ptr_), this);
#else
return iterator(__l.__ptr_);
return iterator(const_cast<__node_pointer>(__l.__ptr_));
#endif
}
@@ -1826,8 +1762,7 @@ list<_Tp, _Alloc>::resize(size_type __n)
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
}
@@ -1886,8 +1821,7 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
throw;
}
#endif // _LIBCPP_NO_EXCEPTIONS
__link_nodes(static_cast<__node_pointer>(pointer_traits<__node_base_pointer>::
pointer_to(base::__end_)), __r.__ptr_, __e.__ptr_);
__link_nodes(static_cast<__node&>(base::__end_), *__r.__ptr_, *__e.__ptr_);
base::__sz() += __ds;
}
}
@@ -1905,10 +1839,10 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
#endif
if (!__c.empty())
{
__node_pointer __f = __c.__end_.__next_;
__node_pointer __l = __c.__end_.__prev_;
__node& __f = *__c.__end_.__next_;
__node& __l = *__c.__end_.__prev_;
base::__unlink_nodes(__f, __l);
__link_nodes(__p.__ptr_, __f, __l);
__link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __l);
base::__sz() += __c.__sz();
__c.__sz() = 0;
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1919,8 +1853,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_))
{
__cn1->__add(*__p);
(*__p)->__c_ = __cn1;
@@ -1950,9 +1883,9 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
#endif
if (__p.__ptr_ != __i.__ptr_ && __p.__ptr_ != __i.__ptr_->__next_)
{
__node_pointer __f = __i.__ptr_;
__node& __f = const_cast<__node&>(*__i.__ptr_);
base::__unlink_nodes(__f, __f);
__link_nodes(__p.__ptr_, __f, __f);
__link_nodes(const_cast<__node&>(*__p.__ptr_), __f, __f);
--__c.__sz();
++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1963,7 +1896,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __i)
{
--__p;
iterator* __j = static_cast<iterator*>((*__p)->__i_);
if (__j->__ptr_ == __f)
if (__j->__ptr_ == &__f)
{
__cn1->__add(*__p);
(*__p)->__c_ = __cn1;
@@ -2004,11 +1937,11 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
__c.__sz() -= __s;
base::__sz() += __s;
}
__node_pointer __first = __f.__ptr_;
__node& __first = const_cast<__node&>(*__f.__ptr_);
--__l;
__node_pointer __last = __l.__ptr_;
__node& __last = const_cast<__node&>(*__l.__ptr_);
base::__unlink_nodes(__first, __last);
__link_nodes(__p.__ptr_, __first, __last);
__link_nodes(const_cast<__node&>(*__p.__ptr_), __first, __last);
#if _LIBCPP_DEBUG_LEVEL >= 2
__libcpp_db* __db = __get_db();
__c_node* __cn1 = __db->__find_c_and_lock(this);
@@ -2017,7 +1950,7 @@ list<_Tp, _Alloc>::splice(const_iterator __p, list& __c, const_iterator __f, con
{
--__p;
iterator* __j = static_cast<iterator*>((*__p)->__i_);
for (__node_pointer __k = __f.__ptr_;
for (__node_pointer __k = const_cast<__node_pointer>(__f.__ptr_);
__k != __l.__ptr_; __k = __k->__next_)
{
if (__j->__ptr_ == __k)
@@ -2123,12 +2056,12 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
;
base::__sz() += __ds;
__c.__sz() -= __ds;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__node& __f = *__f2.__ptr_;
__node& __l = *__m2.__ptr_->__prev_;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _VSTD::next(__f1);
__link_nodes(__f1.__ptr_, __f, __l);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
else
@@ -2143,8 +2076,7 @@ list<_Tp, _Alloc>::merge(list& __c, _Comp __comp)
{
--__p;
iterator* __i = static_cast<iterator*>((*__p)->__i_);
if (__i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(__c.__end_)))
if (__i->__ptr_ != static_cast<__node_pointer>(&__c.__end_))
{
__cn1->__add(*__p);
(*__p)->__c_ = __cn1;
@@ -2187,9 +2119,9 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
case 2:
if (__comp(*--__e2, *__f1))
{
__node_pointer __f = __e2.__ptr_;
__node& __f = *__e2.__ptr_;
base::__unlink_nodes(__f, __f);
__link_nodes(__f1.__ptr_, __f, __f);
__link_nodes(*__f1.__ptr_, __f, __f);
return __e2;
}
return __f1;
@@ -2203,13 +2135,13 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
iterator __m2 = _VSTD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__node& __f = *__f2.__ptr_;
__node& __l = *__m2.__ptr_->__prev_;
__r = __f2;
__e1 = __f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _VSTD::next(__f1);
__link_nodes(__f1.__ptr_, __f, __l);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
else
@@ -2221,14 +2153,14 @@ list<_Tp, _Alloc>::__sort(iterator __f1, iterator __e2, size_type __n, _Comp& __
iterator __m2 = _VSTD::next(__f2);
for (; __m2 != __e2 && __comp(*__m2, *__f1); ++__m2)
;
__node_pointer __f = __f2.__ptr_;
__node_pointer __l = __m2.__ptr_->__prev_;
__node& __f = *__f2.__ptr_;
__node& __l = *__m2.__ptr_->__prev_;
if (__e1 == __f2)
__e1 = __m2;
__f2 = __m2;
base::__unlink_nodes(__f, __l);
__m2 = _VSTD::next(__f1);
__link_nodes(__f1.__ptr_, __f, __l);
__link_nodes(*__f1.__ptr_, __f, __l);
__f1 = __m2;
}
else
@@ -2266,8 +2198,7 @@ template <class _Tp, class _Alloc>
bool
list<_Tp, _Alloc>::__dereferenceable(const const_iterator* __i) const
{
return __i->__ptr_ != static_cast<__node_pointer>(
pointer_traits<__node_base_pointer>::pointer_to(const_cast<__node_base&>(this->__end_)));
return __i->__ptr_ != &this->__end_;
}
template <class _Tp, class _Alloc>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -90,7 +90,7 @@ struct allocator_traits
template <class T>
static void destroy(allocator_type& a, T* p);
static size_type max_size(const allocator_type& a); // noexcept in C++14
static size_type max_size(const allocator_type& a);
static allocator_type
select_on_container_copy_construction(const allocator_type& a);
@@ -350,10 +350,6 @@ class bad_weak_ptr
bad_weak_ptr() noexcept;
};
template<class T, class... Args> unique_ptr<T> make_unique(Args&&... args); // C++14
template<class T> unique_ptr<T> make_unique(size_t n); // C++14
template<class T, class... Args> unspecified make_unique(Args&&...) = delete; // C++14, T == U[N]
template<class T>
class shared_ptr
{
@@ -496,8 +492,8 @@ public:
long use_count() const noexcept;
bool expired() const noexcept;
shared_ptr<T> lock() const noexcept;
template<class U> bool owner_before(shared_ptr<U> const& b) const;
template<class U> bool owner_before(weak_ptr<U> const& b) const;
template<class U> bool owner_before(shared_ptr<U> const& b);
template<class U> bool owner_before(weak_ptr<U> const& b);
};
// weak_ptr specialized algorithms:
@@ -618,12 +614,60 @@ void* align(size_t alignment, size_t size, void*& ptr, size_t& space);
_LIBCPP_BEGIN_NAMESPACE_STD
// addressof moved to <__functional_base>
// addressof
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
_Tp*
addressof(_Tp& __x) _NOEXCEPT
{
return (_Tp*)&reinterpret_cast<const volatile char&>(__x);
}
#if defined(_LIBCPP_HAS_OBJC_ARC) && !defined(_LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF)
// Objective-C++ Automatic Reference Counting uses qualified pointers
// that require special addressof() signatures. When
// _LIBCPP_PREDEFINED_OBJC_ARC_ADDRESSOF is defined, the compiler
// itself is providing these definitions. Otherwise, we provide them.
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__strong _Tp*
addressof(__strong _Tp& __x) _NOEXCEPT
{
return &__x;
}
#ifdef _LIBCPP_HAS_OBJC_ARC_WEAK
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__weak _Tp*
addressof(__weak _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__autoreleasing _Tp*
addressof(__autoreleasing _Tp& __x) _NOEXCEPT
{
return &__x;
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
__unsafe_unretained _Tp*
addressof(__unsafe_unretained _Tp& __x) _NOEXCEPT
{
return &__x;
}
#endif
template <class _Tp> class allocator;
template <>
class _LIBCPP_TYPE_VIS_ONLY allocator<void>
class _LIBCPP_TYPE_VIS allocator<void>
{
public:
typedef void* pointer;
@@ -634,7 +678,7 @@ public:
};
template <>
class _LIBCPP_TYPE_VIS_ONLY allocator<const void>
class _LIBCPP_TYPE_VIS allocator<const void>
{
public:
typedef const void* pointer;
@@ -869,7 +913,7 @@ struct __pointer_traits_rebind<_Sp<_Tp, _A0, _A1, _A2>, _Up, false>
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Ptr>
struct _LIBCPP_TYPE_VIS_ONLY pointer_traits
struct _LIBCPP_TYPE_VIS pointer_traits
{
typedef _Ptr pointer;
typedef typename __pointer_traits_element_type<pointer>::type element_type;
@@ -892,7 +936,7 @@ public:
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY pointer_traits<_Tp*>
struct _LIBCPP_TYPE_VIS pointer_traits<_Tp*>
{
typedef _Tp* pointer;
typedef _Tp element_type;
@@ -917,13 +961,13 @@ public:
namespace __has_pointer_type_imp
{
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::pointer* = 0);
template <class _Up> static __two test(...);
template <class _Up> static char test(typename _Up::pointer* = 0);
}
template <class _Tp>
struct __has_pointer_type
: public integral_constant<bool, sizeof(__has_pointer_type_imp::__test<_Tp>(0)) == 1>
: public integral_constant<bool, sizeof(__has_pointer_type_imp::test<_Tp>(0)) == 1>
{
};
@@ -1399,7 +1443,7 @@ struct __alloc_traits_difference_type<_Alloc, _Ptr, true>
};
template <class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
struct _LIBCPP_TYPE_VIS allocator_traits
{
typedef _Alloc allocator_type;
typedef typename allocator_type::value_type value_type;
@@ -1483,7 +1527,7 @@ struct _LIBCPP_TYPE_VIS_ONLY allocator_traits
{__destroy(__has_destroy<allocator_type, _Tp*>(), __a, __p);}
_LIBCPP_INLINE_VISIBILITY
static size_type max_size(const allocator_type& __a) _NOEXCEPT
static size_type max_size(const allocator_type& __a)
{return __max_size(__has_max_size<const allocator_type>(), __a);}
_LIBCPP_INLINE_VISIBILITY
@@ -1605,7 +1649,7 @@ private:
// allocator
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY allocator
class _LIBCPP_TYPE_VIS allocator
{
public:
typedef size_t size_type;
@@ -1697,7 +1741,7 @@ public:
};
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY allocator<const _Tp>
class _LIBCPP_TYPE_VIS allocator<const _Tp>
{
public:
typedef size_t size_type;
@@ -1706,7 +1750,7 @@ public:
typedef const _Tp* const_pointer;
typedef const _Tp& reference;
typedef const _Tp& const_reference;
typedef const _Tp value_type;
typedef _Tp value_type;
typedef true_type propagate_on_container_move_assignment;
@@ -1795,7 +1839,7 @@ inline _LIBCPP_INLINE_VISIBILITY
bool operator!=(const allocator<_Tp>&, const allocator<_Up>&) _NOEXCEPT {return false;}
template <class _OutputIterator, class _Tp>
class _LIBCPP_TYPE_VIS_ONLY raw_storage_iterator
class _LIBCPP_TYPE_VIS raw_storage_iterator
: public iterator<output_iterator_tag,
_Tp, // purposefully not C++03
ptrdiff_t, // purposefully not C++03
@@ -1848,7 +1892,7 @@ struct auto_ptr_ref
};
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY auto_ptr
class _LIBCPP_TYPE_VIS auto_ptr
{
private:
_Tp* __ptr_;
@@ -1892,7 +1936,7 @@ public:
};
template <>
class _LIBCPP_TYPE_VIS_ONLY auto_ptr<void>
class _LIBCPP_TYPE_VIS auto_ptr<void>
{
public:
typedef void element_type;
@@ -1954,7 +1998,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: __first_(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
@@ -1973,6 +2017,8 @@ public:
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
@@ -1990,7 +2036,9 @@ public:
return *this;
}
#endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2047,7 +2095,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: _T1(_VSTD::forward<_T1_param>(__t1)), __second_(_VSTD::forward<_T2_param>(__t2)) {}
#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
@@ -2065,6 +2113,8 @@ public:
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
@@ -2081,7 +2131,9 @@ public:
return *this;
}
#endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2139,7 +2191,7 @@ public:
is_nothrow_move_constructible<_T2>::value)
: _T2(_VSTD::forward<_T2_param>(__t2)), __first_(_VSTD::forward<_T1_param>(__t1)) {}
#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
@@ -2157,6 +2209,8 @@ public:
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
@@ -2173,7 +2227,9 @@ public:
return *this;
}
#endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2229,7 +2285,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __libcpp_compressed_pair_imp(_T1_param __t1, _T2_param __t2)
: _T1(_VSTD::forward<_T1_param>(__t1)), _T2(_VSTD::forward<_T2_param>(__t2)) {}
#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(const __libcpp_compressed_pair_imp& __p)
@@ -2247,6 +2303,8 @@ public:
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__libcpp_compressed_pair_imp(__libcpp_compressed_pair_imp&& __p)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
@@ -2263,7 +2321,9 @@ public:
return *this;
}
#endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2316,7 +2376,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __compressed_pair(_T1_param __t1, _T2_param __t2)
: base(_VSTD::forward<_T1_param>(__t1), _VSTD::forward<_T2_param>(__t2)) {}
#if defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
__compressed_pair(const __compressed_pair& __p)
@@ -2333,6 +2393,7 @@ public:
return *this;
}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
__compressed_pair(__compressed_pair&& __p)
_NOEXCEPT_(is_nothrow_move_constructible<_T1>::value &&
@@ -2348,7 +2409,9 @@ public:
return *this;
}
#endif // defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif // _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -2409,7 +2472,7 @@ struct __same_or_less_cv_qualified<_Ptr1, _Ptr2, true>
// default_delete
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY default_delete
struct _LIBCPP_TYPE_VIS default_delete
{
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR default_delete() _NOEXCEPT = default;
@@ -2428,7 +2491,7 @@ struct _LIBCPP_TYPE_VIS_ONLY default_delete
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY default_delete<_Tp[]>
struct _LIBCPP_TYPE_VIS default_delete<_Tp[]>
{
public:
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -2451,7 +2514,7 @@ public:
};
template <class _Tp, class _Dp = default_delete<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY unique_ptr
class _LIBCPP_TYPE_VIS unique_ptr
{
public:
typedef _Tp element_type;
@@ -2630,7 +2693,7 @@ public:
};
template <class _Tp, class _Dp>
class _LIBCPP_TYPE_VIS_ONLY unique_ptr<_Tp[], _Dp>
class _LIBCPP_TYPE_VIS unique_ptr<_Tp[], _Dp>
{
public:
typedef _Tp element_type;
@@ -3016,61 +3079,8 @@ move(unique_ptr<_Tp, _Dp>& __t)
#endif
#if _LIBCPP_STD_VER > 11
template<class _Tp>
struct __unique_if
{
typedef unique_ptr<_Tp> __unique_single;
};
template<class _Tp>
struct __unique_if<_Tp[]>
{
typedef unique_ptr<_Tp[]> __unique_array_unknown_bound;
};
template<class _Tp, size_t _Np>
struct __unique_if<_Tp[_Np]>
{
typedef void __unique_array_known_bound;
};
template<class _Tp, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
typename __unique_if<_Tp>::__unique_single
make_unique(_Args&&... __args)
{
return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
}
template<class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
typename __unique_if<_Tp>::__unique_array_unknown_bound
make_unique(size_t __n)
{
typedef typename remove_extent<_Tp>::type _Up;
return unique_ptr<_Tp>(new _Up[__n]());
}
template<class _Tp, class... _Args>
typename __unique_if<_Tp>::__unique_array_known_bound
make_unique(_Args&&...) = delete;
#endif // _LIBCPP_STD_VER > 11
template <class _Tp> struct hash;
template <class _Size>
inline _LIBCPP_INLINE_VISIBILITY
_Size
__loadword(const void* __p)
{
_Size __r;
std::memcpy(&__r, __p, sizeof(__r));
return __r;
}
// We use murmur2 when size_t is 32 bits, and cityhash64 when size_t
// is 64 bits. This is because cityhash64 uses 64bit x 64bit
// multiplication, which can be very slow on 32-bit systems.
@@ -3094,7 +3104,7 @@ __murmur2_or_cityhash<_Size, 32>::operator()(const void* __key, _Size __len)
const unsigned char* __data = static_cast<const unsigned char*>(__key);
for (; __len >= 4; __data += 4, __len -= 4)
{
_Size __k = __loadword<_Size>(__data);
_Size __k = *(const _Size*)__data;
__k *= __m;
__k ^= __k >> __r;
__k *= __m;
@@ -3153,13 +3163,13 @@ struct __murmur2_or_cityhash<_Size, 64>
static _Size __hash_len_0_to_16(const char* __s, _Size __len) {
if (__len > 8) {
const _Size __a = __loadword<_Size>(__s);
const _Size __b = __loadword<_Size>(__s + __len - 8);
const _Size __a = *(const _Size*)__s;
const _Size __b = *(const _Size*)(__s + __len - 8);
return __hash_len_16(__a, __rotate_by_at_least_1(__b + __len, __len)) ^ __b;
}
if (__len >= 4) {
const uint32_t __a = __loadword<uint32_t>(__s);
const uint32_t __b = __loadword<uint32_t>(__s + __len - 4);
const uint32_t __a = *(const uint32_t*)(__s);
const uint32_t __b = *(const uint32_t*)(__s + __len - 4);
return __hash_len_16(__len + (__a << 3), __b);
}
if (__len > 0) {
@@ -3175,10 +3185,10 @@ struct __murmur2_or_cityhash<_Size, 64>
}
static _Size __hash_len_17_to_32(const char *__s, _Size __len) {
const _Size __a = __loadword<_Size>(__s) * __k1;
const _Size __b = __loadword<_Size>(__s + 8);
const _Size __c = __loadword<_Size>(__s + __len - 8) * __k2;
const _Size __d = __loadword<_Size>(__s + __len - 16) * __k0;
const _Size __a = *(const _Size*)(__s) * __k1;
const _Size __b = *(const _Size*)(__s + 8);
const _Size __c = *(const _Size*)(__s + __len - 8) * __k2;
const _Size __d = *(const _Size*)(__s + __len - 16) * __k0;
return __hash_len_16(__rotate(__a - __b, 43) + __rotate(__c, 30) + __d,
__a + __rotate(__b ^ __k3, 20) - __c + __len);
}
@@ -3199,33 +3209,33 @@ struct __murmur2_or_cityhash<_Size, 64>
// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
static pair<_Size, _Size> __weak_hash_len_32_with_seeds(
const char* __s, _Size __a, _Size __b) {
return __weak_hash_len_32_with_seeds(__loadword<_Size>(__s),
__loadword<_Size>(__s + 8),
__loadword<_Size>(__s + 16),
__loadword<_Size>(__s + 24),
return __weak_hash_len_32_with_seeds(*(const _Size*)(__s),
*(const _Size*)(__s + 8),
*(const _Size*)(__s + 16),
*(const _Size*)(__s + 24),
__a,
__b);
}
// Return an 8-byte hash for 33 to 64 bytes.
static _Size __hash_len_33_to_64(const char *__s, size_t __len) {
_Size __z = __loadword<_Size>(__s + 24);
_Size __a = __loadword<_Size>(__s) +
(__len + __loadword<_Size>(__s + __len - 16)) * __k0;
_Size __z = *(const _Size*)(__s + 24);
_Size __a = *(const _Size*)(__s) +
(__len + *(const _Size*)(__s + __len - 16)) * __k0;
_Size __b = __rotate(__a + __z, 52);
_Size __c = __rotate(__a, 37);
__a += __loadword<_Size>(__s + 8);
__a += *(const _Size*)(__s + 8);
__c += __rotate(__a, 7);
__a += __loadword<_Size>(__s + 16);
__a += *(const _Size*)(__s + 16);
_Size __vf = __a + __z;
_Size __vs = __b + __rotate(__a, 31) + __c;
__a = __loadword<_Size>(__s + 16) + __loadword<_Size>(__s + __len - 32);
__z += __loadword<_Size>(__s + __len - 8);
__a = *(const _Size*)(__s + 16) + *(const _Size*)(__s + __len - 32);
__z += *(const _Size*)(__s + __len - 8);
__b = __rotate(__a + __z, 52);
__c = __rotate(__a, 37);
__a += __loadword<_Size>(__s + __len - 24);
__a += *(const _Size*)(__s + __len - 24);
__c += __rotate(__a, 7);
__a += __loadword<_Size>(__s + __len - 16);
__a += *(const _Size*)(__s + __len - 16);
_Size __wf = __a + __z;
_Size __ws = __b + __rotate(__a, 31) + __c;
_Size __r = __shift_mix((__vf + __ws) * __k2 + (__wf + __vs) * __k0);
@@ -3251,26 +3261,26 @@ __murmur2_or_cityhash<_Size, 64>::operator()(const void* __key, _Size __len)
// For strings over 64 bytes we hash the end first, and then as we
// loop we keep 56 bytes of state: v, w, x, y, and z.
_Size __x = __loadword<_Size>(__s + __len - 40);
_Size __y = __loadword<_Size>(__s + __len - 16) +
__loadword<_Size>(__s + __len - 56);
_Size __z = __hash_len_16(__loadword<_Size>(__s + __len - 48) + __len,
__loadword<_Size>(__s + __len - 24));
_Size __x = *(const _Size*)(__s + __len - 40);
_Size __y = *(const _Size*)(__s + __len - 16) +
*(const _Size*)(__s + __len - 56);
_Size __z = __hash_len_16(*(const _Size*)(__s + __len - 48) + __len,
*(const _Size*)(__s + __len - 24));
pair<_Size, _Size> __v = __weak_hash_len_32_with_seeds(__s + __len - 64, __len, __z);
pair<_Size, _Size> __w = __weak_hash_len_32_with_seeds(__s + __len - 32, __y + __k1, __x);
__x = __x * __k1 + __loadword<_Size>(__s);
__x = __x * __k1 + *(const _Size*)(__s);
// Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
__len = (__len - 1) & ~static_cast<_Size>(63);
do {
__x = __rotate(__x + __y + __v.first + __loadword<_Size>(__s + 8), 37) * __k1;
__y = __rotate(__y + __v.second + __loadword<_Size>(__s + 48), 42) * __k1;
__x = __rotate(__x + __y + __v.first + *(const _Size*)(__s + 8), 37) * __k1;
__y = __rotate(__y + __v.second + *(const _Size*)(__s + 48), 42) * __k1;
__x ^= __w.second;
__y += __v.first + __loadword<_Size>(__s + 40);
__y += __v.first + *(const _Size*)(__s + 40);
__z = __rotate(__z + __w.first, 33) * __k1;
__v = __weak_hash_len_32_with_seeds(__s, __v.second * __k1, __x + __w.first);
__w = __weak_hash_len_32_with_seeds(__s + 32, __z + __w.second,
__y + __loadword<_Size>(__s + 16));
__y + *(const _Size*)(__s + 16));
std::swap(__z, __x);
__s += 64;
__len -= 64;
@@ -3385,7 +3395,7 @@ struct __scalar_hash<_Tp, 4>
};
template<class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY hash<_Tp*>
struct _LIBCPP_TYPE_VIS hash<_Tp*>
: public unary_function<_Tp*, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -3402,7 +3412,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<_Tp*>
};
template <class _Tp, class _Dp>
struct _LIBCPP_TYPE_VIS_ONLY hash<unique_ptr<_Tp, _Dp> >
struct _LIBCPP_TYPE_VIS hash<unique_ptr<_Tp, _Dp> >
{
typedef unique_ptr<_Tp, _Dp> argument_type;
typedef size_t result_type;
@@ -3575,9 +3585,9 @@ public:
virtual const char* what() const _NOEXCEPT;
};
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
template<class _Tp> class _LIBCPP_TYPE_VIS weak_ptr;
class _LIBCPP_TYPE_VIS __shared_count
class __shared_count
{
__shared_count(const __shared_count&);
__shared_count& operator=(const __shared_count&);
@@ -3599,7 +3609,7 @@ public:
long use_count() const _NOEXCEPT {return __shared_owners_ + 1;}
};
class _LIBCPP_TYPE_VIS __shared_weak_count
class __shared_weak_count
: private __shared_count
{
long __shared_weak_owners_;
@@ -3744,10 +3754,10 @@ __shared_ptr_emplace<_Tp, _Alloc>::__on_zero_shared_weak() _NOEXCEPT
__a.deallocate(this, 1);
}
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this;
template<class _Tp> class _LIBCPP_TYPE_VIS enable_shared_from_this;
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY shared_ptr
class _LIBCPP_TYPE_VIS shared_ptr
{
public:
typedef _Tp element_type;
@@ -3876,8 +3886,8 @@ public:
<
!is_array<_Yp>::value &&
is_convertible<_Yp*, element_type*>::value,
shared_ptr
>::type&
shared_ptr&
>::type
operator=(auto_ptr<_Yp>&& __r);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template<class _Yp>
@@ -4016,8 +4026,8 @@ private:
_LIBCPP_INLINE_VISIBILITY
void __enable_weak_this(const void*) _NOEXCEPT {}
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS shared_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS weak_ptr;
};
template<class _Tp>
@@ -4503,8 +4513,8 @@ typename enable_if
<
!is_array<_Yp>::value &&
is_convertible<_Yp*, _Tp*>::value,
shared_ptr<_Tp>
>::type&
shared_ptr<_Tp>&
>::type
shared_ptr<_Tp>::operator=(auto_ptr<_Yp>&& __r)
{
shared_ptr(_VSTD::move(__r)).swap(*this);
@@ -4913,7 +4923,7 @@ get_deleter(const shared_ptr<_Tp>& __p) _NOEXCEPT
#endif // _LIBCPP_NO_RTTI
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY weak_ptr
class _LIBCPP_TYPE_VIS weak_ptr
{
public:
typedef _Tp element_type;
@@ -4988,8 +4998,8 @@ public:
bool owner_before(const weak_ptr<_Up>& __r) const
{return __cntrl_ < __r.__cntrl_;}
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY weak_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS_ONLY shared_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS weak_ptr;
template <class _Up> friend class _LIBCPP_TYPE_VIS shared_ptr;
};
template<class _Tp>
@@ -5189,7 +5199,7 @@ weak_ptr<_Tp>::lock() const _NOEXCEPT
template <class _Tp> struct owner_less;
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
struct _LIBCPP_TYPE_VIS owner_less<shared_ptr<_Tp> >
: binary_function<shared_ptr<_Tp>, shared_ptr<_Tp>, bool>
{
typedef bool result_type;
@@ -5205,7 +5215,7 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<shared_ptr<_Tp> >
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
struct _LIBCPP_TYPE_VIS owner_less<weak_ptr<_Tp> >
: binary_function<weak_ptr<_Tp>, weak_ptr<_Tp>, bool>
{
typedef bool result_type;
@@ -5221,7 +5231,7 @@ struct _LIBCPP_TYPE_VIS_ONLY owner_less<weak_ptr<_Tp> >
};
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY enable_shared_from_this
class _LIBCPP_TYPE_VIS enable_shared_from_this
{
mutable weak_ptr<_Tp> __weak_this_;
protected:
@@ -5246,7 +5256,7 @@ public:
};
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY hash<shared_ptr<_Tp> >
struct _LIBCPP_TYPE_VIS hash<shared_ptr<_Tp> >
{
typedef shared_ptr<_Tp> argument_type;
typedef size_t result_type;
@@ -5264,7 +5274,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p);
#if __has_feature(cxx_atomic)
class _LIBCPP_TYPE_VIS __sp_mut
class __sp_mut
{
void* __lx;
public:
@@ -5408,11 +5418,11 @@ struct _LIBCPP_TYPE_VIS pointer_safety
operator int() const {return __v_;}
};
_LIBCPP_FUNC_VIS void declare_reachable(void* __p);
_LIBCPP_FUNC_VIS void declare_no_pointers(char* __p, size_t __n);
_LIBCPP_FUNC_VIS void undeclare_no_pointers(char* __p, size_t __n);
_LIBCPP_FUNC_VIS pointer_safety get_pointer_safety() _NOEXCEPT;
_LIBCPP_FUNC_VIS void* __undeclare_reachable(void* __p);
void declare_reachable(void* __p);
void declare_no_pointers(char* __p, size_t __n);
void undeclare_no_pointers(char* __p, size_t __n);
pointer_safety get_pointer_safety() _NOEXCEPT;
void* __undeclare_reachable(void* __p);
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY
@@ -5422,7 +5432,7 @@ undeclare_reachable(_Tp* __p)
return static_cast<_Tp*>(__undeclare_reachable(__p));
}
_LIBCPP_FUNC_VIS void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
void* align(size_t __align, size_t __sz, void*& __ptr, size_t& __space);
_LIBCPP_END_NAMESPACE_STD

View File

@@ -441,7 +441,7 @@ void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_TYPE_VIS_ONLY once_flag
struct _LIBCPP_TYPE_VIS once_flag
{
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
@@ -527,7 +527,7 @@ __call_once_proxy(void* __vp)
(*__p)();
}
_LIBCPP_FUNC_VIS void __call_once(volatile unsigned long&, void*, void(*)(void*));
void __call_once(volatile unsigned long&, void*, void(*)(void*));
#ifndef _LIBCPP_HAS_NO_VARIADICS

View File

@@ -27,18 +27,6 @@ public:
virtual const char* what() const noexcept;
};
class bad_array_length : public bad_alloc // C++14
{
public:
bad_array_length() noexcept;
};
class bad_array_new_length : public bad_alloc
{
public:
bad_array_new_length() noexcept;
};
struct nothrow_t {};
extern const nothrow_t nothrow;
typedef void (*new_handler)();
@@ -93,22 +81,7 @@ public:
virtual const char* what() const _NOEXCEPT;
};
#if defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
class _LIBCPP_EXCEPTION_ABI bad_array_length
: public bad_alloc
{
public:
bad_array_length() _NOEXCEPT;
virtual ~bad_array_length() _NOEXCEPT;
virtual const char* what() const _NOEXCEPT;
};
#define _LIBCPP_BAD_ARRAY_LENGTH_DEFINED
#endif // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
_LIBCPP_FUNC_VIS void __throw_bad_alloc(); // not in C++ spec
void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_TYPE_VIS nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow;
@@ -118,33 +91,27 @@ _LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT;
} // std
#if defined(_WIN32) && !defined(cxx_EXPORTS)
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS_ONLY
#else
# define _LIBCPP_NEW_DELETE_VIS _LIBCPP_FUNC_VIS
#endif
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz)
_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_NEW_DELETE_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_FUNC_VIS void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz)
_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept)
throw(std::bad_alloc)
#endif
;
_LIBCPP_NEW_DELETE_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_NEW_DELETE_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS;
_LIBCPP_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
inline _LIBCPP_INLINE_VISIBILITY void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
inline _LIBCPP_INLINE_VISIBILITY void operator delete (void*, void*) _NOEXCEPT {}
inline _LIBCPP_INLINE_VISIBILITY void operator delete[](void*, void*) _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) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void operator delete (void*, void*) _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY inline void operator delete[](void*, void*) _NOEXCEPT {}
#endif // _LIBCPP_NEW

View File

@@ -157,7 +157,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
{
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
*__result = __t2 - __t1;
__t1 = _VSTD::move(__t2);
__t1 = __t2;
}
}
return __result;
@@ -177,7 +177,7 @@ adjacent_difference(_InputIterator __first, _InputIterator __last, _OutputIterat
{
typename iterator_traits<_InputIterator>::value_type __t2(*__first);
*__result = __binary_op(__t2, __t1);
__t1 = _VSTD::move(__t2);
__t1 = __t2;
}
}
return __result;

View File

@@ -32,7 +32,6 @@ public:
virtual ~basic_ostream();
// 27.7.2.3 Assign/swap
basic_ostream& operator=(const basic_ostream& rhs) = delete; // C++14
basic_ostream& operator=(basic_ostream&& rhs);
void swap(basic_ostream& rhs);
@@ -141,7 +140,7 @@ template <class charT, class traits, class T>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ostream
class _LIBCPP_TYPE_VIS basic_ostream
: virtual public basic_ios<_CharT, _Traits>
{
public:
@@ -162,9 +161,6 @@ protected:
#endif
// 27.7.2.3 Assign/swap
#if _LIBCPP_STD_VER > 11
basic_ostream& operator=(const basic_ostream&) = delete;
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_ostream& operator=(basic_ostream&& __rhs);
@@ -173,7 +169,7 @@ protected:
public:
// 27.7.2.4 Prefix/suffix:
class _LIBCPP_TYPE_VIS_ONLY sentry;
class _LIBCPP_TYPE_VIS sentry;
// 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
@@ -211,7 +207,7 @@ protected:
};
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_ostream<_CharT, _Traits>::sentry
class _LIBCPP_TYPE_VIS basic_ostream<_CharT, _Traits>::sentry
{
bool __ok_;
basic_ostream<_CharT, _Traits>& __os_;
@@ -1159,8 +1155,7 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(pos_type __pos)
{
sentry __s(*this);
if (__s)
if (!this->fail())
{
if (this->rdbuf()->pubseekpos(__pos, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
@@ -1173,12 +1168,8 @@ inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::seekp(off_type __off, ios_base::seekdir __dir)
{
sentry __s(*this);
if (__s)
{
if (this->rdbuf()->pubseekoff(__off, __dir, ios_base::out) == pos_type(-1))
this->setstate(ios_base::failbit);
}
if (!this->fail())
this->rdbuf()->pubseekoff(__off, __dir, ios_base::out);
return *this;
}
@@ -1287,8 +1278,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ostream<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>)
_LIBCPP_END_NAMESPACE_STD

View File

@@ -177,7 +177,7 @@ template <class T, class Container, class Compare>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY queue;
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS queue;
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
@@ -190,7 +190,7 @@ bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY queue
class _LIBCPP_TYPE_VIS queue
{
public:
typedef _Container container_type;
@@ -376,14 +376,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<queue<_Tp, _Container>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};
template <class _Tp, class _Container = vector<_Tp>,
class _Compare = less<typename _Container::value_type> >
class _LIBCPP_TYPE_VIS_ONLY priority_queue
class _LIBCPP_TYPE_VIS priority_queue
{
public:
typedef _Container container_type;
@@ -707,7 +707,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
}
template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

View File

@@ -1813,7 +1813,7 @@ struct __lce_ta<__a, __c, __m, (unsigned short)(~0), __b>
};
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class _LIBCPP_TYPE_VIS_ONLY linear_congruential_engine;
class _LIBCPP_TYPE_VIS linear_congruential_engine;
template <class _CharT, class _Traits,
class _Up, _Up _Ap, _Up _Cp, _Up _Np>
@@ -1829,7 +1829,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
linear_congruential_engine<_Up, _Ap, _Cp, _Np>& __x);
template <class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
class _LIBCPP_TYPE_VIS_ONLY linear_congruential_engine
class _LIBCPP_TYPE_VIS linear_congruential_engine
{
public:
// types
@@ -1880,7 +1880,7 @@ public:
seed(_Sseq& __q)
{__seed(__q, integral_constant<unsigned,
1 + (__m == 0 ? (sizeof(result_type) * __CHAR_BIT__ - 1)/32
: (__m > 0x100000000ull))>());}
: (__m-1) / 0x100000000ull)>());}
// generating functions
_LIBCPP_INLINE_VISIBILITY
@@ -1969,10 +1969,37 @@ linear_congruential_engine<_UIntType, __a, __c, __m>::__seed(_Sseq& __q,
uint32_t __ar[__k+3];
__q.generate(__ar, __ar + __k + 3);
result_type __s = static_cast<result_type>((__ar[3] +
((uint64_t)__ar[4] << 32)) % __m);
(uint64_t)__ar[4] << 32) % __m);
__x_ = __c == 0 && __s == 0 ? result_type(1) : __s;
}
template <class _CharT, class _Traits>
class __save_flags
{
typedef basic_ios<_CharT, _Traits> __stream_type;
typedef typename __stream_type::fmtflags fmtflags;
__stream_type& __stream_;
fmtflags __fmtflags_;
_CharT __fill_;
__save_flags(const __save_flags&);
__save_flags& operator=(const __save_flags&);
public:
_LIBCPP_INLINE_VISIBILITY
explicit __save_flags(__stream_type& __stream)
: __stream_(__stream),
__fmtflags_(__stream.flags()),
__fill_(__stream.fill())
{}
_LIBCPP_INLINE_VISIBILITY
~__save_flags()
{
__stream_.flags(__fmtflags_);
__stream_.fill(__fill_);
}
};
template <class _CharT, class _Traits,
class _UIntType, _UIntType __a, _UIntType __c, _UIntType __m>
inline _LIBCPP_INLINE_VISIBILITY
@@ -2011,7 +2038,7 @@ typedef minstd_rand default_random_engine;
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
class _LIBCPP_TYPE_VIS_ONLY mersenne_twister_engine;
class _LIBCPP_TYPE_VIS mersenne_twister_engine;
template <class _UI, size_t _Wp, size_t _Np, size_t _Mp, size_t _Rp,
_UI _Ap, size_t _Up, _UI _Dp, size_t _Sp,
@@ -2053,7 +2080,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
template <class _UIntType, size_t __w, size_t __n, size_t __m, size_t __r,
_UIntType __a, size_t __u, _UIntType __d, size_t __s,
_UIntType __b, size_t __t, _UIntType __c, size_t __l, _UIntType __f>
class _LIBCPP_TYPE_VIS_ONLY mersenne_twister_engine
class _LIBCPP_TYPE_VIS mersenne_twister_engine
{
public:
// types
@@ -2499,7 +2526,7 @@ typedef mersenne_twister_engine<uint_fast64_t, 64, 312, 156, 31,
// subtract_with_carry_engine
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TYPE_VIS_ONLY subtract_with_carry_engine;
class _LIBCPP_TYPE_VIS subtract_with_carry_engine;
template<class _UI, size_t _Wp, size_t _Sp, size_t _Rp>
bool
@@ -2527,7 +2554,7 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
subtract_with_carry_engine<_UI, _Wp, _Sp, _Rp>& __x);
template<class _UIntType, size_t __w, size_t __s, size_t __r>
class _LIBCPP_TYPE_VIS_ONLY subtract_with_carry_engine
class _LIBCPP_TYPE_VIS subtract_with_carry_engine
{
public:
// types
@@ -2810,7 +2837,7 @@ typedef subtract_with_carry_engine<uint_fast64_t, 48, 5, 12> ranlux48_base;
// discard_block_engine
template<class _Engine, size_t __p, size_t __r>
class _LIBCPP_TYPE_VIS_ONLY discard_block_engine
class _LIBCPP_TYPE_VIS discard_block_engine
{
_Engine __e_;
int __n_;
@@ -2983,7 +3010,7 @@ typedef discard_block_engine<ranlux48_base, 389, 11> ranlux48;
// independent_bits_engine
template<class _Engine, size_t __w, class _UIntType>
class _LIBCPP_TYPE_VIS_ONLY independent_bits_engine
class _LIBCPP_TYPE_VIS independent_bits_engine
{
template <class _UI, _UI _R0, size_t _Wp, size_t _Mp>
class __get_n
@@ -3246,7 +3273,7 @@ public:
};
template<class _Engine, size_t __k>
class _LIBCPP_TYPE_VIS_ONLY shuffle_order_engine
class _LIBCPP_TYPE_VIS shuffle_order_engine
{
static_assert(0 < __k, "shuffle_order_engine invalid parameters");
public:
@@ -3475,9 +3502,7 @@ typedef shuffle_order_engine<minstd_rand0, 256> knuth_b;
class _LIBCPP_TYPE_VIS random_device
{
#if !defined(_WIN32)
int __f_;
#endif // defined(_WIN32)
public:
// types
typedef unsigned result_type;
@@ -3509,7 +3534,7 @@ private:
// seed_seq
class _LIBCPP_TYPE_VIS_ONLY seed_seq
class _LIBCPP_TYPE_VIS seed_seq
{
public:
// types
@@ -3523,7 +3548,7 @@ private:
public:
// constructors
_LIBCPP_INLINE_VISIBILITY
seed_seq() _NOEXCEPT {}
seed_seq() {}
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template<class _Tp>
_LIBCPP_INLINE_VISIBILITY
@@ -3541,7 +3566,7 @@ public:
// property functions
_LIBCPP_INLINE_VISIBILITY
size_t size() const _NOEXCEPT {return __v_.size();}
size_t size() const {return __v_.size();}
template<class _OutputIterator>
_LIBCPP_INLINE_VISIBILITY
void param(_OutputIterator __dest) const
@@ -3686,13 +3711,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// uniform_real_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY uniform_real_distribution
class _LIBCPP_TYPE_VIS uniform_real_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __a_;
result_type __b_;
@@ -3807,13 +3832,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// bernoulli_distribution
class _LIBCPP_TYPE_VIS_ONLY bernoulli_distribution
class _LIBCPP_TYPE_VIS bernoulli_distribution
{
public:
// types
typedef bool result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
double __p_;
public:
@@ -3916,13 +3941,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bernoulli_distribution& __x)
// binomial_distribution
template<class _IntType = int>
class _LIBCPP_TYPE_VIS_ONLY binomial_distribution
class _LIBCPP_TYPE_VIS binomial_distribution
{
public:
// types
typedef _IntType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __t_;
double __p_;
@@ -4081,13 +4106,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// exponential_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY exponential_distribution
class _LIBCPP_TYPE_VIS exponential_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __lambda_;
public:
@@ -4196,13 +4221,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// normal_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY normal_distribution
class _LIBCPP_TYPE_VIS normal_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __mean_;
result_type __stddev_;
@@ -4364,13 +4389,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// lognormal_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY lognormal_distribution
class _LIBCPP_TYPE_VIS lognormal_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
normal_distribution<result_type> __nd_;
public:
@@ -4489,13 +4514,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// poisson_distribution
template<class _IntType = int>
class _LIBCPP_TYPE_VIS_ONLY poisson_distribution
class _LIBCPP_TYPE_VIS poisson_distribution
{
public:
// types
typedef _IntType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
double __mean_;
double __s_;
@@ -4720,13 +4745,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// weibull_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY weibull_distribution
class _LIBCPP_TYPE_VIS weibull_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __a_;
result_type __b_;
@@ -4834,13 +4859,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
}
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY extreme_value_distribution
class _LIBCPP_TYPE_VIS extreme_value_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __a_;
result_type __b_;
@@ -4955,13 +4980,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// gamma_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY gamma_distribution
class _LIBCPP_TYPE_VIS gamma_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __alpha_;
result_type __beta_;
@@ -5127,13 +5152,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// negative_binomial_distribution
template<class _IntType = int>
class _LIBCPP_TYPE_VIS_ONLY negative_binomial_distribution
class _LIBCPP_TYPE_VIS negative_binomial_distribution
{
public:
// types
typedef _IntType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __k_;
double __p_;
@@ -5262,13 +5287,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// geometric_distribution
template<class _IntType = int>
class _LIBCPP_TYPE_VIS_ONLY geometric_distribution
class _LIBCPP_TYPE_VIS geometric_distribution
{
public:
// types
typedef _IntType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
double __p_;
public:
@@ -5364,13 +5389,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// chi_squared_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY chi_squared_distribution
class _LIBCPP_TYPE_VIS chi_squared_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __n_;
public:
@@ -5470,13 +5495,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// cauchy_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY cauchy_distribution
class _LIBCPP_TYPE_VIS cauchy_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __a_;
result_type __b_;
@@ -5593,13 +5618,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// fisher_f_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY fisher_f_distribution
class _LIBCPP_TYPE_VIS fisher_f_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __m_;
result_type __n_;
@@ -5715,13 +5740,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// student_t_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY student_t_distribution
class _LIBCPP_TYPE_VIS student_t_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
result_type __n_;
public:
@@ -5828,13 +5853,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// discrete_distribution
template<class _IntType = int>
class _LIBCPP_TYPE_VIS_ONLY discrete_distribution
class _LIBCPP_TYPE_VIS discrete_distribution
{
public:
// types
typedef _IntType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
vector<double> __p_;
public:
@@ -5903,8 +5928,8 @@ public:
discrete_distribution(size_t __nw, double __xmin, double __xmax,
_UnaryOperation __fw)
: __p_(__nw, __xmin, __xmax, __fw) {}
_LIBCPP_INLINE_VISIBILITY
explicit discrete_distribution(const param_type& __p)
_LIBCPP_INLINE_VISIBILITY
: __p_(__p) {}
_LIBCPP_INLINE_VISIBILITY
void reset() {}
@@ -6059,13 +6084,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// piecewise_constant_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY piecewise_constant_distribution
class _LIBCPP_TYPE_VIS piecewise_constant_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
vector<result_type> __b_;
vector<result_type> __densities_;
@@ -6383,13 +6408,13 @@ operator>>(basic_istream<_CharT, _Traits>& __is,
// piecewise_linear_distribution
template<class _RealType = double>
class _LIBCPP_TYPE_VIS_ONLY piecewise_linear_distribution
class _LIBCPP_TYPE_VIS piecewise_linear_distribution
{
public:
// types
typedef _RealType result_type;
class _LIBCPP_TYPE_VIS_ONLY param_type
class _LIBCPP_TYPE_VIS param_type
{
vector<result_type> __b_;
vector<result_type> __densities_;

View File

@@ -231,7 +231,7 @@ public:
};
template <intmax_t _Num, intmax_t _Den = 1>
class _LIBCPP_TYPE_VIS_ONLY ratio
class _LIBCPP_TYPE_VIS ratio
{
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
static_assert(_Den != 0, "ratio divide by 0");
@@ -292,7 +292,7 @@ template <class _R1, class _R2> using ratio_multiply
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_multiply
struct _LIBCPP_TYPE_VIS ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -319,7 +319,7 @@ template <class _R1, class _R2> using ratio_divide
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_divide
struct _LIBCPP_TYPE_VIS ratio_divide
: public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -354,7 +354,7 @@ template <class _R1, class _R2> using ratio_add
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_add
struct _LIBCPP_TYPE_VIS ratio_add
: public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -389,7 +389,7 @@ template <class _R1, class _R2> using ratio_subtract
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
struct _LIBCPP_TYPE_VIS ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -397,11 +397,11 @@ struct _LIBCPP_TYPE_VIS_ONLY ratio_subtract
// ratio_equal
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_equal
struct _LIBCPP_TYPE_VIS ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_not_equal
struct _LIBCPP_TYPE_VIS ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
// ratio_less
@@ -460,19 +460,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
};
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_less
struct _LIBCPP_TYPE_VIS ratio_less
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_less_equal
struct _LIBCPP_TYPE_VIS ratio_less_equal
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater
struct _LIBCPP_TYPE_VIS ratio_greater
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS_ONLY ratio_greater_equal
struct _LIBCPP_TYPE_VIS ratio_greater_equal
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2>

View File

@@ -925,7 +925,7 @@ public:
};
template <class _CharT>
struct _LIBCPP_TYPE_VIS_ONLY regex_traits
struct _LIBCPP_TYPE_VIS regex_traits
{
public:
typedef _CharT char_type;
@@ -970,7 +970,7 @@ public:
bool isctype(char_type __c, char_class_type __m) const;
_LIBCPP_INLINE_VISIBILITY
int value(char_type __ch, int __radix) const
{return __regex_traits_value(__ch, __radix);}
{return __value(__ch, __radix);}
locale_type imbue(locale_type __l);
_LIBCPP_INLINE_VISIBILITY
locale_type getloc()const {return __loc_;}
@@ -1001,11 +1001,11 @@ private:
__lookup_classname(_ForwardIterator __f, _ForwardIterator __l,
bool __icase, wchar_t) const;
static int __regex_traits_value(unsigned char __ch, int __radix);
static int __value(unsigned char __ch, int __radix);
_LIBCPP_INLINE_VISIBILITY
int __regex_traits_value(char __ch, int __radix) const
{return __regex_traits_value(static_cast<unsigned char>(__ch), __radix);}
int __regex_traits_value(wchar_t __ch, int __radix) const;
int __value(char __ch, int __radix) const
{return __value(static_cast<unsigned char>(__ch), __radix);}
int __value(wchar_t __ch, int __radix) const;
};
template <class _CharT>
@@ -1100,7 +1100,7 @@ regex_traits<_CharT>::__transform_primary(_ForwardIterator __f,
// lookup_collatename is very FreeBSD-specific
_LIBCPP_FUNC_VIS string __get_collation_name(const char* __s);
string __get_collation_name(const char* __s);
template <class _CharT>
template <class _ForwardIterator>
@@ -1161,7 +1161,7 @@ regex_traits<_CharT>::__lookup_collatename(_ForwardIterator __f,
// lookup_classname
ctype_base::mask _LIBCPP_FUNC_VIS __get_classname(const char* __s, bool __icase);
ctype_base::mask __get_classname(const char* __s, bool __icase);
template <class _CharT>
template <class _ForwardIterator>
@@ -1207,7 +1207,7 @@ regex_traits<_CharT>::isctype(char_type __c, char_class_type __m) const
template <class _CharT>
int
regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
regex_traits<_CharT>::__value(unsigned char __ch, int __radix)
{
if ((__ch & 0xF8u) == 0x30) // '0' <= __ch && __ch <= '7'
return __ch - '0';
@@ -1228,18 +1228,18 @@ regex_traits<_CharT>::__regex_traits_value(unsigned char __ch, int __radix)
template <class _CharT>
inline _LIBCPP_INLINE_VISIBILITY
int
regex_traits<_CharT>::__regex_traits_value(wchar_t __ch, int __radix) const
regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
{
return __regex_traits_value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
return __value(static_cast<unsigned char>(__ct_->narrow(__ch, char_type())), __radix);
}
template <class _CharT> class __node;
template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS_ONLY sub_match;
template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS sub_match;
template <class _BidirectionalIterator,
class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
class _LIBCPP_TYPE_VIS_ONLY match_results;
class _LIBCPP_TYPE_VIS match_results;
template <class _CharT>
struct __state
@@ -2014,9 +2014,6 @@ public:
virtual void __exec(__state&) const;
};
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<char>::__exec(__state&) const;
template <> _LIBCPP_FUNC_VIS void __match_any_but_newline<wchar_t>::__exec(__state&) const;
// __match_char
template <class _CharT>
@@ -2418,7 +2415,7 @@ __exit:
template <class _CharT, class _Traits> class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY basic_regex
class _LIBCPP_TYPE_VIS basic_regex
{
public:
// types:
@@ -2772,7 +2769,7 @@ private:
void __push_end_marked_subexpression(unsigned);
void __push_empty();
void __push_word_boundary(bool);
void __push_lookahead(const basic_regex&, bool, unsigned);
void __push_lookahead(const basic_regex&, bool);
template <class _Allocator>
bool
@@ -2846,15 +2843,6 @@ private:
const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags);
template <class _Iter, class _Ap, class _Cp, class _Tp>
friend
bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Ap>& __m,
const basic_regex<_Cp, _Tp>& __e,
regex_constants::match_flag_type __flags);
template <class, class> friend class __lookahead;
};
@@ -2910,7 +2898,6 @@ class __lookahead
typedef __owns_one_state<_CharT> base;
basic_regex<_CharT, _Traits> __exp_;
unsigned __mexp_;
bool __invert_;
__lookahead(const __lookahead&);
@@ -2919,8 +2906,8 @@ public:
typedef _VSTD::__state<_CharT> __state;
_LIBCPP_INLINE_VISIBILITY
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s, unsigned __mexp)
: base(__s), __exp_(__exp), __invert_(__invert), __mexp_(__mexp) {}
__lookahead(const basic_regex<_CharT, _Traits>& __exp, bool __invert, __node<_CharT>* __s)
: base(__s), __exp_(__exp), __invert_(__invert) {}
virtual void __exec(__state&) const;
};
@@ -2934,14 +2921,11 @@ __lookahead<_CharT, _Traits>::__exec(__state& __s) const
bool __matched = __exp_.__match_at_start_ecma(__s.__current_, __s.__last_,
__m,
__s.__flags_ | regex_constants::match_continuous,
__s.__at_first_ && __s.__current_ == __s.__first_);
true);
if (__matched != __invert_)
{
__s.__do_ = __state::__accept_but_not_consume;
__s.__node_ = this->first();
for (unsigned __i = 1; __i < __m.size(); ++__i) {
__s.__sub_matches_[__mexp_ + __i - 1] = __m.__matches_[__i];
}
}
else
{
@@ -3436,7 +3420,6 @@ basic_regex<_CharT, _Traits>::__parse_QUOTED_CHAR_ERE(_ForwardIterator __first,
case '+':
case '?':
case '{':
case '}':
__push_char(*__temp);
__first = ++__temp;
break;
@@ -3785,7 +3768,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
}
__ml->__add_range(_VSTD::move(__start_range), _VSTD::move(__end_range));
}
else if (!__start_range.empty())
else
{
if (__start_range.size() == 1)
__ml->__add_char(__start_range[0]);
@@ -3793,7 +3776,7 @@ basic_regex<_CharT, _Traits>::__parse_expression_term(_ForwardIterator __first,
__ml->__add_digraph(__start_range[0], __start_range[1]);
}
}
else if (!__start_range.empty())
else
{
if (__start_range.size() == 1)
__ml->__add_char(__start_range[0]);
@@ -3920,7 +3903,7 @@ basic_regex<_CharT, _Traits>::__parse_awk_escape(_ForwardIterator __first,
{
__val = 8 * __val + *__first - '0';
if (++__first != __last && ('0' <= *__first && *__first <= '7'))
__val = 8 * __val + *__first++ - '0';
__val = 8 * __val + *__first - '0';
}
if (__str)
*__str = _CharT(__val);
@@ -4175,9 +4158,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), false, __marked_count_);
__marked_count_ += __mexp;
__push_lookahead(_VSTD::move(__exp), false);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
@@ -4190,9 +4171,7 @@ basic_regex<_CharT, _Traits>::__parse_assertion(_ForwardIterator __first,
basic_regex __exp;
__exp.__flags_ = __flags_;
__temp = __exp.__parse(++__temp, __last);
unsigned __mexp = __exp.__marked_count_;
__push_lookahead(_VSTD::move(__exp), true, __marked_count_);
__marked_count_ += __mexp;
__push_lookahead(_VSTD::move(__exp), true);
#ifndef _LIBCPP_NO_EXCEPTIONS
if (__temp == __last || *__temp != ')')
throw regex_error(regex_constants::error_paren);
@@ -4429,8 +4408,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
case 'c':
if ((__t = _VSTD::next(__first)) != __last)
{
if (('A' <= *__t && *__t <= 'Z') ||
('a' <= *__t && *__t <= 'z'))
if ('A' <= *__t <= 'Z' || 'a' <= *__t <= 'z')
{
if (__str)
*__str = _CharT(*__t % 32);
@@ -4438,15 +4416,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
__push_char(_CharT(*__t % 32));
__first = ++__t;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
break;
case 'u':
++__first;
@@ -4511,7 +4481,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
++__first;
}
#ifndef _LIBCPP_NO_EXCEPTIONS
else
else if (__str)
throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS
break;
@@ -4770,11 +4740,10 @@ basic_regex<_CharT, _Traits>::__start_matching_list(bool __negate)
template <class _CharT, class _Traits>
void
basic_regex<_CharT, _Traits>::__push_lookahead(const basic_regex& __exp,
bool __invert,
unsigned __mexp)
bool __invert)
{
__end_->first() = new __lookahead<_CharT, _Traits>(__exp, __invert,
__end_->first(), __mexp);
__end_->first());
__end_ = static_cast<__owns_one_state<_CharT>*>(__end_->first());
}
@@ -4784,7 +4753,7 @@ typedef basic_regex<wchar_t> wregex;
// sub_match
template <class _BidirectionalIterator>
class _LIBCPP_TYPE_VIS_ONLY sub_match
class _LIBCPP_TYPE_VIS sub_match
: public pair<_BidirectionalIterator, _BidirectionalIterator>
{
public:
@@ -5207,7 +5176,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
}
template <class _BidirectionalIterator, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY match_results
class _LIBCPP_TYPE_VIS match_results
{
public:
typedef _Allocator allocator_type;
@@ -5794,8 +5763,7 @@ basic_regex<_CharT, _Traits>::__search(
{
__m.__init(1 + mark_count(), __first, __last,
__flags & regex_constants::__no_update_pos);
if (__match_at_start(__first, __last, __m, __flags,
!(__flags & regex_constants::__no_update_pos)))
if (__match_at_start(__first, __last, __m, __flags, true))
{
__m.__prefix_.second = __m[0].first;
__m.__prefix_.matched = __m.__prefix_.first != __m.__prefix_.second;
@@ -5832,25 +5800,9 @@ regex_search(_BidirectionalIterator __first, _BidirectionalIterator __last,
const basic_regex<_CharT, _Traits>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
int __offset = (__flags & regex_constants::match_prev_avail) ? 1 : 0;
basic_string<_CharT> __s(_VSTD::prev(__first, __offset), __last);
basic_string<_CharT> __s(__first, __last);
match_results<const _CharT*> __mc;
bool __r = __e.__search(__s.data() + __offset, __s.data() + __s.size(), __mc, __flags);
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
return __r;
}
template <class _Iter, class _Allocator, class _CharT, class _Traits>
inline _LIBCPP_INLINE_VISIBILITY
bool
regex_search(__wrap_iter<_Iter> __first,
__wrap_iter<_Iter> __last,
match_results<__wrap_iter<_Iter>, _Allocator>& __m,
const basic_regex<_CharT, _Traits>& __e,
regex_constants::match_flag_type __flags = regex_constants::match_default)
{
match_results<const _CharT*> __mc;
bool __r = __e.__search(__first.base(), __last.base(), __mc, __flags);
bool __r = __e.__search(__s.data(), __s.data() + __s.size(), __mc, __flags);
__m.__assign(__first, __last, __mc, __flags & regex_constants::__no_update_pos);
return __r;
}
@@ -6010,7 +5962,7 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY regex_iterator
class _LIBCPP_TYPE_VIS regex_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6092,7 +6044,7 @@ regex_iterator<_BidirectionalIterator, _CharT, _Traits>::operator++()
{
__flags_ |= regex_constants::__no_update_pos;
_BidirectionalIterator __start = __match_[0].second;
if (__match_.empty())
if (__match_.length() == 0)
{
if (__start == __end_)
{
@@ -6122,7 +6074,7 @@ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS_ONLY regex_token_iterator
class _LIBCPP_TYPE_VIS regex_token_iterator
{
public:
typedef basic_regex<_CharT, _Traits> regex_type;

View File

@@ -365,7 +365,7 @@ struct __outermost<_Alloc, true>
};
template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_TYPE_VIS_ONLY scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
class _LIBCPP_TYPE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;

View File

@@ -66,11 +66,6 @@ public:
set(initializer_list<value_type> il, const value_compare& comp = value_compare());
set(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
template <class InputIterator>
set(InputIterator first, InputIterator last, const allocator_type& a)
: set(first, last, Compare(), a) {} // C++14
set(initializer_list<value_type> il, const allocator_type& a)
: set(il, Compare(), a) {} // C++14
~set();
set& operator=(const set& s);
@@ -134,33 +129,13 @@ public:
// set operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
template<typename K>
iterator find(const K& x);
template<typename K>
const_iterator find(const K& x) const; // C++14
template<typename K>
size_type count(const K& x) const; // C++14
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
template<typename K>
iterator lower_bound(const K& x); // C++14
template<typename K>
const_iterator lower_bound(const K& x) const; // C++14
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
template<typename K>
iterator upper_bound(const K& x); // C++14
template<typename K>
const_iterator upper_bound(const K& x) const; // C++14
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
template<typename K>
pair<iterator,iterator> equal_range(const K& x); // C++14
template<typename K>
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class Compare, class Allocator>
@@ -247,11 +222,6 @@ public:
multiset(initializer_list<value_type> il, const value_compare& comp = value_compare());
multiset(initializer_list<value_type> il, const value_compare& comp,
const allocator_type& a);
template <class InputIterator>
multiset(InputIterator first, InputIterator last, const allocator_type& a)
: set(first, last, Compare(), a) {} // C++14
multiset(initializer_list<value_type> il, const allocator_type& a)
: set(il, Compare(), a) {} // C++14
~multiset();
multiset& operator=(const multiset& s);
@@ -315,32 +285,13 @@ public:
// set operations:
iterator find(const key_type& k);
const_iterator find(const key_type& k) const;
template<typename K>
iterator find(const K& x);
template<typename K>
const_iterator find(const K& x) const; // C++14
size_type count(const key_type& k) const;
iterator lower_bound(const key_type& k);
const_iterator lower_bound(const key_type& k) const;
template<typename K>
iterator lower_bound(const K& x); // C++14
template<typename K>
const_iterator lower_bound(const K& x) const; // C++14
iterator upper_bound(const key_type& k);
const_iterator upper_bound(const key_type& k) const;
template<typename K>
iterator upper_bound(const K& x); // C++14
template<typename K>
const_iterator upper_bound(const K& x) const; // C++14
pair<iterator,iterator> equal_range(const key_type& k);
pair<const_iterator,const_iterator> equal_range(const key_type& k) const;
template<typename K>
pair<iterator,iterator> equal_range(const K& x); // C++14
template<typename K>
pair<const_iterator,const_iterator> equal_range(const K& x) const; // C++14
};
template <class Key, class Compare, class Allocator>
@@ -395,7 +346,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS_ONLY set
class _LIBCPP_TYPE_VIS set
{
public:
// types:
@@ -452,13 +403,6 @@ public:
insert(__f, __l);
}
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
set(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: set(__f, __l, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
set(const set& __s)
: __tree_(__s.__tree_)
@@ -511,12 +455,6 @@ public:
insert(__il.begin(), __il.end());
}
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
set(initializer_list<value_type> __il, const allocator_type& __a)
: set(__il, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
set& operator=(initializer_list<value_type> __il)
{
@@ -641,17 +579,6 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_unique(__k);}
@@ -661,51 +588,18 @@ public:
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,iterator>::type
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,const_iterator>::type
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_unique(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_unique(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
equal_range(const _K2& __k) {return __tree_.__equal_range_unique(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename enable_if<__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
equal_range(const _K2& __k) const {return __tree_.__equal_range_unique(__k);}
#endif
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -791,7 +685,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS_ONLY multiset
class _LIBCPP_TYPE_VIS multiset
{
public:
// types:
@@ -840,13 +734,6 @@ public:
insert(__f, __l);
}
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l, const allocator_type& __a)
: multiset(__f, __l, key_compare(), __a) {}
#endif
template <class _InputIterator>
_LIBCPP_INLINE_VISIBILITY
multiset(_InputIterator __f, _InputIterator __l,
@@ -906,12 +793,6 @@ public:
insert(__il.begin(), __il.end());
}
#if _LIBCPP_STD_VER > 11
_LIBCPP_INLINE_VISIBILITY
multiset(initializer_list<value_type> __il, const allocator_type& __a)
: multiset(__il, key_compare(), __a) {}
#endif
_LIBCPP_INLINE_VISIBILITY
multiset& operator=(initializer_list<value_type> __il)
{
@@ -1036,72 +917,27 @@ public:
iterator find(const key_type& __k) {return __tree_.find(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator find(const key_type& __k) const {return __tree_.find(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
find(const _K2& __k) {return __tree_.find(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
find(const _K2& __k) const {return __tree_.find(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
size_type count(const key_type& __k) const
{return __tree_.__count_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
iterator lower_bound(const key_type& __k)
{return __tree_.lower_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator lower_bound(const key_type& __k) const
{return __tree_.lower_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
lower_bound(const _K2& __k) {return __tree_.lower_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
lower_bound(const _K2& __k) const {return __tree_.lower_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
iterator upper_bound(const key_type& __k)
{return __tree_.upper_bound(__k);}
_LIBCPP_INLINE_VISIBILITY
const_iterator upper_bound(const key_type& __k) const
{return __tree_.upper_bound(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,iterator>::type
upper_bound(const _K2& __k) {return __tree_.upper_bound(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,const_iterator>::type
upper_bound(const _K2& __k) const {return __tree_.upper_bound(__k);}
#endif
_LIBCPP_INLINE_VISIBILITY
pair<iterator,iterator> equal_range(const key_type& __k)
{return __tree_.__equal_range_multi(__k);}
_LIBCPP_INLINE_VISIBILITY
pair<const_iterator,const_iterator> equal_range(const key_type& __k) const
{return __tree_.__equal_range_multi(__k);}
#if _LIBCPP_STD_VER > 11
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<iterator,iterator>>::type
equal_range(const _K2& __k) {return __tree_.__equal_range_multi(__k);}
template <typename _K2>
_LIBCPP_INLINE_VISIBILITY
typename _VSTD::enable_if<_VSTD::__is_transparent<_Compare, _K2>::value,pair<const_iterator,const_iterator>>::type
equal_range(const _K2& __k) const {return __tree_.__equal_range_multi(__k);}
#endif
};
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES

View File

@@ -1,419 +0,0 @@
// -*- C++ -*-
//===------------------------ shared_mutex --------------------------------===//
//
// 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_SHARED_MUTEX
#define _LIBCPP_SHARED_MUTEX
/*
shared_mutex synopsis
// C++1y
namespace std
{
class shared_mutex
{
public:
shared_mutex();
~shared_mutex();
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
// Exclusive ownership
void lock(); // blocking
bool try_lock();
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
void unlock();
// Shared ownership
void lock_shared(); // blocking
bool try_lock_shared();
template <class Rep, class Period>
bool
try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
bool
try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time);
void unlock_shared();
};
template <class Mutex>
class shared_lock
{
public:
typedef Mutex mutex_type;
// Shared locking
shared_lock() noexcept;
explicit shared_lock(mutex_type& m); // blocking
shared_lock(mutex_type& m, defer_lock_t) noexcept;
shared_lock(mutex_type& m, try_to_lock_t);
shared_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration>
shared_lock(mutex_type& m,
const chrono::time_point<Clock, Duration>& abs_time);
template <class Rep, class Period>
shared_lock(mutex_type& m,
const chrono::duration<Rep, Period>& rel_time);
~shared_lock();
shared_lock(shared_lock const&) = delete;
shared_lock& operator=(shared_lock const&) = delete;
shared_lock(shared_lock&& u) noexcept;
shared_lock& operator=(shared_lock&& u) noexcept;
void lock(); // blocking
bool try_lock();
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
void unlock();
// Setters
void swap(shared_lock& u) noexcept;
mutex_type* release() noexcept;
// Getters
bool owns_lock() const noexcept;
explicit operator bool () const noexcept;
mutex_type* mutex() const noexcept;
};
template <class Mutex>
void swap(shared_lock<Mutex>& x, shared_lock<Mutex>& y) noexcept;
} // std
*/
#include <__config>
#if _LIBCPP_STD_VER > 11 || defined(_LIBCPP_BUILDING_SHARED_MUTEX)
#include <__mutex_base>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS shared_mutex
{
mutex __mut_;
condition_variable __gate1_;
condition_variable __gate2_;
unsigned __state_;
static const unsigned __write_entered_ = 1U << (sizeof(unsigned)*__CHAR_BIT__ - 1);
static const unsigned __n_readers_ = ~__write_entered_;
public:
shared_mutex();
_LIBCPP_INLINE_VISIBILITY ~shared_mutex() = default;
shared_mutex(const shared_mutex&) = delete;
shared_mutex& operator=(const shared_mutex&) = delete;
// Exclusive ownership
void lock();
bool try_lock();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool
try_lock_for(const chrono::duration<_Rep, _Period>& __rel_time)
{
return try_lock_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Clock, class _Duration>
bool
try_lock_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock();
// Shared ownership
void lock_shared();
bool try_lock_shared();
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
bool
try_lock_shared_for(const chrono::duration<_Rep, _Period>& __rel_time)
{
return try_lock_shared_until(chrono::steady_clock::now() + __rel_time);
}
template <class _Clock, class _Duration>
bool
try_lock_shared_until(const chrono::time_point<_Clock, _Duration>& __abs_time);
void unlock_shared();
};
template <class _Clock, class _Duration>
bool
shared_mutex::try_lock_until(
const chrono::time_point<_Clock, _Duration>& __abs_time)
{
unique_lock<mutex> __lk(__mut_);
if (__state_ & __write_entered_)
{
while (true)
{
cv_status __status = __gate1_.wait_until(__lk, __abs_time);
if ((__state_ & __write_entered_) == 0)
break;
if (__status == cv_status::timeout)
return false;
}
}
__state_ |= __write_entered_;
if (__state_ & __n_readers_)
{
while (true)
{
cv_status __status = __gate2_.wait_until(__lk, __abs_time);
if ((__state_ & __n_readers_) == 0)
break;
if (__status == cv_status::timeout)
{
__state_ &= ~__write_entered_;
return false;
}
}
}
return true;
}
template <class _Clock, class _Duration>
bool
shared_mutex::try_lock_shared_until(
const chrono::time_point<_Clock, _Duration>& __abs_time)
{
unique_lock<mutex> __lk(__mut_);
if ((__state_ & __write_entered_) || (__state_ & __n_readers_) == __n_readers_)
{
while (true)
{
cv_status status = __gate1_.wait_until(__lk, __abs_time);
if ((__state_ & __write_entered_) == 0 &&
(__state_ & __n_readers_) < __n_readers_)
break;
if (status == cv_status::timeout)
return false;
}
}
unsigned __num_readers = (__state_ & __n_readers_) + 1;
__state_ &= ~__n_readers_;
__state_ |= __num_readers;
return true;
}
template <class _Mutex>
class shared_lock
{
public:
typedef _Mutex mutex_type;
private:
mutex_type* __m_;
bool __owns_;
public:
_LIBCPP_INLINE_VISIBILITY
shared_lock() noexcept
: __m_(nullptr),
__owns_(false)
{}
_LIBCPP_INLINE_VISIBILITY
explicit shared_lock(mutex_type& __m)
: __m_(&__m),
__owns_(true)
{__m_->lock_shared();}
_LIBCPP_INLINE_VISIBILITY
shared_lock(mutex_type& __m, defer_lock_t) noexcept
: __m_(&__m),
__owns_(false)
{}
_LIBCPP_INLINE_VISIBILITY
shared_lock(mutex_type& __m, try_to_lock_t)
: __m_(&__m),
__owns_(__m.try_lock_shared())
{}
_LIBCPP_INLINE_VISIBILITY
shared_lock(mutex_type& __m, adopt_lock_t)
: __m_(&__m),
__owns_(true)
{}
template <class _Clock, class _Duration>
_LIBCPP_INLINE_VISIBILITY
shared_lock(mutex_type& __m,
const chrono::time_point<_Clock, _Duration>& __abs_time)
: __m_(&__m),
__owns_(__m.try_lock_shared_until(__abs_time))
{}
template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY
shared_lock(mutex_type& __m,
const chrono::duration<_Rep, _Period>& __rel_time)
: __m_(&__m),
__owns_(__m.try_lock_shared_for(__rel_time))
{}
_LIBCPP_INLINE_VISIBILITY
~shared_lock()
{
if (__owns_)
__m_->unlock_shared();
}
shared_lock(shared_lock const&) = delete;
shared_lock& operator=(shared_lock const&) = delete;
_LIBCPP_INLINE_VISIBILITY
shared_lock(shared_lock&& __u) noexcept
: __m_(__u.__m_),
__owns_(__u.__owns_)
{
__u.__m_ = nullptr;
__u.__owns_ = false;
}
_LIBCPP_INLINE_VISIBILITY
shared_lock& operator=(shared_lock&& __u) noexcept
{
if (__owns_)
__m_->unlock_shared();
__m_ = nullptr;
__owns_ = false;
__m_ = __u.__m_;
__owns_ = __u.__owns_;
__u.__m_ = nullptr;
__u.__owns_ = false;
return *this;
}
void lock();
bool try_lock();
template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration>
bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time);
void unlock();
// Setters
_LIBCPP_INLINE_VISIBILITY
void swap(shared_lock& __u) noexcept
{
_VSTD::swap(__m_, __u.__m_);
_VSTD::swap(__owns_, __u.__owns_);
}
_LIBCPP_INLINE_VISIBILITY
mutex_type* release() noexcept
{
mutex_type* __m = __m_;
__m_ = nullptr;
__owns_ = false;
return __m;
}
// Getters
_LIBCPP_INLINE_VISIBILITY
bool owns_lock() const noexcept {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
explicit operator bool () const noexcept {return __owns_;}
_LIBCPP_INLINE_VISIBILITY
mutex_type* mutex() const noexcept {return __m_;}
};
template <class _Mutex>
void
shared_lock<_Mutex>::lock()
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "shared_lock::lock: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "shared_lock::lock: already locked");
__m_->lock_shared();
__owns_ = true;
}
template <class _Mutex>
bool
shared_lock<_Mutex>::try_lock()
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "shared_lock::try_lock: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "shared_lock::try_lock: already locked");
__owns_ = __m_->try_lock_shared();
return __owns_;
}
template <class _Mutex>
template <class _Rep, class _Period>
bool
shared_lock<_Mutex>::try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "shared_lock::try_lock_for: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "shared_lock::try_lock_for: already locked");
__owns_ = __m_->try_lock_shared_for(__d);
return __owns_;
}
template <class _Mutex>
template <class _Clock, class _Duration>
bool
shared_lock<_Mutex>::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
{
if (__m_ == nullptr)
__throw_system_error(EPERM, "shared_lock::try_lock_until: references null mutex");
if (__owns_)
__throw_system_error(EDEADLK, "shared_lock::try_lock_until: already locked");
__owns_ = __m_->try_lock_shared_until(__t);
return __owns_;
}
template <class _Mutex>
void
shared_lock<_Mutex>::unlock()
{
if (!__owns_)
__throw_system_error(EPERM, "shared_lock::unlock: not locked");
__m_->unlock_shared();
__owns_ = false;
}
template <class _Mutex>
inline _LIBCPP_INLINE_VISIBILITY
void
swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept
{__x.swap(__y);}
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_STD_VER > 11
#endif // _LIBCPP_SHARED_MUTEX

View File

@@ -186,7 +186,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_stringbuf
class _LIBCPP_TYPE_VIS basic_stringbuf
: public basic_streambuf<_CharT, _Traits>
{
public:
@@ -613,7 +613,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_istringstream
class _LIBCPP_TYPE_VIS basic_istringstream
: public basic_istream<_CharT, _Traits>
{
public:
@@ -732,7 +732,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_ostringstream
class _LIBCPP_TYPE_VIS basic_ostringstream
: public basic_ostream<_CharT, _Traits>
{
public:
@@ -851,7 +851,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream
template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY basic_stringstream
class _LIBCPP_TYPE_VIS basic_stringstream
: public basic_iostream<_CharT, _Traits>
{
public:

View File

@@ -91,7 +91,7 @@ template <class T, class Container>
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS_ONLY stack;
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS stack;
template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
@@ -104,7 +104,7 @@ bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY stack
class _LIBCPP_TYPE_VIS stack
{
public:
typedef _Container container_type;
@@ -282,7 +282,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
}
template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<stack<_Tp, _Container>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc>
{
};

View File

@@ -119,7 +119,7 @@ protected:
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS_ONLY basic_streambuf
class _LIBCPP_TYPE_VIS basic_streambuf
{
public:
// types:
@@ -553,11 +553,11 @@ basic_streambuf<_CharT, _Traits>::overflow(int_type)
return traits_type::eof();
}
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_streambuf<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<char>)
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS basic_ios<wchar_t>)
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>)
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>)
_LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -1,99 +0,0 @@
// -*- C++ -*-
//===--------------------- support/ibm/limits.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_IBM_LIMITS_H
#define _LIBCPP_SUPPORT_IBM_LIMITS_H
#if !defined(_AIX) // Linux
#include <math.h> // for HUGE_VAL, HUGE_VALF, HUGE_VALL, and NAN
static const unsigned int _QNAN_F = 0x7fc00000;
#define NANF (*((float *)(&_QNAN_F)))
static const unsigned int _QNAN_LDBL128[4] = {0x7ff80000, 0x0, 0x0, 0x0};
#define NANL (*((long double *)(&_QNAN_LDBL128)))
static const unsigned int _SNAN_F= 0x7f855555;
#define NANSF (*((float *)(&_SNAN_F)))
static const unsigned int _SNAN_D[2] = {0x7ff55555, 0x55555555};
#define NANS (*((double *)(&_SNAN_D)))
static const unsigned int _SNAN_LDBL128[4] = {0x7ff55555, 0x55555555, 0x0, 0x0};
#define NANSL (*((long double *)(&_SNAN_LDBL128)))
#define __builtin_huge_val() HUGE_VAL
#define __builtin_huge_valf() HUGE_VALF
#define __builtin_huge_vall() HUGE_VALL
#define __builtin_nan(__dummy) NAN
#define __builtin_nanf(__dummy) NANF
#define __builtin_nanl(__dummy) NANL
#define __builtin_nans(__dummy) NANS
#define __builtin_nansf(__dummy) NANSF
#define __builtin_nansl(__dummy) NANSL
#else
#include <math.h>
#include <float.h> // limit constants
#define __builtin_huge_val() HUGE_VAL //0x7ff0000000000000
#define __builtin_huge_valf() HUGE_VALF //0x7f800000
#define __builtin_huge_vall() HUGE_VALL //0x7ff0000000000000
#define __builtin_nan(__dummy) nan(__dummy) //0x7ff8000000000000
#define __builtin_nanf(__dummy) nanf(__dummy) // 0x7ff80000
#define __builtin_nanl(__dummy) nanl(__dummy) //0x7ff8000000000000
#define __builtin_nans(__dummy) DBL_SNAN //0x7ff5555555555555
#define __builtin_nansf(__dummy) FLT_SNAN //0x7f855555
#define __builtin_nansl(__dummy) DBL_SNAN //0x7ff5555555555555
#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 XLC on LoP
#define __FLT_DENORM_MIN__ 1.40129846e-45F
#define __DBL_MANT_DIG__ DBL_MANT_DIG
#define __DBL_DIG__ DBL_DIG
#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 XLC on LoP
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __LDBL_MANT_DIG__ LDBL_MANT_DIG
#define __LDBL_DIG__ LDBL_DIG
#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 XLC on LoP
#if __LONGDOUBLE128
#define __LDBL_DENORM_MIN__ 4.94065645841246544176568792868221e-324L
#else
#define __LDBL_DENORM_MIN__ 4.9406564584124654e-324L
#endif
// predefined by XLC on LoP
#define __CHAR_BIT__ 8
#endif // _AIX
#endif // _LIBCPP_SUPPORT_IBM_LIMITS_H

View File

@@ -1,54 +0,0 @@
// -*- C++ -*-
//===----------------------- support/ibm/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_IBM_SUPPORT_H
#define _LIBCPP_SUPPORT_IBM_SUPPORT_H
extern "builtin" int __popcnt4(unsigned int);
extern "builtin" int __popcnt8(unsigned long long);
extern "builtin" unsigned int __cnttz4(unsigned int);
extern "builtin" unsigned int __cnttz8(unsigned long long);
extern "builtin" unsigned int __cntlz4(unsigned long long);
extern "builtin" unsigned int __cntlz8(unsigned long long);
// Builtin functions for counting population
#define __builtin_popcount(x) __popcnt4(x)
#define __builtin_popcountll(x) __popcnt8(x)
#if defined(__64BIT__)
#define __builtin_popcountl(x) __builtin_popcountll(x)
#else
#define __builtin_popcountl(x) __builtin_popcount(x)
#endif
// Builtin functions for counting trailing zeros
#define __builtin_ctz(x) __cnttz4(x)
#define __builtin_ctzll(x) __cnttz8(x)
#if defined(__64BIT__)
#define __builtin_ctzl(x) __builtin_ctzll(x)
#else
#define __builtin_ctzl(x) __builtin_ctz(x)
#endif
// Builtin functions for counting leading zeros
#define __builtin_clz(x) __cntlz4(x)
#define __builtin_clzll(x) __cntlz8(x)
#if defined(__64BIT__)
#define __builtin_clzl(x) __builtin_clzll(x)
#else
#define __builtin_clzl(x) __builtin_clz(x)
#endif
#if defined(__64BIT__)
#define __SIZE_WIDTH__ 64
#else
#define __SIZE_WIDTH__ 32
#endif
#endif // _LIBCPP_SUPPORT_IBM_SUPPORT_H

View File

@@ -1,326 +0,0 @@
// -*- C++ -*-
//===--------------------- support/ibm/xlocale.h -------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef _LIBCPP_SUPPORT_IBM_XLOCALE_H
#define _LIBCPP_SUPPORT_IBM_XLOCALE_H
#if defined(_AIX)
#include "cstdlib"
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(_AIX71)
// AIX 7.1 and higher has these definitions. Definitions and stubs
// are provied here as a temporary workaround on AIX 6.1.
#define LC_COLLATE_MASK 1
#define LC_CTYPE_MASK 2
#define LC_MESSAGES_MASK 4
#define LC_MONETARY_MASK 8
#define LC_NUMERIC_MASK 16
#define LC_TIME_MASK 32
#define LC_ALL_MASK (LC_COLLATE_MASK | LC_CTYPE_MASK | \
LC_MESSAGES_MASK | LC_MONETARY_MASK |\
LC_NUMERIC_MASK | LC_TIME_MASK)
typedef void* locale_t;
// The following are stubs. They are not supported on AIX 6.1.
static inline
locale_t newlocale(int category_mask, const char *locale, locale_t base)
{
_LC_locale_t *newloc, *loc;
if ((loc = (_LC_locale_t *)__xopen_locale(locale)) == NULL)
{
errno = EINVAL;
return (locale_t)0;
}
if ((newloc = (_LC_locale_t *)calloc(1, sizeof(_LC_locale_t))) == NULL)
{
errno = ENOMEM;
return (locale_t)0;
}
if (!base)
base = (_LC_locale_t *)__xopen_locale("C");
memcpy(newloc, base, sizeof (_LC_locale_t));
if (category_mask & LC_COLLATE_MASK)
newloc->lc_collate = loc->lc_collate;
if (category_mask & LC_CTYPE_MASK)
newloc->lc_ctype = loc->lc_ctype;
//if (category_mask & LC_MESSAGES_MASK)
// newloc->lc_messages = loc->lc_messages;
if (category_mask & LC_MONETARY_MASK)
newloc->lc_monetary = loc->lc_monetary;
if (category_mask & LC_TIME_MASK)
newloc->lc_time = loc->lc_time;
if (category_mask & LC_NUMERIC_MASK)
newloc->lc_numeric = loc->lc_numeric;
return (locale_t)newloc;
}
static inline
void freelocale(locale_t locobj)
{
free(locobj);
}
static inline
locale_t uselocale(locale_t newloc)
{
return (locale_t)0;
}
static inline
int isalnum_l(int c, locale_t locale)
{
return __xisalnum(locale, c);
}
static inline
int isalpha_l(int c, locale_t locale)
{
return __xisalpha(locale, c);
}
static inline
int isblank_l(int c, locale_t locale)
{
return __xisblank(locale, c);
}
static inline
int iscntrl_l(int c, locale_t locale)
{
return __xiscntrl(locale, c);
}
static inline
int isdigit_l(int c, locale_t locale)
{
return __xisdigit(locale, c);
}
static inline
int isgraph_l(int c, locale_t locale)
{
return __xisgraph(locale, c);
}
static inline
int islower_l(int c, locale_t locale)
{
return __xislower(locale, c);
}
static inline
int isprint_l(int c, locale_t locale)
{
return __xisprint(locale, c);
}
static inline
int ispunct_l(int c, locale_t locale)
{
return __xispunct(locale, c);
}
static inline
int isspace_l(int c, locale_t locale)
{
return __xisspace(locale, c);
}
static inline
int isupper_l(int c, locale_t locale)
{
return __xisupper(locale, c);
}
static inline
int isxdigit_l(int c, locale_t locale)
{
return __xisxdigit(locale, c);
}
static inline
int iswalnum_l(wchar_t wc, locale_t locale)
{
return __xiswalnum(locale, wc);
}
static inline
int iswalpha_l(wchar_t wc, locale_t locale)
{
return __xiswalpha(locale, wc);
}
static inline
int iswblank_l(wchar_t wc, locale_t locale)
{
return __xiswblank(locale, wc);
}
static inline
int iswcntrl_l(wchar_t wc, locale_t locale)
{
return __xiswcntrl(locale, wc);
}
static inline
int iswdigit_l(wchar_t wc, locale_t locale)
{
return __xiswdigit(locale, wc);
}
static inline
int iswgraph_l(wchar_t wc, locale_t locale)
{
return __xiswgraph(locale, wc);
}
static inline
int iswlower_l(wchar_t wc, locale_t locale)
{
return __xiswlower(locale, wc);
}
static inline
int iswprint_l(wchar_t wc, locale_t locale)
{
return __xiswprint(locale, wc);
}
static inline
int iswpunct_l(wchar_t wc, locale_t locale)
{
return __xiswpunct(locale, wc);
}
static inline
int iswspace_l(wchar_t wc, locale_t locale)
{
return __xiswspace(locale, wc);
}
static inline
int iswupper_l(wchar_t wc, locale_t locale)
{
return __xiswupper(locale, wc);
}
static inline
int iswxdigit_l(wchar_t wc, locale_t locale)
{
return __xiswxdigit(locale, wc);
}
static inline
int iswctype_l(wint_t wc, wctype_t desc, locale_t locale)
{
return __xiswctype(locale, wc, desc);
}
static inline
int toupper_l(int c, locale_t locale)
{
return __xtoupper(locale, c);
}
static inline
int tolower_l(int c, locale_t locale)
{
return __xtolower(locale, c);
}
static inline
wint_t towupper_l(wint_t wc, locale_t locale)
{
return __xtowupper(locale, wc);
}
static inline
wint_t towlower_l(wint_t wc, locale_t locale)
{
return __xtowlower(locale, wc);
}
static inline
int strcoll_l(const char *__s1, const char *__s2, locale_t locale)
{
return __xstrcoll(locale, __s1, __s2);
}
static inline
int wcscoll_l(const wchar_t *__s1, const wchar_t *__s2, locale_t locale)
{
return __xwcscoll(locale, __s1, __s2);
}
static inline
size_t strxfrm_l(char *__s1, const char *__s2, size_t __n, locale_t locale)
{
return __xstrxfrm(locale, __s1, __s2, __n);
}
static inline
size_t wcsxfrm_l(wchar_t *__ws1, const wchar_t *__ws2, size_t __n,
locale_t locale)
{
return __xwcsxfrm(locale, __ws1, __ws2, __n);
}
#endif // !defined(_AIX71)
// strftime_l() is defined by POSIX. However, AIX 7.1 does not have it
// implemented yet.
static inline
size_t strftime_l(char *__s, size_t __size, const char *__fmt,
const struct tm *__tm, locale_t locale) {
return __xstrftime(locale, __s, __size, __fmt, __tm);
}
// The following are not POSIX routines. 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 locale) {
return strtoll(__nptr, __endptr, __base);
}
static inline
long strtol_l(const char *__nptr, char **__endptr,
int __base, locale_t locale) {
return strtol(__nptr, __endptr, __base);
}
static inline
long double strtold_l(const char *__nptr, char **__endptr,
locale_t locale) {
return strtold(__nptr, __endptr);
}
static inline
unsigned long long strtoull_l(const char *__nptr, char **__endptr,
int __base, locale_t locale) {
return strtoull(__nptr, __endptr, __base);
}
static inline
unsigned long strtoul_l(const char *__nptr, char **__endptr,
int __base, locale_t locale) {
return strtoul(__nptr, __endptr, __base);
}
static inline
int vasprintf(char **strp, const char *fmt, va_list ap)
{
const size_t buff_size = 256;
int str_size;
if ((*strp = (char *)malloc(buff_size)) == NULL)
{
return -1;
}
if ((str_size = vsnprintf(*strp, buff_size, fmt, ap)) >= buff_size)
{
if ((*strp = (char *)realloc(*strp, str_size + 1)) == NULL)
{
return -1;
}
str_size = vsnprintf(*strp, str_size + 1, fmt, ap);
}
return str_size;
}
#ifdef __cplusplus
}
#endif
#endif // defined(_AIX)
#endif // _LIBCPP_SUPPORT_IBM_XLOCALE_H

View File

@@ -11,15 +11,16 @@
#ifndef _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H
#if !defined(_LIBCPP_MSVCRT)
#error "This header complements the Microsoft C Runtime library, and should not be included otherwise."
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#include <limits.h> // CHAR_BIT
#include <float.h> // limit constants
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // ymath.h works correctly
#if ! defined(__clang__)
#define __CHAR_BIT__ CHAR_BIT
#include <float.h> // limit constants
#define __FLT_MANT_DIG__ FLT_MANT_DIG
#define __FLT_DIG__ FLT_DIG
@@ -72,8 +73,7 @@
#define __builtin_nans(__dummy) _Snan._Double
#define __builtin_nansf(__dummy) _FSnan._Float
#define __builtin_nansl(__dummy) _LSnan._Long_double
#endif // ! defined(__clang__)
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LIMITS_WIN32_H

View File

@@ -15,7 +15,6 @@
extern "C" unsigned short __declspec(dllimport) _ctype[];
#include "support/win32/support.h"
#include <stdio.h>
#include <memory>
#include <xlocinfo.h> // _locale_t
#define locale_t _locale_t
@@ -36,23 +35,23 @@ extern "C" unsigned short __declspec(dllimport) _ctype[];
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,
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);
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;
inline _LIBCPP_ALWAYS_INLINE
_LIBCPP_ALWAYS_INLINE inline
decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
{
__locale_raii __current( uselocale(__l), uselocale );
@@ -60,6 +59,7 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
}
// 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
@@ -103,9 +103,9 @@ isupper_l(int c, _locale_t loc)
#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 snprintf_l(char *ret, size_t n, locale_t loc, const char *format, ...);
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 );
@@ -120,10 +120,10 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ )
return ( c == L' ' || c == L'\t' );
}
#if defined(_LIBCPP_MSVCRT)
#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 // _LIBCPP_MSVCRT
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

@@ -11,14 +11,12 @@
#ifndef _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#define _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H
#if !defined(_LIBCPP_MSVCRT)
#error "This header complements Microsoft's C Runtime library, and should not be included otherwise."
#if !defined(_MSC_VER)
#error "This header is MSVC specific, Clang and GCC should not include it"
#else
#include <math.h>
#include <float.h> // _FPCLASS_PN etc.
// Necessary?
typedef float float_t;
typedef double double_t;
@@ -110,6 +108,6 @@ _LIBCPP_ALWAYS_INLINE int fpclassify( double num )
return _fpclass(num);
}
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_MATH_WIN32_H

View File

@@ -15,27 +15,26 @@
Functions and constants used in libc++ that are missing from the Windows C library.
*/
#include <__config>
#include <wchar.h> // mbstate_t
#include <cstdarg> // va_ macros
#include <stdio.h> // _snwprintf
#define swprintf _snwprintf
#define vswprintf _vsnwprintf
#define vfscnaf fscanf
#ifndef NOMINMAX
#define NOMINMAX
#endif
extern "C" {
int vasprintf( char **sptr, const char *__restrict fmt, va_list ap );
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(_LIBCPP_MSVCRT)
#if defined(_MSC_VER)
#define snprintf _snprintf
#include <xlocinfo.h>
#define atoll _atoi64
#define strtoll _strtoi64
@@ -86,11 +85,9 @@ _LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
_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;
@@ -113,6 +110,6 @@ _LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
return static_cast<int>(r);
}
#endif // !__clang__
#endif // _LIBCPP_MSVCRT
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -22,7 +22,6 @@ class error_category
public:
virtual ~error_category() noexcept;
constexpr error_category();
error_category(const error_category&) = delete;
error_category& operator=(const error_category&) = delete;
@@ -233,13 +232,13 @@ _LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_error_code_enum
struct _LIBCPP_TYPE_VIS is_error_code_enum
: public false_type {};
// is_error_condition_enum
template <class _Tp>
struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum
struct _LIBCPP_TYPE_VIS is_error_condition_enum
: public false_type {};
// Some error codes are not present on all platforms, so we provide equivalents
@@ -346,12 +345,12 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc>
: true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <>
struct _LIBCPP_TYPE_VIS_ONLY is_error_condition_enum<errc::__lx>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc::__lx>
: true_type { };
#endif
@@ -367,12 +366,7 @@ class _LIBCPP_TYPE_VIS error_category
public:
virtual ~error_category() _NOEXCEPT;
#ifdef _LIBCPP_BUILDING_SYSTEM_ERROR
error_category() _NOEXCEPT;
#else
_LIBCPP_ALWAYS_INLINE
_LIBCPP_CONSTEXPR_AFTER_CXX11 error_category() _NOEXCEPT _LIBCPP_DEFAULT;
#endif
private:
error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete;
@@ -403,8 +397,8 @@ public:
virtual string message(int ev) const;
};
_LIBCPP_FUNC_VIS const error_category& generic_category() _NOEXCEPT;
_LIBCPP_FUNC_VIS const error_category& system_category() _NOEXCEPT;
const error_category& generic_category() _NOEXCEPT;
const error_category& system_category() _NOEXCEPT;
class _LIBCPP_TYPE_VIS error_condition
{
@@ -603,7 +597,7 @@ operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);}
template <>
struct _LIBCPP_TYPE_VIS_ONLY hash<error_code>
struct _LIBCPP_TYPE_VIS hash<error_code>
: public unary_function<error_code, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -635,7 +629,7 @@ private:
static string __init(const error_code&, string);
};
_LIBCPP_FUNC_VIS void __throw_system_error(int ev, const char* what_arg);
void __throw_system_error(int ev, const char* what_arg);
_LIBCPP_END_NAMESPACE_STD

View File

@@ -185,9 +185,10 @@ _LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT;
} // this_thread
template<> struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>;
class _LIBCPP_TYPE_VIS __thread_id;
template<> struct _LIBCPP_TYPE_VIS hash<__thread_id>;
class _LIBCPP_TYPE_VIS_ONLY __thread_id
class _LIBCPP_TYPE_VIS __thread_id
{
// FIXME: pthread_t is a pointer on Darwin but a long on Linux.
// NULL is the no-thread value on Darwin. Someone needs to check
@@ -230,11 +231,11 @@ private:
friend __thread_id this_thread::get_id() _NOEXCEPT;
friend class _LIBCPP_TYPE_VIS thread;
friend struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>;
friend struct _LIBCPP_TYPE_VIS hash<__thread_id>;
};
template<>
struct _LIBCPP_TYPE_VIS_ONLY hash<__thread_id>
struct _LIBCPP_TYPE_VIS hash<__thread_id>
: public unary_function<__thread_id, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -306,7 +307,7 @@ class __assoc_sub_state;
class _LIBCPP_HIDDEN __thread_struct_imp;
class _LIBCPP_TYPE_VIS __thread_struct
class __thread_struct
{
__thread_struct_imp* __p_;
@@ -320,7 +321,7 @@ public:
void __make_ready_at_thread_exit(__assoc_sub_state*);
};
_LIBCPP_FUNC_VIS __thread_specific_ptr<__thread_struct>& __thread_local_data();
__thread_specific_ptr<__thread_struct>& __thread_local_data();
#ifndef _LIBCPP_HAS_NO_VARIADICS
@@ -404,7 +405,7 @@ void swap(thread& __x, thread& __y) _NOEXCEPT {__x.swap(__y);}
namespace this_thread
{
_LIBCPP_FUNC_VIS void sleep_for(const chrono::nanoseconds& ns);
void sleep_for(const chrono::nanoseconds& ns);
template <class _Rep, class _Period>
void

View File

@@ -21,19 +21,19 @@ template <class... T>
class tuple {
public:
constexpr tuple();
explicit tuple(const T&...); // constexpr in C++14
explicit tuple(const T&...);
template <class... U>
explicit tuple(U&&...); // constexpr in C++14
explicit tuple(U&&...);
tuple(const tuple&) = default;
tuple(tuple&&) = default;
template <class... U>
tuple(const tuple<U...>&); // constexpr in C++14
tuple(const tuple<U...>&);
template <class... U>
tuple(tuple<U...>&&); // constexpr in C++14
tuple(tuple<U...>&&);
template <class U1, class U2>
tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2 // constexpr in C++14
tuple(const pair<U1, U2>&); // iff sizeof...(T) == 2
template <class U1, class U2>
tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2 // constexpr in C++14
tuple(pair<U1, U2>&&); // iff sizeof...(T) == 2
// allocator-extended constructors
template <class Alloc>
@@ -72,10 +72,10 @@ public:
const unspecified ignore;
template <class... T> tuple<V...> make_tuple(T&&...); // constexpr in C++14
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept; // constexpr in C++14
template <class... T> tuple<V...> make_tuple(T&&...);
template <class... T> tuple<ATypes...> forward_as_tuple(T&&...) noexcept;
template <class... T> tuple<T&...> tie(T&...) noexcept;
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls); // constexpr in C++14
template <class... Tuples> tuple<CTypes...> tuple_cat(Tuples&&... tpls);
// 20.4.1.4, tuple helper classes:
template <class T> class tuple_size; // undefined
@@ -86,28 +86,21 @@ template <intsize_t I, class... T> class tuple_element<I, tuple<T...>>;
// 20.4.1.5, element access:
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&
get(tuple<T...>&) noexcept; // constexpr in C++14
get(tuple<T...>&) noexcept;
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type const&
get(const tuple<T...>&) noexcept; // constexpr in C++14
get(const tuple<T...>&) noexcept;
template <intsize_t I, class... T>
typename tuple_element<I, tuple<T...>>::type&&
get(tuple<T...>&&) noexcept; // constexpr in C++14
template <class T1, class... T>
constexpr T1& get(tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1 const& get(const tuple<T...>&) noexcept; // C++14
template <class T1, class... T>
constexpr T1&& get(tuple<T...>&&) noexcept; // C++14
get(tuple<T...>&&) noexcept;
// 20.4.1.6, relational operators:
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator<(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator!=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator>(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&); // constexpr in C++14
template<class... T, class... U> bool operator==(const tuple<T...>&, const tuple<U...>&);
template<class... T, class... U> bool operator<(const tuple<T...>&, const tuple<U...>&);
template<class... T, class... U> bool operator!=(const tuple<T...>&, const tuple<U...>&);
template<class... T, class... U> bool operator>(const tuple<T...>&, const tuple<U...>&);
template<class... T, class... U> bool operator<=(const tuple<T...>&, const tuple<U...>&);
template<class... T, class... U> bool operator>=(const tuple<T...>&, const tuple<U...>&);
template <class... Types, class Alloc>
struct uses_allocator<tuple<Types...>, Alloc>;
@@ -133,12 +126,74 @@ template <class... Types>
_LIBCPP_BEGIN_NAMESPACE_STD
// allocator_arg_t
struct _LIBCPP_TYPE_VIS allocator_arg_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_MEMORY)
extern const allocator_arg_t allocator_arg;
#else
constexpr allocator_arg_t allocator_arg = allocator_arg_t();
#endif
// uses_allocator
template <class _Tp>
struct __has_allocator_type
{
private:
struct __two {char __lx; char __lxx;};
template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::allocator_type* = 0);
public:
static const bool value = sizeof(__test<_Tp>(0)) == 1;
};
template <class _Tp, class _Alloc, bool = __has_allocator_type<_Tp>::value>
struct __uses_allocator
: public integral_constant<bool,
is_convertible<_Alloc, typename _Tp::allocator_type>::value>
{
};
template <class _Tp, class _Alloc>
struct __uses_allocator<_Tp, _Alloc, false>
: public false_type
{
};
template <class _Tp, class _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator
: public __uses_allocator<_Tp, _Alloc>
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
// uses-allocator construction
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor_imp
{
static const bool __ua = uses_allocator<_Tp, _Alloc>::value;
static const bool __ic =
is_constructible<_Tp, allocator_arg_t, _Alloc, _Args...>::value;
static const int value = __ua ? 2 - __ic : 0;
};
template <class _Tp, class _Alloc, class ..._Args>
struct __uses_alloc_ctor
: integral_constant<int, __uses_alloc_ctor_imp<_Tp, _Alloc, _Args...>::value>
{};
#endif // _LIBCPP_HAS_NO_VARIADICS
#ifndef _LIBCPP_HAS_NO_VARIADICS
// tuple_size
template <class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<tuple<_Tp...> >
class _LIBCPP_TYPE_VIS tuple_size<tuple<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)>
{
};
@@ -146,7 +201,7 @@ class _LIBCPP_TYPE_VIS_ONLY tuple_size<tuple<_Tp...> >
// tuple_element
template <size_t _Ip, class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<_Ip, tuple<_Tp...> >
class _LIBCPP_TYPE_VIS tuple_element<_Ip, tuple<_Tp...> >
{
public:
typedef typename tuple_element<_Ip, __tuple_types<_Tp...> >::type type;
@@ -204,7 +259,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: value(_VSTD::forward<_Tp>(__t))
{static_assert(!is_reference<_Hp>::value ||
@@ -261,17 +316,15 @@ public:
>::value)),
"Attempted to construct a reference element in a tuple with an rvalue");}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_leaf(const __tuple_leaf& __t) _NOEXCEPT_(is_nothrow_copy_constructible<_Hp>::value)
: value(__t.get())
{static_assert(!is_rvalue_reference<_Hp>::value, "Can not copy a tuple with rvalue reference member");}
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR_AFTER_CXX11
__tuple_leaf(__tuple_leaf&& __t) _NOEXCEPT_(is_nothrow_move_constructible<_Hp>::value)
: value(_VSTD::forward<_Hp>(__t.get()))
{}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
_NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: value(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
@@ -289,8 +342,8 @@ public:
return 0;
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return value;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return value;}
_LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return value;}
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return value;}
};
template <size_t _Ip, class _Hp>
@@ -319,7 +372,7 @@ public:
template <class _Tp,
class = typename enable_if<is_constructible<_Hp, _Tp>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(_Tp&& __t) _NOEXCEPT_((is_nothrow_constructible<_Hp, _Tp>::value))
: _Hp(_VSTD::forward<_Tp>(__t)) {}
@@ -338,6 +391,12 @@ public:
explicit __tuple_leaf(integral_constant<int, 2>, const _Alloc& __a, _Tp&& __t)
: _Hp(_VSTD::forward<_Tp>(__t), __a) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
explicit __tuple_leaf(const __tuple_leaf<_Ip, _Tp>& __t)
_NOEXCEPT_((is_nothrow_constructible<_Hp, const _Tp&>::value))
: _Hp(__t.get()) {}
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
__tuple_leaf&
@@ -355,8 +414,8 @@ public:
return 0;
}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11 const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
_LIBCPP_INLINE_VISIBILITY _Hp& get() _NOEXCEPT {return static_cast<_Hp&>(*this);}
_LIBCPP_INLINE_VISIBILITY const _Hp& get() const _NOEXCEPT {return static_cast<const _Hp&>(*this);}
};
template <class ..._Tp>
@@ -391,7 +450,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
template <size_t ..._Uf, class ..._Tf,
size_t ..._Ul, class ..._Tl, class ..._Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit
__tuple_impl(__tuple_indices<_Uf...>, __tuple_types<_Tf...>,
__tuple_indices<_Ul...>, __tuple_types<_Tl...>,
@@ -421,7 +480,7 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
__tuple_constructible<_Tuple, tuple<_Tp...> >::value
>::type
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
__tuple_impl(_Tuple&& __t) _NOEXCEPT_((__all<is_nothrow_constructible<_Tp, typename tuple_element<_Indx,
typename __make_tuple_types<_Tuple>::type>::type>::value...>::value))
: __tuple_leaf<_Indx, _Tp>(_VSTD::forward<typename tuple_element<_Indx,
@@ -457,24 +516,13 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
return *this;
}
__tuple_impl(const __tuple_impl&) = default;
__tuple_impl(__tuple_impl&&) = default;
_LIBCPP_INLINE_VISIBILITY
__tuple_impl&
operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__tuple_impl&
operator=(__tuple_impl&& __t) _NOEXCEPT_((__all<is_nothrow_move_assignable<_Tp>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(_VSTD::forward<_Tp>(static_cast<__tuple_leaf<_Indx, _Tp>&>(__t).get()))...);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
__tuple_impl&
operator=(const __tuple_impl& __t) _NOEXCEPT_((__all<is_nothrow_copy_assignable<_Tp>::value...>::value))
{
__swallow(__tuple_leaf<_Indx, _Tp>::operator=(static_cast<const __tuple_leaf<_Indx, _Tp>&>(__t).get())...);
return *this;
}
_LIBCPP_INLINE_VISIBILITY
void swap(__tuple_impl& __t)
@@ -485,17 +533,17 @@ struct __tuple_impl<__tuple_indices<_Indx...>, _Tp...>
};
template <class ..._Tp>
class _LIBCPP_TYPE_VIS_ONLY tuple
class _LIBCPP_TYPE_VIS tuple
{
typedef __tuple_impl<typename __make_tuple_indices<sizeof...(_Tp)>::type, _Tp...> base;
base base_;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type& get(tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
template <size_t _Jp, class ..._Up> friend
const typename tuple_element<_Jp, tuple<_Up...> >::type& get(const tuple<_Up...>&) _NOEXCEPT;
template <size_t _Jp, class ..._Up> friend _LIBCPP_CONSTEXPR_AFTER_CXX11
template <size_t _Jp, class ..._Up> friend
typename tuple_element<_Jp, tuple<_Up...> >::type&& get(tuple<_Up...>&&) _NOEXCEPT;
public:
@@ -503,7 +551,7 @@ public:
_LIBCPP_CONSTEXPR tuple()
_NOEXCEPT_(__all<is_nothrow_default_constructible<_Tp>::value...>::value) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit tuple(const _Tp& ... __t) _NOEXCEPT_((__all<is_nothrow_copy_constructible<_Tp>::value...>::value))
: base_(typename __make_tuple_indices<sizeof...(_Tp)>::type(),
typename __make_tuple_types<tuple, sizeof...(_Tp)>::type(),
@@ -538,7 +586,7 @@ public:
bool
>::type = false
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
tuple(_Up&&... __u)
_NOEXCEPT_((
is_nothrow_constructible<
@@ -578,7 +626,7 @@ public:
bool
>::type =false
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Up&&... __u)
_NOEXCEPT_((
@@ -626,7 +674,7 @@ public:
bool
>::type = false
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
@@ -638,7 +686,7 @@ public:
bool
>::type = false
>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
explicit
tuple(_Tuple&& __t) _NOEXCEPT_((is_nothrow_constructible<base, _Tuple>::value))
: base_(_VSTD::forward<_Tuple>(__t)) {}
@@ -673,7 +721,7 @@ public:
};
template <>
class _LIBCPP_TYPE_VIS_ONLY tuple<>
class _LIBCPP_TYPE_VIS tuple<>
{
public:
_LIBCPP_INLINE_VISIBILITY
@@ -708,7 +756,7 @@ swap(tuple<_Tp...>& __t, tuple<_Tp...>& __u)
// get
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>& __t) _NOEXCEPT
{
@@ -717,7 +765,7 @@ get(tuple<_Tp...>& __t) _NOEXCEPT
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>& __t) _NOEXCEPT
{
@@ -726,7 +774,7 @@ get(const tuple<_Tp...>& __t) _NOEXCEPT
}
template <size_t _Ip, class ..._Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&& __t) _NOEXCEPT
{
@@ -735,64 +783,6 @@ get(tuple<_Tp...>&& __t) _NOEXCEPT
static_cast<__tuple_leaf<_Ip, type>&&>(__t.base_).get());
}
#if _LIBCPP_STD_VER > 11
// get by type
template <typename _T1, size_t _Idx, typename... _Args>
struct __find_exactly_one_t_helper;
// -- find exactly one
template <typename _T1, size_t _Idx, typename... _Args>
struct __find_exactly_one_t_checker {
static constexpr size_t value = _Idx;
// Check the rest of the list to make sure there's only one
static_assert ( __find_exactly_one_t_helper<_T1, 0, _Args...>::value == -1, "type can only occur once in type list" );
};
template <typename _T1, size_t _Idx>
struct __find_exactly_one_t_helper <_T1, _Idx> {
static constexpr size_t value = -1;
};
template <typename _T1, size_t _Idx, typename _Head, typename... _Args>
struct __find_exactly_one_t_helper <_T1, _Idx, _Head, _Args...> {
static constexpr size_t value =
std::conditional<
std::is_same<_T1, _Head>::value,
__find_exactly_one_t_checker<_T1, _Idx, _Args...>,
__find_exactly_one_t_helper <_T1, _Idx+1, _Args...>
>::type::value;
};
template <typename _T1, typename... _Args>
struct __find_exactly_one_t {
static constexpr size_t value = __find_exactly_one_t_helper<_T1, 0, _Args...>::value;
static_assert ( value != -1, "type not found in type list" );
};
template <class _T1, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1& get(tuple<_Args...>& __tup) noexcept
{
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const& get(tuple<_Args...> const& __tup) noexcept
{
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(__tup);
}
template <class _T1, class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1&& get(tuple<_Args...>&& __tup) noexcept
{
return _VSTD::get<__find_exactly_one_t<_T1, _Args...>::value>(_VSTD::move(__tup));
}
#endif
// tie
template <class ..._Tp>
@@ -813,7 +803,7 @@ struct __ignore_t
namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>(); }
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
template <class _Tp> class _LIBCPP_TYPE_VIS reference_wrapper;
template <class _Tp>
struct ___make_tuple_return
@@ -834,7 +824,7 @@ struct __make_tuple_return
};
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
tuple<typename __make_tuple_return<_Tp>::type...>
make_tuple(_Tp&&... __t)
{
@@ -842,7 +832,7 @@ make_tuple(_Tp&&... __t)
}
template <class... _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
tuple<_Tp&&...>
forward_as_tuple(_Tp&&... __t) _NOEXCEPT
{
@@ -853,7 +843,7 @@ template <size_t _Ip>
struct __tuple_equal
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_equal<_Ip - 1>()(__x, __y) && get<_Ip-1>(__x) == get<_Ip-1>(__y);
@@ -864,7 +854,7 @@ template <>
struct __tuple_equal<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return true;
@@ -872,7 +862,7 @@ struct __tuple_equal<0>
};
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -880,7 +870,7 @@ operator==(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -891,7 +881,7 @@ template <size_t _Ip>
struct __tuple_less
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp& __x, const _Up& __y)
{
return __tuple_less<_Ip-1>()(__x, __y) ||
@@ -903,7 +893,7 @@ template <>
struct __tuple_less<0>
{
template <class _Tp, class _Up>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
bool operator()(const _Tp&, const _Up&)
{
return false;
@@ -911,7 +901,7 @@ struct __tuple_less<0>
};
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -919,7 +909,7 @@ operator<(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -927,7 +917,7 @@ operator>(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -935,7 +925,7 @@ operator>=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
}
template <class ..._Tp, class ..._Up>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const tuple<_Tp...>& __x, const tuple<_Up...>& __y)
{
@@ -993,7 +983,7 @@ struct __tuple_cat_return<>
typedef tuple<> type;
};
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
tuple<>
tuple_cat()
{
@@ -1040,16 +1030,16 @@ template <class ..._Types, size_t ..._I0, size_t ..._J0>
struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J0...> >
{
template <class _Tuple0>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0)
{
return forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
return _VSTD::forward_as_tuple(_VSTD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...);
}
template <class _Tuple0, class _Tuple1, class ..._Tuples>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return_ref<tuple<_Types...>&&, _Tuple0&&, _Tuple1&&, _Tuples&&...>::type
operator()(tuple<_Types...> __t, _Tuple0&& __t0, _Tuple1&& __t1, _Tuples&& ...__tpls)
{
@@ -1059,7 +1049,7 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
tuple<_Types..., typename __apply_cv<_Tuple0, typename tuple_element<_J0, _T0>::type>::type&&...>,
typename __make_tuple_indices<sizeof ...(_Types) + tuple_size<_T0>::value>::type,
typename __make_tuple_indices<tuple_size<_T1>::value>::type>()
(forward_as_tuple(
(_VSTD::forward_as_tuple(
_VSTD::forward<_Types>(get<_I0>(__t))...,
get<_J0>(_VSTD::forward<_Tuple0>(__t0))...
),
@@ -1069,7 +1059,7 @@ struct __tuple_cat<tuple<_Types...>, __tuple_indices<_I0...>, __tuple_indices<_J
};
template <class _Tuple0, class... _Tuples>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
typename __tuple_cat_return<_Tuple0, _Tuples...>::type
tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
{
@@ -1081,7 +1071,7 @@ tuple_cat(_Tuple0&& __t0, _Tuples&&... __tpls)
}
template <class ..._Tp, class _Alloc>
struct _LIBCPP_TYPE_VIS_ONLY uses_allocator<tuple<_Tp...>, _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<tuple<_Tp...>, _Alloc>
: true_type {};
template <class _T1, class _T2>

File diff suppressed because it is too large Load Diff

View File

@@ -55,7 +55,7 @@ struct hash<type_index>
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS_ONLY type_index
class _LIBCPP_TYPE_VIS type_index
{
const type_info* __t_;
public:
@@ -87,10 +87,10 @@ public:
const char* name() const _NOEXCEPT {return __t_->name();}
};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY hash;
template <class _Tp> struct _LIBCPP_TYPE_VIS hash;
template <>
struct _LIBCPP_TYPE_VIS_ONLY hash<type_index>
struct _LIBCPP_TYPE_VIS hash<type_index>
: public unary_function<type_index, size_t>
{
_LIBCPP_INLINE_VISIBILITY

File diff suppressed because it is too large Load Diff

View File

@@ -68,16 +68,6 @@ public:
unordered_set(initializer_list<value_type>, size_type n = 0,
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type());
unordered_set(size_type n, const allocator_type& a); // C++14
unordered_set(size_type n, const hasher& hf, const allocator_type& a); // C++14
template <class InputIterator>
unordered_set(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
template <class InputIterator>
unordered_set(InputIterator f, InputIterator l, size_type n,
const hasher& hf, const allocator_type& a); // C++14
unordered_set(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
unordered_set(initializer_list<value_type> il, size_type n,
const hasher& hf, const allocator_type& a); // C++14
~unordered_set();
unordered_set& operator=(const unordered_set&);
unordered_set& operator=(unordered_set&&)
@@ -217,16 +207,6 @@ public:
unordered_multiset(initializer_list<value_type>, size_type n = /see below/,
const hasher& hf = hasher(), const key_equal& eql = key_equal(),
const allocator_type& a = allocator_type());
unordered_multiset(size_type n, const allocator_type& a); // C++14
unordered_multiset(size_type n, const hasher& hf, const allocator_type& a); // C++14
template <class InputIterator>
unordered_multiset(InputIterator f, InputIterator l, size_type n, const allocator_type& a); // C++14
template <class InputIterator>
unordered_multiset(InputIterator f, InputIterator l, size_type n,
const hasher& hf, const allocator_type& a); // C++14
unordered_multiset(initializer_list<value_type> il, size_type n, const allocator_type& a); // C++14
unordered_multiset(initializer_list<value_type> il, size_type n,
const hasher& hf, const allocator_type& a); // C++14
~unordered_multiset();
unordered_multiset& operator=(const unordered_multiset&);
unordered_multiset& operator=(unordered_multiset&&)
@@ -333,7 +313,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY unordered_set
class _LIBCPP_TYPE_VIS unordered_set
{
public:
// types
@@ -344,8 +324,6 @@ public:
typedef _Alloc allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<value_type, typename allocator_type::value_type>::value),
"Invalid allocator::value_type");
private:
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
@@ -366,21 +344,9 @@ public:
_LIBCPP_INLINE_VISIBILITY
unordered_set()
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
{} // = default;
explicit unordered_set(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
#if _LIBCPP_STD_VER > 11
inline _LIBCPP_INLINE_VISIBILITY
unordered_set(size_type __n, const allocator_type& __a)
: unordered_set(__n, hasher(), key_equal(), __a) {}
inline _LIBCPP_INLINE_VISIBILITY
unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_set(__n, __hf, key_equal(), __a) {}
#endif
unordered_set(size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
template <class _InputIterator>
@@ -393,17 +359,6 @@ public:
unordered_set(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
unordered_set(_InputIterator __first, _InputIterator __last,
size_type __n, const allocator_type& __a)
: unordered_set(__first, __last, __n, hasher(), key_equal(), __a) {}
template <class _InputIterator>
unordered_set(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_set(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
explicit unordered_set(const allocator_type& __a);
unordered_set(const unordered_set& __u);
unordered_set(const unordered_set& __u, const allocator_type& __a);
@@ -420,16 +375,6 @@ public:
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#if _LIBCPP_STD_VER > 11
inline _LIBCPP_INLINE_VISIBILITY
unordered_set(initializer_list<value_type> __il, size_type __n,
const allocator_type& __a)
: unordered_set(__il, __n, hasher(), key_equal(), __a) {}
inline _LIBCPP_INLINE_VISIBILITY
unordered_set(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const allocator_type& __a)
: unordered_set(__il, __n, __hf, key_equal(), __a) {}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_set() = default;
_LIBCPP_INLINE_VISIBILITY
@@ -477,18 +422,8 @@ public:
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...);}
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_DEBUG_LEVEL >= 2
iterator emplace_hint(const_iterator __p, _Args&&... __args)
{
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"unordered_set::emplace_hint(const_iterator, args...) called with an iterator not"
" referring to this unordered_set");
return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;
}
#else
iterator emplace_hint(const_iterator, _Args&&... __args)
{return __table_.__emplace_unique(_VSTD::forward<_Args>(__args)...).first;}
#endif
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(const value_type& __x)
@@ -499,32 +434,12 @@ public:
{return __table_.__insert_unique(_VSTD::move(__x));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_DEBUG_LEVEL >= 2
iterator insert(const_iterator __p, const value_type& __x)
{
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"unordered_set::insert(const_iterator, const value_type&) called with an iterator not"
" referring to this unordered_set");
return insert(__x).first;
}
#else
iterator insert(const_iterator, const value_type& __x)
{return insert(__x).first;}
#endif
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
#if _LIBCPP_DEBUG_LEVEL >= 2
iterator insert(const_iterator __p, value_type&& __x)
{
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"unordered_set::insert(const_iterator, value_type&&) called with an iterator not"
" referring to this unordered_set");
return insert(_VSTD::move(__x)).first;
}
#else
iterator insert(const_iterator, value_type&& __x)
{return insert(_VSTD::move(__x)).first;}
#endif
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _InputIterator>
void insert(_InputIterator __first, _InputIterator __last);
@@ -600,20 +515,6 @@ public:
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL >= 2
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
bool __decrementable(const const_iterator* __i) const
{return __table_.__decrementable(__i);}
bool __addable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
#endif // _LIBCPP_DEBUG_LEVEL >= 2
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -621,9 +522,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
const hasher& __hf, const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
}
@@ -632,9 +530,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(size_type __n,
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
}
@@ -643,9 +538,6 @@ template <class _InputIterator>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
_InputIterator __first, _InputIterator __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
insert(__first, __last);
}
@@ -656,9 +548,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const hasher& __hf, const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__first, __last);
}
@@ -670,9 +559,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__first, __last);
}
@@ -683,9 +569,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const allocator_type& __a)
: __table_(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -693,9 +576,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const unordered_set& __u)
: __table_(__u.__table_)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__u.bucket_count());
insert(__u.begin(), __u.end());
}
@@ -705,9 +585,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const unordered_set& __u, const allocator_type& __a)
: __table_(__u.__table_, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__u.bucket_count());
insert(__u.begin(), __u.end());
}
@@ -721,10 +598,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
: __table_(_VSTD::move(__u.__table_))
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
__get_db()->swap(this, &__u);
#endif
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -732,19 +605,12 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
unordered_set&& __u, const allocator_type& __a)
: __table_(_VSTD::move(__u.__table_), __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__a != __u.get_allocator())
{
iterator __i = __u.begin();
while (__u.size() != 0)
__table_.__insert_unique(_VSTD::move(__u.__table_.remove(__i++)->__value_));
}
#if _LIBCPP_DEBUG_LEVEL >= 2
else
__get_db()->swap(this, &__u);
#endif
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -755,9 +621,6 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
initializer_list<value_type> __il)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
insert(__il.begin(), __il.end());
}
@@ -767,9 +630,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__il.begin(), __il.end());
}
@@ -780,9 +640,6 @@ unordered_set<_Value, _Hash, _Pred, _Alloc>::unordered_set(
const key_equal& __eql, const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__il.begin(), __il.end());
}
@@ -868,7 +725,7 @@ operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS_ONLY unordered_multiset
class _LIBCPP_TYPE_VIS unordered_multiset
{
public:
// types
@@ -879,8 +736,6 @@ public:
typedef _Alloc allocator_type;
typedef value_type& reference;
typedef const value_type& const_reference;
static_assert((is_same<value_type, typename allocator_type::value_type>::value),
"Invalid allocator::value_type");
private:
typedef __hash_table<value_type, hasher, key_equal, allocator_type> __table;
@@ -901,23 +756,11 @@ public:
_LIBCPP_INLINE_VISIBILITY
unordered_multiset()
_NOEXCEPT_(is_nothrow_default_constructible<__table>::value)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
{} // = default
explicit unordered_multiset(size_type __n, const hasher& __hf = hasher(),
const key_equal& __eql = key_equal());
unordered_multiset(size_type __n, const hasher& __hf,
const key_equal& __eql, const allocator_type& __a);
#if _LIBCPP_STD_VER > 11
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(size_type __n, const allocator_type& __a)
: unordered_multiset(__n, hasher(), key_equal(), __a) {}
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__n, __hf, key_equal(), __a) {}
#endif
template <class _InputIterator>
unordered_multiset(_InputIterator __first, _InputIterator __last);
template <class _InputIterator>
@@ -928,18 +771,6 @@ public:
unordered_multiset(_InputIterator __first, _InputIterator __last,
size_type __n , const hasher& __hf,
const key_equal& __eql, const allocator_type& __a);
#if _LIBCPP_STD_VER > 11
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(_InputIterator __first, _InputIterator __last,
size_type __n, const allocator_type& __a)
: unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) {}
template <class _InputIterator>
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(_InputIterator __first, _InputIterator __last,
size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) {}
#endif
explicit unordered_multiset(const allocator_type& __a);
unordered_multiset(const unordered_multiset& __u);
unordered_multiset(const unordered_multiset& __u, const allocator_type& __a);
@@ -956,14 +787,6 @@ public:
unordered_multiset(initializer_list<value_type> __il, size_type __n,
const hasher& __hf, const key_equal& __eql,
const allocator_type& __a);
#if _LIBCPP_STD_VER > 11
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(initializer_list<value_type> __il, size_type __n, const allocator_type& __a)
: unordered_multiset(__il, __n, hasher(), key_equal(), __a) {}
inline _LIBCPP_INLINE_VISIBILITY
unordered_multiset(initializer_list<value_type> __il, size_type __n, const hasher& __hf, const allocator_type& __a)
: unordered_multiset(__il, __n, __hf, key_equal(), __a) {}
#endif
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
// ~unordered_multiset() = default;
_LIBCPP_INLINE_VISIBILITY
@@ -1102,20 +925,6 @@ public:
void rehash(size_type __n) {__table_.rehash(__n);}
_LIBCPP_INLINE_VISIBILITY
void reserve(size_type __n) {__table_.reserve(__n);}
#if _LIBCPP_DEBUG_LEVEL >= 2
bool __dereferenceable(const const_iterator* __i) const
{return __table_.__dereferenceable(__i);}
bool __decrementable(const const_iterator* __i) const
{return __table_.__decrementable(__i);}
bool __addable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
bool __subscriptable(const const_iterator* __i, ptrdiff_t __n) const
{return __table_.__addable(__i, __n);}
#endif // _LIBCPP_DEBUG_LEVEL >= 2
};
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1123,9 +932,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
size_type __n, const hasher& __hf, const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
}
@@ -1135,9 +941,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
}
@@ -1146,9 +949,6 @@ template <class _InputIterator>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
_InputIterator __first, _InputIterator __last)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
insert(__first, __last);
}
@@ -1159,9 +959,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const hasher& __hf, const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__first, __last);
}
@@ -1173,9 +970,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const hasher& __hf, const key_equal& __eql, const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__first, __last);
}
@@ -1186,9 +980,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const allocator_type& __a)
: __table_(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1196,9 +987,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const unordered_multiset& __u)
: __table_(__u.__table_)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__u.bucket_count());
insert(__u.begin(), __u.end());
}
@@ -1208,9 +996,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const unordered_multiset& __u, const allocator_type& __a)
: __table_(__u.__table_, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__u.bucket_count());
insert(__u.begin(), __u.end());
}
@@ -1224,10 +1009,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
_NOEXCEPT_(is_nothrow_move_constructible<__table>::value)
: __table_(_VSTD::move(__u.__table_))
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
__get_db()->swap(this, &__u);
#endif
}
template <class _Value, class _Hash, class _Pred, class _Alloc>
@@ -1235,19 +1016,12 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
unordered_multiset&& __u, const allocator_type& __a)
: __table_(_VSTD::move(__u.__table_), __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__a != __u.get_allocator())
{
iterator __i = __u.begin();
while (__u.size() != 0)
__table_.__insert_multi(_VSTD::move(__u.__table_.remove(__i++)->__value_));
}
#if _LIBCPP_DEBUG_LEVEL >= 2
else
__get_db()->swap(this, &__u);
#endif
}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1258,9 +1032,6 @@ template <class _Value, class _Hash, class _Pred, class _Alloc>
unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
initializer_list<value_type> __il)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
insert(__il.begin(), __il.end());
}
@@ -1270,9 +1041,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const key_equal& __eql)
: __table_(__hf, __eql)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__il.begin(), __il.end());
}
@@ -1283,9 +1051,6 @@ unordered_multiset<_Value, _Hash, _Pred, _Alloc>::unordered_multiset(
const key_equal& __eql, const allocator_type& __a)
: __table_(__hf, __eql, __a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
__table_.rehash(__n);
insert(__il.begin(), __il.end());
}

View File

@@ -38,10 +38,10 @@ template <class T, size_t N>
void
swap(T (&a)[N], T (&b)[N]) noexcept(noexcept(swap(*a, *b)));
template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept; // constexpr in C++14
template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept; // constexpr in C++14
template <class T> T&& forward(typename remove_reference<T>::type& t) noexcept;
template <class T> T&& forward(typename remove_reference<T>::type&& t) noexcept;
template <class T> typename remove_reference<T>::type&& move(T&&) noexcept; // constexpr in C++14
template <class T> typename remove_reference<T>::type&& move(T&&) noexcept;
template <class T>
typename conditional
@@ -50,7 +50,7 @@ template <class T>
const T&,
T&&
>::type
move_if_noexcept(T& x) noexcept; // constexpr in C++14
move_if_noexcept(T& x) noexcept;
template <class T> typename add_rvalue_reference<T>::type declval() noexcept;
@@ -66,10 +66,10 @@ struct pair
pair(const pair&) = default;
pair(pair&&) = default;
constexpr pair();
pair(const T1& x, const T2& y); // constexpr in C++14
template <class U, class V> pair(U&& x, V&& y); // constexpr in C++14
template <class U, class V> pair(const pair<U, V>& p); // constexpr in C++14
template <class U, class V> pair(pair<U, V>&& p); // constexpr in C++14
pair(const T1& x, const T2& y);
template <class U, class V> pair(U&& x, V&& y);
template <class U, class V> pair(const pair<U, V>& p);
template <class U, class V> pair(pair<U, V>&& p);
template <class... Args1, class... Args2>
pair(piecewise_construct_t, tuple<Args1...> first_args,
tuple<Args2...> second_args);
@@ -83,14 +83,14 @@ struct pair
noexcept(swap(second, p.second)));
};
template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); // constexpr in C++14
template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&);
template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&); // constexpr in C++14
template <class T1, class T2> pair<V1, V2> make_pair(T1&&, T2&&);
template <class T1, class T2>
void
swap(pair<T1, T2>& x, pair<T1, T2>& y) noexcept(noexcept(x.swap(y)));
@@ -107,48 +107,16 @@ template <class T1, class T2> struct tuple_element<1, std::pair<T1, T2> >;
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&
get(std::pair<T1, T2>&) noexcept; // constexpr in C++14
get(std::pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
const typename const tuple_element<I, std::pair<T1, T2> >::type&
get(const std::pair<T1, T2>&) noexcept; // constexpr in C++14
get(const std::pair<T1, T2>&) noexcept;
template<size_t I, class T1, class T2>
typename tuple_element<I, std::pair<T1, T2> >::type&&
get(std::pair<T1, T2>&&) noexcept; // constexpr in C++14
get(std::pair<T1, T2>&&) noexcept;
template<class T1, class T2>
constexpr T1& get(std::pair<T1, T2>&) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1 const& get(std::pair<T1, T2> const &) noexcept; // C++14
template<size_t I, class T1, class T2>
constexpr T1&& get(std::pair<T1, T2>&&) noexcept; // C++14
// C++14
template<class T, T... I>
struct integer_sequence
{
typedef T value_type;
static constexpr size_t size() noexcept;
};
template<size_t... I>
using index_sequence = integer_sequence<size_t, I...>;
template<class T, T N>
using make_integer_sequence = integer_sequence<T, 0, 1, ..., N-1>;
template<size_t N>
using make_index_sequence = make_integer_sequence<size_t, N>;
template<class... T>
using index_sequence_for = make_index_sequence<sizeof...(T)>;
template<class T, class U=T>
T exchange(T& obj, U&& new_value);
} // std
*/
@@ -221,7 +189,7 @@ swap(_Tp (&__a)[_Np], _Tp (&__b)[_Np]) _NOEXCEPT_(__is_nothrow_swappable<_Tp>::v
}
template <class _Tp>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
typename conditional
<
@@ -237,7 +205,7 @@ move_if_noexcept(_Tp& __x) _NOEXCEPT
return _VSTD::move(__x);
}
struct _LIBCPP_TYPE_VIS_ONLY piecewise_construct_t { };
struct _LIBCPP_TYPE_VIS piecewise_construct_t { };
#if defined(_LIBCPP_HAS_NO_CONSTEXPR) || defined(_LIBCPP_BUILDING_UTILITY)
extern const piecewise_construct_t piecewise_construct;// = piecewise_construct_t();
#else
@@ -245,7 +213,7 @@ constexpr piecewise_construct_t piecewise_construct = piecewise_construct_t();
#endif
template <class _T1, class _T2>
struct _LIBCPP_TYPE_VIS_ONLY pair
struct _LIBCPP_TYPE_VIS pair
{
typedef _T1 first_type;
typedef _T2 second_type;
@@ -258,12 +226,11 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR pair() : first(), second() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
pair(const _T1& __x, const _T2& __y)
_LIBCPP_INLINE_VISIBILITY pair(const _T1& __x, const _T2& __y)
: first(__x), second(__y) {}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
pair(const pair<_U1, _U2>& __p
#ifndef _LIBCPP_HAS_NO_ADVANCED_SFINAE
,typename enable_if<is_convertible<const _U1&, _T1>::value &&
@@ -272,10 +239,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
)
: first(__p.first), second(__p.second) {}
#if !defined(_LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS) && _LIBCPP_TRIVIAL_PAIR_COPY_CTOR
_LIBCPP_INLINE_VISIBILITY
pair(const pair& __p) = default;
#elif !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) || !_LIBCPP_TRIVIAL_PAIR_COPY_CTOR
_LIBCPP_INLINE_VISIBILITY
pair(const pair& __p)
_NOEXCEPT_(is_nothrow_copy_constructible<first_type>::value &&
@@ -284,7 +247,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
second(__p.second)
{
}
#endif
_LIBCPP_INLINE_VISIBILITY
pair& operator=(const pair& __p)
@@ -301,24 +263,20 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
template <class _U1, class _U2,
class = typename enable_if<is_convertible<_U1, first_type>::value &&
is_convertible<_U2, second_type>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
pair(_U1&& __u1, _U2&& __u2)
: first(_VSTD::forward<_U1>(__u1)),
second(_VSTD::forward<_U2>(__u2))
{}
template<class _U1, class _U2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
pair(pair<_U1, _U2>&& __p,
typename enable_if<is_convertible<_U1, _T1>::value &&
is_convertible<_U2, _T2>::value>::type* = 0)
: first(_VSTD::forward<_U1>(__p.first)),
second(_VSTD::forward<_U2>(__p.second)) {}
#ifndef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
_LIBCPP_INLINE_VISIBILITY
pair(pair&& __p) = default;
#else
_LIBCPP_INLINE_VISIBILITY
pair(pair&& __p) _NOEXCEPT_(is_nothrow_move_constructible<first_type>::value &&
is_nothrow_move_constructible<second_type>::value)
@@ -326,7 +284,6 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
second(_VSTD::forward<second_type>(__p.second))
{
}
#endif
_LIBCPP_INLINE_VISIBILITY
pair&
@@ -342,7 +299,7 @@ struct _LIBCPP_TYPE_VIS_ONLY pair
template<class _Tuple,
class = typename enable_if<__tuple_convertible<_Tuple, pair>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
pair(_Tuple&& __p)
: first(_VSTD::forward<typename tuple_element<0,
typename __make_tuple_types<_Tuple>::type>::type>(get<0>(__p))),
@@ -398,7 +355,7 @@ private:
};
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -406,7 +363,7 @@ operator==(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -414,7 +371,7 @@ operator!=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -422,7 +379,7 @@ operator< (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -430,7 +387,7 @@ operator> (const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -438,7 +395,7 @@ operator>=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const pair<_T1,_T2>& __x, const pair<_T1,_T2>& __y)
{
@@ -462,7 +419,7 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
template <class _Tp> class _LIBCPP_TYPE_VIS reference_wrapper;
template <class _Tp>
struct ___make_pair_return
@@ -483,7 +440,7 @@ struct __make_pair_return
};
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
inline _LIBCPP_INLINE_VISIBILITY
pair<typename __make_pair_return<_T1>::type, typename __make_pair_return<_T2>::type>
make_pair(_T1&& __t1, _T2&& __t2)
{
@@ -504,36 +461,36 @@ make_pair(_T1 __x, _T2 __y)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_size<pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_size<const pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_size<const pair<_T1, _T2> >
: public integral_constant<size_t, 2> {};
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_element<0, pair<_T1, _T2> >
{
public:
typedef _T1 type;
};
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<1, pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_element<1, pair<_T1, _T2> >
{
public:
typedef _T2 type;
};
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<0, const pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_element<0, const pair<_T1, _T2> >
{
public:
typedef const _T1 type;
};
template <class _T1, class _T2>
class _LIBCPP_TYPE_VIS_ONLY tuple_element<1, const pair<_T1, _T2> >
class _LIBCPP_TYPE_VIS tuple_element<1, const pair<_T1, _T2> >
{
public:
typedef const _T2 type;
@@ -546,13 +503,13 @@ struct __get_pair<0>
{
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_T1&
get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
const _T1&
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.first;}
@@ -560,7 +517,7 @@ struct __get_pair<0>
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_T1&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T1>(__p.first);}
@@ -572,13 +529,13 @@ struct __get_pair<1>
{
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_T2&
get(pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
const _T2&
get(const pair<_T1, _T2>& __p) _NOEXCEPT {return __p.second;}
@@ -586,7 +543,7 @@ struct __get_pair<1>
template <class _T1, class _T2>
static
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY
_T2&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT {return _VSTD::forward<_T2>(__p.second);}
@@ -594,7 +551,7 @@ struct __get_pair<1>
};
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>& __p) _NOEXCEPT
{
@@ -602,7 +559,7 @@ get(pair<_T1, _T2>& __p) _NOEXCEPT
}
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>& __p) _NOEXCEPT
{
@@ -612,7 +569,7 @@ get(const pair<_T1, _T2>& __p) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <size_t _Ip, class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_AFTER_CXX11
_LIBCPP_INLINE_VISIBILITY inline
typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&& __p) _NOEXCEPT
{
@@ -621,148 +578,6 @@ get(pair<_T1, _T2>&& __p) _NOEXCEPT
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#if _LIBCPP_STD_VER > 11
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 & get(pair<_T1, _T2>& __p) _NOEXCEPT
{
return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const & get(pair<_T1, _T2> const& __p) _NOEXCEPT
{
return __get_pair<0>::get(__p);
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 && get(pair<_T1, _T2>&& __p) _NOEXCEPT
{
return __get_pair<0>::get(_VSTD::move(__p));
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 & get(pair<_T2, _T1>& __p) _NOEXCEPT
{
return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 const & get(pair<_T2, _T1> const& __p) _NOEXCEPT
{
return __get_pair<1>::get(__p);
}
template <class _T1, class _T2>
inline _LIBCPP_INLINE_VISIBILITY
constexpr _T1 && get(pair<_T2, _T1>&& __p) _NOEXCEPT
{
return __get_pair<1>::get(_VSTD::move(__p));
}
#endif
#if _LIBCPP_STD_VER > 11
template<class _Tp, _Tp... _Ip>
struct _LIBCPP_TYPE_VIS_ONLY integer_sequence
{
typedef _Tp value_type;
static_assert( is_integral<_Tp>::value,
"std::integer_sequence can only be instantiated with an integral type" );
static
_LIBCPP_INLINE_VISIBILITY
constexpr
size_t
size() noexcept { return sizeof...(_Ip); }
};
template<size_t... _Ip>
using index_sequence = integer_sequence<size_t, _Ip...>;
namespace __detail {
template<typename _Tp, size_t ..._Extra> struct __repeat;
template<typename _Tp, _Tp ..._Np, size_t ..._Extra> struct __repeat<integer_sequence<_Tp, _Np...>, _Extra...> {
typedef integer_sequence<_Tp,
_Np...,
sizeof...(_Np) + _Np...,
2 * sizeof...(_Np) + _Np...,
3 * sizeof...(_Np) + _Np...,
4 * sizeof...(_Np) + _Np...,
5 * sizeof...(_Np) + _Np...,
6 * sizeof...(_Np) + _Np...,
7 * sizeof...(_Np) + _Np...,
_Extra...> type;
};
template<size_t _Np> struct __parity;
template<size_t _Np> struct __make : __parity<_Np % 8>::template __pmake<_Np> {};
template<> struct __make<0> { typedef integer_sequence<size_t> type; };
template<> struct __make<1> { typedef integer_sequence<size_t, 0> type; };
template<> struct __make<2> { typedef integer_sequence<size_t, 0, 1> type; };
template<> struct __make<3> { typedef integer_sequence<size_t, 0, 1, 2> type; };
template<> struct __make<4> { typedef integer_sequence<size_t, 0, 1, 2, 3> type; };
template<> struct __make<5> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4> type; };
template<> struct __make<6> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4, 5> type; };
template<> struct __make<7> { typedef integer_sequence<size_t, 0, 1, 2, 3, 4, 5, 6> type; };
template<> struct __parity<0> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type> {}; };
template<> struct __parity<1> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 1> {}; };
template<> struct __parity<2> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 2, _Np - 1> {}; };
template<> struct __parity<3> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 3, _Np - 2, _Np - 1> {}; };
template<> struct __parity<4> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
template<> struct __parity<5> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
template<> struct __parity<6> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
template<> struct __parity<7> { template<size_t _Np> struct __pmake : __repeat<typename __make<_Np / 8>::type, _Np - 7, _Np - 6, _Np - 5, _Np - 4, _Np - 3, _Np - 2, _Np - 1> {}; };
template<typename _Tp, typename _Up> struct __convert {
template<typename> struct __result;
template<_Tp ..._Np> struct __result<integer_sequence<_Tp, _Np...> > { typedef integer_sequence<_Up, _Np...> type; };
};
template<typename _Tp> struct __convert<_Tp, _Tp> { template<typename _Up> struct __result { typedef _Up type; }; };
}
template<typename _Tp, _Tp _Np> using __make_integer_sequence_unchecked =
typename __detail::__convert<size_t, _Tp>::template __result<typename __detail::__make<_Np>::type>::type;
template <class _Tp, _Tp _Ep>
struct __make_integer_sequence
{
static_assert(is_integral<_Tp>::value,
"std::make_integer_sequence can only be instantiated with an integral type" );
static_assert(0 <= _Ep, "std::make_integer_sequence input shall not be negative");
typedef __make_integer_sequence_unchecked<_Tp, _Ep> type;
};
template<class _Tp, _Tp _Np>
using make_integer_sequence = typename __make_integer_sequence<_Tp, _Np>::type;
template<size_t _Np>
using make_index_sequence = make_integer_sequence<size_t, _Np>;
template<class... _Tp>
using index_sequence_for = make_index_sequence<sizeof...(_Tp)>;
#endif // _LIBCPP_STD_VER > 11
#if _LIBCPP_STD_VER > 11
template<class _T1, class _T2 = _T1>
inline _LIBCPP_INLINE_VISIBILITY
_T1 exchange(_T1& __obj, _T2 && __new_value)
{
_T1 __old_value = _VSTD::move(__obj);
__obj = _VSTD::forward<_T2>(__new_value);
return __old_value;
}
#endif // _LIBCPP_STD_VER > 11
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_UTILITY

View File

@@ -354,9 +354,9 @@ template <class T> unspecified2 end(const valarray<T>& v);
_LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TYPE_VIS_ONLY valarray;
template<class _Tp> class _LIBCPP_TYPE_VIS valarray;
class _LIBCPP_TYPE_VIS_ONLY slice
class _LIBCPP_TYPE_VIS slice
{
size_t __start_;
size_t __size_;
@@ -381,11 +381,11 @@ public:
_LIBCPP_INLINE_VISIBILITY size_t stride() const {return __stride_;}
};
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY slice_array;
template <class _Tp> class _LIBCPP_TYPE_VIS slice_array;
class _LIBCPP_TYPE_VIS gslice;
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY gslice_array;
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY mask_array;
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY indirect_array;
template <class _Tp> class _LIBCPP_TYPE_VIS gslice_array;
template <class _Tp> class _LIBCPP_TYPE_VIS mask_array;
template <class _Tp> class _LIBCPP_TYPE_VIS indirect_array;
template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
@@ -671,7 +671,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return __size_;}
template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
template <class> friend class _LIBCPP_TYPE_VIS valarray;
};
template <class _ValExpr>
@@ -786,7 +786,7 @@ template<class _Tp>
struct __is_val_expr<valarray<_Tp> > : true_type {};
template<class _Tp>
class _LIBCPP_TYPE_VIS_ONLY valarray
class _LIBCPP_TYPE_VIS valarray
{
public:
typedef _Tp value_type;
@@ -976,12 +976,12 @@ public:
void resize(size_t __n, value_type __x = value_type());
private:
template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY slice_array;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY gslice_array;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY mask_array;
template <class> friend class _LIBCPP_TYPE_VIS valarray;
template <class> friend class _LIBCPP_TYPE_VIS slice_array;
template <class> friend class _LIBCPP_TYPE_VIS gslice_array;
template <class> friend class _LIBCPP_TYPE_VIS mask_array;
template <class> friend class __mask_expr;
template <class> friend class _LIBCPP_TYPE_VIS_ONLY indirect_array;
template <class> friend class _LIBCPP_TYPE_VIS indirect_array;
template <class> friend class __indirect_expr;
template <class> friend class __val_expr;
@@ -1006,10 +1006,6 @@ private:
end(const valarray<_Up>& __v);
};
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::valarray(size_t))
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS valarray<size_t>::~valarray())
_LIBCPP_EXTERN_TEMPLATE(_LIBCPP_FUNC_VIS void valarray<size_t>::resize(size_t, size_t))
template <class _Op, class _Tp>
struct _UnaryOp<_Op, valarray<_Tp> >
{
@@ -1095,7 +1091,7 @@ struct _BinaryOp<_Op, valarray<_Tp>, valarray<_Tp> >
// slice_array
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY slice_array
class _LIBCPP_TYPE_VIS slice_array
{
public:
typedef _Tp value_type;
@@ -1465,7 +1461,7 @@ private:
// gslice_array
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY gslice_array
class _LIBCPP_TYPE_VIS gslice_array
{
public:
typedef _Tp value_type;
@@ -1794,7 +1790,7 @@ gslice_array<_Tp>::operator=(const value_type& __x) const
// mask_array
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY mask_array
class _LIBCPP_TYPE_VIS mask_array
{
public:
typedef _Tp value_type;
@@ -2138,7 +2134,7 @@ public:
// indirect_array
template <class _Tp>
class _LIBCPP_TYPE_VIS_ONLY indirect_array
class _LIBCPP_TYPE_VIS indirect_array
{
public:
typedef _Tp value_type;
@@ -2489,7 +2485,7 @@ public:
_LIBCPP_INLINE_VISIBILITY
size_t size() const {return __1d_.size();}
template <class> friend class _LIBCPP_TYPE_VIS_ONLY valarray;
template <class> friend class _LIBCPP_TYPE_VIS valarray;
};
template<class _ValExpr>
@@ -2628,7 +2624,7 @@ public:
};
template<class _ValExpr>
__val_expr<_ValExpr>::operator valarray<__val_expr::result_type>() const
__val_expr<_ValExpr>::operator valarray<result_type>() const
{
valarray<result_type> __r;
size_t __n = __expr_.size();
@@ -4774,6 +4770,10 @@ end(const valarray<_Tp>& __v)
return __v.__end_;
}
_LIBCPP_EXTERN_TEMPLATE(valarray<size_t>::valarray(size_t))
_LIBCPP_EXTERN_TEMPLATE(valarray<size_t>::~valarray())
_LIBCPP_EXTERN_TEMPLATE(void valarray<size_t>::resize(size_t, size_t))
_LIBCPP_END_NAMESPACE_STD
#endif // _LIBCPP_VALARRAY

View File

@@ -38,7 +38,6 @@ public:
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit vector(const allocator_type&);
explicit vector(size_type n);
explicit vector(size_type n, const allocator_type&); // C++14
vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
template <class InputIterator>
vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
@@ -162,8 +161,7 @@ public:
vector()
noexcept(is_nothrow_default_constructible<allocator_type>::value);
explicit vector(const allocator_type&);
explicit vector(size_type n, const allocator_type& a = allocator_type()); // C++14
vector(size_type n, const value_type& value, const allocator_type& = allocator_type());
explicit vector(size_type n, const value_type& value = value_type(), const allocator_type& = allocator_type());
template <class InputIterator>
vector(InputIterator first, InputIterator last, const allocator_type& = allocator_type());
vector(const vector& x);
@@ -218,10 +216,8 @@ public:
const_reference back() const;
void push_back(const value_type& x);
template <class... Args> void emplace_back(Args&&... args); // C++14
void pop_back();
template <class... Args> iterator emplace(const_iterator position, Args&&... args); // C++14
iterator insert(const_iterator position, const value_type& x);
iterator insert(const_iterator position, size_type n, const value_type& x);
template <class InputIterator>
@@ -276,12 +272,6 @@ void swap(vector<T,Allocator>& x, vector<T,Allocator>& y)
#include <__undef_min_max>
#ifdef _LIBCPP_DEBUG
# include <__debug>
#else
# define _LIBCPP_ASSERT(x, m) ((void)0)
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
@@ -319,14 +309,14 @@ __vector_base_common<__b>::__throw_out_of_range() const
#endif
}
#ifdef _LIBCPP_MSVC
#ifdef _MSC_VER
#pragma warning( push )
#pragma warning( disable: 4231 )
#endif // _LIBCPP_MSVC
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS __vector_base_common<true>)
#ifdef _LIBCPP_MSVC
#endif // _MSC_VER
_LIBCPP_EXTERN_TEMPLATE(class __vector_base_common<true>)
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _LIBCPP_MSVC
#endif // _MSC_VER
template <class _Tp, class _Allocator>
class __vector_base
@@ -375,7 +365,12 @@ protected:
{return static_cast<size_type>(__end_cap() - __begin_);}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT;
void __destruct_at_end(const_pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, false_type());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(const_pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(const_pointer __new_last, true_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __vector_base& __c)
@@ -440,37 +435,45 @@ private:
};
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__vector_base<_Tp, _Allocator>::__destruct_at_end(pointer __new_last) _NOEXCEPT
__vector_base<_Tp, _Allocator>::__destruct_at_end(const_pointer __new_last, false_type) _NOEXCEPT
{
while (__new_last != __end_)
__alloc_traits::destroy(__alloc(), _VSTD::__to_raw_pointer(--__end_));
__alloc_traits::destroy(__alloc(), const_cast<pointer>(--__end_));
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
__vector_base<_Tp, _Allocator>::__destruct_at_end(const_pointer __new_last, true_type) _NOEXCEPT
{
__end_ = const_cast<pointer>(__new_last);
}
template <class _Tp, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
__vector_base<_Tp, _Allocator>::__vector_base()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __begin_(nullptr),
__end_(nullptr),
__end_cap_(nullptr)
: __begin_(0),
__end_(0),
__end_cap_(0)
{
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
__vector_base<_Tp, _Allocator>::__vector_base(const allocator_type& __a)
: __begin_(nullptr),
__end_(nullptr),
__end_cap_(nullptr, __a)
: __begin_(0),
__end_(0),
__end_cap_(0, __a)
{
}
template <class _Tp, class _Allocator>
__vector_base<_Tp, _Allocator>::~__vector_base()
{
if (__begin_ != nullptr)
if (__begin_ != 0)
{
clear();
__alloc_traits::deallocate(__alloc(), __begin_, capacity());
@@ -478,7 +481,7 @@ __vector_base<_Tp, _Allocator>::~__vector_base()
}
template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_TYPE_VIS_ONLY vector
class _LIBCPP_TYPE_VIS vector
: private __vector_base<_Tp, _Allocator>
{
private:
@@ -518,19 +521,15 @@ public:
#endif
}
explicit vector(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit vector(size_type __n, const allocator_type& __a);
#endif
vector(size_type __n, const_reference __x);
vector(size_type __n, const_reference __x, const allocator_type& __a);
template <class _InputIterator>
vector(_InputIterator __first,
vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value &&
is_constructible<
value_type,
typename iterator_traits<_InputIterator>::reference>::value,
_InputIterator>::type __last);
typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
template <class _InputIterator>
vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
@@ -539,12 +538,11 @@ public:
value_type,
typename iterator_traits<_InputIterator>::reference>::value>::type* = 0);
template <class _ForwardIterator>
vector(_ForwardIterator __first,
vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
is_constructible<
value_type,
typename iterator_traits<_ForwardIterator>::reference>::value,
_ForwardIterator>::type __last);
typename iterator_traits<_ForwardIterator>::reference>::value>::type* = 0);
template <class _ForwardIterator>
vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
@@ -799,7 +797,7 @@ private:
_NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value);
void __move_assign(vector& __c, false_type);
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT
void __destruct_at_end(const_pointer __new_last) _NOEXCEPT
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__c_node* __c = __get_db()->__find_c_and_lock(this);
@@ -880,11 +878,11 @@ template <class _Tp, class _Allocator>
void
vector<_Tp, _Allocator>::deallocate() _NOEXCEPT
{
if (this->__begin_ != nullptr)
if (this->__begin_ != 0)
{
clear();
__alloc_traits::deallocate(this->__alloc(), this->__begin_, capacity());
this->__begin_ = this->__end_ = this->__end_cap() = nullptr;
this->__begin_ = this->__end_ = this->__end_cap() = 0;
}
}
@@ -897,7 +895,7 @@ vector<_Tp, _Allocator>::max_size() const _NOEXCEPT
// Precondition: __new_size > capacity()
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::size_type
vector<_Tp, _Allocator>::__recommend(size_type __new_size) const
{
@@ -935,7 +933,7 @@ vector<_Tp, _Allocator>::__construct_at_end(size_type __n)
// Postcondition: size() == old size() + __n
// Postcondition: [i] == __x for all i in [size() - __n, __n)
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x)
{
@@ -1029,22 +1027,6 @@ vector<_Tp, _Allocator>::vector(size_type __n)
}
}
#if _LIBCPP_STD_VER > 11
template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n, const allocator_type& __a)
: __base(__a)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
#endif
if (__n > 0)
{
allocate(__n);
__construct_at_end(__n);
}
}
#endif
template <class _Tp, class _Allocator>
vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x)
{
@@ -1074,13 +1056,12 @@ vector<_Tp, _Allocator>::vector(size_type __n, const_reference __x, const alloca
template <class _Tp, class _Allocator>
template <class _InputIterator>
vector<_Tp, _Allocator>::vector(_InputIterator __first,
vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value &&
is_constructible<
value_type,
typename iterator_traits<_InputIterator>::reference>::value,
_InputIterator>::type __last)
typename iterator_traits<_InputIterator>::reference>::value>::type*)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1108,12 +1089,11 @@ vector<_Tp, _Allocator>::vector(_InputIterator __first, _InputIterator __last, c
template <class _Tp, class _Allocator>
template <class _ForwardIterator>
vector<_Tp, _Allocator>::vector(_ForwardIterator __first,
vector<_Tp, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value &&
is_constructible<
value_type,
typename iterator_traits<_ForwardIterator>::reference>::value,
_ForwardIterator>::type __last)
typename iterator_traits<_ForwardIterator>::reference>::value>::type*)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
__get_db()->__insert_c(this);
@@ -1179,7 +1159,7 @@ vector<_Tp, _Allocator>::vector(const vector& __x, const allocator_type& __a)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(vector&& __x)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __base(_VSTD::move(__x.__alloc()))
@@ -1191,11 +1171,11 @@ vector<_Tp, _Allocator>::vector(vector&& __x)
this->__begin_ = __x.__begin_;
this->__end_ = __x.__end_;
this->__end_cap() = __x.__end_cap();
__x.__begin_ = __x.__end_ = __x.__end_cap() = nullptr;
__x.__begin_ = __x.__end_ = __x.__end_cap() = 0;
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
: __base(__a)
{
@@ -1222,7 +1202,7 @@ vector<_Tp, _Allocator>::vector(vector&& __x, const allocator_type& __a)
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
{
#if _LIBCPP_DEBUG_LEVEL >= 2
@@ -1236,7 +1216,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
: __base(__a)
{
@@ -1253,7 +1233,7 @@ vector<_Tp, _Allocator>::vector(initializer_list<value_type> __il, const allocat
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(vector&& __x)
_NOEXCEPT_(
@@ -1297,7 +1277,7 @@ vector<_Tp, _Allocator>::__move_assign(vector& __c, true_type)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<_Tp, _Allocator>&
vector<_Tp, _Allocator>::operator=(const vector& __x)
{
@@ -1386,7 +1366,7 @@ vector<_Tp, _Allocator>::assign(size_type __n, const_reference __u)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
{
@@ -1398,7 +1378,7 @@ vector<_Tp, _Allocator>::__make_iter(pointer __p) _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
{
@@ -1410,7 +1390,7 @@ vector<_Tp, _Allocator>::__make_iter(const_pointer __p) const _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::begin() _NOEXCEPT
{
@@ -1418,7 +1398,7 @@ vector<_Tp, _Allocator>::begin() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::begin() const _NOEXCEPT
{
@@ -1426,7 +1406,7 @@ vector<_Tp, _Allocator>::begin() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::end() _NOEXCEPT
{
@@ -1434,7 +1414,7 @@ vector<_Tp, _Allocator>::end() _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_iterator
vector<_Tp, _Allocator>::end() const _NOEXCEPT
{
@@ -1442,7 +1422,7 @@ vector<_Tp, _Allocator>::end() const _NOEXCEPT
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::reference
vector<_Tp, _Allocator>::operator[](size_type __n)
{
@@ -1451,7 +1431,7 @@ vector<_Tp, _Allocator>::operator[](size_type __n)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::const_reference
vector<_Tp, _Allocator>::operator[](size_type __n) const
{
@@ -1529,7 +1509,7 @@ vector<_Tp, _Allocator>::__push_back_slow_path(_Up& __x)
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::push_back(const_reference __x)
{
@@ -1546,7 +1526,7 @@ vector<_Tp, _Allocator>::push_back(const_reference __x)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::push_back(value_type&& __x)
{
@@ -1578,7 +1558,7 @@ vector<_Tp, _Allocator>::__emplace_back_slow_path(_Args&&... __args)
template <class _Tp, class _Allocator>
template <class... _Args>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
{
@@ -1597,7 +1577,7 @@ vector<_Tp, _Allocator>::emplace_back(_Args&&... __args)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::pop_back()
{
@@ -1606,7 +1586,7 @@ vector<_Tp, _Allocator>::pop_back()
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<_Tp, _Allocator>::iterator
vector<_Tp, _Allocator>::erase(const_iterator __position)
{
@@ -1617,8 +1597,7 @@ vector<_Tp, _Allocator>::erase(const_iterator __position)
#endif
_LIBCPP_ASSERT(__position != end(),
"vector::erase(iterator) called with a non-dereferenceable iterator");
difference_type __ps = __position - cbegin();
pointer __p = this->__begin_ + __ps;
pointer __p = const_cast<pointer>(&*__position);
iterator __r = __make_iter(__p);
this->__destruct_at_end(_VSTD::move(__p + 1, this->__end_, __p));
return __r;
@@ -1964,9 +1943,9 @@ template <class _Tp, class _Allocator>
bool
vector<_Tp, _Allocator>::__invariants() const
{
if (this->__begin_ == nullptr)
if (this->__begin_ == 0)
{
if (this->__end_ != nullptr || this->__end_cap() != nullptr)
if (this->__end_ != 0 || this->__end_cap() != 0)
return false;
}
else
@@ -2016,7 +1995,7 @@ vector<_Tp, _Allocator>::__subscriptable(const const_iterator* __i, ptrdiff_t __
#endif // _LIBCPP_DEBUG_LEVEL >= 2
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<_Tp, _Allocator>::__invalidate_all_iterators()
{
@@ -2038,7 +2017,7 @@ struct __has_storage_type<vector<bool, _Allocator> >
};
template <class _Allocator>
class _LIBCPP_TYPE_VIS_ONLY vector<bool, _Allocator>
class _LIBCPP_TYPE_VIS vector<bool, _Allocator>
: private __vector_base_common<true>
{
public:
@@ -2051,8 +2030,21 @@ public:
typedef size_type __storage_type;
typedef __bit_iterator<vector, false> pointer;
typedef __bit_iterator<vector, true> const_pointer;
#ifdef _LIBCPP_DEBUG
typedef __debug_iter<vector, pointer> iterator;
typedef __debug_iter<vector, const_pointer> const_iterator;
friend class __debug_iter<vector, pointer>;
friend class __debug_iter<vector, const_pointer>;
pair<iterator*, const_iterator*> __iterator_list_;
_LIBCPP_INLINE_VISIBILITY iterator*& __get_iterator_list(iterator*) {return __iterator_list_.first;}
_LIBCPP_INLINE_VISIBILITY const_iterator*& __get_iterator_list(const_iterator*) {return __iterator_list_.second;}
#else // _LIBCPP_DEBUG
typedef pointer iterator;
typedef const_pointer const_iterator;
#endif // _LIBCPP_DEBUG
typedef _VSTD::reverse_iterator<iterator> reverse_iterator;
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
@@ -2104,9 +2096,6 @@ public:
_LIBCPP_INLINE_VISIBILITY explicit vector(const allocator_type& __a);
~vector();
explicit vector(size_type __n);
#if _LIBCPP_STD_VER > 11
explicit vector(size_type __n, const allocator_type& __a);
#endif
vector(size_type __n, const value_type& __v);
vector(size_type __n, const value_type& __v, const allocator_type& __a);
template <class _InputIterator>
@@ -2238,20 +2227,8 @@ public:
_LIBCPP_INLINE_VISIBILITY const_reference back() const {return __make_ref(__size_ - 1);}
void push_back(const value_type& __x);
#if _LIBCPP_STD_VER > 11
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY void emplace_back(_Args&&... __args)
{ push_back ( value_type ( _VSTD::forward<_Args>(__args)... )); }
#endif
_LIBCPP_INLINE_VISIBILITY void pop_back() {--__size_;}
#if _LIBCPP_STD_VER > 11
template <class... _Args>
_LIBCPP_INLINE_VISIBILITY iterator emplace(const_iterator position, _Args&&... __args)
{ return insert ( position, value_type ( _VSTD::forward<_Args>(__args)... )); }
#endif
iterator insert(const_iterator __position, const value_type& __x);
iterator insert(const_iterator __position, size_type __n, const value_type& __x);
iterator insert(const_iterator __position, size_type __n, const_reference __x);
@@ -2296,7 +2273,7 @@ private:
void allocate(size_type __n);
void deallocate() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
static size_type __align_it(size_type __new_size) _NOEXCEPT
static size_type __align(size_type __new_size) _NOEXCEPT
{return __new_size + (__bits_per_word-1) & ~(__bits_per_word-1);};
_LIBCPP_INLINE_VISIBILITY size_type __recommend(size_type __new_size) const;
_LIBCPP_INLINE_VISIBILITY void __construct_at_end(size_type __n, bool __x);
@@ -2314,6 +2291,14 @@ private:
_LIBCPP_INLINE_VISIBILITY
const_reference __make_ref(size_type __pos) const _NOEXCEPT
{return const_reference(__begin_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
#ifdef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_type __pos)
{return iterator(this, pointer(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word)));}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_type __pos) const
{return const_iterator(this, const_pointer(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word)));}
_LIBCPP_INLINE_VISIBILITY iterator __const_iterator_cast(const_iterator __p)
{return iterator(this, pointer(const_cast<__storage_pointer>(__p.base().__seg_), __p.base().__ctz_));}
#else // _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
iterator __make_iter(size_type __pos) _NOEXCEPT
{return iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
@@ -2322,7 +2307,8 @@ private:
{return const_iterator(__begin_ + __pos / __bits_per_word, static_cast<unsigned>(__pos % __bits_per_word));}
_LIBCPP_INLINE_VISIBILITY
iterator __const_iterator_cast(const_iterator __p) _NOEXCEPT
{return begin() + (__p - cbegin());}
{return iterator(const_cast<__storage_pointer>(__p.__seg_), __p.__ctz_);}
#endif // _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const vector& __v)
@@ -2389,14 +2375,20 @@ private:
friend class __bit_iterator<vector, false>;
friend class __bit_iterator<vector, true>;
friend struct __bit_array<vector>;
friend struct _LIBCPP_TYPE_VIS_ONLY hash<vector>;
friend struct _LIBCPP_TYPE_VIS hash<vector>;
};
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
#ifndef _LIBCPP_DEBUG
_LIBCPP_INLINE_VISIBILITY inline
#endif
void
vector<bool, _Allocator>::__invalidate_all_iterators()
{
#ifdef _LIBCPP_DEBUG
iterator::__remove_all(this);
const_iterator::__remove_all(this);
#endif // _LIBCPP_DEBUG
}
// Allocate space for __n objects
@@ -2422,11 +2414,11 @@ template <class _Allocator>
void
vector<bool, _Allocator>::deallocate() _NOEXCEPT
{
if (this->__begin_ != nullptr)
if (this->__begin_ != 0)
{
__storage_traits::deallocate(this->__alloc(), this->__begin_, __cap());
__invalidate_all_iterators();
this->__begin_ = nullptr;
this->__begin_ = 0;
this->__size_ = this->__cap() = 0;
}
}
@@ -2444,7 +2436,7 @@ vector<bool, _Allocator>::max_size() const _NOEXCEPT
// Precondition: __new_size > capacity()
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<bool, _Allocator>::size_type
vector<bool, _Allocator>::__recommend(size_type __new_size) const
{
@@ -2454,7 +2446,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
const size_type __cap = capacity();
if (__cap >= __ms / 2)
return __ms;
return _VSTD::max(2*__cap, __align_it(__new_size));
return _VSTD::max(2*__cap, __align(__new_size));
}
// Default constructs __n objects starting at __end_
@@ -2462,7 +2454,7 @@ vector<bool, _Allocator>::__recommend(size_type __new_size) const
// Precondition: size() + __n <= capacity()
// Postcondition: size() == size() + __n
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
vector<bool, _Allocator>::__construct_at_end(size_type __n, bool __x)
{
@@ -2486,19 +2478,19 @@ vector<bool, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardI
}
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>::vector()
_NOEXCEPT_(is_nothrow_default_constructible<allocator_type>::value)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
}
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>::vector(const allocator_type& __a)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
@@ -2506,7 +2498,7 @@ vector<bool, _Allocator>::vector(const allocator_type& __a)
template <class _Allocator>
vector<bool, _Allocator>::vector(size_type __n)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
@@ -2517,24 +2509,9 @@ vector<bool, _Allocator>::vector(size_type __n)
}
}
#if _LIBCPP_STD_VER > 11
template <class _Allocator>
vector<bool, _Allocator>::vector(size_type __n, const allocator_type& __a)
: __begin_(nullptr),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
if (__n > 0)
{
allocate(__n);
__construct_at_end(__n, false);
}
}
#endif
template <class _Allocator>
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
@@ -2547,7 +2524,7 @@ vector<bool, _Allocator>::vector(size_type __n, const value_type& __x)
template <class _Allocator>
vector<bool, _Allocator>::vector(size_type __n, const value_type& __x, const allocator_type& __a)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
@@ -2563,7 +2540,7 @@ template <class _InputIterator>
vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value>::type*)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
@@ -2577,7 +2554,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
}
catch (...)
{
if (__begin_ != nullptr)
if (__begin_ != 0)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
__invalidate_all_iterators();
throw;
@@ -2590,7 +2567,7 @@ template <class _InputIterator>
vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last, const allocator_type& __a,
typename enable_if<__is_input_iterator <_InputIterator>::value &&
!__is_forward_iterator<_InputIterator>::value>::type*)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
@@ -2604,7 +2581,7 @@ vector<bool, _Allocator>::vector(_InputIterator __first, _InputIterator __last,
}
catch (...)
{
if (__begin_ != nullptr)
if (__begin_ != 0)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
__invalidate_all_iterators();
throw;
@@ -2616,7 +2593,7 @@ template <class _Allocator>
template <class _ForwardIterator>
vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
@@ -2632,7 +2609,7 @@ template <class _Allocator>
template <class _ForwardIterator>
vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __last, const allocator_type& __a,
typename enable_if<__is_forward_iterator<_ForwardIterator>::value>::type*)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
@@ -2648,7 +2625,7 @@ vector<bool, _Allocator>::vector(_ForwardIterator __first, _ForwardIterator __la
template <class _Allocator>
vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0)
{
@@ -2662,7 +2639,7 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il)
template <class _Allocator>
vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const allocator_type& __a)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, static_cast<__storage_allocator>(__a))
{
@@ -2679,14 +2656,16 @@ vector<bool, _Allocator>::vector(initializer_list<value_type> __il, const alloca
template <class _Allocator>
vector<bool, _Allocator>::~vector()
{
if (__begin_ != nullptr)
if (__begin_ != 0)
__storage_traits::deallocate(__alloc(), __begin_, __cap());
#ifdef _LIBCPP_DEBUG
__invalidate_all_iterators();
#endif
}
template <class _Allocator>
vector<bool, _Allocator>::vector(const vector& __v)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, __storage_traits::select_on_container_copy_construction(__v.__alloc()))
{
@@ -2699,7 +2678,7 @@ vector<bool, _Allocator>::vector(const vector& __v)
template <class _Allocator>
vector<bool, _Allocator>::vector(const vector& __v, const allocator_type& __a)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, __a)
{
@@ -2734,21 +2713,21 @@ vector<bool, _Allocator>::operator=(const vector& __v)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>::vector(vector&& __v)
_NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
: __begin_(__v.__begin_),
__size_(__v.__size_),
__cap_alloc_(__v.__cap_alloc_)
{
__v.__begin_ = nullptr;
__v.__begin_ = 0;
__v.__size_ = 0;
__v.__cap() = 0;
}
template <class _Allocator>
vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a)
: __begin_(nullptr),
: __begin_(0),
__size_(0),
__cap_alloc_(0, __a)
{
@@ -2768,7 +2747,7 @@ vector<bool, _Allocator>::vector(vector&& __v, const allocator_type& __a)
}
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
vector<bool, _Allocator>&
vector<bool, _Allocator>::operator=(vector&& __v)
_NOEXCEPT_(
@@ -3055,7 +3034,7 @@ vector<bool, _Allocator>::insert(const_iterator __position, _ForwardIterator __f
}
template <class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
typename vector<bool, _Allocator>::iterator
vector<bool, _Allocator>::erase(const_iterator __position)
{
@@ -3086,6 +3065,10 @@ vector<bool, _Allocator>::swap(vector& __x)
_VSTD::swap(this->__size_, __x.__size_);
_VSTD::swap(this->__cap(), __x.__cap());
__swap_alloc(this->__alloc(), __x.__alloc());
#ifdef _LIBCPP_DEBUG
iterator::swap(this, &__x);
const_iterator::swap(this, &__x);
#endif // _LIBCPP_DEBUG
}
template <class _Allocator>
@@ -3140,7 +3123,7 @@ template <class _Allocator>
bool
vector<bool, _Allocator>::__invariants() const
{
if (this->__begin_ == nullptr)
if (this->__begin_ == 0)
{
if (this->__size_ != 0 || this->__cap() != 0)
return false;
@@ -3175,7 +3158,7 @@ vector<bool, _Allocator>::__hash_code() const _NOEXCEPT
}
template <class _Allocator>
struct _LIBCPP_TYPE_VIS_ONLY hash<vector<bool, _Allocator> >
struct _LIBCPP_TYPE_VIS hash<vector<bool, _Allocator> >
: public unary_function<vector<bool, _Allocator>, size_t>
{
_LIBCPP_INLINE_VISIBILITY
@@ -3184,7 +3167,7 @@ struct _LIBCPP_TYPE_VIS_ONLY hash<vector<bool, _Allocator> >
};
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3193,7 +3176,7 @@ operator==(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3201,7 +3184,7 @@ operator!=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3209,7 +3192,7 @@ operator< (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3217,7 +3200,7 @@ operator> (const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3225,7 +3208,7 @@ operator>=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
bool
operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __y)
{
@@ -3233,7 +3216,7 @@ operator<=(const vector<_Tp, _Allocator>& __x, const vector<_Tp, _Allocator>& __
}
template <class _Tp, class _Allocator>
inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_INLINE_VISIBILITY inline
void
swap(vector<_Tp, _Allocator>& __x, vector<_Tp, _Allocator>& __y)
_NOEXCEPT_(_NOEXCEPT_(__x.swap(__y)))

View File

@@ -49,43 +49,6 @@ target_link_libraries(cxx ${libraries})
append_if(compile_flags LIBCXX_HAS_FPIC_FLAG -fPIC)
append_if(link_flags LIBCXX_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
if ( APPLE )
if ( CMAKE_OSX_DEPLOYMENT_TARGET STREQUAL "10.6" )
list(APPEND compile_flags "-U__STRICT_ANSI__")
list(APPEND link_flags
"-compatibility_version 1"
"-current_version ${LIBCXX_VERSION}"
"-install_name /usr/lib/libc++.1.dylib"
"-Wl,-reexport_library,/usr/lib/libc++abi.dylib"
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
"/usr/lib/libSystem.B.dylib")
else()
if ( ${CMAKE_OSX_SYSROOT} )
list(FIND ${CMAKE_OSX_ARCHITECTURES} "armv7" OSX_HAS_ARMV7)
if (OSX_HAS_ARMV7)
set(OSX_RE_EXPORT_LINE
"${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib"
"-Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++sjlj-abi.exp")
else()
set(OSX_RE_EXPORT_LINE
"-Wl,-reexport_library,${CMAKE_OSX_SYSROOT}/usr/lib/libc++abi.dylib")
endif()
else()
set (OSX_RE_EXPORT_LINE "/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++abi${LIBCXX_LIBCPPABI_VERSION}.exp")
endif()
list(APPEND link_flags
"-compatibility_version 1"
"-install_name /usr/lib/libc++.1.dylib"
"-Wl,-unexported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/libc++unexp.exp"
"${OSX_RE_EXPORT_LINE}"
"-Wl,-force_symbols_not_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/notweak.exp"
"-Wl,-force_symbols_weak_list,${CMAKE_CURRENT_SOURCE_DIR}/weak.exp")
endif()
endif()
string(REPLACE ";" " " link_flags "${link_flags}")
set_target_properties(cxx
PROPERTIES
COMPILE_FLAGS "${compile_flags}"
@@ -99,3 +62,10 @@ install(TARGETS cxx
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(DIRECTORY ../include/
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
PATTERN ".svn" EXCLUDE
)

View File

@@ -22,21 +22,22 @@ then
CC=clang
fi
if [ -z "$MACOSX_DEPLOYMENT_TARGET" ]
if [ -z $MACOSX_DEPLOYMENT_TARGET ]
then
if [ -z "$IPHONEOS_DEPLOYMENT_TARGET" ]
if [ -z $IPHONEOS_DEPLOYMENT_TARGET ]
then
MACOSX_DEPLOYMENT_TARGET=10.7
fi
fi
if [ -z "$RC_ProjectSourceVersion" ]
if [ -z $RC_ProjectSourceVersion ]
then
RC_ProjectSourceVersion=1
fi
EXTRA_FLAGS="-nostdinc++ -std=c++11 -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
-Wpadded -Wstrict-aliasing=2 -Wstrict-overflow=4 "
EXTRA_FLAGS="-std=c++0x -fstrict-aliasing -Wall -Wextra -Wshadow -Wconversion \
-Wnewline-eof -Wpadded -Wmissing-prototypes -Wstrict-aliasing=2 \
-Wstrict-overflow=4 "
case $TRIPLE in
*-apple-*)
@@ -47,7 +48,7 @@ case $TRIPLE in
SOEXT=dylib
if [ "$MACOSX_DEPLOYMENT_TARGET" == "10.6" ]
then
EXTRA_FLAGS="-nostdinc++ -std=c++11 -U__STRICT_ANSI__"
EXTRA_FLAGS="-std=c++0x -U__STRICT_ANSI__"
LDSHARED_FLAGS="-o libc++.1.dylib \
-dynamiclib -nodefaultlibs -current_version 1 \
-compatibility_version 1 \
@@ -58,7 +59,7 @@ case $TRIPLE in
else
if [ -n "$SDKROOT" ]
then
EXTRA_FLAGS+="-nostdinc++ -isysroot ${SDKROOT}"
EXTRA_FLAGS+="-isysroot ${SDKROOT}"
if echo "${RC_ARCHS}" | grep -q "armv7"
then
RE_EXPORT_LINE="${SDKROOT}/usr/lib/libc++abi.dylib -Wl,-reexported_symbols_list,libc++sjlj-abi.exp"
@@ -96,23 +97,6 @@ case $TRIPLE in
-shared -nodefaultlibs -Wl,--export-all-symbols -Wl,--allow-multiple-definition -Wl,--out-implib,libc++.dll.a \
-lsupc++ -lpthread -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcr100 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc_s -lgcc -lmoldname -lmingwex -lmsvcrt"
;;
*-ibm-*)
hostOS=`uname`
hostOS=`echo $hostOS | sed -e "s/\s+$//"`
hostOS=`echo $hostOS | tr '[A-Z]' '[a-z]'`
if [ $hostOS == "linux" ]
then
LDSHARED_FLAGS="-o libc++.so.1 \
-qmkshrobj -Wl,-soname,libc++.so.1 \
-lpthread -lrt -lc -lstdc++"
EXTRA_FLAGS="-qlanglvl=extended0x -D__GLIBCXX__=1"
else
LDSHARED_FLAGS="-o shr.o -qmkshrobj -lpthread -bnoquiet"
EXTRA_FLAGS="-qlanglvl=extended0x"
fi
RC_CFLAGS="-qpic=large"
;;
*)
RC_CFLAGS="-fPIC"
SOEXT=so
@@ -122,7 +106,7 @@ case $TRIPLE in
;;
esac
if [ -z "$RC_XBS" ]
if [ -z $RC_XBS ]
then
rm -f libc++.1.$SOEXT*
fi
@@ -130,12 +114,12 @@ fi
set -x
for FILE in ../src/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
done
case $TRIPLE in
*-*-mingw*)
for FILE in ../src/support/win32/*.cpp; do
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -I../include $FILE
$CXX -c -g -Os $RC_CFLAGS $EXTRA_FLAGS -nostdinc++ -I../include $FILE
done
;;
esac
@@ -152,23 +136,13 @@ case $TRIPLE in
;;
*-*-mingw*)
;;
*-ibm-*)
if [ $hostOS == "linux" ]
then
rm -f libc++.so
ln -s libc++.so.1 libc++.so
else #AIX
rm -f libc++.a
ar r libc++.a shr.o
fi
;;
*)
rm -f libc++.so
ln -s libc++.so.1 libc++.so
;;
esac
if [ -z "$RC_XBS" ]
if [ -z $RC_XBS ]
then
rm *.o
fi

View File

@@ -7,7 +7,6 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include "algorithm"
#include "random"
#include "mutex"

View File

@@ -7,7 +7,7 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_DEBUG 1
#define _LIBCPP_DEBUG2 1
#include "__config"
#include "__debug"
#include "functional"
@@ -118,19 +118,20 @@ void
__libcpp_db::__insert_ic(void* __i, const void* __c)
{
WLock _(mut());
if (__cbeg_ == __cend_)
return;
__i_node* i = __insert_iterator(__i);
const char* errmsg =
"Container constructed in a translation unit with debug mode disabled."
" But it is being used in a translation unit with debug mode enabled."
" Enable it in the other translation unit with #define _LIBCPP_DEBUG2 1";
_LIBCPP_ASSERT(__cbeg_ != __cend_, errmsg);
size_t hc = hash<const void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* c = __cbeg_[hc];
if (c == nullptr)
return;
_LIBCPP_ASSERT(c != nullptr, errmsg);
while (c->__c_ != __c)
{
c = c->__next_;
if (c == nullptr)
return;
_LIBCPP_ASSERT(c != nullptr, errmsg);
}
__i_node* i = __insert_iterator(__i);
c->__add(i);
i->__c_ = c;
}
@@ -216,23 +217,18 @@ void
__libcpp_db::__invalidate_all(void* __c)
{
WLock _(mut());
if (__cend_ != __cbeg_)
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all A");
while (p->__c_ != __c)
{
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
if (p == nullptr)
return;
while (p->__c_ != __c)
{
p = p->__next_;
if (p == nullptr)
return;
}
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __invalidate_all B");
}
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
}
@@ -240,26 +236,13 @@ __c_node*
__libcpp_db::__find_c_and_lock(void* __c) const
{
mut().lock();
if (__cend_ == __cbeg_)
{
mut().unlock();
return nullptr;
}
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
if (p == nullptr)
{
mut().unlock();
return nullptr;
}
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock A");
while (p->__c_ != __c)
{
p = p->__next_;
if (p == nullptr)
{
mut().unlock();
return nullptr;
}
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __find_c_and_lock B");
}
return p;
}
@@ -288,35 +271,28 @@ void
__libcpp_db::__erase_c(void* __c)
{
WLock _(mut());
if (__cend_ != __cbeg_)
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
__c_node* q = nullptr;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
while (p->__c_ != __c)
{
size_t hc = hash<void*>()(__c) % static_cast<size_t>(__cend_ - __cbeg_);
__c_node* p = __cbeg_[hc];
if (p == nullptr)
return;
__c_node* q = nullptr;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c A");
while (p->__c_ != __c)
{
q = p;
p = p->__next_;
if (p == nullptr)
return;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c B");
}
if (q == nullptr)
__cbeg_[hc] = p->__next_;
else
q->__next_ = p->__next_;
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
free(p->beg_);
free(p);
--__csz_;
q = p;
p = p->__next_;
_LIBCPP_ASSERT(p != nullptr, "debug mode internal logic error __erase_c B");
}
if (q == nullptr)
__cbeg_[hc] = p->__next_;
else
q->__next_ = p->__next_;
while (p->end_ != p->beg_)
{
--p->end_;
(*p->end_)->__c_ = nullptr;
}
free(p->beg_);
free(p);
--__csz_;
}
void
@@ -378,7 +354,7 @@ __libcpp_db::__subscriptable(const void* __i, ptrdiff_t __n) const
}
bool
__libcpp_db::__less_than_comparable(const void* __i, const void* __j) const
__libcpp_db::__comparable(const void* __i, const void* __j) const
{
RLock _(mut());
__i_node* i = __find_iterator(__i);

View File

@@ -7,10 +7,8 @@
//
//===----------------------------------------------------------------------===//
#include <stdlib.h>
#include <stdio.h>
#include "exception"
#include "new"
#ifndef __has_include
#define __has_include(inc) 0
@@ -24,7 +22,7 @@
#ifndef _LIBCPPABI_VERSION
using namespace __cxxabiapple;
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared library. The globals holding the current terminate handler and
// shared libray. The globals holding the current terminate handler and
// current unexpected handler are in the ABI library.
#define __terminate_handler __cxxabiapple::__cxa_terminate_handler
#define __unexpected_handler __cxxabiapple::__cxa_unexpected_handler
@@ -79,7 +77,7 @@ get_terminate() _NOEXCEPT
return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
}
#ifndef __EMSCRIPTEN__ // We provide this in JS
#ifndef EMSCRIPTEN // We provide this in JS
_LIBCPP_NORETURN
void
terminate() _NOEXCEPT
@@ -90,39 +88,31 @@ terminate() _NOEXCEPT
#endif // _LIBCPP_NO_EXCEPTIONS
(*get_terminate())();
// handler should not return
printf("terminate_handler unexpectedly returned\n");
::abort();
::abort ();
#ifndef _LIBCPP_NO_EXCEPTIONS
}
catch (...)
{
// handler should not throw exception
printf("terminate_handler unexpectedly threw an exception\n");
::abort();
::abort ();
}
#endif // _LIBCPP_NO_EXCEPTIONS
}
#endif // !__EMSCRIPTEN__
#endif // !EMSCRIPTEN
#endif // !defined(LIBCXXRT) && !defined(_LIBCPPABI_VERSION)
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(__EMSCRIPTEN__)
#if !defined(LIBCXXRT) && !defined(__GLIBCXX__) && !defined(EMSCRIPTEN)
bool uncaught_exception() _NOEXCEPT
{
#if defined(__APPLE__) || defined(_LIBCPPABI_VERSION)
// on Darwin, there is a helper function so __cxa_get_globals is private
return __cxa_uncaught_exception();
#else // __APPLE__
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("uncaught_exception not yet implemented")
# else
# warning uncaught_exception not yet implemented
# endif
printf("uncaught_exception not yet implemented\n");
#warning uncaught_exception not yet implemented
::abort();
#endif // __APPLE__
}
#ifndef _LIBCPPABI_VERSION
exception::~exception() _NOEXCEPT
@@ -149,50 +139,15 @@ const char* bad_exception::what() const _NOEXCEPT
#endif
#if defined(__GLIBCXX__)
// libsupc++ does not implement the dependent EH ABI and the functionality
// it uses to implement std::exception_ptr (which it declares as an alias of
// std::__exception_ptr::exception_ptr) is not directly exported to clients. So
// we have little choice but to hijack std::__exception_ptr::exception_ptr's
// (which fortunately has the same layout as our std::exception_ptr) copy
// constructor, assignment operator and destructor (which are part of its
// stable ABI), and its rethrow_exception(std::__exception_ptr::exception_ptr)
// function.
namespace __exception_ptr
{
struct exception_ptr
{
void* __ptr_;
exception_ptr(const exception_ptr&) _NOEXCEPT;
exception_ptr& operator=(const exception_ptr&) _NOEXCEPT;
~exception_ptr() _NOEXCEPT;
};
}
_LIBCPP_NORETURN void rethrow_exception(__exception_ptr::exception_ptr);
#endif
exception_ptr::~exception_ptr() _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_decrement_exception_refcount(__ptr_);
#elif defined(__GLIBCXX__)
reinterpret_cast<__exception_ptr::exception_ptr*>(this)->~exception_ptr();
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
printf("exception_ptr not yet implemented\n");
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
@@ -200,18 +155,10 @@ exception_ptr::exception_ptr(const exception_ptr& other) _NOEXCEPT
{
#if HAVE_DEPENDENT_EH_ABI
__cxa_increment_exception_refcount(__ptr_);
#elif defined(__GLIBCXX__)
new (reinterpret_cast<void*>(this)) __exception_ptr::exception_ptr(
reinterpret_cast<const __exception_ptr::exception_ptr&>(other));
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
printf("exception_ptr not yet implemented\n");
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
@@ -224,19 +171,10 @@ exception_ptr& exception_ptr::operator=(const exception_ptr& other) _NOEXCEPT
__ptr_ = other.__ptr_;
}
return *this;
#elif defined(__GLIBCXX__)
*reinterpret_cast<__exception_ptr::exception_ptr*>(this) =
reinterpret_cast<const __exception_ptr::exception_ptr&>(other);
return *this;
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
printf("exception_ptr not yet implemented\n");
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
nested_exception::nested_exception() _NOEXCEPT
@@ -244,14 +182,10 @@ nested_exception::nested_exception() _NOEXCEPT
{
}
#if !defined(__GLIBCXX__)
nested_exception::~nested_exception() _NOEXCEPT
{
}
#endif
_LIBCPP_NORETURN
void
nested_exception::rethrow_nested() const
@@ -261,7 +195,6 @@ nested_exception::rethrow_nested() const
rethrow_exception(__ptr_);
}
#if !defined(__GLIBCXX__)
exception_ptr current_exception() _NOEXCEPT
{
@@ -272,19 +205,12 @@ exception_ptr current_exception() _NOEXCEPT
exception_ptr ptr;
ptr.__ptr_ = __cxa_current_primary_exception();
return ptr;
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING( "exception_ptr not yet implemented" )
# else
# warning exception_ptr not yet implemented
# endif
printf("exception_ptr not yet implemented\n");
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
#endif // !__GLIBCXX__
_LIBCPP_NORETURN
void rethrow_exception(exception_ptr p)
{
@@ -292,16 +218,9 @@ void rethrow_exception(exception_ptr p)
__cxa_rethrow_primary_exception(p.__ptr_);
// if p.__ptr_ is NULL, above returns so we terminate
terminate();
#elif defined(__GLIBCXX__)
rethrow_exception(reinterpret_cast<__exception_ptr::exception_ptr&>(p));
#else
# if defined(_MSC_VER) && ! defined(__clang__)
_LIBCPP_WARNING("exception_ptr not yet implemented")
# else
# warning exception_ptr not yet implemented
# endif
printf("exception_ptr not yet implemented\n");
#else // __APPLE__
#warning exception_ptr not yet implemented
::abort();
#endif
#endif // __APPLE__
}
} // std

View File

@@ -26,20 +26,11 @@ __future_error_category::name() const _NOEXCEPT
return "future";
}
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch"
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch"
#endif
string
__future_error_category::message(int ev) const
{
switch (static_cast<future_errc>(ev))
{
case future_errc(0): // For backwards compatibility with C++11 (LWG 2056)
case future_errc::broken_promise:
return string("The associated promise has been destructed prior "
"to the associated state becoming ready.");
@@ -55,12 +46,6 @@ __future_error_category::message(int ev) const
return string("unspecified future_errc value\n");
}
#if defined(__clang__)
#pragma clang diagnostic pop
#elif defined(__GNUC__) || defined(__GNUG__)
#pragma GCC diagnostic pop
#endif
const error_category&
future_category() _NOEXCEPT
{

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#include "ios"
#include "streambuf"
#include "istream"
@@ -63,7 +61,7 @@ __iostream_category::message(int ev) const
}
const error_category&
iostream_category() _NOEXCEPT
iostream_category()
{
static __iostream_category s;
return s;
@@ -149,11 +147,8 @@ ios_base::getloc() const
}
// xalloc
#if __has_feature(cxx_atomic)
atomic<int> ios_base::__xindex_ = ATOMIC_VAR_INIT(0);
#else
int ios_base::__xindex_ = 0;
#endif
int
ios_base::xalloc()

View File

@@ -22,14 +22,14 @@ _ALIGNAS_TYPE (__stdinbuf<wchar_t> ) static char __wcin [sizeof(__stdinbuf <wcha
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcout[sizeof(__stdoutbuf<wchar_t>)];
_ALIGNAS_TYPE (__stdoutbuf<wchar_t>) static char __wcerr[sizeof(__stdoutbuf<wchar_t>)];
_ALIGNAS_TYPE (istream) _LIBCPP_FUNC_VIS char cin [sizeof(istream)];
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cout[sizeof(ostream)];
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char cerr[sizeof(ostream)];
_ALIGNAS_TYPE (ostream) _LIBCPP_FUNC_VIS char clog[sizeof(ostream)];
_ALIGNAS_TYPE (wistream) _LIBCPP_FUNC_VIS char wcin [sizeof(wistream)];
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcout[sizeof(wostream)];
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wcerr[sizeof(wostream)];
_ALIGNAS_TYPE (wostream) _LIBCPP_FUNC_VIS char wclog[sizeof(wostream)];
_ALIGNAS_TYPE (istream) char cin [sizeof(istream)];
_ALIGNAS_TYPE (ostream) char cout[sizeof(ostream)];
_ALIGNAS_TYPE (ostream) char cerr[sizeof(ostream)];
_ALIGNAS_TYPE (ostream) char clog[sizeof(ostream)];
_ALIGNAS_TYPE (wistream) char wcin [sizeof(wistream)];
_ALIGNAS_TYPE (wostream) char wcout[sizeof(wostream)];
_ALIGNAS_TYPE (wostream) char wcerr[sizeof(wostream)];
_ALIGNAS_TYPE (wostream) char wclog[sizeof(wostream)];
ios_base::Init __start_std_streams;

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
// On Solaris, we need to define something to make the C99 parts of localeconv
// visible.
#ifdef __sun__
@@ -20,27 +18,23 @@
#include "codecvt"
#include "vector"
#include "algorithm"
#include "algorithm"
#include "typeinfo"
#ifndef _LIBCPP_NO_EXCEPTIONS
# include "type_traits"
#endif
#include "type_traits"
#include "clocale"
#include "cstring"
#include "cwctype"
#include "__sso_allocator"
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
#include <support/win32/locale_win32.h>
#else // _LIBCPP_MSVCRT
#else // _WIN32
#include <langinfo.h>
#endif // !_LIBCPP_MSVCRT
#endif // _!WIN32
#include <stdlib.h>
#include <stdio.h>
// On Linux, wint_t and wchar_t have different signed-ness, and this causes
// lots of noise in the build log, but no bugs that I know of.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wsign-conversion"
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
@@ -111,11 +105,6 @@ countof(const T * const begin, const T * const end)
}
#if defined(_AIX)
// Set priority to INT_MIN + 256 + 150
# pragma priority ( -2147483242 )
#endif
const locale::category locale::none;
const locale::category locale::collate;
const locale::category locale::ctype;
@@ -125,23 +114,14 @@ const locale::category locale::time;
const locale::category locale::messages;
const locale::category locale::all;
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpadded"
#endif
class _LIBCPP_HIDDEN locale::__imp
: public facet
{
enum {N = 28};
#if defined(_LIBCPP_MSVC)
// FIXME: MSVC doesn't support aligned parameters by value.
// I can't get the __sso_allocator to work here
// for MSVC I think for this reason.
vector<facet*> facets_;
#else
vector<facet*, __sso_allocator<facet*, N> > facets_;
#endif
string name_;
public:
explicit __imp(size_t refs = 0);
@@ -165,9 +145,7 @@ private:
template <class F> void install_from(const __imp& other);
};
#if defined(__clang__)
#pragma clang diagnostic pop
#endif
locale::__imp::__imp(size_t refs)
: facet(refs),
@@ -777,7 +755,7 @@ ctype<wchar_t>::~ctype()
bool
ctype<wchar_t>::do_is(mask m, char_type c) const
{
return isascii(c) ? (ctype<char>::classic_table()[c] & m) != 0 : false;
return isascii(c) ? ctype<char>::classic_table()[c] & m : false;
}
const wchar_t*
@@ -812,7 +790,7 @@ ctype<wchar_t>::do_toupper(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__mapupper[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
return isascii(c) ? ctype<char>::__classic_upper_table()[c] : c;
#else
return (isascii(c) && iswlower_l(c, __cloc())) ? c-L'a'+L'A' : c;
@@ -825,7 +803,7 @@ ctype<wchar_t>::do_toupper(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__mapupper[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
*low = isascii(*low) ? ctype<char>::__classic_upper_table()[*low]
: *low;
#else
@@ -839,7 +817,7 @@ ctype<wchar_t>::do_tolower(char_type c) const
{
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ? _DefaultRuneLocale.__maplower[c] : c;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
return isascii(c) ? ctype<char>::__classic_lower_table()[c] : c;
#else
return (isascii(c) && isupper_l(c, __cloc())) ? c-L'A'+'a' : c;
@@ -852,7 +830,7 @@ ctype<wchar_t>::do_tolower(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? _DefaultRuneLocale.__maplower[*low] : *low;
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
*low = isascii(*low) ? ctype<char>::__classic_lower_table()[*low]
: *low;
#else
@@ -919,11 +897,9 @@ ctype<char>::do_toupper(char_type c) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
return static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
return isascii(c) ?
static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(c)]) : c;
static_cast<char>(__classic_upper_table()[static_cast<size_t>(c)]) : c;
#else
return (isascii(c) && islower_l(c, __cloc())) ? c-'a'+'A' : c;
#endif
@@ -936,9 +912,7 @@ ctype<char>::do_toupper(char_type* low, const char_type* high) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ?
static_cast<char>(_DefaultRuneLocale.__mapupper[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
*low = static_cast<char>(__classic_upper_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
*low = isascii(*low) ?
static_cast<char>(__classic_upper_table()[static_cast<size_t>(*low)]) : *low;
#else
@@ -953,9 +927,7 @@ ctype<char>::do_tolower(char_type c) const
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
return isascii(c) ?
static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(c)]) : c;
#elif defined(__NetBSD__)
return static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(c)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__) || defined(__NetBSD__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
return isascii(c) ?
static_cast<char>(__classic_lower_table()[static_cast<size_t>(c)]) : c;
#else
@@ -969,9 +941,7 @@ ctype<char>::do_tolower(char_type* low, const char_type* high) const
for (; low != high; ++low)
#ifdef _LIBCPP_HAS_DEFAULTRUNELOCALE
*low = isascii(*low) ? static_cast<char>(_DefaultRuneLocale.__maplower[static_cast<ptrdiff_t>(*low)]) : *low;
#elif defined(__NetBSD__)
*low = static_cast<char>(__classic_lower_table()[static_cast<unsigned char>(*low)]);
#elif defined(__GLIBC__) || defined(__EMSCRIPTEN__)
#elif defined(__GLIBC__) || defined(EMSCRIPTEN)
*low = isascii(*low) ? static_cast<char>(__classic_lower_table()[static_cast<size_t>(*low)]) : *low;
#else
*low = (isascii(*low) && isupper_l(*low, __cloc())) ? *low-'A'+'a' : *low;
@@ -1012,7 +982,7 @@ ctype<char>::do_narrow(const char_type* low, const char_type* high, char dfault,
return low;
}
#ifdef __EMSCRIPTEN__
#ifdef EMSCRIPTEN
extern "C" const unsigned short ** __ctype_b_loc();
extern "C" const int ** __ctype_tolower_loc();
extern "C" const int ** __ctype_toupper_loc();
@@ -1023,25 +993,20 @@ ctype<char>::classic_table() _NOEXCEPT
{
#if defined(__APPLE__) || defined(__FreeBSD__)
return _DefaultRuneLocale.__runetype;
#elif defined(__NetBSD__)
return _C_ctype_tab_ + 1;
#elif defined(__GLIBC__)
return __cloc()->__ctype_b;
#elif __sun__
return __ctype_mask;
#elif defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#elif defined(_WIN32)
return _ctype+1; // internal ctype mask table defined in msvcrt.dll
// This is assumed to be safe, which is a nonsense assumption because we're
// going to end up dereferencing it later...
#elif defined(__EMSCRIPTEN__)
#elif defined(EMSCRIPTEN)
return *__ctype_b_loc();
#elif defined(_AIX)
return (const unsigned long *)__lc_ctype_ptr->obj->mask;
#else
// Platform not supported: abort so the person doing the port knows what to
// fix
# warning ctype<char>::classic_table() is not implemented
printf("ctype<char>::classic_table() is not implemented\n");
abort();
return NULL;
#endif
@@ -1059,20 +1024,9 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
{
return __cloc()->__ctype_toupper;
}
#elif __NetBSD__
const short*
ctype<char>::__classic_lower_table() _NOEXCEPT
{
return _C_tolower_tab_ + 1;
}
#endif // __GLIBC__
const short*
ctype<char>::__classic_upper_table() _NOEXCEPT
{
return _C_toupper_tab_ + 1;
}
#elif defined(__EMSCRIPTEN__)
#if defined(EMSCRIPTEN)
const int*
ctype<char>::__classic_lower_table() _NOEXCEPT
{
@@ -1084,7 +1038,7 @@ ctype<char>::__classic_upper_table() _NOEXCEPT
{
return *__ctype_toupper_loc();
}
#endif // __GLIBC__ || __EMSCRIPTEN__ || __NETBSD__
#endif // EMSCRIPTEN
// template <> class ctype_byname<char>
@@ -1422,7 +1376,7 @@ locale::id codecvt<wchar_t, char, mbstate_t>::id;
codecvt<wchar_t, char, mbstate_t>::codecvt(size_t refs)
: locale::facet(refs),
__l(_LIBCPP_GET_C_LOCALE)
__l(0)
{
}
@@ -1439,7 +1393,7 @@ codecvt<wchar_t, char, mbstate_t>::codecvt(const char* nm, size_t refs)
codecvt<wchar_t, char, mbstate_t>::~codecvt()
{
if (__l != _LIBCPP_GET_C_LOCALE)
if (__l != 0)
freelocale(__l);
}
@@ -3226,25 +3180,14 @@ __codecvt_utf8<wchar_t>::do_out(state_type&,
const intern_type* frm, const intern_type* frm_end, const intern_type*& frm_nxt,
extern_type* to, extern_type* to_end, extern_type*& to_nxt) const
{
#if _WIN32
const uint16_t* _frm = reinterpret_cast<const uint16_t*>(frm);
const uint16_t* _frm_end = reinterpret_cast<const uint16_t*>(frm_end);
const uint16_t* _frm_nxt = _frm;
#else
const uint32_t* _frm = reinterpret_cast<const uint32_t*>(frm);
const uint32_t* _frm_end = reinterpret_cast<const uint32_t*>(frm_end);
const uint32_t* _frm_nxt = _frm;
#endif
uint8_t* _to = reinterpret_cast<uint8_t*>(to);
uint8_t* _to_end = reinterpret_cast<uint8_t*>(to_end);
uint8_t* _to_nxt = _to;
#if _WIN32
result r = ucs2_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
_Maxcode_, _Mode_);
#else
result r = ucs4_to_utf8(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
_Maxcode_, _Mode_);
#endif
frm_nxt = frm + (_frm_nxt - _frm);
to_nxt = to + (_to_nxt - _to);
return r;
@@ -3258,19 +3201,11 @@ __codecvt_utf8<wchar_t>::do_in(state_type&,
const uint8_t* _frm = reinterpret_cast<const uint8_t*>(frm);
const uint8_t* _frm_end = reinterpret_cast<const uint8_t*>(frm_end);
const uint8_t* _frm_nxt = _frm;
#if _WIN32
uint16_t* _to = reinterpret_cast<uint16_t*>(to);
uint16_t* _to_end = reinterpret_cast<uint16_t*>(to_end);
uint16_t* _to_nxt = _to;
result r = utf8_to_ucs2(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
_Maxcode_, _Mode_);
#else
uint32_t* _to = reinterpret_cast<uint32_t*>(to);
uint32_t* _to_end = reinterpret_cast<uint32_t*>(to_end);
uint32_t* _to_nxt = _to;
result r = utf8_to_ucs4(_frm, _frm_end, _frm_nxt, _to, _to_end, _to_nxt,
_Maxcode_, _Mode_);
#endif
frm_nxt = frm + (_frm_nxt - _frm);
to_nxt = to + (_to_nxt - _to);
return r;
@@ -4372,7 +4307,7 @@ __num_put_base::__format_float(char* __fmtp, const char* __len,
if (__flags & ios_base::showpoint)
*__fmtp++ = '#';
ios_base::fmtflags floatfield = __flags & ios_base::floatfield;
bool uppercase = (__flags & ios_base::uppercase) != 0;
bool uppercase = __flags & ios_base::uppercase;
if (floatfield == (ios_base::fixed | ios_base::scientific))
specify_precision = false;
else
@@ -4703,12 +4638,9 @@ __time_get::~__time_get()
{
freelocale(__loc_);
}
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wmissing-field-initializers"
#endif
#if defined(__GNUG__)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
template <>
string
@@ -4854,9 +4786,7 @@ __time_get_storage<char>::__analyze(char fmt, const ctype<char>& ct)
return result;
}
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wmissing-braces"
#endif
template <>
wstring
@@ -5389,7 +5319,7 @@ __time_put::__time_put(const string& nm)
__time_put::~__time_put()
{
if (__loc_ != _LIBCPP_GET_C_LOCALE)
if (__loc_)
freelocale(__loc_);
}
@@ -5875,19 +5805,19 @@ moneypunct_byname<char, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
if (lc->p_sign_posn == 0)
#else // _LIBCPP_MSVCRT
#else // _WIN32
if (lc->int_p_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
#endif //_WIN32
__positive_sign_ = "()";
else
__positive_sign_ = lc->positive_sign;
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
if(lc->n_sign_posn == 0)
#else // _LIBCPP_MSVCRT
#else // _WIN32
if (lc->int_n_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
#endif // _WIN32
__negative_sign_ = "()";
else
__negative_sign_ = lc->negative_sign;
@@ -5895,19 +5825,19 @@ moneypunct_byname<char, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, ' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, ' ');
#else // _LIBCPP_MSVCRT
#else
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
lc->int_p_sign_posn, ' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
lc->int_n_sign_posn, ' ');
#endif // !_LIBCPP_MSVCRT
#endif // _WIN32
}
template<>
@@ -6034,11 +5964,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
__frac_digits_ = lc->int_frac_digits;
else
__frac_digits_ = base::do_frac_digits();
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
if (lc->p_sign_posn == 0)
#else // _LIBCPP_MSVCRT
#else // _WIN32
if (lc->int_p_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
#endif // _WIN32
__positive_sign_ = L"()";
else
{
@@ -6054,11 +5984,11 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
wbe = wbuf + j;
__positive_sign_.assign(wbuf, wbe);
}
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
if (lc->n_sign_posn == 0)
#else // _LIBCPP_MSVCRT
#else // _WIN32
if (lc->int_n_sign_posn == 0)
#endif // !_LIBCPP_MSVCRT
#endif // _WIN32
__negative_sign_ = L"()";
else
{
@@ -6078,19 +6008,19 @@ moneypunct_byname<wchar_t, true>::init(const char* nm)
// the same places in curr_symbol since there's no way to
// represent anything else.
string_type __dummy_curr_symbol = __curr_symbol_;
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#ifdef _WIN32
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->p_cs_precedes, lc->p_sep_by_space, lc->p_sign_posn, L' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->n_cs_precedes, lc->n_sep_by_space, lc->n_sign_posn, L' ');
#else // _LIBCPP_MSVCRT
#else // _WIN32
__init_pat(__pos_format_, __dummy_curr_symbol, true,
lc->int_p_cs_precedes, lc->int_p_sep_by_space,
lc->int_p_sign_posn, L' ');
__init_pat(__neg_format_, __curr_symbol_, true,
lc->int_n_cs_precedes, lc->int_n_sep_by_space,
lc->int_n_sign_posn, L' ');
#endif // !_LIBCPP_MSVCRT
#endif // _WIN32
}
void __do_nothing(void*) {}

View File

@@ -42,7 +42,6 @@ void
mutex::unlock() _NOEXCEPT
{
int ec = pthread_mutex_unlock(&__m_);
(void)ec;
assert(ec == 0);
}
@@ -80,7 +79,6 @@ fail:
recursive_mutex::~recursive_mutex()
{
int e = pthread_mutex_destroy(&__m_);
(void)e;
assert(e == 0);
}
@@ -96,7 +94,6 @@ void
recursive_mutex::unlock() _NOEXCEPT
{
int e = pthread_mutex_unlock(&__m_);
(void)e;
assert(e == 0);
}

View File

@@ -7,8 +7,6 @@
//
//===----------------------------------------------------------------------===//
#define _LIBCPP_BUILDING_NEW
#include <stdlib.h>
#include "new"
@@ -22,7 +20,7 @@
#ifndef _LIBCPPABI_VERSION
// On Darwin, there are two STL shared libraries and a lower level ABI
// shared library. The global holding the current new handler is
// shared libray. The global holding the current new handler is
// in the ABI library and named __cxa_new_handler.
#define __new_handler __cxxabiapple::__cxa_new_handler
#endif
@@ -30,18 +28,16 @@
#if defined(LIBCXXRT) || __has_include(<cxxabi.h>)
#include <cxxabi.h>
#endif // __has_include(<cxxabi.h>)
#if !defined(_LIBCPPABI_VERSION) && !defined(__GLIBCXX__)
#ifndef _LIBCPPABI_VERSION
static std::new_handler __new_handler;
#endif // _LIBCPPABI_VERSION
#endif
#ifndef __GLIBCXX__
// Implement all new and delete operators as weak definitions
// in this shared library, so that they can be overriden by programs
// that define non-weak copies of the functions.
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void *
operator new(std::size_t size)
#if !__has_feature(cxx_noexcept)
@@ -68,7 +64,7 @@ operator new(std::size_t size)
return p;
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void*
operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
{
@@ -87,7 +83,7 @@ operator new(size_t size, const std::nothrow_t&) _NOEXCEPT
return p;
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void*
operator new[](size_t size)
#if !__has_feature(cxx_noexcept)
@@ -97,7 +93,7 @@ operator new[](size_t size)
return ::operator new(size);
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void*
operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
{
@@ -116,7 +112,7 @@ operator new[](size_t size, const std::nothrow_t&) _NOEXCEPT
return p;
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void
operator delete(void* ptr) _NOEXCEPT
{
@@ -124,40 +120,34 @@ operator delete(void* ptr) _NOEXCEPT
::free(ptr);
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void
operator delete(void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete(ptr);
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void
operator delete[] (void* ptr) _NOEXCEPT
{
::operator delete (ptr);
}
_LIBCPP_WEAK _LIBCPP_NEW_DELETE_VIS
__attribute__((__weak__, __visibility__("default")))
void
operator delete[] (void* ptr, const std::nothrow_t&) _NOEXCEPT
{
::operator delete[](ptr);
}
#endif // !__GLIBCXX__
namespace std
{
#ifndef __GLIBCXX__
const nothrow_t nothrow = {};
#endif
#ifndef _LIBCPPABI_VERSION
#ifndef __GLIBCXX__
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
@@ -170,16 +160,12 @@ get_new_handler() _NOEXCEPT
return __sync_fetch_and_add(&__new_handler, (new_handler)0);
}
#endif // !__GLIBCXX__
#ifndef LIBCXXRT
bad_alloc::bad_alloc() _NOEXCEPT
{
}
#ifndef __GLIBCXX__
bad_alloc::~bad_alloc() _NOEXCEPT
{
}
@@ -190,8 +176,6 @@ bad_alloc::what() const _NOEXCEPT
return "std::bad_alloc";
}
#endif // !__GLIBCXX__
#endif //LIBCXXRT
bad_array_new_length::bad_array_new_length() _NOEXCEPT
@@ -202,29 +186,13 @@ bad_array_new_length::~bad_array_new_length() _NOEXCEPT
{
}
const char*
bad_array_length::what() const _NOEXCEPT
{
return "bad_array_length";
}
bad_array_length::bad_array_length() _NOEXCEPT
{
}
bad_array_length::~bad_array_length() _NOEXCEPT
{
}
const char*
bad_array_new_length::what() const _NOEXCEPT
{
return "bad_array_new_length";
}
#endif // _LIBCPPABI_VERSION
#ifndef LIBSTDCXX
#endif
void
__throw_bad_alloc()
@@ -234,6 +202,4 @@ __throw_bad_alloc()
#endif
}
#endif // !LIBSTDCXX
} // std

View File

@@ -1,25 +0,0 @@
//===------------------------ optional.cpp --------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "experimental/optional"
namespace std // purposefully not using versioning namespace
{ namespace experimental {
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
bad_optional_access::~bad_optional_access() _NOEXCEPT {}
#else
bad_optional_access::~bad_optional_access() _NOEXCEPT = default;
#endif
}} // std::experimental

View File

@@ -7,45 +7,18 @@
//
//===----------------------------------------------------------------------===//
#if defined(_WIN32)
// Must be defined before including stdlib.h to enable rand_s().
#define _CRT_RAND_S
#include <stdio.h>
#endif
#include "random"
#include "system_error"
#ifdef __sun__
#define rename solaris_headers_are_broken
#endif
#if !defined(_WIN32)
#include <fcntl.h>
#include <unistd.h>
#endif // defined(_WIN32)
#include <errno.h>
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(_WIN32)
random_device::random_device(const string&)
{
}
random_device::~random_device()
{
}
unsigned
random_device::operator()()
{
unsigned r;
errno_t err = rand_s(&r);
if (err)
__throw_system_error(err, "random_device rand_s failed.");
return r;
}
#else
random_device::random_device(const string& __token)
: __f_(open(__token.c_str(), O_RDONLY))
{
@@ -65,7 +38,6 @@ random_device::operator()()
read(__f_, &r, sizeof(r));
return r;
}
#endif // defined(_WIN32)
double
random_device::entropy() const _NOEXCEPT

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