Compare commits

..

1 Commits

Author SHA1 Message Date
Bill Wendling
699f9ca983 Creating release_30 branch
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/branches/release_30@142042 91177308-0d34-0410-b5e6-96231b3b80d8
2011-10-15 01:58:33 +00:00
906 changed files with 11053 additions and 19555 deletions

View File

@@ -1,4 +0,0 @@
{
"project_id" : "libcxx",
"conduit_uri" : "http://llvm-reviews.chandlerc.com/"
}

View File

@@ -39,14 +39,6 @@ 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_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_ENABLE_SHARED "Build libc++ as a shared library." ON)
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})
#=============================================================================== #===============================================================================
# Configure System # Configure System
#=============================================================================== #===============================================================================
@@ -66,91 +58,6 @@ get_target_triple(LIBCXX_TARGET_TRIPLE
) )
set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.") set(LIBCXX_TARGET_TRIPLE ${LIBCXX_TARGET_TRIPLE} CACHE STRING "Target triple.")
#===============================================================================
# Add an ABI library if appropriate
#===============================================================================
#
# _setup_abi: Set up the build to use an ABI library
#
# Parameters:
# abidefines: A list of defines needed to compile libc++ with the ABI library
# abilibs : A list of libraries to link against
# abifiles : A list of files (which may be relative paths) to copy into the
# libc++ build tree for the build. These files will also be
# installed alongside the libc++ headers.
# abidirs : A list of relative paths to create under an include directory
# in the libc++ build directory.
#
macro(setup_abi_lib abipathvar abidefines abilibs abifiles abidirs)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS ${abidefines})
set(${abipathvar} "${${abipathvar}}"
CACHE STRINGS
"Paths to ABI include directories separate by ';'."
)
set(LIBCXX_CXX_ABI_LIBRARIES ${abilibs})
set(LIBCXX_ABILIB_FILES ${abifiles})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include")
foreach(_d ${abidirs})
file(MAKE_DIRECTORY "${CMAKE_BINARY_DIR}/include/${_d}")
endforeach()
set(LIBCXX_ABILIB_FILE_PATHS)
foreach(fpath ${LIBCXX_ABILIB_FILES})
set(found FALSE)
foreach(incpath ${${abipathvar}})
if (EXISTS "${incpath}/${fpath}")
set(found TRUE)
get_filename_component(dstdir ${fpath} PATH)
get_filename_component(ifile ${fpath} NAME)
add_custom_command(
OUTPUT "${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${incpath}/${fpath}"
"${CMAKE_BINARY_DIR}/include/${dstdir}"
MAIN_DEPENDENCY "${incpath}/${fpath}"
)
list(APPEND LIBCXX_CXX_ABI_DEPS
"${CMAKE_BINARY_DIR}/include/${dstdir}/${ifile}"
)
endif()
endforeach()
if (NOT found)
message(FATAL_ERROR "Failed to find ${fpath}")
endif()
endforeach()
add_custom_target(abilib_headers DEPENDS ${LIBCXX_CXX_ABI_DEPS})
set(LIBCXX_CXX_ABI_DEPS abilib_headers)
include_directories("${CMAKE_BINARY_DIR}/include")
install(DIRECTORY "${CMAKE_BINARY_DIR}/include/"
DESTINATION include/c++/v1
FILES_MATCHING
PATTERN "*"
)
endmacro()
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
)
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;cxa_demangle.h" ""
)
elseif ("${LIBCXX_CXX_ABI}" STREQUAL "libcxxrt")
setup_abi_lib("LIBCXX_LIBCXXRT_INCLUDE_PATHS" "-DLIBCXXRT"
"cxxrt" "cxxabi.h;unwind.h;unwind-arm.h;unwind-itanium.h" ""
)
elseif (NOT "${LIBCXX_CXX_ABI}" STREQUAL "none")
message(FATAL_ERROR
"Currently libsupc++, libcxxabi, libcxxrt and none are "
"supported for c++ abi."
)
endif ()
# Configure compiler. # Configure compiler.
include(config-ix) include(config-ix)
@@ -180,17 +87,17 @@ macro(append_if list condition var)
endmacro() endmacro()
# Get warning flags # Get warning flags
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WALL_FLAG -Wall)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_W_FLAG -W)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_UNUSED_PARAMETER_FLAG -Wno-unused-parameter)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WWRITE_STRINGS_FLAG -Wwrite-strings)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WNO_LONG_LONG_FLAG -Wno-long-long)
if (LIBCXX_ENABLE_WERROR) if (LIBCXX_ENABLE_WERROR)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WERROR_FLAG -Werror)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_WX_FLAG -WX)
endif() endif()
if (LIBCXX_ENABLE_PEDANTIC) if (LIBCXX_ENABLE_PEDANTIC)
append_if(LIBCXX_CXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic) append_if(LIBCXX_WARNING_FLAGS LIBCXX_HAS_PEDANTIC_FLAG -pedantic)
endif() endif()
# Get feature flags. # Get feature flags.
@@ -212,8 +119,7 @@ if (NOT LIBCXX_ENABLE_RTTI)
append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti) append_if(LIBCXX_CXX_FEATURE_FLAGS LIBCXX_HAS_FNO_RTTI_FLAG -fno-rtti)
endif() endif()
# Assert # Assert
string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE) if (LLVM_ENABLE_ASSERTIONS)
if (LIBCXX_ENABLE_ASSERTIONS)
# MSVC doesn't like _DEBUG on release builds. See PR 4379. # MSVC doesn't like _DEBUG on release builds. See PR 4379.
if (NOT MSVC) if (NOT MSVC)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG) list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_DEBUG)
@@ -228,10 +134,6 @@ else()
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG) list(APPEND LIBCXX_CXX_FEATURE_FLAGS -DNDEBUG)
endif() endif()
endif() endif()
# Static library
if (NOT LIBCXX_ENABLE_SHARED)
list(APPEND LIBCXX_CXX_FEATURE_FLAGS -D_LIBCPP_BUILD_STATIC)
endif()
# This is the _ONLY_ place where add_definitions is called. # This is the _ONLY_ place where add_definitions is called.
add_definitions( add_definitions(

View File

@@ -8,96 +8,27 @@ beautification by scripts. The fields are: name (N), email (E), web-address
(W), PGP key ID and fingerprint (P), description (D), and snail-mail address (W), PGP key ID and fingerprint (P), description (D), and snail-mail address
(S). (S).
N: Saleem Abdulrasool
E: compnerd@compnerd.org
D: Minor patches and Linux fixes.
N: Dimitry Andric
E: dimitry@andric.com
D: Visibility fixes, minor FreeBSD portability patches.
N: Holger Arnold
E: holgerar@gmail.com
D: Minor fix.
N: Ruben Van Boxem
E: vanboxem dot ruben at gmail dot com
D: Initial Windows patches.
N: David Chisnall
E: theraven at theravensnest dot org
D: FreeBSD and Solaris ports, libcxxrt support, some atomics work.
N: Marshall Clow
E: mclow.lists@gmail.com
E: marshall@idio.com
D: Minor patches and bug fixes.
N: Google Inc.
D: Copyright owner and contributor of the CityHash algorithm
N: Howard Hinnant N: Howard Hinnant
E: hhinnant@apple.com E: hhinnant@apple.com
D: Architect and primary author of libc++ D: Architect and primary author of libc++
N: Hyeon-bin Jeong N: Marshall Clow
E: tuhertz@gmail.com E: marshall@idio.com
E: mclow@qualcomm.com
D: Minor patches and bug fixes. D: Minor patches and bug fixes.
N: Argyrios Kyrtzidis
E: kyrtzidis@apple.com
D: Bug fixes.
N: Bruce Mitchener, Jr.
E: bruce.mitchener@gmail.com
D: Emscripten-related changes.
N: Michel Morin
E: mimomorin@gmail.com
D: Minor patches to is_convertible.
N: Andrew Morrow
E: andrew.c.morrow@gmail.com
D: Minor patches and Linux fixes.
N: Arvid Picciani
E: aep at exys dot org
D: Minor patches and musl port.
N: Bjorn Reese N: Bjorn Reese
E: breese@users.sourceforge.net E: breese@users.sourceforge.net
D: Initial regex prototype D: Initial regex prototype
N: Jonathan Sauer N: David Chisnall
D: Minor patches, mostly related to constexpr E: theraven at theravensnest dot org
D: FreeBSD port and libcxxrt support.
N: Craig Silverstein N: Ruben Van Boxem
E: csilvers@google.com E: vanboxem dot ruben at gmail dot com
D: Implemented Cityhash as the string hash function on 64-bit machines D: Initial Windows patches.
N: Richard Smith N: Arvid Picciani
D: Minor patches. E: aep at exys dot org
D: Minor patches and musl port.
N: Joerg Sonnenberger
E: joerg@NetBSD.org
D: NetBSD port.
N: Stephan Tolksdorf
E: st@quanttec.com
D: Minor <atomic> fix
N: Michael van der Westhuizen
E: r1mikey at gmail dot com
N: Klaas de Vries
E: klaas at klaasgaaf dot nl
D: Minor bug fix.
N: Zhang Xiongpang
E: zhangxiongpang@gmail.com
D: Minor patches and bug fixes.
N: Jeffrey Yasskin
E: jyasskin@gmail.com
E: jyasskin@google.com
D: Linux fixes.

View File

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

View File

@@ -1,5 +1,5 @@
## ##
# libc++ Makefile # libcpp Makefile
## ##
SRCDIRS = . SRCDIRS = .
@@ -14,12 +14,9 @@ ifeq (,$(RC_INDIGO))
else else
INSTALL_PREFIX="$(SDKROOT)" INSTALL_PREFIX="$(SDKROOT)"
endif endif
INSTALL_DIR=$(DSTROOT)/$(INSTALL_PREFIX)
.PHONY: help installsrc clean installheaders install
help:: help::
@echo "Use make install DSTROOT=<destination>" echo Use make install DSTROOT=<destination>
installsrc:: $(SRCROOT) installsrc:: $(SRCROOT)
@@ -30,23 +27,42 @@ installsrc:: $(SRCROOT)
clean:: clean::
# The installheaders target is used by clang's runtime/libcxx makefile. installhdrs::
installheaders::
mkdir -p $(HEADER_DIR)/c++/v1/ext
(cd $(SRCDIRS)/include && tar cf - --exclude=support .) | \
(cd $(HEADER_DIR)/c++/v1 && tar xf -)
chmod 755 $(HEADER_DIR)/c++/v1
chmod 644 $(HEADER_DIR)/c++/v1/*
chmod 755 $(HEADER_DIR)/c++/v1/ext
chmod 644 $(HEADER_DIR)/c++/v1/ext/*
install:: mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/
rsync -r --exclude=".*" $(SRCDIRS)/include/* $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++
chown -R root:wheel $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/*
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext
chmod 755 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/usr/clang-ide/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/usr/lib/c++/v1/ext/*
chmod 644 $(DSTROOT)/$(INSTALL_PREFIX)/Developer/Platforms/iPhoneOS.platform/usr/lib/c++/v1/ext/*
install:: installhdrs $(DESTDIR)
cd lib && ./buildit cd lib && ./buildit
ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib ditto lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM \ cd lib && dsymutil -o $(SYMROOT)/libc++.1.dylib.dSYM $(SYMROOT)/usr/lib/libc++.1.dylib
$(SYMROOT)/usr/lib/libc++.1.dylib mkdir -p $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib
mkdir -p $(INSTALL_DIR)/usr/lib strip -S -o $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib/libc++.1.dylib $(SYMROOT)/usr/lib/libc++.1.dylib
strip -S -o $(INSTALL_DIR)/usr/lib/libc++.1.dylib \ cd $(DSTROOT)/$(INSTALL_PREFIX)/usr/lib && ln -s libc++.1.dylib libc++.dylib
$(SYMROOT)/usr/lib/libc++.1.dylib
cd $(INSTALL_DIR)/usr/lib && ln -s libc++.1.dylib libc++.dylib

View File

@@ -14,16 +14,12 @@
#include <__config> #include <__config>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Cp, bool _IsConst, typename _Cp::__storage_type = 0> class __bit_iterator; template <class _C, bool _IsConst> class __bit_iterator;
template <class _Cp> class __bit_const_reference; template <class _C> class __bit_const_reference;
template <class _Tp> template <class _Tp>
struct __has_storage_type struct __has_storage_type
@@ -31,22 +27,22 @@ struct __has_storage_type
static const bool value = false; static const bool value = false;
}; };
template <class _Cp, bool = __has_storage_type<_Cp>::value> template <class _C, bool = __has_storage_type<_C>::value>
class __bit_reference class __bit_reference
{ {
typedef typename _Cp::__storage_type __storage_type; typedef typename _C::__storage_type __storage_type;
typedef typename _Cp::__storage_pointer __storage_pointer; typedef typename _C::__storage_pointer __storage_pointer;
__storage_pointer __seg_; __storage_pointer __seg_;
__storage_type __mask_; __storage_type __mask_;
#if defined(__clang__) #if defined(__clang__)
friend typename _Cp::__self; friend typename _C::__self;
#else #else
friend class _Cp::__self; friend class _C::__self;
#endif #endif
friend class __bit_const_reference<_Cp>; friend class __bit_const_reference<_C>;
friend class __bit_iterator<_Cp, false>; friend class __bit_iterator<_C, false>;
public: public:
_LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);} {return static_cast<bool>(*__seg_ & __mask_);}
@@ -68,87 +64,76 @@ public:
{return operator=(static_cast<bool>(__x));} {return operator=(static_cast<bool>(__x));}
_LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;} _LIBCPP_INLINE_VISIBILITY void flip() _NOEXCEPT {*__seg_ ^= __mask_;}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, false> operator&() const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, false> operator&() const _NOEXCEPT
{return __bit_iterator<_Cp, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));} {return __bit_iterator<_C, false>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT __bit_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {} : __seg_(__s), __mask_(__m) {}
}; };
template <class _Cp> template <class _C>
class __bit_reference<_Cp, false> class __bit_reference<_C, false>
{ {
}; };
template <class _Cp> template <class _C, class _D>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
swap(__bit_reference<_Cp> __x, __bit_reference<_Cp> __y) _NOEXCEPT swap(__bit_reference<_C> __x, __bit_reference<_D> __y) _NOEXCEPT
{ {
bool __t = __x; bool __t = __x;
__x = __y; __x = __y;
__y = __t; __y = __t;
} }
template <class _Cp, class _Dp> template <class _C>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
swap(__bit_reference<_Cp> __x, __bit_reference<_Dp> __y) _NOEXCEPT swap(__bit_reference<_C> __x, bool& __y) _NOEXCEPT
{ {
bool __t = __x; bool __t = __x;
__x = __y; __x = __y;
__y = __t; __y = __t;
} }
template <class _Cp> template <class _C>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
swap(__bit_reference<_Cp> __x, bool& __y) _NOEXCEPT swap(bool& __x, __bit_reference<_C> __y) _NOEXCEPT
{ {
bool __t = __x; bool __t = __x;
__x = __y; __x = __y;
__y = __t; __y = __t;
} }
template <class _Cp> template <class _C>
_LIBCPP_INLINE_VISIBILITY inline
void
swap(bool& __x, __bit_reference<_Cp> __y) _NOEXCEPT
{
bool __t = __x;
__x = __y;
__y = __t;
}
template <class _Cp>
class __bit_const_reference class __bit_const_reference
{ {
typedef typename _Cp::__storage_type __storage_type; typedef typename _C::__storage_type __storage_type;
typedef typename _Cp::__const_storage_pointer __storage_pointer; typedef typename _C::__const_storage_pointer __storage_pointer;
__storage_pointer __seg_; __storage_pointer __seg_;
__storage_type __mask_; __storage_type __mask_;
#if defined(__clang__) #if defined(__clang__)
friend typename _Cp::__self; friend typename _C::__self;
#else #else
friend class _Cp::__self; friend class _C::__self;
#endif #endif
friend class __bit_iterator<_Cp, true>; friend class __bit_iterator<_C, true>;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__bit_const_reference(const __bit_reference<_Cp>& __x) _NOEXCEPT __bit_const_reference(const __bit_reference<_C>& __x) _NOEXCEPT
: __seg_(__x.__seg_), __mask_(__x.__mask_) {} : __seg_(__x.__seg_), __mask_(__x.__mask_) {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR operator bool() const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY operator bool() const _NOEXCEPT
{return static_cast<bool>(*__seg_ & __mask_);} {return static_cast<bool>(*__seg_ & __mask_);}
_LIBCPP_INLINE_VISIBILITY __bit_iterator<_Cp, true> operator&() const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __bit_iterator<_C, true> operator&() const _NOEXCEPT
{return __bit_iterator<_Cp, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));} {return __bit_iterator<_C, true>(__seg_, static_cast<unsigned>(__ctz(__mask_)));}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT __bit_const_reference(__storage_pointer __s, __storage_type __m) _NOEXCEPT
: __seg_(__s), __mask_(__m) {} : __seg_(__s), __mask_(__m) {}
@@ -157,11 +142,11 @@ private:
// find // find
template <class _Cp, bool _IsConst> template <class _C>
__bit_iterator<_Cp, _IsConst> __bit_iterator<_C, false>
__find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) __find_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, _IsConst> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word // do first partial word
@@ -191,11 +176,11 @@ __find_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
return _It(__first.__seg_, static_cast<unsigned>(__n)); return _It(__first.__seg_, static_cast<unsigned>(__n));
} }
template <class _Cp, bool _IsConst> template <class _C>
__bit_iterator<_Cp, _IsConst> __bit_iterator<_C, false>
__find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) __find_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, _IsConst> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word // do first partial word
@@ -204,7 +189,7 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n); __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__storage_type __b = ~*__first.__seg_ & __m; __storage_type __b = ~(*__first.__seg_ & __m);
if (__b) if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
__n -= __dn; __n -= __dn;
@@ -221,30 +206,30 @@ __find_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
if (__n > 0) if (__n > 0)
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__storage_type __b = ~*__first.__seg_ & __m; __storage_type __b = ~(*__first.__seg_ & __m);
if (__b) if (__b)
return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b))); return _It(__first.__seg_, static_cast<unsigned>(_VSTD::__ctz(__b)));
} }
return _It(__first.__seg_, static_cast<unsigned>(__n)); return _It(__first.__seg_, static_cast<unsigned>(__n));
} }
template <class _Cp, bool _IsConst, class _Tp> template <class _C, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, _IsConst> __bit_iterator<_C, false>
find(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) find(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
{ {
if (static_cast<bool>(__value_)) if (static_cast<bool>(__value))
return __find_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __find_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
return __find_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __find_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
} }
// count // count
template <class _Cp, bool _IsConst> template <class _C>
typename __bit_iterator<_Cp, _IsConst>::difference_type typename __bit_iterator<_C, false>::difference_type
__count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) __count_bool_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, _IsConst> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type; typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -271,11 +256,11 @@ __count_bool_true(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type
return __r; return __r;
} }
template <class _Cp, bool _IsConst> template <class _C>
typename __bit_iterator<_Cp, _IsConst>::difference_type typename __bit_iterator<_C, false>::difference_type
__count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_type __n) __count_bool_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, _IsConst> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
typedef typename _It::difference_type difference_type; typedef typename _It::difference_type difference_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -286,7 +271,7 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
__storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_); __storage_type __clz_f = static_cast<__storage_type>(__bits_per_word - __first.__ctz_);
__storage_type __dn = _VSTD::min(__clz_f, __n); __storage_type __dn = _VSTD::min(__clz_f, __n);
__storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn)); __storage_type __m = (~__storage_type(0) << __first.__ctz_) & (~__storage_type(0) >> (__clz_f - __dn));
__r = _VSTD::__pop_count(~*__first.__seg_ & __m); __r = _VSTD::__pop_count(~(*__first.__seg_ & __m));
__n -= __dn; __n -= __dn;
++__first.__seg_; ++__first.__seg_;
} }
@@ -297,28 +282,28 @@ __count_bool_false(__bit_iterator<_Cp, _IsConst> __first, typename _Cp::size_typ
if (__n > 0) if (__n > 0)
{ {
__storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n); __storage_type __m = ~__storage_type(0) >> (__bits_per_word - __n);
__r += _VSTD::__pop_count(~*__first.__seg_ & __m); __r += _VSTD::__pop_count(~(*__first.__seg_ & __m));
} }
return __r; return __r;
} }
template <class _Cp, bool _IsConst, class _Tp> template <class _C, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename __bit_iterator<_Cp, _IsConst>::difference_type typename __bit_iterator<_C, false>::difference_type
count(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, const _Tp& __value_) count(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, const _Tp& __value)
{ {
if (static_cast<bool>(__value_)) if (static_cast<bool>(__value))
return __count_bool_true(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __count_bool_true(__first, static_cast<typename _C::size_type>(__last - __first));
return __count_bool_false(__first, static_cast<typename _Cp::size_type>(__last - __first)); return __count_bool_false(__first, static_cast<typename _C::size_type>(__last - __first));
} }
// fill_n // fill_n
template <class _Cp> template <class _C>
void void
__fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) __fill_n_false(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, false> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word // do first partial word
@@ -344,11 +329,11 @@ __fill_n_false(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
} }
} }
template <class _Cp> template <class _C>
void void
__fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n) __fill_n_true(__bit_iterator<_C, false> __first, typename _C::size_type __n)
{ {
typedef __bit_iterator<_Cp, false> _It; typedef __bit_iterator<_C, false> _It;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
// do first partial word // do first partial word
@@ -374,14 +359,14 @@ __fill_n_true(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n)
} }
} }
template <class _Cp> template <class _C>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
void void
fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __value_) fill_n(__bit_iterator<_C, false> __first, typename _C::size_type __n, bool __value)
{ {
if (__n > 0) if (__n > 0)
{ {
if (__value_) if (__value)
__fill_n_true(__first, __n); __fill_n_true(__first, __n);
else else
__fill_n_false(__first, __n); __fill_n_false(__first, __n);
@@ -390,22 +375,22 @@ fill_n(__bit_iterator<_Cp, false> __first, typename _Cp::size_type __n, bool __v
// fill // fill
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
fill(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __last, bool __value_) fill(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __last, bool __value)
{ {
_VSTD::fill_n(__first, static_cast<typename _Cp::size_type>(__last - __first), __value_); _VSTD::fill_n(__first, static_cast<typename _C::size_type>(__last - __first), __value);
} }
// copy // copy
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
__copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __copy_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_Cp, false> __result) __bit_iterator<_C, false> __result)
{ {
typedef __bit_iterator<_Cp, _IsConst> _In; typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type; typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type; typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word; static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -447,12 +432,12 @@ __copy_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCon
return __result; return __result;
} }
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
__copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __copy_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_Cp, false> __result) __bit_iterator<_C, false> __result)
{ {
typedef __bit_iterator<_Cp, _IsConst> _In; typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type; typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type; typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word; static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -525,10 +510,10 @@ __copy_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsC
return __result; return __result;
} }
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) copy(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{ {
if (__first.__ctz_ == __result.__ctz_) if (__first.__ctz_ == __result.__ctz_)
return __copy_aligned(__first, __last, __result); return __copy_aligned(__first, __last, __result);
@@ -537,12 +522,12 @@ copy(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last
// copy_backward // copy_backward
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
__copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __copy_backward_aligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_Cp, false> __result) __bit_iterator<_C, false> __result)
{ {
typedef __bit_iterator<_Cp, _IsConst> _In; typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type; typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type; typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word; static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -584,12 +569,12 @@ __copy_backward_aligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_C
return __result; return __result;
} }
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
__copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __copy_backward_unaligned(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last,
__bit_iterator<_Cp, false> __result) __bit_iterator<_C, false> __result)
{ {
typedef __bit_iterator<_Cp, _IsConst> _In; typedef __bit_iterator<_C, _IsConst> _In;
typedef typename _In::difference_type difference_type; typedef typename _In::difference_type difference_type;
typedef typename _In::__storage_type __storage_type; typedef typename _In::__storage_type __storage_type;
static const unsigned __bits_per_word = _In::__bits_per_word; static const unsigned __bits_per_word = _In::__bits_per_word;
@@ -648,7 +633,7 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
{ {
__m = ~__storage_type(0) << (__bits_per_word - __n); __m = ~__storage_type(0) << (__bits_per_word - __n);
__storage_type __b = *--__last.__seg_ & __m; __storage_type __b = *--__last.__seg_ & __m;
__clz_r = __bits_per_word - __result.__ctz_; unsigned __clz_r = __bits_per_word - __result.__ctz_;
__storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_)); __storage_type __dn = _VSTD::min(__n, static_cast<difference_type>(__result.__ctz_));
__m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r); __m = (~__storage_type(0) << (__result.__ctz_ - __dn)) & (~__storage_type(0) >> __clz_r);
*__result.__seg_ &= ~__m; *__result.__seg_ &= ~__m;
@@ -670,10 +655,10 @@ __copy_backward_unaligned(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<
return __result; return __result;
} }
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) copy_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{ {
if (__last.__ctz_ == __result.__ctz_) if (__last.__ctz_ == __result.__ctz_)
return __copy_backward_aligned(__first, __last, __result); return __copy_backward_aligned(__first, __last, __result);
@@ -682,20 +667,20 @@ copy_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsCons
// move // move
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
move(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) move(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{ {
return _VSTD::copy(__first, __last, __result); return _VSTD::copy(__first, __last, __result);
} }
// move_backward // move_backward
template <class _Cp, bool _IsConst> template <class _C, bool _IsConst>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
move_backward(__bit_iterator<_Cp, _IsConst> __first, __bit_iterator<_Cp, _IsConst> __last, __bit_iterator<_Cp, false> __result) move_backward(__bit_iterator<_C, _IsConst> __first, __bit_iterator<_C, _IsConst> __last, __bit_iterator<_C, false> __result)
{ {
return _VSTD::copy(__first, __last, __result); return _VSTD::copy(__first, __last, __result);
} }
@@ -865,33 +850,34 @@ swap_ranges(__bit_iterator<__C1, false> __first1, __bit_iterator<__C1, false> __
// rotate // rotate
template <class _Cp> template <class _C>
struct __bit_array struct __bit_array
{ {
typedef typename _Cp::difference_type difference_type; typedef typename _C::difference_type difference_type;
typedef typename _Cp::__storage_type __storage_type; typedef typename _C::__storage_type __storage_type;
typedef typename _Cp::iterator iterator; typedef typename _C::iterator iterator;
static const unsigned __bits_per_word = _Cp::__bits_per_word; static const unsigned __bits_per_word = _C::__bits_per_word;
static const unsigned _Np = 4; static const unsigned _N = 4;
difference_type __size_; difference_type __size_;
__storage_type __word_[_Np]; __storage_type __word_[_N];
_LIBCPP_INLINE_VISIBILITY static difference_type capacity() _LIBCPP_INLINE_VISIBILITY static difference_type capacity()
{return static_cast<difference_type>(_Np * __bits_per_word);} {return static_cast<difference_type>(_N * __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {} _LIBCPP_INLINE_VISIBILITY explicit __bit_array(difference_type __s) : __size_(__s) {}
_LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);} _LIBCPP_INLINE_VISIBILITY iterator begin() {return iterator(__word_, 0);}
_LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word, _LIBCPP_INLINE_VISIBILITY iterator end() {return iterator(__word_ + __size_ / __bits_per_word,
static_cast<unsigned>(__size_ % __bits_per_word));} static_cast<unsigned>(__size_ % __bits_per_word));}
}; };
template <class _Cp> template <class _C>
__bit_iterator<_Cp, false> __bit_iterator<_C, false>
rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle, __bit_iterator<_Cp, false> __last) rotate(__bit_iterator<_C, false> __first, __bit_iterator<_C, false> __middle, __bit_iterator<_C, false> __last)
{ {
typedef __bit_iterator<_Cp, false> _I1; typedef __bit_iterator<_C, false> _I1;
typedef typename _I1::difference_type difference_type; typedef typename _I1::difference_type difference_type;
typedef typename _I1::__storage_type __storage_type; typedef typename _I1::__storage_type __storage_type;
static const unsigned __bits_per_word = _I1::__bits_per_word;
difference_type __d1 = __middle - __first; difference_type __d1 = __middle - __first;
difference_type __d2 = __last - __middle; difference_type __d2 = __last - __middle;
_I1 __r = __first + __d2; _I1 __r = __first + __d2;
@@ -899,16 +885,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
{ {
if (__d1 <= __d2) if (__d1 <= __d2)
{ {
if (__d1 <= __bit_array<_Cp>::capacity()) if (__d1 <= __bit_array<_C>::capacity())
{ {
__bit_array<_Cp> __b(__d1); __bit_array<_C> __b(__d1);
_VSTD::copy(__first, __middle, __b.begin()); _VSTD::copy(__first, __middle, __b.begin());
_VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first)); _VSTD::copy(__b.begin(), __b.end(), _VSTD::copy(__middle, __last, __first));
break; break;
} }
else else
{ {
__bit_iterator<_Cp, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle); __bit_iterator<_C, false> __mp = _VSTD::swap_ranges(__first, __middle, __middle);
__first = __middle; __first = __middle;
__middle = __mp; __middle = __mp;
__d2 -= __d1; __d2 -= __d1;
@@ -916,16 +902,16 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
} }
else else
{ {
if (__d2 <= __bit_array<_Cp>::capacity()) if (__d2 <= __bit_array<_C>::capacity())
{ {
__bit_array<_Cp> __b(__d2); __bit_array<_C> __b(__d2);
_VSTD::copy(__middle, __last, __b.begin()); _VSTD::copy(__middle, __last, __b.begin());
_VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last)); _VSTD::copy_backward(__b.begin(), __b.end(), _VSTD::copy_backward(__first, __middle, __last));
break; break;
} }
else else
{ {
__bit_iterator<_Cp, false> __mp = __first + __d2; __bit_iterator<_C, false> __mp = __first + __d2;
_VSTD::swap_ranges(__first, __mp, __middle); _VSTD::swap_ranges(__first, __mp, __middle);
__first = __mp; __first = __mp;
__d1 -= __d2; __d1 -= __d2;
@@ -937,12 +923,12 @@ rotate(__bit_iterator<_Cp, false> __first, __bit_iterator<_Cp, false> __middle,
// equal // equal
template <class _Cp, bool _IC1, bool _IC2> template <class _C>
bool bool
__equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __equal_unaligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
__bit_iterator<_Cp, _IC2> __first2) __bit_iterator<_C, true> __first2)
{ {
typedef __bit_iterator<_Cp, _IC1> _It; typedef __bit_iterator<_C, true> _It;
typedef typename _It::difference_type difference_type; typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -961,15 +947,11 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
__storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r); __storage_type __ddn = _VSTD::min<__storage_type>(__dn, __clz_r);
__m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn)); __m = (~__storage_type(0) << __first2.__ctz_) & (~__storage_type(0) >> (__clz_r - __ddn));
if (__first2.__ctz_ > __first1.__ctz_) if (__first2.__ctz_ > __first1.__ctz_)
{
if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_))) if ((*__first2.__seg_ & __m) != (__b << (__first2.__ctz_ - __first1.__ctz_)))
return false; return false;
}
else else
{
if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_))) if ((*__first2.__seg_ & __m) != (__b >> (__first1.__ctz_ - __first2.__ctz_)))
return false; return false;
}
__first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word; __first2.__seg_ += (__ddn + __first2.__ctz_) / __bits_per_word;
__first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word); __first2.__ctz_ = static_cast<unsigned>((__ddn + __first2.__ctz_) % __bits_per_word);
__dn -= __ddn; __dn -= __ddn;
@@ -1019,12 +1001,12 @@ __equal_unaligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1>
return true; return true;
} }
template <class _Cp, bool _IC1, bool _IC2> template <class _C>
bool bool
__equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __equal_aligned(__bit_iterator<_C, true> __first1, __bit_iterator<_C, true> __last1,
__bit_iterator<_Cp, _IC2> __first2) __bit_iterator<_C, true> __first2)
{ {
typedef __bit_iterator<_Cp, _IC1> _It; typedef __bit_iterator<_C, true> _It;
typedef typename _It::difference_type difference_type; typedef typename _It::difference_type difference_type;
typedef typename _It::__storage_type __storage_type; typedef typename _It::__storage_type __storage_type;
static const unsigned __bits_per_word = _It::__bits_per_word; static const unsigned __bits_per_word = _It::__bits_per_word;
@@ -1062,32 +1044,31 @@ __equal_aligned(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __
return true; return true;
} }
template <class _Cp, bool _IC1, bool _IC2> template <class _C, bool _IC1, bool _IC2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
equal(__bit_iterator<_Cp, _IC1> __first1, __bit_iterator<_Cp, _IC1> __last1, __bit_iterator<_Cp, _IC2> __first2) equal(__bit_iterator<_C, _IC1> __first1, __bit_iterator<_C, _IC1> __last1, __bit_iterator<_C, _IC2> __first2)
{ {
if (__first1.__ctz_ == __first2.__ctz_) if (__first1.__ctz_ == __first2.__ctz_)
return __equal_aligned(__first1, __last1, __first2); return __equal_aligned(__first1, __last1, __first2);
return __equal_unaligned(__first1, __last1, __first2); return __equal_unaligned(__first1, __last1, __first2);
} }
template <class _Cp, bool _IsConst, template <class _C, bool _IsConst>
typename _Cp::__storage_type>
class __bit_iterator class __bit_iterator
{ {
public: public:
typedef typename _Cp::difference_type difference_type; typedef typename _C::difference_type difference_type;
typedef bool value_type; typedef bool value_type;
typedef __bit_iterator pointer; typedef __bit_iterator pointer;
typedef typename conditional<_IsConst, __bit_const_reference<_Cp>, __bit_reference<_Cp> >::type reference; typedef typename conditional<_IsConst, __bit_const_reference<_C>, __bit_reference<_C> >::type reference;
typedef random_access_iterator_tag iterator_category; typedef random_access_iterator_tag iterator_category;
private: private:
typedef typename _Cp::__storage_type __storage_type; typedef typename _C::__storage_type __storage_type;
typedef typename conditional<_IsConst, typename _Cp::__const_storage_pointer, typedef typename conditional<_IsConst, typename _C::__const_storage_pointer,
typename _Cp::__storage_pointer>::type __storage_pointer; typename _C::__storage_pointer>::type __storage_pointer;
static const unsigned __bits_per_word = _Cp::__bits_per_word; static const unsigned __bits_per_word = _C::__bits_per_word;
__storage_pointer __seg_; __storage_pointer __seg_;
unsigned __ctz_; unsigned __ctz_;
@@ -1096,7 +1077,7 @@ public:
_LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY __bit_iterator() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__bit_iterator(const __bit_iterator<_Cp, false>& __it) _NOEXCEPT __bit_iterator(const __bit_iterator<_C, false>& __it) _NOEXCEPT
: __seg_(__it.__seg_), __ctz_(__it.__ctz_) {} : __seg_(__it.__seg_), __ctz_(__it.__ctz_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference operator*() const _NOEXCEPT
@@ -1204,34 +1185,34 @@ private:
: __seg_(__s), __ctz_(__ctz) {} : __seg_(__s), __ctz_(__ctz) {}
#if defined(__clang__) #if defined(__clang__)
friend typename _Cp::__self; friend typename _C::__self;
#else #else
friend class _Cp::__self; friend class _C::__self;
#endif #endif
friend class __bit_reference<_Cp>; friend class __bit_reference<_C>;
friend class __bit_const_reference<_Cp>; friend class __bit_const_reference<_C>;
friend class __bit_iterator<_Cp, true>; friend class __bit_iterator<_C, true>;
template <class _Dp> friend struct __bit_array; template <class _D> friend struct __bit_array;
template <class _Dp> friend void __fill_n_false(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); template <class _D> friend void __fill_n_false(__bit_iterator<_D, false> __first, typename _D::size_type __n);
template <class _Dp> friend void __fill_n_true(__bit_iterator<_Dp, false> __first, typename _Dp::size_type __n); template <class _D> friend void __fill_n_true(__bit_iterator<_D, false> __first, typename _D::size_type __n);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_aligned(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_aligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_unaligned(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_unaligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> copy(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_aligned(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_aligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> __copy_backward_unaligned(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> __copy_backward_unaligned(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, false> copy_backward(__bit_iterator<_Dp, _IC> __first, template <class _D, bool _IC> friend __bit_iterator<_D, false> copy_backward(__bit_iterator<_D, _IC> __first,
__bit_iterator<_Dp, _IC> __last, __bit_iterator<_D, _IC> __last,
__bit_iterator<_Dp, false> __result); __bit_iterator<_D, false> __result);
template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>, template <class __C1, class __C2>friend __bit_iterator<__C2, false> __swap_ranges_aligned(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>, __bit_iterator<__C1, false>,
__bit_iterator<__C2, false>); __bit_iterator<__C2, false>);
@@ -1241,26 +1222,22 @@ private:
template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>, template <class __C1, class __C2>friend __bit_iterator<__C2, false> swap_ranges(__bit_iterator<__C1, false>,
__bit_iterator<__C1, false>, __bit_iterator<__C1, false>,
__bit_iterator<__C2, false>); __bit_iterator<__C2, false>);
template <class _Dp> friend __bit_iterator<_Dp, false> rotate(__bit_iterator<_Dp, false>, template <class _D> friend __bit_iterator<_D, false> rotate(__bit_iterator<_D, false>,
__bit_iterator<_Dp, false>, __bit_iterator<_D, false>,
__bit_iterator<_Dp, false>); __bit_iterator<_D, false>);
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_aligned(__bit_iterator<_Dp, _IC1>, template <class _D> friend bool __equal_aligned(__bit_iterator<_D, true>,
__bit_iterator<_Dp, _IC1>, __bit_iterator<_D, true>,
__bit_iterator<_Dp, _IC2>); __bit_iterator<_D, true>);
template <class _Dp, bool _IC1, bool _IC2> friend bool __equal_unaligned(__bit_iterator<_Dp, _IC1>, template <class _D> friend bool __equal_unaligned(__bit_iterator<_D, true>,
__bit_iterator<_Dp, _IC1>, __bit_iterator<_D, true>,
__bit_iterator<_Dp, _IC2>); __bit_iterator<_D, true>);
template <class _Dp, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_Dp, _IC1>, template <class _D, bool _IC1, bool _IC2> friend bool equal(__bit_iterator<_D, _IC1>,
__bit_iterator<_Dp, _IC1>, __bit_iterator<_D, _IC1>,
__bit_iterator<_Dp, _IC2>); __bit_iterator<_D, _IC2>);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_true(__bit_iterator<_Dp, _IC>, template <class _D> friend __bit_iterator<_D, false> __find_bool_true(__bit_iterator<_D, false>,
typename _Dp::size_type); typename _D::size_type);
template <class _Dp, bool _IC> friend __bit_iterator<_Dp, _IC> __find_bool_false(__bit_iterator<_Dp, _IC>, template <class _D> friend __bit_iterator<_D, false> __find_bool_false(__bit_iterator<_D, false>,
typename _Dp::size_type); typename _D::size_type);
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
__count_bool_true(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
template <class _Dp, bool _IC> friend typename __bit_iterator<_Dp, _IC>::difference_type
__count_bool_false(__bit_iterator<_Dp, _IC>, typename _Dp::size_type);
}; };
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -11,15 +11,9 @@
#ifndef _LIBCPP_CONFIG #ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG #define _LIBCPP_CONFIG
#ifndef _MSC_VER // explicit macro necessary because it is only defined below in this file
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef __GNUC__ #define _LIBCPP_VERSION 1001
#define _GNUC_VER (__GNUC__ * 100 + __GNUC_MINOR__)
#endif
#define _LIBCPP_VERSION 1101
#define _LIBCPP_ABI_VERSION 1 #define _LIBCPP_ABI_VERSION 1
@@ -51,38 +45,17 @@
# define _LIBCPP_LITTLE_ENDIAN 0 # define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1 # define _LIBCPP_BIG_ENDIAN 1
# endif // _BYTE_ORDER == _LITTLE_ENDIAN # endif // _BYTE_ORDER == _LITTLE_ENDIAN
# ifndef __LONG_LONG_SUPPORTED
# define _LIBCPP_HAS_NO_LONG_LONG
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__ #endif // __FreeBSD__
#ifdef _WIN32 #ifdef _WIN32
# define _LIBCPP_LITTLE_ENDIAN 1 # define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0 # define _LIBCPP_BIG_ENDIAN 0
// Compiler intrinsics (GCC or MSVC) // Compiler intrinsics (GCC or MSVC)
# if (defined(_MSC_VER) && _MSC_VER >= 1400) \ # if (defined(_MSC_VER) && _MSC_VER >= 1400) || (__GNUC__ >= 4 && __GNUC_MINOR__ > 3)
|| (defined(__GNUC__) && _GNUC_VER > 403)
# define _LIBCP_HAS_IS_BASE_OF # define _LIBCP_HAS_IS_BASE_OF
# endif # endif
#endif // _WIN32 #endif // _WIN32
#ifdef __linux__
# if defined(__GNUC__) && _GNUC_VER >= 403
# define _LIBCP_HAS_IS_BASE_OF
# endif
#endif
#ifdef __sun__
# include <sys/isa_defs.h>
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN 1
# define _LIBCPP_BIG_ENDIAN 0
# else
# define _LIBCPP_LITTLE_ENDIAN 0
# define _LIBCPP_BIG_ENDIAN 1
# endif
#endif // __sun__
#if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) #if !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
# include <endian.h> # include <endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN # if __BYTE_ORDER == __LITTLE_ENDIAN
@@ -96,91 +69,32 @@
# endif # endif
#endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN) #endif // !defined(_LIBCPP_LITTLE_ENDIAN) || !defined(_LIBCPP_BIG_ENDIAN)
#ifdef _WIN32 #ifndef _LIBCPP_VISIBILITY_TAG
#define _LIBCPP_VISIBILITY_TAG 1
// only really useful for a DLL
#ifdef _LIBCPP_DLL // this should be a compiler builtin define ideally...
# ifdef cxx_EXPORTS
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllexport)
# define _LIBCPP_TYPE_VIS __declspec(dllexport)
# else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS __declspec(dllimport)
# define _LIBCPP_TYPE_VIS __declspec(dllimport)
# endif
#else
# define _LIBCPP_HIDDEN
# define _LIBCPP_FUNC_VIS
# define _LIBCPP_TYPE_VIS
#endif #endif
#ifndef _LIBCPP_INLINE_VISIBILITY #if _LIBCPP_VISIBILITY_TAG
# ifdef _MSC_VER
# define _LIBCPP_INLINE_VISIBILITY __forceinline
# else // MinGW GCC and Clang
# define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__))
# endif
#endif
#ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
# ifdef _MSC_VER
# define _LIBCPP_ALWAYS_INLINE __forceinline
# endif
#endif
#endif // _WIN32
#ifndef __has_attribute
#define __has_attribute(__x) 0
#endif
#ifndef _LIBCPP_HIDDEN
#define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden")))
#endif #define _LIBCPP_VISIBLE __attribute__ ((__visibility__("default")))
#else // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_FUNC_VIS #define _LIBCPP_HIDDEN
#define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) #define _LIBCPP_VISIBLE
#endif #endif // _LIBCPP_VISIBILITY_TAG
#ifndef _LIBCPP_TYPE_VIS
# 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_INLINE_VISIBILITY #ifndef _LIBCPP_INLINE_VISIBILITY
#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif #endif
#ifndef _LIBCPP_EXCEPTION_ABI #ifndef _LIBCPP_EXCEPTION_ABI
#define _LIBCPP_EXCEPTION_ABI _LIBCPP_TYPE_VIS #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default")))
#endif #endif
#ifndef _LIBCPP_CANTTHROW
#define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__)) #define _LIBCPP_CANTTHROW __attribute__ ((__nothrow__))
#endif
#ifndef _LIBCPP_ALWAYS_INLINE
#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__))
#endif
#if defined(__clang__) #if defined(__clang__)
#if __has_feature(cxx_alignas)
# define _ALIGNAS_TYPE(x) alignas(x)
# define _ALIGNAS(x) alignas(x)
#else
# define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
# define _ALIGNAS(x) __attribute__((__aligned__(x)))
#endif
#if !__has_feature(cxx_alias_templates) #if !__has_feature(cxx_alias_templates)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES #define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#endif #endif
@@ -202,23 +116,17 @@ typedef __char32_t char32_t;
#define _LIBCPP_NO_RTTI #define _LIBCPP_NO_RTTI
#endif #endif
#if !(__has_feature(cxx_strong_enums))
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif
#if !(__has_feature(cxx_decltype)) #if !(__has_feature(cxx_decltype))
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#endif #endif
#if __has_feature(cxx_attributes) #if __has_feature(cxx_attributes)
# define _LIBCPP_NORETURN [[noreturn]] # define _ATTRIBUTE(x) [[x]]
#else #else
# define _LIBCPP_NORETURN __attribute__ ((noreturn)) # define _ATTRIBUTE(x) __attribute__ ((x))
#endif #endif
#if !(__has_feature(cxx_defaulted_functions))
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#endif // !(__has_feature(cxx_defaulted_functions))
#if !(__has_feature(cxx_deleted_functions)) #if !(__has_feature(cxx_deleted_functions))
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS #define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
@@ -271,18 +179,22 @@ typedef __char32_t char32_t;
#if __has_feature(objc_arc_weak) #if __has_feature(objc_arc_weak)
#define _LIBCPP_HAS_OBJC_ARC_WEAK #define _LIBCPP_HAS_OBJC_ARC_WEAK
#define _LIBCPP_HAS_NO_STRONG_ENUMS
#endif #endif
// Inline namespaces are available in Clang regardless of C++ dialect.
#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 {
}
}
#if !(__has_feature(cxx_constexpr)) #if !(__has_feature(cxx_constexpr))
#define _LIBCPP_HAS_NO_CONSTEXPR #define _LIBCPP_HAS_NO_CONSTEXPR
#endif #endif
#if defined(__FreeBSD__) && (__ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L)
#define _LIBCPP_HAS_QUICK_EXIT
#define _LIBCPP_HAS_C11_FEATURES
#endif
#if (__has_feature(cxx_noexcept)) #if (__has_feature(cxx_noexcept))
# define _NOEXCEPT noexcept # define _NOEXCEPT noexcept
# define _NOEXCEPT_(x) noexcept(x) # define _NOEXCEPT_(x) noexcept(x)
@@ -295,22 +207,11 @@ typedef __char32_t char32_t;
# define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T) # define _LIBCXX_UNDERLYING_TYPE(T) __underlying_type(T)
#endif #endif
// Inline namespaces are available in Clang regardless of C++ dialect. // end defined(__clang__)
#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 {
}
}
#elif defined(__GNUC__) #elif defined(__GNUC__)
#define _ALIGNAS(x) __attribute__((__aligned__(x))) #define _ATTRIBUTE(x) __attribute__((x))
#define _ALIGNAS_TYPE(x) __attribute__((__aligned__(__alignof(x))))
#define _LIBCPP_NORETURN __attribute__((noreturn))
#if !__EXCEPTIONS #if !__EXCEPTIONS
#define _LIBCPP_NO_EXCEPTIONS #define _LIBCPP_NO_EXCEPTIONS
@@ -340,15 +241,15 @@ namespace std {
#define _LIBCPP_HAS_NO_TRAILING_RETURN #define _LIBCPP_HAS_NO_TRAILING_RETURN
#define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS #define _LIBCPP_HAS_NO_ALWAYS_INLINE_VARIADICS
#if _GNUC_VER < 403 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_RVALUE_REFERENCES #define _LIBCPP_HAS_NO_RVALUE_REFERENCES
#endif #endif
#if _GNUC_VER < 403 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 3)
#define _LIBCPP_HAS_NO_STATIC_ASSERT #define _LIBCPP_HAS_NO_STATIC_ASSERT
#endif #endif
#if _GNUC_VER < 404 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#define _LIBCPP_HAS_NO_ADVANCED_SFINAE #define _LIBCPP_HAS_NO_ADVANCED_SFINAE
#define _LIBCPP_HAS_NO_DECLTYPE #define _LIBCPP_HAS_NO_DECLTYPE
#define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS #define _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
@@ -356,9 +257,9 @@ namespace std {
#define _LIBCPP_HAS_NO_UNICODE_CHARS #define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_VARIADICS #define _LIBCPP_HAS_NO_VARIADICS
#define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #define _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
#endif // _GNUC_VER < 404 #endif // !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
#if _GNUC_VER < 406 #if !(__GNUC__ >= 4 && __GNUC_MINOR__ >= 6)
#define _LIBCPP_HAS_NO_NULLPTR #define _LIBCPP_HAS_NO_NULLPTR
#endif #endif
@@ -374,29 +275,7 @@ namespace _LIBCPP_NAMESPACE {
using namespace _LIBCPP_NAMESPACE __attribute__((__strong__)); using namespace _LIBCPP_NAMESPACE __attribute__((__strong__));
} }
#elif defined(_MSC_VER) #endif // defined(__GNUC__)
#define _LIBCPP_HAS_NO_TEMPLATE_ALIASES
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_HAS_NO_UNICODE_CHARS
#define _LIBCPP_HAS_NO_DELETED_FUNCTIONS
#define __alignof__ __alignof
#define _LIBCPP_NORETURN __declspec(noreturn)
#define _ALIGNAS(x) __declspec(align(x))
#define _LIBCPP_HAS_NO_VARIADICS
#define _NOEXCEPT throw()
#define _NOEXCEPT_(x)
#define _LIBCPP_BEGIN_NAMESPACE_STD namespace std {
#define _LIBCPP_END_NAMESPACE_STD }
#define _VSTD std
namespace std {
}
#endif // __clang__ || __GNUC___ || _MSC_VER
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS #ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
typedef unsigned short char16_t; typedef unsigned short char16_t;
@@ -419,62 +298,22 @@ template <unsigned> struct __static_assert_check {};
#endif #endif
#ifdef _LIBCPP_HAS_NO_CONSTEXPR #ifdef _LIBCPP_HAS_NO_CONSTEXPR
#define _LIBCPP_CONSTEXPR #define constexpr const
#else
#define _LIBCPP_CONSTEXPR constexpr
#endif
#ifdef _LIBCPP_HAS_NO_DEFAULTED_FUNCTIONS
#define _LIBCPP_DEFAULT {}
#else
#define _LIBCPP_DEFAULT = default;
#endif
#ifdef __GNUC__
#define _NOALIAS __attribute__((__malloc__))
#else
#define _NOALIAS
#endif #endif
#ifndef __has_feature #ifndef __has_feature
#define __has_feature(__x) 0 #define __has_feature(__x) 0
#endif #endif
#if __has_feature(cxx_explicit_conversions) #if __APPLE__ || __FreeBSD__ || _WIN32
# define _LIBCPP_EXPLICIT explicit
#else
# define _LIBCPP_EXPLICIT
#endif
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) struct _LIBCPP_TYPE_VIS x { enum __lx
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x) \
__lx __v_; \
_LIBCPP_ALWAYS_INLINE x(__lx __v) : __v_(__v) {} \
_LIBCPP_ALWAYS_INLINE explicit x(int __v) : __v_(static_cast<__lx>(__v)) {} \
_LIBCPP_ALWAYS_INLINE operator int() const {return __v_;} \
};
#else // _LIBCPP_HAS_NO_STRONG_ENUMS
#define _LIBCPP_DECLARE_STRONG_ENUM(x) enum class _LIBCPP_TYPE_VIS x
#define _LIBCPP_DECLARE_STRONG_ENUM_EPILOG(x)
#endif // _LIBCPP_HAS_NO_STRONG_ENUMS
#ifndef _LIBCPP_EXTERN_TEMPLATE
#define _LIBCPP_EXTERN_TEMPLATE(...) extern template __VA_ARGS__;
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_WIN32) || defined(__sun__)
#define _LIBCPP_LOCALE__L_EXTENSIONS 1 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
#endif #endif
#ifdef __FreeBSD__
#define _DECLARE_C99_LDBL_MATH 1
#endif
#if defined(__APPLE__) || defined(__FreeBSD__) #if __APPLE__ || __FreeBSD__
#define _LIBCPP_HAS_DEFAULTRUNELOCALE #define _LIBCPP_HAS_DEFAULTRUNELOCALE
#endif #endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__) #if __APPLE__ || __FreeBSD__
#define _LIBCPP_WCTYPE_IS_MASK #define _LIBCPP_WCTYPE_IS_MASK
#endif #endif

View File

@@ -16,9 +16,7 @@
# include <cstdlib> # include <cstdlib>
# include <cstdio> # include <cstdio>
# include <cstddef> # include <cstddef>
# ifndef _LIBCPP_ASSERT
# define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort())) # define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : (_VSTD::printf("%s\n", m), _VSTD::abort()))
# endif
#endif #endif
@@ -26,9 +24,9 @@
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS __c_node; struct _LIBCPP_VISIBLE __c_node;
struct _LIBCPP_TYPE_VIS __i_node struct _LIBCPP_VISIBLE __i_node
{ {
void* __i_; void* __i_;
__i_node* __next_; __i_node* __next_;
@@ -42,7 +40,7 @@ struct _LIBCPP_TYPE_VIS __i_node
~__i_node(); ~__i_node();
}; };
struct _LIBCPP_TYPE_VIS __c_node struct _LIBCPP_VISIBLE __c_node
{ {
void* __c_; void* __c_;
__c_node* __next_; __c_node* __next_;
@@ -85,8 +83,8 @@ _C_node<_Cont>::__dereferenceable(const void* __i) const
{ {
typedef typename _Cont::const_iterator iterator; typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i); const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_); _Cont* _C = static_cast<_Cont*>(__c_);
return _Cp->__dereferenceable(__j); return _C->__dereferenceable(__j);
} }
template <class _Cont> template <class _Cont>
@@ -95,8 +93,8 @@ _C_node<_Cont>::__decrementable(const void* __i) const
{ {
typedef typename _Cont::const_iterator iterator; typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i); const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_); _Cont* _C = static_cast<_Cont*>(__c_);
return _Cp->__decrementable(__j); return _C->__decrementable(__j);
} }
template <class _Cont> template <class _Cont>
@@ -105,8 +103,8 @@ _C_node<_Cont>::__addable(const void* __i, ptrdiff_t __n) const
{ {
typedef typename _Cont::const_iterator iterator; typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i); const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_); _Cont* _C = static_cast<_Cont*>(__c_);
return _Cp->__addable(__j, __n); return _C->__addable(__j, __n);
} }
template <class _Cont> template <class _Cont>
@@ -115,11 +113,11 @@ _C_node<_Cont>::__subscriptable(const void* __i, ptrdiff_t __n) const
{ {
typedef typename _Cont::const_iterator iterator; typedef typename _Cont::const_iterator iterator;
const iterator* __j = static_cast<const iterator*>(__i); const iterator* __j = static_cast<const iterator*>(__i);
_Cont* _Cp = static_cast<_Cont*>(__c_); _Cont* _C = static_cast<_Cont*>(__c_);
return _Cp->__subscriptable(__j, __n); return _C->__subscriptable(__j, __n);
} }
class _LIBCPP_TYPE_VIS __libcpp_db class _LIBCPP_VISIBLE __libcpp_db
{ {
__c_node** __cbeg_; __c_node** __cbeg_;
__c_node** __cend_; __c_node** __cend_;
@@ -178,11 +176,11 @@ private:
_LIBCPP_HIDDEN _LIBCPP_HIDDEN
__i_node* __find_iterator(const void* __i) const; __i_node* __find_iterator(const void* __i) const;
friend _LIBCPP_FUNC_VIS __libcpp_db* __get_db(); friend _LIBCPP_VISIBLE __libcpp_db* __get_db();
}; };
_LIBCPP_FUNC_VIS __libcpp_db* __get_db(); _LIBCPP_VISIBLE __libcpp_db* __get_db();
_LIBCPP_FUNC_VIS const __libcpp_db* __get_const_db(); _LIBCPP_VISIBLE const __libcpp_db* __get_const_db();
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -16,47 +16,38 @@
#include <typeinfo> #include <typeinfo>
#include <exception> #include <exception>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Arg, class _Result> template <class _Arg, class _Result>
struct _LIBCPP_TYPE_VIS unary_function struct _LIBCPP_VISIBLE unary_function
{ {
typedef _Arg argument_type; typedef _Arg argument_type;
typedef _Result result_type; typedef _Result result_type;
}; };
template <class _Arg1, class _Arg2, class _Result> template <class _Arg1, class _Arg2, class _Result>
struct _LIBCPP_TYPE_VIS binary_function struct _LIBCPP_VISIBLE binary_function
{ {
typedef _Arg1 first_argument_type; typedef _Arg1 first_argument_type;
typedef _Arg2 second_argument_type; typedef _Arg2 second_argument_type;
typedef _Result result_type; typedef _Result result_type;
}; };
template <class _Tp> struct _LIBCPP_TYPE_VIS hash; template <class _Tp> struct _LIBCPP_VISIBLE hash;
template <class _Tp> template <class _Tp>
struct __has_result_type struct __has_result_type
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
template <class _Up> static __two __test(...); template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::result_type* = 0); template <class _Up> static char __test(typename _Up::result_type* = 0);
public: public:
static const bool value = sizeof(__test<_Tp>(0)) == 1; static const bool value = sizeof(__test<_Tp>(0)) == 1;
}; };
template <class _Tp>
struct _LIBCPP_TYPE_VIS less : binary_function<_Tp, _Tp, bool>
{
_LIBCPP_INLINE_VISIBILITY bool operator()(const _Tp& __x, const _Tp& __y) const
{return __x < __y;}
};
#ifdef _LIBCPP_HAS_NO_VARIADICS #ifdef _LIBCPP_HAS_NO_VARIADICS
#include <__functional_base_03> #include <__functional_base_03>
@@ -69,11 +60,11 @@ template <class _Tp>
struct __derives_from_unary_function struct __derives_from_unary_function
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
static __two __test(...); static __two __test(...);
template <class _Ap, class _Rp> template <class _A, class _R>
static unary_function<_Ap, _Rp> static unary_function<_A, _R>
__test(const volatile unary_function<_Ap, _Rp>*); __test(const volatile unary_function<_A, _R>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -83,11 +74,11 @@ template <class _Tp>
struct __derives_from_binary_function struct __derives_from_binary_function
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
static __two __test(...); static __two __test(...);
template <class _A1, class _A2, class _Rp> template <class _A1, class _A2, class _R>
static binary_function<_A1, _A2, _Rp> static binary_function<_A1, _A2, _R>
__test(const volatile binary_function<_A1, _A2, _Rp>*); __test(const volatile binary_function<_A1, _A2, _R>*);
public: public:
static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value; static const bool value = !is_same<decltype(__test((_Tp*)0)), __two>::value;
typedef decltype(__test((_Tp*)0)) type; typedef decltype(__test((_Tp*)0)) type;
@@ -138,173 +129,173 @@ struct __weak_result_type
// 0 argument case // 0 argument case
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp ()> struct __weak_result_type<_R ()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp (&)()> struct __weak_result_type<_R (&)()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp> template <class _R>
struct __weak_result_type<_Rp (*)()> struct __weak_result_type<_R (*)()>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
// 1 argument case // 1 argument case
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (_A1)> struct __weak_result_type<_R (_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (&)(_A1)> struct __weak_result_type<_R (&)(_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _A1> template <class _R, class _A1>
struct __weak_result_type<_Rp (*)(_A1)> struct __weak_result_type<_R (*)(_A1)>
: public unary_function<_A1, _Rp> : public unary_function<_A1, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)()> struct __weak_result_type<_R (_C::*)()>
: public unary_function<_Cp*, _Rp> : public unary_function<_C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() const> struct __weak_result_type<_R (_C::*)() const>
: public unary_function<const _Cp*, _Rp> : public unary_function<const _C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() volatile> struct __weak_result_type<_R (_C::*)() volatile>
: public unary_function<volatile _Cp*, _Rp> : public unary_function<volatile _C*, _R>
{ {
}; };
template <class _Rp, class _Cp> template <class _R, class _C>
struct __weak_result_type<_Rp (_Cp::*)() const volatile> struct __weak_result_type<_R (_C::*)() const volatile>
: public unary_function<const volatile _Cp*, _Rp> : public unary_function<const volatile _C*, _R>
{ {
}; };
// 2 argument case // 2 argument case
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (_A1, _A2)> struct __weak_result_type<_R (_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (*)(_A1, _A2)> struct __weak_result_type<_R (*)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _A1, class _A2> template <class _R, class _A1, class _A2>
struct __weak_result_type<_Rp (&)(_A1, _A2)> struct __weak_result_type<_R (&)(_A1, _A2)>
: public binary_function<_A1, _A2, _Rp> : public binary_function<_A1, _A2, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1)> struct __weak_result_type<_R (_C::*)(_A1)>
: public binary_function<_Cp*, _A1, _Rp> : public binary_function<_C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const> struct __weak_result_type<_R (_C::*)(_A1) const>
: public binary_function<const _Cp*, _A1, _Rp> : public binary_function<const _C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) volatile> struct __weak_result_type<_R (_C::*)(_A1) volatile>
: public binary_function<volatile _Cp*, _A1, _Rp> : public binary_function<volatile _C*, _A1, _R>
{ {
}; };
template <class _Rp, class _Cp, class _A1> template <class _R, class _C, class _A1>
struct __weak_result_type<_Rp (_Cp::*)(_A1) const volatile> struct __weak_result_type<_R (_C::*)(_A1) const volatile>
: public binary_function<const volatile _Cp*, _A1, _Rp> : public binary_function<const volatile _C*, _A1, _R>
{ {
}; };
// 3 or more arguments // 3 or more arguments
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (&)(_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (&)(_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _A1, class _A2, class _A3, class ..._A4> template <class _R, class _A1, class _A2, class _A3, class ..._A4>
struct __weak_result_type<_Rp (*)(_A1, _A2, _A3, _A4...)> struct __weak_result_type<_R (*)(_A1, _A2, _A3, _A4...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...)> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...)>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) volatile> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) volatile>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
template <class _Rp, class _Cp, class _A1, class _A2, class ..._A3> template <class _R, class _C, class _A1, class _A2, class ..._A3>
struct __weak_result_type<_Rp (_Cp::*)(_A1, _A2, _A3...) const volatile> struct __weak_result_type<_R (_C::*)(_A1, _A2, _A3...) const volatile>
{ {
typedef _Rp result_type; typedef _R result_type;
}; };
// __invoke // __invoke
// bullets 1 and 2 // bullets 1 and 2
template <class _Fp, class _A0, class ..._Args> template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...)) -> decltype((_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...))
{ {
return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...); return (_VSTD::forward<_A0>(__a0).*__f)(_VSTD::forward<_Args>(__args)...);
} }
template <class _Fp, class _A0, class ..._Args> template <class _F, class _A0, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
__invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args) __invoke(_F&& __f, _A0&& __a0, _Args&& ...__args)
-> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...)) -> decltype(((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...))
{ {
return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...); return ((*_VSTD::forward<_A0>(__a0)).*__f)(_VSTD::forward<_Args>(__args)...);
@@ -312,19 +303,19 @@ __invoke(_Fp&& __f, _A0&& __a0, _Args&& ...__args)
// bullets 3 and 4 // bullets 3 and 4
template <class _Fp, class _A0> template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
__invoke(_Fp&& __f, _A0&& __a0) __invoke(_F&& __f, _A0&& __a0)
-> decltype(_VSTD::forward<_A0>(__a0).*__f) -> decltype(_VSTD::forward<_A0>(__a0).*__f)
{ {
return _VSTD::forward<_A0>(__a0).*__f; return _VSTD::forward<_A0>(__a0).*__f;
} }
template <class _Fp, class _A0> template <class _F, class _A0>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
__invoke(_Fp&& __f, _A0&& __a0) __invoke(_F&& __f, _A0&& __a0)
-> decltype((*_VSTD::forward<_A0>(__a0)).*__f) -> decltype((*_VSTD::forward<_A0>(__a0)).*__f)
{ {
return (*_VSTD::forward<_A0>(__a0)).*__f; return (*_VSTD::forward<_A0>(__a0)).*__f;
@@ -332,13 +323,13 @@ __invoke(_Fp&& __f, _A0&& __a0)
// bullet 5 // bullet 5
template <class _Fp, class ..._Args> template <class _F, class ..._Args>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
__invoke(_Fp&& __f, _Args&& ...__args) __invoke(_F&& __f, _Args&& ...__args)
-> decltype(_VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...)) -> decltype(_VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...))
{ {
return _VSTD::forward<_Fp>(__f)(_VSTD::forward<_Args>(__args)...); return _VSTD::forward<_F>(__f)(_VSTD::forward<_Args>(__args)...);
} }
template <class _Tp, class ..._Args> template <class _Tp, class ..._Args>
@@ -348,7 +339,7 @@ struct __invoke_return
}; };
template <class _Tp> template <class _Tp>
class _LIBCPP_TYPE_VIS reference_wrapper class _LIBCPP_VISIBLE reference_wrapper
: public __weak_result_type<_Tp> : public __weak_result_type<_Tp>
{ {
public: public:
@@ -418,13 +409,13 @@ cref(reference_wrapper<_Tp> __t) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS #ifndef _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&) = delete; template <class _Tp> void ref(const _Tp&& __t) = delete;
template <class _Tp> void cref(const _Tp&&) = delete; template <class _Tp> void cref(const _Tp&& __t) = delete;
#else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #else // _LIBCPP_HAS_NO_DELETED_FUNCTIONS
template <class _Tp> void ref(const _Tp&&);// = delete; template <class _Tp> void ref(const _Tp&& __t);// = delete;
template <class _Tp> void cref(const _Tp&&);// = delete; template <class _Tp> void cref(const _Tp&& __t);// = delete;
#endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS #endif // _LIBCPP_HAS_NO_DELETED_FUNCTIONS

File diff suppressed because it is too large Load Diff

View File

@@ -18,15 +18,11 @@
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
_LIBCPP_FUNC_VIS _LIBCPP_VISIBLE
size_t __next_prime(size_t __n); size_t __next_prime(size_t __n);
template <class _NodePtr> template <class _NodePtr>
@@ -58,36 +54,15 @@ struct __hash_node
value_type __value_; value_type __value_;
}; };
inline _LIBCPP_INLINE_VISIBILITY
bool
__is_power2(size_t __bc)
{
return __bc > 2 && !(__bc & (__bc - 1));
}
inline _LIBCPP_INLINE_VISIBILITY
size_t
__constrain_hash(size_t __h, size_t __bc)
{
return !(__bc & (__bc - 1)) ? __h & (__bc - 1) : __h % __bc;
}
inline _LIBCPP_INLINE_VISIBILITY
size_t
__next_pow2(size_t __n)
{
return size_t(1) << (std::numeric_limits<size_t>::digits - __clz(__n-1));
}
template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table; template <class _Tp, class _Hash, class _Equal, class _Alloc> class __hash_table;
template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS __hash_const_iterator; template <class _ConstNodePtr> class __hash_const_iterator;
template <class _HashIterator> class _LIBCPP_TYPE_VIS __hash_map_iterator; template <class _HashIterator> class __hash_map_iterator;
template <class _HashIterator> class _LIBCPP_TYPE_VIS __hash_map_const_iterator; template <class _HashIterator> class __hash_map_const_iterator;
template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc> template <class _Key, class _Tp, class _Hash, class _Pred, class _Alloc>
class _LIBCPP_TYPE_VIS unordered_map; class _LIBCPP_VISIBLE unordered_map;
template <class _NodePtr> template <class _NodePtr>
class _LIBCPP_TYPE_VIS __hash_iterator class _LIBCPP_VISIBLE __hash_iterator
{ {
typedef _NodePtr __node_pointer; typedef _NodePtr __node_pointer;
@@ -142,14 +117,14 @@ private:
{} {}
template <class, class, class, class> friend class __hash_table; template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_map; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_multimap; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
}; };
template <class _ConstNodePtr> template <class _ConstNodePtr>
class _LIBCPP_TYPE_VIS __hash_const_iterator class _LIBCPP_VISIBLE __hash_const_iterator
{ {
typedef _ConstNodePtr __node_pointer; typedef _ConstNodePtr __node_pointer;
@@ -220,15 +195,15 @@ private:
{} {}
template <class, class, class, class> friend class __hash_table; template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_map; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS unordered_multimap; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE unordered_multimap;
}; };
template <class _ConstNodePtr> class _LIBCPP_TYPE_VIS __hash_const_local_iterator; template <class _ConstNodePtr> class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class _NodePtr> template <class _NodePtr>
class _LIBCPP_TYPE_VIS __hash_local_iterator class _LIBCPP_VISIBLE __hash_local_iterator
{ {
typedef _NodePtr __node_pointer; typedef _NodePtr __node_pointer;
@@ -261,7 +236,7 @@ public:
__hash_local_iterator& operator++() __hash_local_iterator& operator++()
{ {
__node_ = __node_->__next_; __node_ = __node_->__next_;
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_) if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
__node_ = nullptr; __node_ = nullptr;
return *this; return *this;
} }
@@ -294,12 +269,12 @@ private:
} }
template <class, class, class, class> friend class __hash_table; template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_map_iterator;
}; };
template <class _ConstNodePtr> template <class _ConstNodePtr>
class _LIBCPP_TYPE_VIS __hash_const_local_iterator class _LIBCPP_VISIBLE __hash_const_local_iterator
{ {
typedef _ConstNodePtr __node_pointer; typedef _ConstNodePtr __node_pointer;
@@ -351,7 +326,7 @@ public:
__hash_const_local_iterator& operator++() __hash_const_local_iterator& operator++()
{ {
__node_ = __node_->__next_; __node_ = __node_->__next_;
if (__node_ != nullptr && __constrain_hash(__node_->__hash_, __bucket_count_) != __bucket_) if (__node_ != nullptr && __node_->__hash_ % __bucket_count_ != __bucket_)
__node_ = nullptr; __node_ = nullptr;
return *this; return *this;
} }
@@ -384,7 +359,7 @@ private:
} }
template <class, class, class, class> friend class __hash_table; template <class, class, class, class> friend class __hash_table;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
}; };
template <class _Alloc> template <class _Alloc>
@@ -496,6 +471,7 @@ public:
public: public:
// Create __node // Create __node
typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node; typedef __hash_node<value_type, typename __alloc_traits::void_pointer> __node;
typedef typename __node::__first_node __first_node;
typedef typename __alloc_traits::template typedef typename __alloc_traits::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
rebind_alloc<__node> rebind_alloc<__node>
@@ -506,7 +482,6 @@ public:
typedef allocator_traits<__node_allocator> __node_traits; typedef allocator_traits<__node_allocator> __node_traits;
typedef typename __node_traits::pointer __node_pointer; typedef typename __node_traits::pointer __node_pointer;
typedef typename __node_traits::const_pointer __node_const_pointer; typedef typename __node_traits::const_pointer __node_const_pointer;
typedef __hash_node_base<__node_pointer> __first_node;
private: private:
@@ -625,15 +600,15 @@ public:
pair<iterator, bool> __insert_unique(const value_type& __x); pair<iterator, bool> __insert_unique(const value_type& __x);
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp> template <class _P>
pair<iterator, bool> __insert_unique(_Pp&& __x); pair<iterator, bool> __insert_unique(_P&& __x);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Pp> template <class _P>
iterator __insert_multi(_Pp&& __x); iterator __insert_multi(_P&& __x);
template <class _Pp> template <class _P>
iterator __insert_multi(const_iterator __p, _Pp&& __x); iterator __insert_multi(const_iterator __p, _P&& __x);
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
iterator __insert_multi(const value_type& __x); iterator __insert_multi(const value_type& __x);
iterator __insert_multi(const_iterator __p, const value_type& __x); iterator __insert_multi(const_iterator __p, const value_type& __x);
@@ -658,15 +633,15 @@ public:
template <class _Key> template <class _Key>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type bucket(const _Key& __k) const size_type bucket(const _Key& __k) const
{return __constrain_hash(hash_function()(__k), bucket_count());} {return hash_function()(__k) % bucket_count();}
template <class _Key> template <class _Key>
iterator find(const _Key& __x); iterator find(const _Key& __x);
template <class _Key> template <class _Key>
const_iterator find(const _Key& __x) const; const_iterator find(const _Key& __x) const;
typedef __hash_node_destructor<__node_allocator> _Dp; typedef __hash_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
iterator erase(const_iterator __p); iterator erase(const_iterator __p);
iterator erase(const_iterator __first, const_iterator __last); iterator erase(const_iterator __first, const_iterator __last);
@@ -744,7 +719,7 @@ private:
__node_traits::propagate_on_container_copy_assignment::value>());} __node_traits::propagate_on_container_copy_assignment::value>());}
void __copy_assign_alloc(const __hash_table& __u, true_type); void __copy_assign_alloc(const __hash_table& __u, true_type);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const __hash_table&, false_type) {} void __copy_assign_alloc(const __hash_table& __u, false_type) {}
void __move_assign(__hash_table& __u, false_type); void __move_assign(__hash_table& __u, false_type);
void __move_assign(__hash_table& __u, true_type) void __move_assign(__hash_table& __u, true_type)
@@ -773,37 +748,37 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {} void __move_assign_alloc(__hash_table&, false_type) _NOEXCEPT {}
template <class _Ap> template <class _A>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static static
void void
__swap_alloc(_Ap& __x, _Ap& __y) __swap_alloc(_A& __x, _A& __y)
_NOEXCEPT_( _NOEXCEPT_(
!allocator_traits<_Ap>::propagate_on_container_swap::value || !allocator_traits<_A>::propagate_on_container_swap::value ||
__is_nothrow_swappable<_Ap>::value) __is_nothrow_swappable<_A>::value)
{ {
__swap_alloc(__x, __y, __swap_alloc(__x, __y,
integral_constant<bool, integral_constant<bool,
allocator_traits<_Ap>::propagate_on_container_swap::value allocator_traits<_A>::propagate_on_container_swap::value
>()); >());
} }
template <class _Ap> template <class _A>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static static
void void
__swap_alloc(_Ap& __x, _Ap& __y, true_type) __swap_alloc(_A& __x, _A& __y, true_type)
_NOEXCEPT_(__is_nothrow_swappable<_Ap>::value) _NOEXCEPT_(__is_nothrow_swappable<_A>::value)
{ {
using _VSTD::swap; using _VSTD::swap;
swap(__x, __y); swap(__x, __y);
} }
template <class _Ap> template <class _A>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static static
void void
__swap_alloc(_Ap&, _Ap&, false_type) _NOEXCEPT {} __swap_alloc(_A& __x, _A& __y, false_type) _NOEXCEPT {}
void __deallocate(__node_pointer __np) _NOEXCEPT; void __deallocate(__node_pointer __np) _NOEXCEPT;
__node_pointer __detach() _NOEXCEPT; __node_pointer __detach() _NOEXCEPT;
@@ -892,7 +867,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u)
{ {
if (size() > 0) if (size() > 0)
{ {
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr; __u.__p1_.first().__next_ = nullptr;
__u.size() = 0; __u.size() = 0;
@@ -916,7 +891,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__hash_table(__hash_table&& __u,
{ {
__p1_.first().__next_ = __u.__p1_.first().__next_; __p1_.first().__next_ = __u.__p1_.first().__next_;
__u.__p1_.first().__next_ = nullptr; __u.__p1_.first().__next_ = nullptr;
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
size() = __u.size(); size() = __u.size();
__u.size() = 0; __u.size() = 0;
@@ -1013,7 +988,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__move_assign(
__p1_.first().__next_ = __u.__p1_.first().__next_; __p1_.first().__next_ = __u.__p1_.first().__next_;
if (size() > 0) if (size() > 0)
{ {
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
__u.__p1_.first().__next_ = nullptr; __u.__p1_.first().__next_ = nullptr;
__u.size() = 0; __u.size() = 0;
@@ -1211,12 +1186,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
size_t __chash; size_t __chash;
if (__bc != 0) if (__bc != 0)
{ {
__chash = __constrain_hash(__nd->__hash_, __bc); __chash = __nd->__hash_ % __bc;
__ndptr = __bucket_list_[__chash]; __ndptr = __bucket_list_[__chash];
if (__ndptr != nullptr) if (__ndptr != nullptr)
{ {
for (__ndptr = __ndptr->__next_; __ndptr != nullptr && for (__ndptr = __ndptr->__next_; __ndptr != nullptr &&
__constrain_hash(__ndptr->__hash_, __bc) == __chash; __ndptr->__hash_ % __bc == __chash;
__ndptr = __ndptr->__next_) __ndptr = __ndptr->__next_)
{ {
if (key_eq()(__ndptr->__value_, __nd->__value_)) if (key_eq()(__ndptr->__value_, __nd->__value_))
@@ -1227,10 +1202,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
{ {
if (size()+1 > __bc * max_load_factor() || __bc == 0) if (size()+1 > __bc * max_load_factor() || __bc == 0)
{ {
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc), rehash(_VSTD::max<size_type>(2 * __bc + 1,
size_type(ceil(float(size() + 1) / max_load_factor())))); size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count(); __bc = bucket_count();
__chash = __constrain_hash(__nd->__hash_, __bc); __chash = __nd->__hash_ % __bc;
} }
// insert_after __bucket_list_[__chash], or __first_node if bucket is null // insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash]; __node_pointer __pn = __bucket_list_[__chash];
@@ -1242,7 +1217,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_unique(__node_pointer __
// fix up __bucket_list_ // fix up __bucket_list_
__bucket_list_[__chash] = __pn; __bucket_list_[__chash] = __pn;
if (__nd->__next_ != nullptr) if (__nd->__next_ != nullptr)
__bucket_list_[__constrain_hash(__nd->__next_->__hash_, __bc)] = __nd; __bucket_list_[__nd->__next_->__hash_ % __bc] = __nd;
} }
else else
{ {
@@ -1266,11 +1241,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
size_type __bc = bucket_count(); size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0) if (size()+1 > __bc * max_load_factor() || __bc == 0)
{ {
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc), rehash(_VSTD::max<size_type>(2 * __bc + 1,
size_type(ceil(float(size() + 1) / max_load_factor())))); size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count(); __bc = bucket_count();
} }
size_t __chash = __constrain_hash(__cp->__hash_, __bc); size_t __chash = __cp->__hash_ % __bc;
__node_pointer __pn = __bucket_list_[__chash]; __node_pointer __pn = __bucket_list_[__chash];
if (__pn == nullptr) if (__pn == nullptr)
{ {
@@ -1280,12 +1255,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
// fix up __bucket_list_ // fix up __bucket_list_
__bucket_list_[__chash] = __pn; __bucket_list_[__chash] = __pn;
if (__cp->__next_ != nullptr) if (__cp->__next_ != nullptr)
__bucket_list_[__constrain_hash(__cp->__next_->__hash_, __bc)] = __cp; __bucket_list_[__cp->__next_->__hash_ % __bc] = __cp;
} }
else else
{ {
for (bool __found = false; __pn->__next_ != nullptr && for (bool __found = false; __pn->__next_ != nullptr &&
__constrain_hash(__pn->__next_->__hash_, __bc) == __chash; __pn->__next_->__hash_ % __bc == __chash;
__pn = __pn->__next_) __pn = __pn->__next_)
{ {
// __found key_eq() action // __found key_eq() action
@@ -1306,7 +1281,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(__node_pointer __c
__pn->__next_ = __cp; __pn->__next_ = __cp;
if (__cp->__next_ != nullptr) if (__cp->__next_ != nullptr)
{ {
size_t __nhash = __constrain_hash(__cp->__next_->__hash_, __bc); size_t __nhash = __cp->__next_->__hash_ % __bc;
if (__nhash != __chash) if (__nhash != __chash)
__bucket_list_[__nhash] = __cp; __bucket_list_[__nhash] = __cp;
} }
@@ -1327,11 +1302,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_insert_multi(
size_type __bc = bucket_count(); size_type __bc = bucket_count();
if (size()+1 > __bc * max_load_factor() || __bc == 0) if (size()+1 > __bc * max_load_factor() || __bc == 0)
{ {
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc), rehash(_VSTD::max<size_type>(2 * __bc + 1,
size_type(ceil(float(size() + 1) / max_load_factor())))); size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count(); __bc = bucket_count();
} }
size_t __chash = __constrain_hash(__cp->__hash_, __bc); size_t __chash = __cp->__hash_ % __bc;
__node_pointer __pp = __bucket_list_[__chash]; __node_pointer __pp = __bucket_list_[__chash];
while (__pp->__next_ != __np) while (__pp->__next_ != __np)
__pp = __pp->__next_; __pp = __pp->__next_;
@@ -1354,12 +1329,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
size_t __chash; size_t __chash;
if (__bc != 0) if (__bc != 0)
{ {
__chash = __constrain_hash(__hash, __bc); __chash = __hash % __bc;
__nd = __bucket_list_[__chash]; __nd = __bucket_list_[__chash];
if (__nd != nullptr) if (__nd != nullptr)
{ {
for (__nd = __nd->__next_; __nd != nullptr && for (__nd = __nd->__next_; __nd != nullptr &&
__constrain_hash(__nd->__hash_, __bc) == __chash; __nd->__hash_ % __bc == __chash;
__nd = __nd->__next_) __nd = __nd->__next_)
{ {
if (key_eq()(__nd->__value_, __x)) if (key_eq()(__nd->__value_, __x))
@@ -1371,10 +1346,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
__node_holder __h = __construct_node(__x, __hash); __node_holder __h = __construct_node(__x, __hash);
if (size()+1 > __bc * max_load_factor() || __bc == 0) if (size()+1 > __bc * max_load_factor() || __bc == 0)
{ {
rehash(_VSTD::max<size_type>(2 * __bc + !__is_power2(__bc), rehash(_VSTD::max<size_type>(2 * __bc + 1,
size_type(ceil(float(size() + 1) / max_load_factor())))); size_type(ceil(float(size() + 1) / max_load_factor()))));
__bc = bucket_count(); __bc = bucket_count();
__chash = __constrain_hash(__hash, __bc); __chash = __hash % __bc;
} }
// insert_after __bucket_list_[__chash], or __first_node if bucket is null // insert_after __bucket_list_[__chash], or __first_node if bucket is null
__node_pointer __pn = __bucket_list_[__chash]; __node_pointer __pn = __bucket_list_[__chash];
@@ -1386,7 +1361,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(const value_type& __x)
// fix up __bucket_list_ // fix up __bucket_list_
__bucket_list_[__chash] = __pn; __bucket_list_[__chash] = __pn;
if (__h->__next_ != nullptr) if (__h->__next_ != nullptr)
__bucket_list_[__constrain_hash(__h->__next_->__hash_, __bc)] = __h.get(); __bucket_list_[__h->__next_->__hash_ % __bc] = __h.get();
} }
else else
{ {
@@ -1443,11 +1418,11 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__emplace_hint_multi(
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Pp> template <class _P>
pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool> pair<typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator, bool>
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x) __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_P&& __x)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
pair<iterator, bool> __r = __node_insert_unique(__h.get()); pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second) if (__r.second)
__h.release(); __h.release();
@@ -1459,23 +1434,23 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_unique(_Pp&& __x)
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Pp> template <class _P>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_Pp&& __x) __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(_P&& __x)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
iterator __r = __node_insert_multi(__h.get()); iterator __r = __node_insert_multi(__h.get());
__h.release(); __h.release();
return __r; return __r;
} }
template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc>
template <class _Pp> template <class _P>
typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::iterator
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p, __hash_table<_Tp, _Hash, _Equal, _Alloc>::__insert_multi(const_iterator __p,
_Pp&& __x) _P&& __x)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Pp>(__x)); __node_holder __h = __construct_node(_VSTD::forward<_P>(__x));
iterator __r = __node_insert_multi(__p, __h.get()); iterator __r = __node_insert_multi(__p, __h.get());
__h.release(); __h.release();
return __r; return __r;
@@ -1510,19 +1485,15 @@ template <class _Tp, class _Hash, class _Equal, class _Alloc>
void void
__hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n) __hash_table<_Tp, _Hash, _Equal, _Alloc>::rehash(size_type __n)
{ {
if (__n == 1) __n = __next_prime(_VSTD::max<size_type>(__n, size() > 0));
__n = 2;
else if (__n & (__n - 1))
__n = __next_prime(__n);
size_type __bc = bucket_count(); size_type __bc = bucket_count();
if (__n > __bc) if (__n > __bc)
__rehash(__n); __rehash(__n);
else if (__n < __bc) else
{ {
__n = _VSTD::max<size_type> __n = _VSTD::max<size_type>
( (
__n, __n,
__is_power2(__bc) ? __next_pow2(size_t(ceil(float(size()) / max_load_factor()))) :
__next_prime(size_t(ceil(float(size()) / max_load_factor()))) __next_prime(size_t(ceil(float(size()) / max_load_factor())))
); );
if (__n < __bc) if (__n < __bc)
@@ -1546,13 +1517,13 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__rehash(size_type __nbc)
__node_pointer __cp = __pp->__next_; __node_pointer __cp = __pp->__next_;
if (__cp != nullptr) if (__cp != nullptr)
{ {
size_type __chash = __constrain_hash(__cp->__hash_, __nbc); size_type __chash = __cp->__hash_ % __nbc;
__bucket_list_[__chash] = __pp; __bucket_list_[__chash] = __pp;
size_type __phash = __chash; size_type __phash = __chash;
for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr; for (__pp = __cp, __cp = __cp->__next_; __cp != nullptr;
__cp = __pp->__next_) __cp = __pp->__next_)
{ {
__chash = __constrain_hash(__cp->__hash_, __nbc); __chash = __cp->__hash_ % __nbc;
if (__chash == __phash) if (__chash == __phash)
__pp = __cp; __pp = __cp;
else else
@@ -1590,12 +1561,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k)
size_type __bc = bucket_count(); size_type __bc = bucket_count();
if (__bc != 0) if (__bc != 0)
{ {
size_t __chash = __constrain_hash(__hash, __bc); size_t __chash = __hash % __bc;
__node_pointer __nd = __bucket_list_[__chash]; __node_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr) if (__nd != nullptr)
{ {
for (__nd = __nd->__next_; __nd != nullptr && for (__nd = __nd->__next_; __nd != nullptr &&
__constrain_hash(__nd->__hash_, __bc) == __chash; __nd->__hash_ % __bc == __chash;
__nd = __nd->__next_) __nd = __nd->__next_)
{ {
if (key_eq()(__nd->__value_, __k)) if (key_eq()(__nd->__value_, __k))
@@ -1615,12 +1586,12 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::find(const _Key& __k) const
size_type __bc = bucket_count(); size_type __bc = bucket_count();
if (__bc != 0) if (__bc != 0)
{ {
size_t __chash = __constrain_hash(__hash, __bc); size_t __chash = __hash % __bc;
__node_const_pointer __nd = __bucket_list_[__chash]; __node_const_pointer __nd = __bucket_list_[__chash];
if (__nd != nullptr) if (__nd != nullptr)
{ {
for (__nd = __nd->__next_; __nd != nullptr && for (__nd = __nd->__next_; __nd != nullptr &&
__constrain_hash(__nd->__hash_, __bc) == __chash; __nd->__hash_ % __bc == __chash;
__nd = __nd->__next_) __nd = __nd->__next_)
{ {
if (key_eq()(__nd->__value_, __k)) if (key_eq()(__nd->__value_, __k))
@@ -1641,7 +1612,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args) __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(_Args&& ...__args)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_); __h->__hash_ = hash_function()(__h->__value_);
@@ -1657,7 +1628,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(value_type&& __v,
size_t __hash) size_t __hash)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash; __h->__hash_ = __hash;
@@ -1672,7 +1643,7 @@ typename __hash_table<_Tp, _Hash, _Equal, _Alloc>::__node_holder
__hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v) __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
__h->__hash_ = hash_function()(__h->__value_); __h->__hash_ = hash_function()(__h->__value_);
@@ -1688,7 +1659,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::__construct_node(const value_type& __v
size_t __hash) size_t __hash)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
__h->__hash_ = __hash; __h->__hash_ = __hash;
@@ -1759,7 +1730,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// current node // current node
__node_pointer __cn = const_cast<__node_pointer>(__p.__node_); __node_pointer __cn = const_cast<__node_pointer>(__p.__node_);
size_type __bc = bucket_count(); size_type __bc = bucket_count();
size_t __chash = __constrain_hash(__cn->__hash_, __bc); size_t __chash = __cn->__hash_ % __bc;
// find previous node // find previous node
__node_pointer __pn = __bucket_list_[__chash]; __node_pointer __pn = __bucket_list_[__chash];
for (; __pn->__next_ != __cn; __pn = __pn->__next_) for (; __pn->__next_ != __cn; __pn = __pn->__next_)
@@ -1767,15 +1738,15 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
// Fix up __bucket_list_ // Fix up __bucket_list_
// if __pn is not in same bucket (before begin is not in same bucket) && // if __pn is not in same bucket (before begin is not in same bucket) &&
// if __cn->__next_ is not in same bucket (nullptr is not in same bucket) // if __cn->__next_ is not in same bucket (nullptr is not in same bucket)
if (__pn == _VSTD::addressof(__p1_.first()) || __constrain_hash(__pn->__hash_, __bc) != __chash) if (__pn == _VSTD::addressof(__p1_.first()) || __pn->__hash_ % __bc != __chash)
{ {
if (__cn->__next_ == nullptr || __constrain_hash(__cn->__next_->__hash_, __bc) != __chash) if (__cn->__next_ == nullptr || __cn->__next_->__hash_ % __bc != __chash)
__bucket_list_[__chash] = nullptr; __bucket_list_[__chash] = nullptr;
} }
// if __cn->__next_ is not in same bucket (nullptr is in same bucket) // if __cn->__next_ is not in same bucket (nullptr is in same bucket)
if (__cn->__next_ != nullptr) if (__cn->__next_ != nullptr)
{ {
size_t __nhash = __constrain_hash(__cn->__next_->__hash_, __bc); size_t __nhash = __cn->__next_->__hash_ % __bc;
if (__nhash != __chash) if (__nhash != __chash)
__bucket_list_[__nhash] = __pn; __bucket_list_[__nhash] = __pn;
} }
@@ -1783,7 +1754,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::remove(const_iterator __p) _NOEXCEPT
__pn->__next_ = __cn->__next_; __pn->__next_ = __cn->__next_;
__cn->__next_ = nullptr; __cn->__next_ = nullptr;
--size(); --size();
return __node_holder(__cn, _Dp(__node_alloc(), true)); return __node_holder(__cn, _D(__node_alloc(), true));
} }
template <class _Tp, class _Hash, class _Equal, class _Alloc> template <class _Tp, class _Hash, class _Equal, class _Alloc>
@@ -1906,10 +1877,10 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::swap(__hash_table& __u)
__p2_.swap(__u.__p2_); __p2_.swap(__u.__p2_);
__p3_.swap(__u.__p3_); __p3_.swap(__u.__p3_);
if (size() > 0) if (size() > 0)
__bucket_list_[__constrain_hash(__p1_.first().__next_->__hash_, bucket_count())] = __bucket_list_[__p1_.first().__next_->__hash_ % bucket_count()] =
static_cast<__node_pointer>(_VSTD::addressof(__p1_.first())); static_cast<__node_pointer>(_VSTD::addressof(__p1_.first()));
if (__u.size() > 0) if (__u.size() > 0)
__u.__bucket_list_[__constrain_hash(__u.__p1_.first().__next_->__hash_, __u.bucket_count())] = __u.__bucket_list_[__u.__p1_.first().__next_->__hash_ % __u.bucket_count()] =
static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first())); static_cast<__node_pointer>(_VSTD::addressof(__u.__p1_.first()));
} }
@@ -1923,7 +1894,7 @@ __hash_table<_Tp, _Hash, _Equal, _Alloc>::bucket_size(size_type __n) const
if (__np != nullptr) if (__np != nullptr)
{ {
for (__np = __np->__next_; __np != nullptr && for (__np = __np->__next_; __np != nullptr &&
__constrain_hash(__np->__hash_, __bc) == __n; __np->__hash_ % __bc == __n;
__np = __np->__next_, ++__r) __np = __np->__next_, ++__r)
; ;
} }

View File

@@ -19,36 +19,27 @@
#include <cstdint> #include <cstdint>
#include <cctype> #include <cctype>
#include <locale.h> #include <locale.h>
#ifdef _WIN32 #if _WIN32
# include <support/win32/locale_win32.h> # include <support/win32/locale_win32.h>
#elif (defined(__GLIBC__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun__)) || defined(EMSCRIPTEN) #elif (__GLIBC__ || __APPLE__ || __FreeBSD__)
# include <xlocale.h> # include <xlocale.h>
#endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD__ || __sun__ || EMSCRIPTEN #endif // _WIN32 || __GLIBC__ || __APPLE__ || __FreeBSD_
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS locale; class locale;
template <class _Facet> template <class _Facet> bool has_facet(const locale&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY template <class _Facet> const _Facet& use_facet(const locale&);
bool
has_facet(const locale&) _NOEXCEPT;
template <class _Facet> class _LIBCPP_VISIBLE locale
_LIBCPP_INLINE_VISIBILITY
const _Facet&
use_facet(const locale&);
class _LIBCPP_TYPE_VIS locale
{ {
public: public:
// types: // types:
class _LIBCPP_TYPE_VIS facet; class facet;
class _LIBCPP_TYPE_VIS id; class id;
typedef int category; typedef int category;
static const category // values assigned here are for exposition only static const category // values assigned here are for exposition only
@@ -103,7 +94,7 @@ private:
template <class _Facet> friend const _Facet& use_facet(const locale&); template <class _Facet> friend const _Facet& use_facet(const locale&);
}; };
class _LIBCPP_TYPE_VIS locale::facet class _LIBCPP_VISIBLE locale::facet
: public __shared_count : public __shared_count
{ {
protected: protected:
@@ -119,14 +110,14 @@ private:
virtual void __on_zero_shared() _NOEXCEPT; virtual void __on_zero_shared() _NOEXCEPT;
}; };
class _LIBCPP_TYPE_VIS locale::id class _LIBCPP_VISIBLE locale::id
{ {
once_flag __flag_; once_flag __flag_;
int32_t __id_; int32_t __id_;
static int32_t __next_id; static int32_t __next_id;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR id() :__id_(0) {} _LIBCPP_INLINE_VISIBILITY id() {}
private: private:
void __init(); void __init();
void operator=(const id&); // = delete; void operator=(const id&); // = delete;
@@ -175,7 +166,7 @@ use_facet(const locale& __l)
// template <class _CharT> class collate; // template <class _CharT> class collate;
template <class _CharT> template <class _CharT>
class _LIBCPP_TYPE_VIS collate class _LIBCPP_VISIBLE collate
: public locale::facet : public locale::facet
{ {
public: public:
@@ -247,22 +238,22 @@ collate<_CharT>::do_hash(const char_type* __lo, const char_type* __hi) const
const size_t __mask = size_t(0xF) << (__sr + 4); const size_t __mask = size_t(0xF) << (__sr + 4);
for(const char_type* __p = __lo; __p != __hi; ++__p) for(const char_type* __p = __lo; __p != __hi; ++__p)
{ {
__h = (__h << 4) + static_cast<size_t>(*__p); __h = (__h << 4) + *__p;
size_t __g = __h & __mask; size_t __g = __h & __mask;
__h ^= __g | (__g >> __sr); __h ^= __g | (__g >> __sr);
} }
return static_cast<long>(__h); return static_cast<long>(__h);
} }
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<char>) extern template class _LIBCPP_VISIBLE collate<char>;
_LIBCPP_EXTERN_TEMPLATE(class _LIBCPP_TYPE_VIS collate<wchar_t>) extern template class _LIBCPP_VISIBLE collate<wchar_t>;
// template <class CharT> class collate_byname; // template <class CharT> class collate_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS collate_byname; template <class _CharT> class _LIBCPP_VISIBLE collate_byname;
template <> template <>
class _LIBCPP_TYPE_VIS collate_byname<char> class _LIBCPP_VISIBLE collate_byname<char>
: public collate<char> : public collate<char>
{ {
locale_t __l; locale_t __l;
@@ -281,7 +272,7 @@ protected:
}; };
template <> template <>
class _LIBCPP_TYPE_VIS collate_byname<wchar_t> class _LIBCPP_VISIBLE collate_byname<wchar_t>
: public collate<wchar_t> : public collate<wchar_t>
{ {
locale_t __l; locale_t __l;
@@ -312,10 +303,10 @@ locale::operator()(const basic_string<_CharT, _Traits, _Allocator>& __x,
// template <class charT> class ctype // template <class charT> class ctype
class _LIBCPP_TYPE_VIS ctype_base class _LIBCPP_VISIBLE ctype_base
{ {
public: public:
#ifdef __GLIBC__ #if __GLIBC__
typedef unsigned short mask; typedef unsigned short mask;
static const mask space = _ISspace; static const mask space = _ISspace;
static const mask print = _ISprint; static const mask print = _ISprint;
@@ -327,7 +318,7 @@ public:
static const mask punct = _ISpunct; static const mask punct = _ISpunct;
static const mask xdigit = _ISxdigit; static const mask xdigit = _ISxdigit;
static const mask blank = _ISblank; static const mask blank = _ISblank;
#elif defined(_WIN32) #elif _WIN32
typedef unsigned short mask; typedef unsigned short mask;
static const mask space = _SPACE; static const mask space = _SPACE;
static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT; static const mask print = _BLANK|_PUNCT|_ALPHA|_DIGIT;
@@ -339,13 +330,11 @@ public:
static const mask punct = _PUNCT; static const mask punct = _PUNCT;
static const mask xdigit = _HEX; static const mask xdigit = _HEX;
static const mask blank = _BLANK; static const mask blank = _BLANK;
#elif (defined(__APPLE__) || defined(__FreeBSD__)) || defined(EMSCRIPTEN) #elif (__APPLE__ || __FreeBSD__)
#ifdef __APPLE__ #if __APPLE__
typedef __uint32_t mask; typedef __uint32_t mask;
#elif defined(__FreeBSD__) #elif __FreeBSD__
typedef unsigned long mask; typedef unsigned long mask;
#elif defined(EMSCRIPTEN)
typedef unsigned short mask;
#endif #endif
static const mask space = _CTYPE_S; static const mask space = _CTYPE_S;
static const mask print = _CTYPE_R; static const mask print = _CTYPE_R;
@@ -357,19 +346,7 @@ public:
static const mask punct = _CTYPE_P; static const mask punct = _CTYPE_P;
static const mask xdigit = _CTYPE_X; static const mask xdigit = _CTYPE_X;
static const mask blank = _CTYPE_B; static const mask blank = _CTYPE_B;
#elif defined(__sun__) #else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__
typedef unsigned int mask;
static const mask space = _ISSPACE;
static const mask print = _ISPRINT;
static const mask cntrl = _ISCNTRL;
static const mask upper = _ISUPPER;
static const mask lower = _ISLOWER;
static const mask alpha = _ISALPHA;
static const mask digit = _ISDIGIT;
static const mask punct = _ISPUNCT;
static const mask xdigit = _ISXDIGIT;
static const mask blank = _ISBLANK;
#else // __GLIBC__ || _WIN32 || __APPLE__ || __FreeBSD__ || EMSCRIPTEN || __sun__
typedef unsigned long mask; typedef unsigned long mask;
static const mask space = 1<<0; static const mask space = 1<<0;
static const mask print = 1<<1; static const mask print = 1<<1;
@@ -388,10 +365,10 @@ public:
_LIBCPP_ALWAYS_INLINE ctype_base() {} _LIBCPP_ALWAYS_INLINE ctype_base() {}
}; };
template <class _CharT> class _LIBCPP_TYPE_VIS ctype; template <class _CharT> class _LIBCPP_VISIBLE ctype;
template <> template <>
class _LIBCPP_TYPE_VIS ctype<wchar_t> class _LIBCPP_VISIBLE ctype<wchar_t>
: public locale::facet, : public locale::facet,
public ctype_base public ctype_base
{ {
@@ -493,7 +470,7 @@ protected:
}; };
template <> template <>
class _LIBCPP_TYPE_VIS ctype<char> class _LIBCPP_VISIBLE ctype<char>
: public locale::facet, public ctype_base : public locale::facet, public ctype_base
{ {
const mask* __tab_; const mask* __tab_;
@@ -506,14 +483,14 @@ public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool is(mask __m, char_type __c) const bool is(mask __m, char_type __c) const
{ {
return isascii(__c) ? __tab_[static_cast<int>(__c)] & __m : false; return isascii(__c) ? __tab_[__c] & __m : false;
} }
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const const char_type* is(const char_type* __low, const char_type* __high, mask* __vec) const
{ {
for (; __low != __high; ++__low, ++__vec) for (; __low != __high; ++__low, ++__vec)
*__vec = isascii(*__low) ? __tab_[static_cast<int>(*__low)] : 0; *__vec = isascii(*__low) ? __tab_[*__low] : 0;
return __low; return __low;
} }
@@ -521,7 +498,7 @@ public:
const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_is (mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m)) if (isascii(*__low) && (__tab_[*__low] & __m))
break; break;
return __low; return __low;
} }
@@ -530,7 +507,7 @@ public:
const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const const char_type* scan_not(mask __m, const char_type* __low, const char_type* __high) const
{ {
for (; __low != __high; ++__low) for (; __low != __high; ++__low)
if (!(isascii(*__low) && (__tab_[static_cast<int>(*__low)] & __m))) if (!(isascii(*__low) && (__tab_[*__low] & __m)))
break; break;
return __low; return __low;
} }
@@ -592,7 +569,7 @@ public:
#endif #endif
_LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;} _LIBCPP_ALWAYS_INLINE const mask* table() const _NOEXCEPT {return __tab_;}
static const mask* classic_table() _NOEXCEPT; static const mask* classic_table() _NOEXCEPT;
#if defined(__GLIBC__) || defined(EMSCRIPTEN) #if defined(__GLIBC__)
static const int* __classic_upper_table() _NOEXCEPT; static const int* __classic_upper_table() _NOEXCEPT;
static const int* __classic_lower_table() _NOEXCEPT; static const int* __classic_lower_table() _NOEXCEPT;
#endif #endif
@@ -611,10 +588,10 @@ protected:
// template <class CharT> class ctype_byname; // template <class CharT> class ctype_byname;
template <class _CharT> class _LIBCPP_TYPE_VIS ctype_byname; template <class _CharT> class _LIBCPP_VISIBLE ctype_byname;
template <> template <>
class _LIBCPP_TYPE_VIS ctype_byname<char> class _LIBCPP_VISIBLE ctype_byname<char>
: public ctype<char> : public ctype<char>
{ {
locale_t __l; locale_t __l;
@@ -632,7 +609,7 @@ protected:
}; };
template <> template <>
class _LIBCPP_TYPE_VIS ctype_byname<wchar_t> class _LIBCPP_VISIBLE ctype_byname<wchar_t>
: public ctype<wchar_t> : public ctype<wchar_t>
{ {
locale_t __l; locale_t __l;
@@ -763,7 +740,7 @@ tolower(_CharT __c, const locale& __loc)
// codecvt_base // codecvt_base
class _LIBCPP_TYPE_VIS codecvt_base class _LIBCPP_VISIBLE codecvt_base
{ {
public: public:
_LIBCPP_ALWAYS_INLINE codecvt_base() {} _LIBCPP_ALWAYS_INLINE codecvt_base() {}
@@ -772,12 +749,12 @@ public:
// template <class internT, class externT, class stateT> class codecvt; // template <class internT, class externT, class stateT> class codecvt;
template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_TYPE_VIS codecvt; template <class _InternT, class _ExternT, class _StateT> class _LIBCPP_VISIBLE codecvt;
// template <> class codecvt<char, char, mbstate_t> // template <> class codecvt<char, char, mbstate_t>
template <> template <>
class _LIBCPP_TYPE_VIS codecvt<char, char, mbstate_t> class _LIBCPP_VISIBLE codecvt<char, char, mbstate_t>
: public locale::facet, : public locale::facet,
public codecvt_base public codecvt_base
{ {
@@ -863,7 +840,7 @@ protected:
// template <> class codecvt<wchar_t, char, mbstate_t> // template <> class codecvt<wchar_t, char, mbstate_t>
template <> template <>
class _LIBCPP_TYPE_VIS codecvt<wchar_t, char, mbstate_t> class _LIBCPP_VISIBLE codecvt<wchar_t, char, mbstate_t>
: public locale::facet, : public locale::facet,
public codecvt_base public codecvt_base
{ {
@@ -946,7 +923,7 @@ protected:
// template <> class codecvt<char16_t, char, mbstate_t> // template <> class codecvt<char16_t, char, mbstate_t>
template <> template <>
class _LIBCPP_TYPE_VIS codecvt<char16_t, char, mbstate_t> class _LIBCPP_VISIBLE codecvt<char16_t, char, mbstate_t>
: public locale::facet, : public locale::facet,
public codecvt_base public codecvt_base
{ {
@@ -1032,7 +1009,7 @@ protected:
// template <> class codecvt<char32_t, char, mbstate_t> // template <> class codecvt<char32_t, char, mbstate_t>
template <> template <>
class _LIBCPP_TYPE_VIS codecvt<char32_t, char, mbstate_t> class _LIBCPP_VISIBLE codecvt<char32_t, char, mbstate_t>
: public locale::facet, : public locale::facet,
public codecvt_base public codecvt_base
{ {
@@ -1118,7 +1095,7 @@ protected:
// template <class _InternT, class _ExternT, class _StateT> class codecvt_byname // template <class _InternT, class _ExternT, class _StateT> class codecvt_byname
template <class _InternT, class _ExternT, class _StateT> template <class _InternT, class _ExternT, class _StateT>
class _LIBCPP_TYPE_VIS codecvt_byname class _LIBCPP_VISIBLE codecvt_byname
: public codecvt<_InternT, _ExternT, _StateT> : public codecvt<_InternT, _ExternT, _StateT>
{ {
public: public:
@@ -1137,14 +1114,14 @@ codecvt_byname<_InternT, _ExternT, _StateT>::~codecvt_byname()
{ {
} }
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char, char, mbstate_t>) extern template class codecvt_byname<char, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<wchar_t, char, mbstate_t>) extern template class codecvt_byname<wchar_t, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char16_t, char, mbstate_t>) extern template class codecvt_byname<char16_t, char, mbstate_t>;
_LIBCPP_EXTERN_TEMPLATE(class codecvt_byname<char32_t, char, mbstate_t>) extern template class codecvt_byname<char32_t, char, mbstate_t>;
_LIBCPP_FUNC_VIS void __throw_runtime_error(const char*); _LIBCPP_VISIBLE void __throw_runtime_error(const char*);
template <size_t _Np> template <size_t _N>
struct __narrow_to_utf8 struct __narrow_to_utf8
{ {
template <class _OutputIterator, class _CharT> template <class _OutputIterator, class _CharT>
@@ -1234,7 +1211,7 @@ struct __narrow_to_utf8<32>
} }
}; };
template <size_t _Np> template <size_t _N>
struct __widen_from_utf8 struct __widen_from_utf8
{ {
template <class _OutputIterator> template <class _OutputIterator>
@@ -1326,10 +1303,10 @@ struct __widen_from_utf8<32>
// template <class charT> class numpunct // template <class charT> class numpunct
template <class _CharT> class _LIBCPP_TYPE_VIS numpunct; template <class _CharT> class _LIBCPP_VISIBLE numpunct;
template <> template <>
class _LIBCPP_TYPE_VIS numpunct<char> class _LIBCPP_VISIBLE numpunct<char>
: public locale::facet : public locale::facet
{ {
public: public:
@@ -1360,7 +1337,7 @@ protected:
}; };
template <> template <>
class _LIBCPP_TYPE_VIS numpunct<wchar_t> class _LIBCPP_VISIBLE numpunct<wchar_t>
: public locale::facet : public locale::facet
{ {
public: public:
@@ -1392,10 +1369,10 @@ protected:
// template <class charT> class numpunct_byname // template <class charT> class numpunct_byname
template <class charT> class _LIBCPP_TYPE_VIS numpunct_byname; template <class charT> class _LIBCPP_VISIBLE numpunct_byname;
template <> template <>
class _LIBCPP_TYPE_VIS numpunct_byname<char> class _LIBCPP_VISIBLE numpunct_byname<char>
: public numpunct<char> : public numpunct<char>
{ {
public: public:
@@ -1413,7 +1390,7 @@ private:
}; };
template <> template <>
class _LIBCPP_TYPE_VIS numpunct_byname<wchar_t> class _LIBCPP_VISIBLE numpunct_byname<wchar_t>
: public numpunct<wchar_t> : public numpunct<wchar_t>
{ {
public: public:

View File

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

View File

@@ -6,11 +6,7 @@
#include <type_traits> #include <type_traits>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -95,7 +91,7 @@ public:
void reserve(size_type __n); void reserve(size_type __n);
void shrink_to_fit() _NOEXCEPT; void shrink_to_fit() _NOEXCEPT;
void push_front(const_reference __x); void push_front(const_reference __x);
_LIBCPP_INLINE_VISIBILITY void push_back(const_reference __x); void push_back(const_reference __x);
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES)
void push_front(value_type&& __x); void push_front(value_type&& __x);
void push_back(value_type&& __x); void push_back(value_type&& __x);
@@ -133,10 +129,8 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last) _NOEXCEPT void __destruct_at_end(pointer __new_last) _NOEXCEPT
{__destruct_at_end(__new_last, false_type());} {__destruct_at_end(__new_last, is_trivially_destructible<value_type>());}
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT; void __destruct_at_end(pointer __new_last, false_type) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY
void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT; void __destruct_at_end(pointer __new_last, true_type) _NOEXCEPT;
void swap(__split_buffer& __x) void swap(__split_buffer& __x)
@@ -154,7 +148,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT void __move_assign_alloc(__split_buffer& __c, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -173,7 +167,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(__alloc_rr&, __alloc_rr&, false_type) _NOEXCEPT static void __swap_alloc(__alloc_rr& __x, __alloc_rr& __y, false_type) _NOEXCEPT
{} {}
}; };
@@ -289,7 +283,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type) __split_buffer<_Tp, _Allocator>::__destruct_at_begin(pointer __new_begin, false_type)
{ {
while (__begin_ != __new_begin) while (__begin_ < __new_begin)
__alloc_traits::destroy(__alloc(), __begin_++); __alloc_traits::destroy(__alloc(), __begin_++);
} }
@@ -306,7 +300,7 @@ _LIBCPP_INLINE_VISIBILITY inline
void void
__split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT __split_buffer<_Tp, _Allocator>::__destruct_at_end(pointer __new_last, false_type) _NOEXCEPT
{ {
while (__new_last != __end_) while (__new_last < __end_)
__alloc_traits::destroy(__alloc(), --__end_); __alloc_traits::destroy(__alloc(), --__end_);
} }
@@ -394,8 +388,8 @@ __split_buffer<_Tp, _Allocator>::__split_buffer(__split_buffer&& __c, const __al
__first_ = __alloc_traits::allocate(__alloc(), __cap); __first_ = __alloc_traits::allocate(__alloc(), __cap);
__begin_ = __end_ = __first_; __begin_ = __end_ = __first_;
__end_cap() = __first_ + __cap; __end_cap() = __first_ + __cap;
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
__construct_at_end(_Ip(__c.begin()), _Ip(__c.end())); __construct_at_end(_I(__c.begin()), _I(__c.end()));
} }
} }
@@ -492,7 +486,7 @@ __split_buffer<_Tp, _Allocator>::push_front(const_reference __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -523,7 +517,7 @@ __split_buffer<_Tp, _Allocator>::push_front(value_type&& __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, (__c + 3) / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -556,7 +550,7 @@ __split_buffer<_Tp, _Allocator>::push_back(const_reference __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -587,7 +581,7 @@ __split_buffer<_Tp, _Allocator>::push_back(value_type&& __x)
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));
@@ -620,7 +614,7 @@ __split_buffer<_Tp, _Allocator>::emplace_back(_Args&&... __args)
} }
else else
{ {
size_type __c = max<size_type>(2 * static_cast<size_t>(__end_cap() - __first_), 1); size_type __c = max<size_type>(2 * (__end_cap() - __first_), 1);
__split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc()); __split_buffer<value_type, __alloc_rr&> __t(__c, __c / 4, __alloc());
__t.__construct_at_end(move_iterator<pointer>(__begin_), __t.__construct_at_end(move_iterator<pointer>(__begin_),
move_iterator<pointer>(__end_)); move_iterator<pointer>(__end_));

View File

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

View File

@@ -17,15 +17,11 @@
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
static const int __limit = 8; static const unsigned __limit = 8;
// __stdinbuf // __stdinbuf
@@ -41,7 +37,7 @@ public:
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type; typedef typename traits_type::state_type state_type;
__stdinbuf(FILE* __fp, state_type* __st); explicit __stdinbuf(FILE* __fp);
protected: protected:
virtual int_type underflow(); virtual int_type underflow();
@@ -53,7 +49,7 @@ private:
FILE* __file_; FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_; const codecvt<char_type, char, state_type>* __cv_;
state_type* __st_; state_type __st_;
int __encoding_; int __encoding_;
bool __always_noconv_; bool __always_noconv_;
@@ -64,9 +60,9 @@ private:
}; };
template <class _CharT> template <class _CharT>
__stdinbuf<_CharT>::__stdinbuf(FILE* __fp, state_type* __st) __stdinbuf<_CharT>::__stdinbuf(FILE* __fp)
: __file_(__fp), : __file_(__fp),
__st_(__st) __st_()
{ {
imbue(this->getloc()); imbue(this->getloc());
} }
@@ -104,7 +100,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
int __nread = _VSTD::max(1, __encoding_); int __nread = _VSTD::max(1, __encoding_);
for (int __i = 0; __i < __nread; ++__i) for (int __i = 0; __i < __nread; ++__i)
{ {
int __c = getc(__file_); char __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__i] = static_cast<char>(__c); __extbuf[__i] = static_cast<char>(__c);
@@ -119,19 +115,19 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
codecvt_base::result __r; codecvt_base::result __r;
do do
{ {
state_type __sv_st = *__st_; state_type __sv_st = __st_;
__r = __cv_->in(*__st_, __extbuf, __extbuf + __nread, __enxt, __r = __cv_->in(__st_, __extbuf, __extbuf + __nread, __enxt,
&__1buf, &__1buf + 1, __inxt); &__1buf, &__1buf + 1, __inxt);
switch (__r) switch (__r)
{ {
case _VSTD::codecvt_base::ok: case _VSTD::codecvt_base::ok:
break; break;
case codecvt_base::partial: case codecvt_base::partial:
*__st_ = __sv_st; __st_ = __sv_st;
if (__nread == sizeof(__extbuf)) if (__nread == sizeof(__extbuf))
return traits_type::eof(); return traits_type::eof();
{ {
int __c = getc(__file_); char __c = getc(__file_);
if (__c == EOF) if (__c == EOF)
return traits_type::eof(); return traits_type::eof();
__extbuf[__nread] = static_cast<char>(__c); __extbuf[__nread] = static_cast<char>(__c);
@@ -150,7 +146,7 @@ __stdinbuf<_CharT>::__getchar(bool __consume)
{ {
for (int __i = __nread; __i > 0;) for (int __i = __nread; __i > 0;)
{ {
if (ungetc(traits_type::to_int_type(__extbuf[--__i]), __file_) == EOF) if (ungetc(__extbuf[--__i], __file_) == EOF)
return traits_type::eof(); return traits_type::eof();
} }
} }
@@ -167,7 +163,7 @@ __stdinbuf<_CharT>::pbackfail(int_type __c)
char* __enxt; char* __enxt;
const char_type __ci = traits_type::to_char_type(__c); const char_type __ci = traits_type::to_char_type(__c);
const char_type* __inxt; const char_type* __inxt;
switch (__cv_->out(*__st_, &__ci, &__ci + 1, __inxt, switch (__cv_->out(__st_, &__ci, &__ci + 1, __inxt,
__extbuf, __extbuf + sizeof(__extbuf), __enxt)) __extbuf, __extbuf + sizeof(__extbuf), __enxt))
{ {
case _VSTD::codecvt_base::ok: case _VSTD::codecvt_base::ok:
@@ -200,7 +196,7 @@ public:
typedef typename traits_type::off_type off_type; typedef typename traits_type::off_type off_type;
typedef typename traits_type::state_type state_type; typedef typename traits_type::state_type state_type;
__stdoutbuf(FILE* __fp, state_type* __st); explicit __stdoutbuf(FILE* __fp);
protected: protected:
virtual int_type overflow (int_type __c = traits_type::eof()); virtual int_type overflow (int_type __c = traits_type::eof());
@@ -210,7 +206,7 @@ protected:
private: private:
FILE* __file_; FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_; const codecvt<char_type, char, state_type>* __cv_;
state_type* __st_; state_type __st_;
bool __always_noconv_; bool __always_noconv_;
__stdoutbuf(const __stdoutbuf&); __stdoutbuf(const __stdoutbuf&);
@@ -218,10 +214,10 @@ private:
}; };
template <class _CharT> template <class _CharT>
__stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp, state_type* __st) __stdoutbuf<_CharT>::__stdoutbuf(FILE* __fp)
: __file_(__fp), : __file_(__fp),
__cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())), __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(__st), __st_(),
__always_noconv_(__cv_->always_noconv()) __always_noconv_(__cv_->always_noconv())
{ {
} }
@@ -249,7 +245,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
do do
{ {
const char_type* __e; const char_type* __e;
__r = __cv_->out(*__st_, this->pbase(), this->pptr(), __e, __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf, __extbuf,
__extbuf + sizeof(__extbuf), __extbuf + sizeof(__extbuf),
__extbe); __extbe);
@@ -268,7 +264,7 @@ __stdoutbuf<_CharT>::overflow(int_type __c)
if (__r == codecvt_base::partial) if (__r == codecvt_base::partial)
{ {
this->setp((char_type*)__e, this->pptr()); this->setp((char_type*)__e, this->pptr());
this->pbump(static_cast<int>(this->epptr() - this->pbase())); this->pbump(this->epptr() - this->pbase());
} }
} }
else else
@@ -289,7 +285,7 @@ __stdoutbuf<_CharT>::sync()
do do
{ {
char* __extbe; char* __extbe;
__r = __cv_->unshift(*__st_, __extbuf, __r = __cv_->unshift(__st_, __extbuf,
__extbuf + sizeof(__extbuf), __extbuf + sizeof(__extbuf),
__extbe); __extbe);
size_t __nmemb = static_cast<size_t>(__extbe - __extbuf); size_t __nmemb = static_cast<size_t>(__extbe - __extbuf);

View File

@@ -17,25 +17,23 @@
#include <stdexcept> #include <stdexcept>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Compare, class _Allocator> class __tree; template <class _Tp, class _Compare, class _Allocator> class __tree;
template <class _Tp, class _NodePtr, class _DiffType> template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_iterator; class _LIBCPP_VISIBLE __tree_iterator;
template <class _Tp, class _ConstNodePtr, class _DiffType> template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_const_iterator; class _LIBCPP_VISIBLE __tree_const_iterator;
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS map; class _LIBCPP_VISIBLE map;
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS multimap; class _LIBCPP_VISIBLE multimap;
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS set; class _LIBCPP_VISIBLE set;
template <class _Key, class _Compare, class _Allocator> template <class _Key, class _Compare, class _Allocator>
class _LIBCPP_TYPE_VIS multiset; class _LIBCPP_VISIBLE multiset;
/* /*
@@ -614,11 +612,11 @@ public:
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
}; };
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_iterator; template <class _TreeIterator> class __map_iterator;
template <class _TreeIterator> class _LIBCPP_TYPE_VIS __map_const_iterator; template <class _TreeIterator> class __map_const_iterator;
template <class _Tp, class _NodePtr, class _DiffType> template <class _Tp, class _NodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_iterator class _LIBCPP_VISIBLE __tree_iterator
{ {
typedef _NodePtr __node_pointer; typedef _NodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node; typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -673,16 +671,16 @@ private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} explicit __tree_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class> friend class _LIBCPP_TYPE_VIS __tree_const_iterator; template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __map_iterator; template <class> friend class _LIBCPP_VISIBLE __map_iterator;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set; template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset; template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
}; };
template <class _Tp, class _ConstNodePtr, class _DiffType> template <class _Tp, class _ConstNodePtr, class _DiffType>
class _LIBCPP_TYPE_VIS __tree_const_iterator class _LIBCPP_VISIBLE __tree_const_iterator
{ {
typedef _ConstNodePtr __node_pointer; typedef _ConstNodePtr __node_pointer;
typedef typename pointer_traits<__node_pointer>::element_type __node; typedef typename pointer_traits<__node_pointer>::element_type __node;
@@ -759,11 +757,11 @@ private:
explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT explicit __tree_const_iterator(__node_pointer __p) _NOEXCEPT
: __ptr_(__p) {} : __ptr_(__p) {}
template <class, class, class> friend class __tree; template <class, class, class> friend class __tree;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS set; template <class, class, class> friend class _LIBCPP_VISIBLE set;
template <class, class, class> friend class _LIBCPP_TYPE_VIS multiset; template <class, class, class> friend class _LIBCPP_VISIBLE multiset;
template <class> friend class _LIBCPP_TYPE_VIS __map_const_iterator; template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
}; };
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -932,14 +930,14 @@ public:
__emplace_hint_multi(const_iterator __p, _Args&&... __args); __emplace_hint_multi(const_iterator __p, _Args&&... __args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Vp> template <class _V>
pair<iterator, bool> __insert_unique(_Vp&& __v); pair<iterator, bool> __insert_unique(_V&& __v);
template <class _Vp> template <class _V>
iterator __insert_unique(const_iterator __p, _Vp&& __v); iterator __insert_unique(const_iterator __p, _V&& __v);
template <class _Vp> template <class _V>
iterator __insert_multi(_Vp&& __v); iterator __insert_multi(_V&& __v);
template <class _Vp> template <class _V>
iterator __insert_multi(const_iterator __p, _Vp&& __v); iterator __insert_multi(const_iterator __p, _V&& __v);
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
pair<iterator, bool> __insert_unique(const value_type& __v); pair<iterator, bool> __insert_unique(const value_type& __v);
@@ -1021,8 +1019,8 @@ public:
pair<const_iterator, const_iterator> pair<const_iterator, const_iterator>
__equal_range_multi(const _Key& __k) const; __equal_range_multi(const _Key& __k) const;
typedef __tree_node_destructor<__node_allocator> _Dp; typedef __tree_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
__node_holder remove(const_iterator __p) _NOEXCEPT; __node_holder remove(const_iterator __p) _NOEXCEPT;
private: private:
@@ -1711,7 +1709,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args) __tree<_Tp, _Compare, _Allocator>::__construct_node(_Args&& ...__args)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return __h; return __h;
@@ -1781,11 +1779,11 @@ __tree<_Tp, _Compare, _Allocator>::__emplace_hint_multi(const_iterator __p,
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool> pair<typename __tree<_Tp, _Compare, _Allocator>::iterator, bool>
__tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_unique(_V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
pair<iterator, bool> __r = __node_insert_unique(__h.get()); pair<iterator, bool> __r = __node_insert_unique(__h.get());
if (__r.second) if (__r.second)
__h.release(); __h.release();
@@ -1793,11 +1791,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(_Vp&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
iterator __r = __node_insert_unique(__p, __h.get()); iterator __r = __node_insert_unique(__p, __h.get());
if (__r.__ptr_ == __h.get()) if (__r.__ptr_ == __h.get())
__h.release(); __h.release();
@@ -1805,11 +1803,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_unique(const_iterator __p, _Vp&& __v
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_multi(_V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_); __node_base_pointer& __child = __find_leaf_high(__parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1817,11 +1815,11 @@ __tree<_Tp, _Compare, _Allocator>::__insert_multi(_Vp&& __v)
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
template <class _Vp> template <class _V>
typename __tree<_Tp, _Compare, _Allocator>::iterator typename __tree<_Tp, _Compare, _Allocator>::iterator
__tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _Vp&& __v) __tree<_Tp, _Compare, _Allocator>::__insert_multi(const_iterator __p, _V&& __v)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Vp>(__v)); __node_holder __h = __construct_node(_VSTD::forward<_V>(__v));
__node_base_pointer __parent; __node_base_pointer __parent;
__node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_); __node_base_pointer& __child = __find_leaf(__p, __parent, __h->__value_);
__insert_node_at(__parent, __child, __h.get()); __insert_node_at(__parent, __child, __h.get());
@@ -1835,7 +1833,7 @@ typename __tree<_Tp, _Compare, _Allocator>::__node_holder
__tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v) __tree<_Tp, _Compare, _Allocator>::__construct_node(const value_type& __v)
{ {
__node_allocator& __na = __node_alloc(); __node_allocator& __na = __node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), __v);
__h.get_deleter().__value_constructed = true; __h.get_deleter().__value_constructed = true;
return _VSTD::move(__h); return _VSTD::move(__h);
@@ -2053,7 +2051,7 @@ template <class _Key>
typename __tree<_Tp, _Compare, _Allocator>::size_type typename __tree<_Tp, _Compare, _Allocator>::size_type
__tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__count_multi(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2160,7 +2158,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
{ {
typedef pair<iterator, iterator> _Pp; typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node(); __node_pointer __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2173,13 +2171,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else else
return _Pp(iterator(__rt), return _P(iterator(__rt),
iterator( iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_pointer>(__tree_min(__rt->__right_)) static_cast<__node_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _Pp(iterator(__result), iterator(__result)); return _P(iterator(__result), iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2188,7 +2186,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator> typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2201,13 +2199,13 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_unique(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _Pp(const_iterator(__rt), return _P(const_iterator(__rt),
const_iterator( const_iterator(
__rt->__right_ != nullptr ? __rt->__right_ != nullptr ?
static_cast<__node_const_pointer>(__tree_min(__rt->__right_)) static_cast<__node_const_pointer>(__tree_min(__rt->__right_))
: __result)); : __result));
} }
return _Pp(const_iterator(__result), const_iterator(__result)); return _P(const_iterator(__result), const_iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2216,7 +2214,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::iterator,
typename __tree<_Tp, _Compare, _Allocator>::iterator> typename __tree<_Tp, _Compare, _Allocator>::iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
{ {
typedef pair<iterator, iterator> _Pp; typedef pair<iterator, iterator> _P;
__node_pointer __result = __end_node(); __node_pointer __result = __end_node();
__node_pointer __rt = __root(); __node_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2229,10 +2227,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k)
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_pointer>(__rt->__right_); __rt = static_cast<__node_pointer>(__rt->__right_);
else else
return _Pp(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt), return _P(__lower_bound(__k, static_cast<__node_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result)); __upper_bound(__k, static_cast<__node_pointer>(__rt->__right_), __result));
} }
return _Pp(iterator(__result), iterator(__result)); return _P(iterator(__result), iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2241,7 +2239,7 @@ pair<typename __tree<_Tp, _Compare, _Allocator>::const_iterator,
typename __tree<_Tp, _Compare, _Allocator>::const_iterator> typename __tree<_Tp, _Compare, _Allocator>::const_iterator>
__tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
{ {
typedef pair<const_iterator, const_iterator> _Pp; typedef pair<const_iterator, const_iterator> _P;
__node_const_pointer __result = __end_node(); __node_const_pointer __result = __end_node();
__node_const_pointer __rt = __root(); __node_const_pointer __rt = __root();
while (__rt != nullptr) while (__rt != nullptr)
@@ -2254,10 +2252,10 @@ __tree<_Tp, _Compare, _Allocator>::__equal_range_multi(const _Key& __k) const
else if (value_comp()(__rt->__value_, __k)) else if (value_comp()(__rt->__value_, __k))
__rt = static_cast<__node_const_pointer>(__rt->__right_); __rt = static_cast<__node_const_pointer>(__rt->__right_);
else else
return _Pp(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt), return _P(__lower_bound(__k, static_cast<__node_const_pointer>(__rt->__left_), __rt),
__upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result)); __upper_bound(__k, static_cast<__node_const_pointer>(__rt->__right_), __result));
} }
return _Pp(const_iterator(__result), const_iterator(__result)); return _P(const_iterator(__result), const_iterator(__result));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>
@@ -2275,7 +2273,7 @@ __tree<_Tp, _Compare, _Allocator>::remove(const_iterator __p) _NOEXCEPT
--size(); --size();
__tree_remove(__end_node()->__left_, __tree_remove(__end_node()->__left_,
static_cast<__node_base_pointer>(__np)); static_cast<__node_base_pointer>(__np));
return __node_holder(__np, _Dp(__node_alloc())); return __node_holder(__np, _D(__node_alloc()));
} }
template <class _Tp, class _Compare, class _Allocator> template <class _Tp, class _Compare, class _Allocator>

View File

@@ -15,9 +15,7 @@
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_VARIADICS #ifdef _LIBCPP_HAS_NO_VARIADICS
@@ -27,46 +25,46 @@
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size; template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <class _Tp> template <class _Tp>
class _LIBCPP_TYPE_VIS tuple_size<const _Tp> class _LIBCPP_VISIBLE tuple_size<const _Tp>
: public tuple_size<_Tp> {}; : public tuple_size<_Tp> {};
template <class _Tp> template <class _Tp>
class _LIBCPP_TYPE_VIS tuple_size<volatile _Tp> class _LIBCPP_VISIBLE tuple_size<volatile _Tp>
: public tuple_size<_Tp> {}; : public tuple_size<_Tp> {};
template <class _Tp> template <class _Tp>
class _LIBCPP_TYPE_VIS tuple_size<const volatile _Tp> class _LIBCPP_VISIBLE tuple_size<const volatile _Tp>
: public tuple_size<_Tp> {}; : public tuple_size<_Tp> {};
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS tuple_element; template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
template <size_t _Ip, class _Tp> template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const _Tp> class _LIBCPP_VISIBLE tuple_element<_Ip, const _Tp>
{ {
public: public:
typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type; typedef typename add_const<typename tuple_element<_Ip, _Tp>::type>::type type;
}; };
template <size_t _Ip, class _Tp> template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, volatile _Tp> class _LIBCPP_VISIBLE tuple_element<_Ip, volatile _Tp>
{ {
public: public:
typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type; typedef typename add_volatile<typename tuple_element<_Ip, _Tp>::type>::type type;
}; };
template <size_t _Ip, class _Tp> template <size_t _Ip, class _Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const volatile _Tp> class _LIBCPP_VISIBLE tuple_element<_Ip, const volatile _Tp>
{ {
public: public:
typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type; typedef typename add_cv<typename tuple_element<_Ip, _Tp>::type>::type type;
}; };
template <class ..._Tp> class _LIBCPP_TYPE_VIS tuple; template <class ..._Tp> class _LIBCPP_VISIBLE tuple;
template <class _T1, class _T2> struct _LIBCPP_TYPE_VIS pair; template <class _T1, class _T2> class _LIBCPP_VISIBLE pair;
template <class _Tp, size_t _Size> struct _LIBCPP_TYPE_VIS array; template <class _Tp, size_t _Size> struct _LIBCPP_VISIBLE array;
template <class _Tp> struct __tuple_like : false_type {}; template <class _Tp> struct __tuple_like : false_type {};
@@ -79,47 +77,38 @@ template <class _T1, class _T2> struct __tuple_like<pair<_T1, _T2> > : true_type
template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {}; template <class _Tp, size_t _Size> struct __tuple_like<array<_Tp, _Size> > : true_type {};
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type& typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(tuple<_Tp...>&) _NOEXCEPT; get(tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, tuple<_Tp...> >::type& const typename tuple_element<_Ip, tuple<_Tp...> >::type&
get(const tuple<_Tp...>&) _NOEXCEPT; get(const tuple<_Tp...>&) _NOEXCEPT;
template <size_t _Ip, class ..._Tp> template <size_t _Ip, class ..._Tp>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, tuple<_Tp...> >::type&& typename tuple_element<_Ip, tuple<_Tp...> >::type&&
get(tuple<_Tp...>&&) _NOEXCEPT; get(tuple<_Tp...>&&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type& typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(pair<_T1, _T2>&) _NOEXCEPT; get(pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
const typename tuple_element<_Ip, pair<_T1, _T2> >::type& const typename tuple_element<_Ip, pair<_T1, _T2> >::type&
get(const pair<_T1, _T2>&) _NOEXCEPT; get(const pair<_T1, _T2>&) _NOEXCEPT;
template <size_t _Ip, class _T1, class _T2> template <size_t _Ip, class _T1, class _T2>
_LIBCPP_INLINE_VISIBILITY
typename tuple_element<_Ip, pair<_T1, _T2> >::type&& typename tuple_element<_Ip, pair<_T1, _T2> >::type&&
get(pair<_T1, _T2>&&) _NOEXCEPT; get(pair<_T1, _T2>&&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp& _Tp&
get(array<_Tp, _Size>&) _NOEXCEPT; get(array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
const _Tp& const _Tp&
get(const array<_Tp, _Size>&) _NOEXCEPT; get(const array<_Tp, _Size>&) _NOEXCEPT;
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
_LIBCPP_INLINE_VISIBILITY
_Tp&& _Tp&&
get(array<_Tp, _Size>&&) _NOEXCEPT; get(array<_Tp, _Size>&&) _NOEXCEPT;
@@ -154,7 +143,7 @@ struct __make_tuple_indices
template <class ..._Tp> struct __tuple_types {}; template <class ..._Tp> struct __tuple_types {};
template <size_t _Ip> template <size_t _Ip>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<> > class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<> >
{ {
public: public:
static_assert(_Ip == 0, "tuple_element index out of range"); static_assert(_Ip == 0, "tuple_element index out of range");
@@ -162,21 +151,21 @@ public:
}; };
template <class _Hp, class ..._Tp> template <class _Hp, class ..._Tp>
class _LIBCPP_TYPE_VIS tuple_element<0, __tuple_types<_Hp, _Tp...> > class _LIBCPP_VISIBLE tuple_element<0, __tuple_types<_Hp, _Tp...> >
{ {
public: public:
typedef _Hp type; typedef _Hp type;
}; };
template <size_t _Ip, class _Hp, class ..._Tp> template <size_t _Ip, class _Hp, class ..._Tp>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, __tuple_types<_Hp, _Tp...> > class _LIBCPP_VISIBLE tuple_element<_Ip, __tuple_types<_Hp, _Tp...> >
{ {
public: public:
typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type; typedef typename tuple_element<_Ip-1, __tuple_types<_Tp...> >::type type;
}; };
template <class ..._Tp> template <class ..._Tp>
class _LIBCPP_TYPE_VIS tuple_size<__tuple_types<_Tp...> > class _LIBCPP_VISIBLE tuple_size<__tuple_types<_Tp...> >
: public integral_constant<size_t, sizeof...(_Tp)> : public integral_constant<size_t, sizeof...(_Tp)>
{ {
}; };
@@ -225,7 +214,7 @@ struct __tuple_convertible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up> template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> > struct __tuple_convertible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool, : public integral_constant<bool,
is_convertible<_Tp0, _Up0>::value && is_constructible<_Up0, _Tp0>::value &&
__tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {}; __tuple_convertible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <> template <>
@@ -244,33 +233,6 @@ struct __tuple_convertible<_Tp, _Up, true, true>
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type> typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{}; {};
// __tuple_constructible
template <bool, class _Tp, class _Up>
struct __tuple_constructible_imp : public false_type {};
template <class _Tp0, class ..._Tp, class _Up0, class ..._Up>
struct __tuple_constructible_imp<true, __tuple_types<_Tp0, _Tp...>, __tuple_types<_Up0, _Up...> >
: public integral_constant<bool,
is_constructible<_Up0, _Tp0>::value &&
__tuple_constructible_imp<true, __tuple_types<_Tp...>, __tuple_types<_Up...> >::value> {};
template <>
struct __tuple_constructible_imp<true, __tuple_types<>, __tuple_types<> >
: public true_type {};
template <class _Tp, class _Up, bool = __tuple_like<typename remove_reference<_Tp>::type>::value,
bool = __tuple_like<_Up>::value>
struct __tuple_constructible
: public false_type {};
template <class _Tp, class _Up>
struct __tuple_constructible<_Tp, _Up, true, true>
: public __tuple_constructible_imp<tuple_size<typename remove_reference<_Tp>::type>::value ==
tuple_size<_Up>::value,
typename __make_tuple_types<_Tp>::type, typename __make_tuple_types<_Up>::type>
{};
// __tuple_assignable // __tuple_assignable
template <bool, class _Tp, class _Up> template <bool, class _Tp, class _Up>

View File

@@ -13,14 +13,12 @@
#include <__config> #include <__config>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp> class _LIBCPP_TYPE_VIS tuple_size; template <class _Tp> class _LIBCPP_VISIBLE tuple_size;
template <size_t _Ip, class _Tp> class _LIBCPP_TYPE_VIS tuple_element; template <size_t _Ip, class _Tp> class _LIBCPP_VISIBLE tuple_element;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -1,19 +0,0 @@
// -*- C++ -*-
//===----------------------------------------------------------------------===//
//
// 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.
//
//===----------------------------------------------------------------------===//
#ifdef min
#warning: macro min is incompatible with C++. #undefing min
#undef min
#endif
#ifdef max
#warning: macro max is incompatible with C++. #undefing max
#undef max
#endif

View File

@@ -593,13 +593,9 @@ template <class BidirectionalIterator, class Compare>
#include <utility> #include <utility>
#include <memory> #include <memory>
#include <iterator> #include <iterator>
#include <cstddef> #include <cstdlib>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -697,48 +693,14 @@ struct __debug_less
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
// Precondition: __x != 0 // Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY unsigned __ctz(unsigned __x) {return __builtin_ctz (__x);}
unsigned inline _LIBCPP_INLINE_VISIBILITY unsigned long __ctz(unsigned long __x) {return __builtin_ctzl (__x);}
__ctz(unsigned __x) inline _LIBCPP_INLINE_VISIBILITY unsigned long long __ctz(unsigned long long __x) {return __builtin_ctzll(__x);}
{
return static_cast<unsigned>(__builtin_ctz(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long
__ctz(unsigned long __x)
{
return static_cast<unsigned long>(__builtin_ctzl(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long long
__ctz(unsigned long long __x)
{
return static_cast<unsigned long long>(__builtin_ctzll(__x));
}
// Precondition: __x != 0 // Precondition: __x != 0
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY unsigned __clz(unsigned __x) {return __builtin_clz (__x);}
unsigned inline _LIBCPP_INLINE_VISIBILITY unsigned long __clz(unsigned long __x) {return __builtin_clzl (__x);}
__clz(unsigned __x) inline _LIBCPP_INLINE_VISIBILITY unsigned long long __clz(unsigned long long __x) {return __builtin_clzll(__x);}
{
return static_cast<unsigned>(__builtin_clz(__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long
__clz(unsigned long __x)
{
return static_cast<unsigned long>(__builtin_clzl (__x));
}
inline _LIBCPP_INLINE_VISIBILITY
unsigned long long
__clz(unsigned long long __x)
{
return static_cast<unsigned long long>(__builtin_clzll(__x));
}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned __x) {return __builtin_popcount (__x);}
inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);} inline _LIBCPP_INLINE_VISIBILITY int __pop_count(unsigned long __x) {return __builtin_popcountl (__x);}
@@ -800,10 +762,10 @@ for_each(_InputIterator __first, _InputIterator __last, _Function __f)
template <class _InputIterator, class _Tp> template <class _InputIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_InputIterator _InputIterator
find(_InputIterator __first, _InputIterator __last, const _Tp& __value_) find(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{ {
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
if (*__first == __value_) if (*__first == __value)
break; break;
return __first; return __first;
} }
@@ -1040,11 +1002,11 @@ adjacent_find(_ForwardIterator __first, _ForwardIterator __last)
template <class _InputIterator, class _Tp> template <class _InputIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename iterator_traits<_InputIterator>::difference_type typename iterator_traits<_InputIterator>::difference_type
count(_InputIterator __first, _InputIterator __last, const _Tp& __value_) count(_InputIterator __first, _InputIterator __last, const _Tp& __value)
{ {
typename iterator_traits<_InputIterator>::difference_type __r(0); typename iterator_traits<_InputIterator>::difference_type __r(0);
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
if (*__first == __value_) if (*__first == __value)
++__r; ++__r;
return __r; return __r;
} }
@@ -1348,22 +1310,22 @@ search(_ForwardIterator1 __first1, _ForwardIterator1 __last1,
template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp> template <class _BinaryPredicate, class _ForwardIterator, class _Size, class _Tp>
_ForwardIterator _ForwardIterator
__search_n(_ForwardIterator __first, _ForwardIterator __last, __search_n(_ForwardIterator __first, _ForwardIterator __last,
_Size __count, const _Tp& __value_, _BinaryPredicate __pred, forward_iterator_tag) _Size __count, const _Tp& __value, _BinaryPredicate __pred, forward_iterator_tag)
{ {
if (__count <= 0) if (__count <= 0)
return __first; return __first;
while (true) while (true)
{ {
// Find first element in sequence that matchs __value_, with a mininum of loop checks // Find first element in sequence that matchs __value, with a mininum of loop checks
while (true) while (true)
{ {
if (__first == __last) // return __last if no element matches __value_ if (__first == __last) // return __last if no element matches __value
return __last; return __last;
if (__pred(*__first, __value_)) if (__pred(*__first, __value))
break; break;
++__first; ++__first;
} }
// *__first matches __value_, now match elements after here // *__first matches __value, now match elements after here
_ForwardIterator __m = __first; _ForwardIterator __m = __first;
_Size __c(0); _Size __c(0);
while (true) while (true)
@@ -1372,7 +1334,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last,
return __first; return __first;
if (++__m == __last) // Otherwise if source exhaused, pattern not found if (++__m == __last) // Otherwise if source exhaused, pattern not found
return __last; return __last;
if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
{ {
__first = __m; __first = __m;
++__first; ++__first;
@@ -1385,7 +1347,7 @@ __search_n(_ForwardIterator __first, _ForwardIterator __last,
template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp> template <class _BinaryPredicate, class _RandomAccessIterator, class _Size, class _Tp>
_RandomAccessIterator _RandomAccessIterator
__search_n(_RandomAccessIterator __first, _RandomAccessIterator __last, __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
_Size __count, const _Tp& __value_, _BinaryPredicate __pred, random_access_iterator_tag) _Size __count, const _Tp& __value, _BinaryPredicate __pred, random_access_iterator_tag)
{ {
if (__count <= 0) if (__count <= 0)
return __first; return __first;
@@ -1395,16 +1357,16 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
const _RandomAccessIterator __s = __last - (__count - 1); // Start of pattern match can't go beyond here const _RandomAccessIterator __s = __last - (__count - 1); // Start of pattern match can't go beyond here
while (true) while (true)
{ {
// Find first element in sequence that matchs __value_, with a mininum of loop checks // Find first element in sequence that matchs __value, with a mininum of loop checks
while (true) while (true)
{ {
if (__first >= __s) // return __last if no element matches __value_ if (__first == __s) // return __last if no element matches __value
return __last; return __last;
if (__pred(*__first, __value_)) if (__pred(*__first, __value))
break; break;
++__first; ++__first;
} }
// *__first matches __value_, now match elements after here // *__first matches __value, now match elements after here
_RandomAccessIterator __m = __first; _RandomAccessIterator __m = __first;
_Size __c(0); _Size __c(0);
while (true) while (true)
@@ -1412,7 +1374,7 @@ __search_n(_RandomAccessIterator __first, _RandomAccessIterator __last,
if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern) if (++__c == __count) // If pattern exhausted, __first is the answer (works for 1 element pattern)
return __first; return __first;
++__m; // no need to check range on __m because __s guarantees we have enough source ++__m; // no need to check range on __m because __s guarantees we have enough source
if (!__pred(*__m, __value_)) // if there is a mismatch, restart with a new __first if (!__pred(*__m, __value)) // if there is a mismatch, restart with a new __first
{ {
__first = __m; __first = __m;
++__first; ++__first;
@@ -1426,19 +1388,19 @@ template <class _ForwardIterator, class _Size, class _Tp, class _BinaryPredicate
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last, search_n(_ForwardIterator __first, _ForwardIterator __last,
_Size __count, const _Tp& __value_, _BinaryPredicate __pred) _Size __count, const _Tp& __value, _BinaryPredicate __pred)
{ {
return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type> return _VSTD::__search_n<typename add_lvalue_reference<_BinaryPredicate>::type>
(__first, __last, __count, __value_, __pred, typename iterator_traits<_ForwardIterator>::iterator_category()); (__first, __last, __count, __value, __pred, typename iterator_traits<_ForwardIterator>::iterator_category());
} }
template <class _ForwardIterator, class _Size, class _Tp> template <class _ForwardIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value_) search_n(_ForwardIterator __first, _ForwardIterator __last, _Size __count, const _Tp& __value)
{ {
typedef typename iterator_traits<_ForwardIterator>::value_type __v; typedef typename iterator_traits<_ForwardIterator>::value_type __v;
return _VSTD::search_n(__first, __last, __count, __value_, __equal_to<__v, _Tp>()); return _VSTD::search_n(__first, __last, __count, __value, __equal_to<__v, _Tp>());
} }
// copy // copy
@@ -1528,10 +1490,10 @@ copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
// copy_backward // copy_backward
template <class _BidirectionalIterator, class _OutputIterator> template <class _InputIterator, class _OutputIterator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator _OutputIterator
__copy_backward(_BidirectionalIterator __first, _BidirectionalIterator __last, _OutputIterator __result) __copy_backward(_InputIterator __first, _InputIterator __last, _OutputIterator __result)
{ {
while (__first != __last) while (__first != __last)
*--__result = *--__last; *--__result = *--__last;
@@ -1780,29 +1742,29 @@ replace_copy_if(_InputIterator __first, _InputIterator __last, _OutputIterator _
template <class _OutputIterator, class _Size, class _Tp> template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, false_type) __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, false_type)
{ {
for (; __n > 0; ++__first, --__n) for (; __n > 0; ++__first, --__n)
*__first = __value_; *__first = __value;
return __first; return __first;
} }
template <class _OutputIterator, class _Size, class _Tp> template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator _OutputIterator
__fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_, true_type) __fill_n(_OutputIterator __first, _Size __n, const _Tp& __value, true_type)
{ {
if (__n > 0) if (__n > 0)
_VSTD::memset(__first, (unsigned char)__value_, (size_t)(__n)); _VSTD::memset(__first, (unsigned char)__value, (size_t)(__n));
return __first + __n; return __first + __n;
} }
template <class _OutputIterator, class _Size, class _Tp> template <class _OutputIterator, class _Size, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator _OutputIterator
fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_) fill_n(_OutputIterator __first, _Size __n, const _Tp& __value)
{ {
return _VSTD::__fill_n(__first, __n, __value_, integral_constant<bool, return _VSTD::__fill_n(__first, __n, __value, integral_constant<bool,
is_pointer<_OutputIterator>::value && is_pointer<_OutputIterator>::value &&
is_trivially_copy_assignable<_Tp>::value && is_trivially_copy_assignable<_Tp>::value &&
sizeof(_Tp) == 1>()); sizeof(_Tp) == 1>());
@@ -1813,26 +1775,26 @@ fill_n(_OutputIterator __first, _Size __n, const _Tp& __value_)
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, forward_iterator_tag) __fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, forward_iterator_tag)
{ {
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
*__first = __value_; *__first = __value;
} }
template <class _RandomAccessIterator, class _Tp> template <class _RandomAccessIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value_, random_access_iterator_tag) __fill(_RandomAccessIterator __first, _RandomAccessIterator __last, const _Tp& __value, random_access_iterator_tag)
{ {
_VSTD::fill_n(__first, __last - __first, __value_); _VSTD::fill_n(__first, __last - __first, __value);
} }
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) fill(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
_VSTD::__fill(__first, __last, __value_, typename iterator_traits<_ForwardIterator>::iterator_category()); _VSTD::__fill(__first, __last, __value, typename iterator_traits<_ForwardIterator>::iterator_category());
} }
// generate // generate
@@ -1862,15 +1824,15 @@ generate_n(_OutputIterator __first, _Size __n, _Generator __gen)
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
_ForwardIterator _ForwardIterator
remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) remove(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
__first = _VSTD::find(__first, __last, __value_); __first = _VSTD::find(__first, __last, __value);
if (__first != __last) if (__first != __last)
{ {
_ForwardIterator __i = __first; _ForwardIterator __i = __first;
while (++__i != __last) while (++__i != __last)
{ {
if (!(*__i == __value_)) if (!(*__i == __value))
{ {
*__first = _VSTD::move(*__i); *__first = _VSTD::move(*__i);
++__first; ++__first;
@@ -1908,11 +1870,11 @@ remove_if(_ForwardIterator __first, _ForwardIterator __last, _Predicate __pred)
template <class _InputIterator, class _OutputIterator, class _Tp> template <class _InputIterator, class _OutputIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_OutputIterator _OutputIterator
remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value_) remove_copy(_InputIterator __first, _InputIterator __last, _OutputIterator __result, const _Tp& __value)
{ {
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
{ {
if (!(*__first == __value_)) if (!(*__first == __value))
{ {
*__result = *__first; *__result = *__first;
++__result; ++__result;
@@ -2103,31 +2065,12 @@ reverse_copy(_BidirectionalIterator __first, _BidirectionalIterator __last, _Out
template <class _ForwardIterator> template <class _ForwardIterator>
_ForwardIterator _ForwardIterator
__rotate_left(_ForwardIterator __first, _ForwardIterator __last) __rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last, false_type)
{
typedef typename iterator_traits<_ForwardIterator>::value_type value_type;
value_type __tmp = _VSTD::move(*__first);
_ForwardIterator __lm1 = _VSTD::move(_VSTD::next(__first), __last, __first);
*__lm1 = _VSTD::move(__tmp);
return __lm1;
}
template <class _BidirectionalIterator>
_BidirectionalIterator
__rotate_right(_BidirectionalIterator __first, _BidirectionalIterator __last)
{
typedef typename iterator_traits<_BidirectionalIterator>::value_type value_type;
_BidirectionalIterator __lm1 = _VSTD::prev(__last);
value_type __tmp = _VSTD::move(*__lm1);
_BidirectionalIterator __fp1 = _VSTD::move_backward(__first, __lm1, __last);
*__first = _VSTD::move(__tmp);
return __fp1;
}
template <class _ForwardIterator>
_ForwardIterator
__rotate_forward(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{ {
if (__first == __middle)
return __last;
if (__middle == __last)
return __first;
_ForwardIterator __i = __middle; _ForwardIterator __i = __middle;
while (true) while (true)
{ {
@@ -2175,11 +2118,15 @@ __gcd(_Integral __x, _Integral __y)
template<typename _RandomAccessIterator> template<typename _RandomAccessIterator>
_RandomAccessIterator _RandomAccessIterator
__rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last) __rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last, true_type)
{ {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type; typedef typename iterator_traits<_RandomAccessIterator>::value_type value_type;
if (__first == __middle)
return __last;
if (__middle == __last)
return __first;
const difference_type __m1 = __middle - __first; const difference_type __m1 = __middle - __first;
const difference_type __m2 = __last - __middle; const difference_type __m2 = __last - __middle;
if (__m1 == __m2) if (__m1 == __m2)
@@ -2187,15 +2134,15 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
_VSTD::swap_ranges(__first, __middle, __middle); _VSTD::swap_ranges(__first, __middle, __middle);
return __middle; return __middle;
} }
const difference_type __g = _VSTD::__gcd(__m1, __m2); const difference_type __g = __gcd(__m1, __m2);
for (_RandomAccessIterator __p = __first + __g; __p != __first;) for (_RandomAccessIterator __p = __first + __g; __p != __first;)
{ {
value_type __t(_VSTD::move(*--__p)); value_type __t(*--__p);
_RandomAccessIterator __p1 = __p; _RandomAccessIterator __p1 = __p;
_RandomAccessIterator __p2 = __p1 + __m1; _RandomAccessIterator __p2 = __p1 + __m1;
do do
{ {
*__p1 = _VSTD::move(*__p2); *__p1 = *__p2;
__p1 = __p2; __p1 = __p2;
const difference_type __d = __last - __p2; const difference_type __d = __last - __p2;
if (__m1 < __d) if (__m1 < __d)
@@ -2203,72 +2150,30 @@ __rotate_gcd(_RandomAccessIterator __first, _RandomAccessIterator __middle, _Ran
else else
__p2 = __first + (__m1 - __d); __p2 = __first + (__m1 - __d);
} while (__p2 != __p); } while (__p2 != __p);
*__p1 = _VSTD::move(__t); *__p1 = __t;
} }
return __first + __m2; return __first + __m2;
} }
template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator
__rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last,
_VSTD::forward_iterator_tag)
{
typedef typename _VSTD::iterator_traits<_ForwardIterator>::value_type value_type;
if (_VSTD::is_trivially_move_assignable<value_type>::value)
{
if (_VSTD::next(__first) == __middle)
return _VSTD::__rotate_left(__first, __last);
}
return _VSTD::__rotate_forward(__first, __middle, __last);
}
template <class _BidirectionalIterator>
inline _LIBCPP_INLINE_VISIBILITY
_BidirectionalIterator
__rotate(_BidirectionalIterator __first, _BidirectionalIterator __middle, _BidirectionalIterator __last,
_VSTD::bidirectional_iterator_tag)
{
typedef typename _VSTD::iterator_traits<_BidirectionalIterator>::value_type value_type;
if (_VSTD::is_trivially_move_assignable<value_type>::value)
{
if (_VSTD::next(__first) == __middle)
return _VSTD::__rotate_left(__first, __last);
if (_VSTD::next(__middle) == __last)
return _VSTD::__rotate_right(__first, __last);
}
return _VSTD::__rotate_forward(__first, __middle, __last);
}
template <class _RandomAccessIterator>
inline _LIBCPP_INLINE_VISIBILITY
_RandomAccessIterator
__rotate(_RandomAccessIterator __first, _RandomAccessIterator __middle, _RandomAccessIterator __last,
_VSTD::random_access_iterator_tag)
{
typedef typename _VSTD::iterator_traits<_RandomAccessIterator>::value_type value_type;
if (_VSTD::is_trivially_move_assignable<value_type>::value)
{
if (_VSTD::next(__first) == __middle)
return _VSTD::__rotate_left(__first, __last);
if (_VSTD::next(__middle) == __last)
return _VSTD::__rotate_right(__first, __last);
return _VSTD::__rotate_gcd(__first, __middle, __last);
}
return _VSTD::__rotate_forward(__first, __middle, __last);
}
template <class _ForwardIterator> template <class _ForwardIterator>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last) rotate(_ForwardIterator __first, _ForwardIterator __middle, _ForwardIterator __last)
{ {
if (__first == __middle)
return __last;
if (__middle == __last)
return __first;
return _VSTD::__rotate(__first, __middle, __last, return _VSTD::__rotate(__first, __middle, __last,
typename _VSTD::iterator_traits<_ForwardIterator>::iterator_category()); integral_constant
<
bool,
is_convertible
<
typename iterator_traits<_ForwardIterator>::iterator_category,
random_access_iterator_tag
>::value &&
is_trivially_copy_assignable
<
typename iterator_traits<_ForwardIterator>::value_type
>::value
>());
} }
// rotate_copy // rotate_copy
@@ -2421,7 +2326,10 @@ minmax_element(_ForwardIterator __first, _ForwardIterator __last, _Compare __com
if (++__first != __last) if (++__first != __last)
{ {
if (__comp(*__first, *__result.first)) if (__comp(*__first, *__result.first))
{
__result.second = __result.first;
__result.first = __first; __result.first = __first;
}
else else
__result.second = __first; __result.second = __first;
while (++__first != __last) while (++__first != __last)
@@ -2513,29 +2421,29 @@ minmax(initializer_list<_Tp> __t, _Compare __comp)
// __independent_bits_engine // __independent_bits_engine
template <unsigned long long _Xp, size_t _Rp> template <unsigned long long _X, size_t _R>
struct __log2_imp struct __log2_imp
{ {
static const size_t value = _Xp & ((unsigned long long)(1) << _Rp) ? _Rp static const size_t value = _X & ((unsigned long long)(1) << _R) ? _R
: __log2_imp<_Xp, _Rp - 1>::value; : __log2_imp<_X, _R - 1>::value;
}; };
template <unsigned long long _Xp> template <unsigned long long _X>
struct __log2_imp<_Xp, 0> struct __log2_imp<_X, 0>
{ {
static const size_t value = 0; static const size_t value = 0;
}; };
template <size_t _Rp> template <size_t _R>
struct __log2_imp<0, _Rp> struct __log2_imp<0, _R>
{ {
static const size_t value = _Rp + 1; static const size_t value = _R + 1;
}; };
template <class _UI, _UI _Xp> template <class _UI, _UI _X>
struct __log2 struct __log2
{ {
static const size_t value = __log2_imp<_Xp, static const size_t value = __log2_imp<_X,
sizeof(_UI) * __CHAR_BIT__ - 1>::value; sizeof(_UI) * __CHAR_BIT__ - 1>::value;
}; };
@@ -2565,23 +2473,18 @@ private:
_Engine_result_type __mask0_; _Engine_result_type __mask0_;
_Engine_result_type __mask1_; _Engine_result_type __mask1_;
#ifdef _LIBCPP_HAS_NO_CONSTEXPR static const _Working_result_type _R = _Engine::_Max - _Engine::_Min
static const _Working_result_type _Rp = _Engine::_Max - _Engine::_Min
+ _Working_result_type(1); + _Working_result_type(1);
#else static const size_t __m = __log2<_Working_result_type, _R>::value;
static _LIBCPP_CONSTEXPR const _Working_result_type _Rp = _Engine::max() - _Engine::min() static const size_t _WDt = numeric_limits<_Working_result_type>::digits;
+ _Working_result_type(1); static const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
#endif
static _LIBCPP_CONSTEXPR const size_t __m = __log2<_Working_result_type, _Rp>::value;
static _LIBCPP_CONSTEXPR const size_t _WDt = numeric_limits<_Working_result_type>::digits;
static _LIBCPP_CONSTEXPR const size_t _EDt = numeric_limits<_Engine_result_type>::digits;
public: public:
// constructors and seeding functions // constructors and seeding functions
__independent_bits_engine(_Engine& __e, size_t __w); __independent_bits_engine(_Engine& __e, size_t __w);
// generating functions // generating functions
result_type operator()() {return __eval(integral_constant<bool, _Rp != 0>());} result_type operator()() {return __eval(integral_constant<bool, _R != 0>());}
private: private:
result_type __eval(false_type); result_type __eval(false_type);
@@ -2596,24 +2499,24 @@ __independent_bits_engine<_Engine, _UIntType>
{ {
__n_ = __w_ / __m + (__w_ % __m != 0); __n_ = __w_ / __m + (__w_ % __m != 0);
__w0_ = __w_ / __n_; __w0_ = __w_ / __n_;
if (_Rp == 0) if (_R == 0)
__y0_ = _Rp; __y0_ = _R;
else if (__w0_ < _WDt) else if (__w0_ < _WDt)
__y0_ = (_Rp >> __w0_) << __w0_; __y0_ = (_R >> __w0_) << __w0_;
else else
__y0_ = 0; __y0_ = 0;
if (_Rp - __y0_ > __y0_ / __n_) if (_R - __y0_ > __y0_ / __n_)
{ {
++__n_; ++__n_;
__w0_ = __w_ / __n_; __w0_ = __w_ / __n_;
if (__w0_ < _WDt) if (__w0_ < _WDt)
__y0_ = (_Rp >> __w0_) << __w0_; __y0_ = (_R >> __w0_) << __w0_;
else else
__y0_ = 0; __y0_ = 0;
} }
__n0_ = __n_ - __w_ % __n_; __n0_ = __n_ - __w_ % __n_;
if (__w0_ < _WDt - 1) if (__w0_ < _WDt - 1)
__y1_ = (_Rp >> (__w0_ + 1)) << (__w0_ + 1); __y1_ = (_R >> (__w0_ + 1)) << (__w0_ + 1);
else else
__y1_ = 0; __y1_ = 0;
__mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) : __mask0_ = __w0_ > 0 ? _Engine_result_type(~0) >> (_EDt - __w0_) :
@@ -2635,7 +2538,7 @@ template<class _Engine, class _UIntType>
_UIntType _UIntType
__independent_bits_engine<_Engine, _UIntType>::__eval(true_type) __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{ {
result_type _Sp = 0; result_type _S = 0;
for (size_t __k = 0; __k < __n0_; ++__k) for (size_t __k = 0; __k < __n0_; ++__k)
{ {
_Engine_result_type __u; _Engine_result_type __u;
@@ -2643,11 +2546,11 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{ {
__u = __e_() - _Engine::min(); __u = __e_() - _Engine::min();
} while (__u >= __y0_); } while (__u >= __y0_);
if (__w0_ < _WDt) if (__w0_ < _EDt)
_Sp <<= __w0_; _S <<= __w0_;
else else
_Sp = 0; _S = 0;
_Sp += __u & __mask0_; _S += __u & __mask0_;
} }
for (size_t __k = __n0_; __k < __n_; ++__k) for (size_t __k = __n0_; __k < __n_; ++__k)
{ {
@@ -2656,13 +2559,13 @@ __independent_bits_engine<_Engine, _UIntType>::__eval(true_type)
{ {
__u = __e_() - _Engine::min(); __u = __e_() - _Engine::min();
} while (__u >= __y1_); } while (__u >= __y1_);
if (__w0_ < _WDt - 1) if (__w0_ < _EDt - 1)
_Sp <<= __w0_ + 1; _S <<= __w0_ + 1;
else else
_Sp = 0; _S = 0;
_Sp += __u & __mask1_; _S += __u & __mask1_;
} }
return _Sp; return _S;
} }
// uniform_int_distribution // uniform_int_distribution
@@ -2735,22 +2638,22 @@ uniform_int_distribution<_IntType>::operator()(_URNG& __g, const param_type& __p
{ {
typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t), typedef typename conditional<sizeof(result_type) <= sizeof(uint32_t),
uint32_t, uint64_t>::type _UIntType; uint32_t, uint64_t>::type _UIntType;
const _UIntType _Rp = __p.b() - __p.a() + _UIntType(1); const _UIntType _R = __p.b() - __p.a() + _UIntType(1);
if (_Rp == 1) if (_R == 1)
return __p.a(); return __p.a();
const size_t _Dt = numeric_limits<_UIntType>::digits; const size_t _Dt = numeric_limits<_UIntType>::digits;
typedef __independent_bits_engine<_URNG, _UIntType> _Eng; typedef __independent_bits_engine<_URNG, _UIntType> _Eng;
if (_Rp == 0) if (_R == 0)
return static_cast<result_type>(_Eng(__g, _Dt)()); return static_cast<result_type>(_Eng(__g, _Dt)());
size_t __w = _Dt - __clz(_Rp) - 1; size_t __w = _Dt - __clz(_R) - 1;
if ((_Rp & (_UIntType(~0) >> (_Dt - __w))) != 0) if ((_R & (_UIntType(~0) >> (_Dt - __w))) != 0)
++__w; ++__w;
_Eng __e(__g, __w); _Eng __e(__g, __w);
_UIntType __u; _UIntType __u;
do do
{ {
__u = __e(); __u = __e();
} while (__u >= _Rp); } while (__u >= _R);
return static_cast<result_type>(__u + __p.a()); return static_cast<result_type>(__u + __p.a());
} }
@@ -2764,7 +2667,7 @@ class __rs_default
__rs_default(); __rs_default();
public: public:
typedef uint_fast32_t result_type; typedef unsigned result_type;
static const result_type _Min = 0; static const result_type _Min = 0;
static const result_type _Max = 0xFFFFFFFF; static const result_type _Max = 0xFFFFFFFF;
@@ -2774,8 +2677,8 @@ public:
result_type operator()(); result_type operator()();
static _LIBCPP_CONSTEXPR result_type min() {return _Min;} static const/*expr*/ result_type min() {return _Min;}
static _LIBCPP_CONSTEXPR result_type max() {return _Max;} static const/*expr*/ result_type max() {return _Max;}
friend __rs_default __rs_get(); friend __rs_default __rs_get();
}; };
@@ -2787,16 +2690,16 @@ void
random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last) random_shuffle(_RandomAccessIterator __first, _RandomAccessIterator __last)
{ {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef uniform_int_distribution<ptrdiff_t> _Dp; typedef uniform_int_distribution<ptrdiff_t> _D;
typedef typename _Dp::param_type _Pp; typedef typename _D::param_type _P;
difference_type __d = __last - __first; difference_type __d = __last - __first;
if (__d > 1) if (__d > 1)
{ {
_Dp __uid; _D __uid;
__rs_default __g = __rs_get(); __rs_default __g = __rs_get();
for (--__last, --__d; __first < __last; ++__first, --__d) for (--__last, --__d; __first < __last; ++__first, --__d)
{ {
difference_type __i = __uid(__g, _Pp(0, __d)); difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0)) if (__i != difference_type(0))
swap(*__first, *(__first + __i)); swap(*__first, *(__first + __i));
} }
@@ -2833,15 +2736,15 @@ template<class _RandomAccessIterator, class _UniformRandomNumberGenerator>
#endif #endif
{ {
typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type;
typedef uniform_int_distribution<ptrdiff_t> _Dp; typedef uniform_int_distribution<ptrdiff_t> _D;
typedef typename _Dp::param_type _Pp; typedef typename _D::param_type _P;
difference_type __d = __last - __first; difference_type __d = __last - __first;
if (__d > 1) if (__d > 1)
{ {
_Dp __uid; _D __uid;
for (--__last, --__d; __first < __last; ++__first, --__d) for (--__last, --__d; __first < __last; ++__first, --__d)
{ {
difference_type __i = __uid(__g, _Pp(0, __d)); difference_type __i = __uid(__g, _P(0, __d));
if (__i != difference_type(0)) if (__i != difference_type(0))
swap(*__first, *(__first + __i)); swap(*__first, *(__first + __i));
} }
@@ -3778,52 +3681,45 @@ sort(__wrap_iter<_Tp*> __first, __wrap_iter<_Tp*> __last, _Compare __comp)
_VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp); _VSTD::sort<_Tp*, _Comp_ref>(__first.base(), __last.base(), __comp);
} }
#ifdef _MSC_VER extern template void __sort<__less<char>&, char*>(char*, char*, __less<char>&);
#pragma warning( push ) extern template void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&);
#pragma warning( disable: 4231) extern template void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&);
#endif // _MSC_VER extern template void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<char>&, char*>(char*, char*, __less<char>&)) extern template void __sort<__less<short>&, short*>(short*, short*, __less<short>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<wchar_t>&, wchar_t*>(wchar_t*, wchar_t*, __less<wchar_t>&)) extern template void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<signed char>&, signed char*>(signed char*, signed char*, __less<signed char>&)) extern template void __sort<__less<int>&, int*>(int*, int*, __less<int>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned char>&, unsigned char*>(unsigned char*, unsigned char*, __less<unsigned char>&)) extern template void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<short>&, short*>(short*, short*, __less<short>&)) extern template void __sort<__less<long>&, long*>(long*, long*, __less<long>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned short>&, unsigned short*>(unsigned short*, unsigned short*, __less<unsigned short>&)) extern template void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<int>&, int*>(int*, int*, __less<int>&)) extern template void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned>&, unsigned*>(unsigned*, unsigned*, __less<unsigned>&)) 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<long>&, long*>(long*, long*, __less<long>&)) extern template void __sort<__less<float>&, float*>(float*, float*, __less<float>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<unsigned long>&, unsigned long*>(unsigned long*, unsigned long*, __less<unsigned long>&)) extern template void __sort<__less<double>&, double*>(double*, double*, __less<double>&);
_LIBCPP_EXTERN_TEMPLATE(void __sort<__less<long long>&, long long*>(long long*, long long*, __less<long long>&)) extern template void __sort<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
_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(bool __insertion_sort_incomplete<__less<char>&, char*>(char*, char*, __less<char>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) 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>&)) extern template bool __insertion_sort_incomplete<__less<long double>&, long double*>(long double*, long double*, __less<long double>&);
_LIBCPP_EXTERN_TEMPLATE(unsigned __sort5<__less<long double>&, long double*>(long double*, long double*, long double*, long double*, long double*, __less<long double>&)) 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 // _MSC_VER
// lower_bound // lower_bound
template <class _Compare, class _ForwardIterator, class _Tp> template <class _Compare, class _ForwardIterator, class _Tp>
_ForwardIterator _ForwardIterator
__lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
difference_type __len = _VSTD::distance(__first, __last); difference_type __len = _VSTD::distance(__first, __last);
@@ -3832,7 +3728,7 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
difference_type __l2 = __len / 2; difference_type __l2 = __len / 2;
_ForwardIterator __m = __first; _ForwardIterator __m = __first;
_VSTD::advance(__m, __l2); _VSTD::advance(__m, __l2);
if (__comp(*__m, __value_)) if (__comp(*__m, __value))
{ {
__first = ++__m; __first = ++__m;
__len -= __l2 + 1; __len -= __l2 + 1;
@@ -3846,24 +3742,24 @@ __lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
template <class _ForwardIterator, class _Tp, class _Compare> template <class _ForwardIterator, class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
#ifdef _LIBCPP_DEBUG2 #ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp); __debug_less<_Compare> __c(__comp);
return __lower_bound<_Comp_ref>(__first, __last, __value_, __c); return __lower_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2 #else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __lower_bound<_Comp_ref>(__first, __last, __value_, __comp); return __lower_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
} }
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
return _VSTD::lower_bound(__first, __last, __value_, return _VSTD::lower_bound(__first, __last, __value,
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
} }
@@ -3871,7 +3767,7 @@ lower_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
template <class _Compare, class _ForwardIterator, class _Tp> template <class _Compare, class _ForwardIterator, class _Tp>
_ForwardIterator _ForwardIterator
__upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
difference_type __len = _VSTD::distance(__first, __last); difference_type __len = _VSTD::distance(__first, __last);
@@ -3880,7 +3776,7 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
difference_type __l2 = __len / 2; difference_type __l2 = __len / 2;
_ForwardIterator __m = __first; _ForwardIterator __m = __first;
_VSTD::advance(__m, __l2); _VSTD::advance(__m, __l2);
if (__comp(__value_, *__m)) if (__comp(__value, *__m))
__len = __l2; __len = __l2;
else else
{ {
@@ -3894,24 +3790,24 @@ __upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
template <class _ForwardIterator, class _Tp, class _Compare> template <class _ForwardIterator, class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
#ifdef _LIBCPP_DEBUG2 #ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp); __debug_less<_Compare> __c(__comp);
return __upper_bound<_Comp_ref>(__first, __last, __value_, __c); return __upper_bound<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2 #else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __upper_bound<_Comp_ref>(__first, __last, __value_, __comp); return __upper_bound<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
} }
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_ForwardIterator _ForwardIterator
upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
return _VSTD::upper_bound(__first, __last, __value_, return _VSTD::upper_bound(__first, __last, __value,
__less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>()); __less<_Tp, typename iterator_traits<_ForwardIterator>::value_type>());
} }
@@ -3919,7 +3815,7 @@ upper_bound(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
template <class _Compare, class _ForwardIterator, class _Tp> template <class _Compare, class _ForwardIterator, class _Tp>
pair<_ForwardIterator, _ForwardIterator> pair<_ForwardIterator, _ForwardIterator>
__equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type; typedef typename iterator_traits<_ForwardIterator>::difference_type difference_type;
difference_type __len = _VSTD::distance(__first, __last); difference_type __len = _VSTD::distance(__first, __last);
@@ -3928,12 +3824,12 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
difference_type __l2 = __len / 2; difference_type __l2 = __len / 2;
_ForwardIterator __m = __first; _ForwardIterator __m = __first;
_VSTD::advance(__m, __l2); _VSTD::advance(__m, __l2);
if (__comp(*__m, __value_)) if (__comp(*__m, __value))
{ {
__first = ++__m; __first = ++__m;
__len -= __l2 + 1; __len -= __l2 + 1;
} }
else if (__comp(__value_, *__m)) else if (__comp(__value, *__m))
{ {
__last = __m; __last = __m;
__len = __l2; __len = __l2;
@@ -3943,8 +3839,8 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
_ForwardIterator __mp1 = __m; _ForwardIterator __mp1 = __m;
return pair<_ForwardIterator, _ForwardIterator> return pair<_ForwardIterator, _ForwardIterator>
( (
__lower_bound<_Compare>(__first, __m, __value_, __comp), __lower_bound<_Compare>(__first, __m, __value, __comp),
__upper_bound<_Compare>(++__mp1, __last, __value_, __comp) __upper_bound<_Compare>(++__mp1, __last, __value, __comp)
); );
} }
} }
@@ -3954,24 +3850,24 @@ __equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __va
template <class _ForwardIterator, class _Tp, class _Compare> template <class _ForwardIterator, class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
pair<_ForwardIterator, _ForwardIterator> pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
#ifdef _LIBCPP_DEBUG2 #ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp); __debug_less<_Compare> __c(__comp);
return __equal_range<_Comp_ref>(__first, __last, __value_, __c); return __equal_range<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2 #else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __equal_range<_Comp_ref>(__first, __last, __value_, __comp); return __equal_range<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
} }
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
pair<_ForwardIterator, _ForwardIterator> pair<_ForwardIterator, _ForwardIterator>
equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
return _VSTD::equal_range(__first, __last, __value_, return _VSTD::equal_range(__first, __last, __value,
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
} }
@@ -3980,33 +3876,33 @@ equal_range(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __valu
template <class _Compare, class _ForwardIterator, class _Tp> template <class _Compare, class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
__binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) __binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
__first = __lower_bound<_Compare>(__first, __last, __value_, __comp); __first = __lower_bound<_Compare>(__first, __last, __value, __comp);
return __first != __last && !__comp(__value_, *__first); return __first != __last && !__comp(__value, *__first);
} }
template <class _ForwardIterator, class _Tp, class _Compare> template <class _ForwardIterator, class _Tp, class _Compare>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_, _Compare __comp) binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value, _Compare __comp)
{ {
#ifdef _LIBCPP_DEBUG2 #ifdef _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref; typedef typename add_lvalue_reference<__debug_less<_Compare> >::type _Comp_ref;
__debug_less<_Compare> __c(__comp); __debug_less<_Compare> __c(__comp);
return __binary_search<_Comp_ref>(__first, __last, __value_, __c); return __binary_search<_Comp_ref>(__first, __last, __value, __c);
#else // _LIBCPP_DEBUG2 #else // _LIBCPP_DEBUG2
typedef typename add_lvalue_reference<_Compare>::type _Comp_ref; typedef typename add_lvalue_reference<_Compare>::type _Comp_ref;
return __binary_search<_Comp_ref>(__first, __last, __value_, __comp); return __binary_search<_Comp_ref>(__first, __last, __value, __comp);
#endif // _LIBCPP_DEBUG2 #endif // _LIBCPP_DEBUG2
} }
template <class _ForwardIterator, class _Tp> template <class _ForwardIterator, class _Tp>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
bool bool
binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value_) binary_search(_ForwardIterator __first, _ForwardIterator __last, const _Tp& __value)
{ {
return _VSTD::binary_search(__first, __last, __value_, return _VSTD::binary_search(__first, __last, __value,
__less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>()); __less<typename iterator_traits<_ForwardIterator>::value_type, _Tp>());
} }
@@ -4813,8 +4709,6 @@ __nth_element(_RandomAccessIterator __first, _RandomAccessIterator __nth, _Rando
while (true) while (true)
{ {
__restart: __restart:
if (__nth == __last)
return;
difference_type __len = __last - __first; difference_type __len = __last - __first;
switch (__len) switch (__len)
{ {

View File

@@ -55,7 +55,7 @@ struct array
// capacity: // capacity:
constexpr size_type size() const noexcept; constexpr size_type size() const noexcept;
constexpr size_type max_size() const noexcept; constexpr size_type max_size() const noexcept;
constexpr bool empty() const noexcept; bool empty() const noexcept;
// element access: // element access:
reference operator[](size_type n); reference operator[](size_type n);
@@ -111,14 +111,12 @@ template <int I, class T, size_t N> T&& get(array<T, N>&&) noexcept;
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
struct _LIBCPP_TYPE_VIS array struct _LIBCPP_VISIBLE array
{ {
// types: // types:
typedef array __self; typedef array __self;
@@ -173,11 +171,11 @@ struct _LIBCPP_TYPE_VIS array
// capacity: // capacity:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type size() const _NOEXCEPT {return _Size;} /*constexpr*/ size_type size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR size_type max_size() const _NOEXCEPT {return _Size;} /*constexpr*/ size_type max_size() const _NOEXCEPT {return _Size;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR bool empty() const _NOEXCEPT {return _Size == 0;} bool empty() const _NOEXCEPT {return _Size == 0;}
// element access: // element access:
_LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];} _LIBCPP_INLINE_VISIBILITY reference operator[](size_type __n) {return __elems_[__n];}
@@ -284,22 +282,22 @@ swap(const array<_Tp, _Size>& __x, const array<_Tp, _Size>& __y)
} }
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS tuple_size<array<_Tp, _Size> > class _LIBCPP_VISIBLE tuple_size<array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {}; : public integral_constant<size_t, _Size> {};
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS tuple_size<const array<_Tp, _Size> > class _LIBCPP_VISIBLE tuple_size<const array<_Tp, _Size> >
: public integral_constant<size_t, _Size> {}; : public integral_constant<size_t, _Size> {};
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, array<_Tp, _Size> > class _LIBCPP_VISIBLE tuple_element<_Ip, array<_Tp, _Size> >
{ {
public: public:
typedef _Tp type; typedef _Tp type;
}; };
template <size_t _Ip, class _Tp, size_t _Size> template <size_t _Ip, class _Tp, size_t _Size>
class _LIBCPP_TYPE_VIS tuple_element<_Ip, const array<_Tp, _Size> > class _LIBCPP_VISIBLE tuple_element<_Ip, const array<_Tp, _Size> >
{ {
public: public:
typedef const _Tp type; typedef const _Tp type;
@@ -310,7 +308,6 @@ _LIBCPP_INLINE_VISIBILITY inline
_Tp& _Tp&
get(array<_Tp, _Size>& __a) _NOEXCEPT get(array<_Tp, _Size>& __a) _NOEXCEPT
{ {
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array)");
return __a[_Ip]; return __a[_Ip];
} }
@@ -319,7 +316,6 @@ _LIBCPP_INLINE_VISIBILITY inline
const _Tp& const _Tp&
get(const array<_Tp, _Size>& __a) _NOEXCEPT get(const array<_Tp, _Size>& __a) _NOEXCEPT
{ {
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (const std::array)");
return __a[_Ip]; return __a[_Ip];
} }
@@ -330,7 +326,6 @@ _LIBCPP_INLINE_VISIBILITY inline
_Tp&& _Tp&&
get(array<_Tp, _Size>&& __a) _NOEXCEPT get(array<_Tp, _Size>&& __a) _NOEXCEPT
{ {
static_assert(_Ip < _Size, "Index out of bounds in std::get<> (std::array &&)");
return _VSTD::move(__a[_Ip]); return _VSTD::move(__a[_Ip]);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -113,9 +113,7 @@ template <size_t N> struct hash<std::bitset<N>>;
*/ */
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#include <__config> #include <__config>
#include <__bit_reference> #include <__bit_reference>
@@ -129,8 +127,6 @@ template <size_t N> struct hash<std::bitset<N>>;
#include <cassert> #include <cassert>
#endif #endif
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
@@ -148,9 +144,9 @@ class __bitset
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -159,7 +155,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
__storage_type __first_[_N_words]; __storage_type __first_[_N_words];
@@ -168,12 +164,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} {return reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);} {return const_reference(__first_ + __pos / __bits_per_word, __storage_type(1) << __pos % __bits_per_word);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -194,10 +190,8 @@ protected:
bool any() const _NOEXCEPT; bool any() const _NOEXCEPT;
size_t __hash_code() const _NOEXCEPT; size_t __hash_code() const _NOEXCEPT;
private: private:
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
void __init(unsigned long long __v, false_type) _NOEXCEPT; void __init(unsigned long long __v, false_type) _NOEXCEPT;
void __init(unsigned long long __v, true_type) _NOEXCEPT; void __init(unsigned long long __v, true_type) _NOEXCEPT;
#endif // _LIBCPP_HAS_NO_CONSTEXPR
unsigned long to_ulong(false_type) const; unsigned long to_ulong(false_type) const;
unsigned long to_ulong(true_type) const; unsigned long to_ulong(true_type) const;
unsigned long long to_ullong(false_type) const; unsigned long long to_ullong(false_type) const;
@@ -208,22 +202,14 @@ private:
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset() _NOEXCEPT __bitset<_N_words, _Size>::__bitset() _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
: __first_{0}
#endif
{ {
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
_VSTD::fill_n(__first_, _N_words, __storage_type(0)); _VSTD::fill_n(__first_, _N_words, __storage_type(0));
#endif
} }
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type)
{ {
__storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)]; __storage_type __t[sizeof(unsigned long long) / sizeof(__storage_type)];
for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word) for (size_t __i = 0; __i < sizeof(__t)/sizeof(__t[0]); ++__i, __v >>= __bits_per_word)
@@ -236,31 +222,17 @@ __bitset<_N_words, _Size>::__init(unsigned long long __v, false_type) _NOEXCEPT
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
__bitset<_N_words, _Size>::__init(unsigned long long __v, true_type) _NOEXCEPT __bitset<_N_words, _Size>::__init(unsigned long long __v, true_type)
{ {
__first_[0] = __v; __first_[0] = __v;
_VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0)); _VSTD::fill(__first_ + 1, __first_ + sizeof(__first_)/sizeof(__first_[0]), __storage_type(0));
} }
#endif // _LIBCPP_HAS_NO_CONSTEXPR
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
#ifndef _LIBCPP_HAS_NO_CONSTEXPR
#if __SIZE_WIDTH__ == 64
: __first_{__v}
#elif __SIZE_WIDTH__ == 32
: __first_{__v, __v >> __bits_per_word}
#else
#error This constructor has not been ported to this platform
#endif
#endif
{ {
#ifdef _LIBCPP_HAS_NO_CONSTEXPR
__init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>()); __init(__v, integral_constant<bool, sizeof(unsigned long long) == sizeof(__storage_type)>());
#endif
} }
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
@@ -430,9 +402,9 @@ class __bitset<1, _Size>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -441,7 +413,7 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
__storage_type __first_; __storage_type __first_;
@@ -450,12 +422,12 @@ protected:
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long __v) _NOEXCEPT; explicit __bitset(unsigned long long __v) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t __pos) _NOEXCEPT
{return reference(&__first_, __storage_type(1) << __pos);} {return reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t __pos) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t __pos) const _NOEXCEPT
{return const_reference(&__first_, __storage_type(1) << __pos);} {return const_reference(&__first_, __storage_type(1) << __pos);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);} {return iterator(&__first_ + __pos / __bits_per_word, __pos % __bits_per_word);}
@@ -479,7 +451,6 @@ protected:
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset() _NOEXCEPT __bitset<1, _Size>::__bitset() _NOEXCEPT
: __first_(0) : __first_(0)
{ {
@@ -487,7 +458,6 @@ __bitset<1, _Size>::__bitset() _NOEXCEPT
template <size_t _Size> template <size_t _Size>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT __bitset<1, _Size>::__bitset(unsigned long long __v) _NOEXCEPT
: __first_(static_cast<__storage_type>(__v)) : __first_(static_cast<__storage_type>(__v))
{ {
@@ -575,9 +545,9 @@ class __bitset<0, 0>
public: public:
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef size_t size_type; typedef size_t size_type;
typedef size_type __storage_type;
protected: protected:
typedef __bitset __self; typedef __bitset __self;
typedef size_type __storage_type;
typedef __storage_type* __storage_pointer; typedef __storage_type* __storage_pointer;
typedef const __storage_type* __const_storage_pointer; typedef const __storage_type* __const_storage_pointer;
static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT); static const unsigned __bits_per_word = static_cast<unsigned>(sizeof(__storage_type) * CHAR_BIT);
@@ -586,23 +556,23 @@ protected:
friend class __bit_const_reference<__bitset>; friend class __bit_const_reference<__bitset>;
friend class __bit_iterator<__bitset, false>; friend class __bit_iterator<__bitset, false>;
friend class __bit_iterator<__bitset, true>; friend class __bit_iterator<__bitset, true>;
friend struct __bit_array<__bitset>; friend class __bit_array<__bitset>;
typedef __bit_reference<__bitset> reference; typedef __bit_reference<__bitset> reference;
typedef __bit_const_reference<__bitset> const_reference; typedef __bit_const_reference<__bitset> const_reference;
typedef __bit_iterator<__bitset, false> iterator; typedef __bit_iterator<__bitset, false> iterator;
typedef __bit_iterator<__bitset, true> const_iterator; typedef __bit_iterator<__bitset, true> const_iterator;
_LIBCPP_CONSTEXPR __bitset() _NOEXCEPT; __bitset() _NOEXCEPT;
explicit _LIBCPP_CONSTEXPR __bitset(unsigned long long) _NOEXCEPT; explicit __bitset(unsigned long long) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY reference __make_ref(size_t) _NOEXCEPT
{return reference(0, 1);} {return reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR const_reference __make_ref(size_t) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_reference __make_ref(size_t) const _NOEXCEPT
{return const_reference(0, 1);} {return const_reference(0, 1);}
_LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY iterator __make_iter(size_t __pos) _NOEXCEPT
{return iterator(0, 0);} {return iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t) const _NOEXCEPT _LIBCPP_INLINE_VISIBILITY const_iterator __make_iter(size_t __pos) const _NOEXCEPT
{return const_iterator(0, 0);} {return const_iterator(0, 0);}
_LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY void operator&=(const __bitset&) _NOEXCEPT {}
@@ -621,25 +591,22 @@ protected:
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset() _NOEXCEPT __bitset<0, 0>::__bitset() _NOEXCEPT
{ {
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
__bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT __bitset<0, 0>::__bitset(unsigned long long) _NOEXCEPT
{ {
} }
template <size_t _Size> class _LIBCPP_TYPE_VIS bitset; template <size_t _Size> class bitset;
template <size_t _Size> struct _LIBCPP_TYPE_VIS hash<bitset<_Size> >; template <size_t _Size> struct hash<bitset<_Size> >;
template <size_t _Size> template <size_t _Size>
class _LIBCPP_TYPE_VIS bitset class _LIBCPP_VISIBLE bitset
: private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size> : private __bitset<_Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1, _Size>
{ {
public:
static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1; static const unsigned __n_words = _Size == 0 ? 0 : (_Size - 1) / (sizeof(size_t) * CHAR_BIT) + 1;
typedef __bitset<__n_words, _Size> base; typedef __bitset<__n_words, _Size> base;
@@ -648,9 +615,8 @@ public:
typedef typename base::const_reference const_reference; typedef typename base::const_reference const_reference;
// 23.3.5.1 constructors: // 23.3.5.1 constructors:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR bitset() _NOEXCEPT {} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset() _NOEXCEPT {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR /*constexpr*/ _LIBCPP_INLINE_VISIBILITY bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
bitset(unsigned long long __v) _NOEXCEPT : base(__v) {}
template<class _CharT> template<class _CharT>
explicit bitset(const _CharT* __str, explicit bitset(const _CharT* __str,
typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos, typename basic_string<_CharT>::size_type __n = basic_string<_CharT>::npos,
@@ -677,8 +643,7 @@ public:
bitset& flip(size_t __pos); bitset& flip(size_t __pos);
// element access: // element access:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
const_reference operator[](size_t __p) const {return base::__make_ref(__p);}
_LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);} _LIBCPP_INLINE_VISIBILITY reference operator[](size_t __p) {return base::__make_ref(__p);}
unsigned long to_ulong() const; unsigned long to_ulong() const;
unsigned long long to_ullong() const; unsigned long long to_ullong() const;
@@ -694,7 +659,7 @@ public:
basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0', basic_string<char, char_traits<char>, allocator<char> > to_string(char __zero = '0',
char __one = '1') const; char __one = '1') const;
size_t count() const _NOEXCEPT; size_t count() const _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR size_t size() const _NOEXCEPT {return _Size;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY size_t size() const _NOEXCEPT {return _Size;}
bool operator==(const bitset& __rhs) const _NOEXCEPT; bool operator==(const bitset& __rhs) const _NOEXCEPT;
bool operator!=(const bitset& __rhs) const _NOEXCEPT; bool operator!=(const bitset& __rhs) const _NOEXCEPT;
bool test(size_t __pos) const; bool test(size_t __pos) const;
@@ -726,11 +691,11 @@ bitset<_Size>::bitset(const _CharT* __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _Mp = _VSTD::min(__rlen, _Size); size_t _M = _VSTD::min(__rlen, _Size);
size_t __i = 0; size_t __i = 0;
for (; __i < _Mp; ++__i) for (; __i < _M; ++__i)
{ {
_CharT __c = __str[_Mp - 1 - __i]; _CharT __c = __str[_M - 1 - __i];
if (__c == __zero) if (__c == __zero)
(*this)[__i] = false; (*this)[__i] = false;
else else
@@ -760,11 +725,11 @@ bitset<_Size>::bitset(const basic_string<_CharT,_Traits,_Allocator>& __str,
#else #else
assert(!"bitset string ctor has invalid argument"); assert(!"bitset string ctor has invalid argument");
#endif #endif
size_t _Mp = _VSTD::min(__rlen, _Size); size_t _M = _VSTD::min(__rlen, _Size);
size_t __i = 0; size_t __i = 0;
for (; __i < _Mp; ++__i) for (; __i < _M; ++__i)
{ {
_CharT __c = __str[__pos + _Mp - 1 - __i]; _CharT __c = __str[__pos + _M - 1 - __i];
if (_Traits::eq(__c, __zero)) if (_Traits::eq(__c, __zero))
(*this)[__i] = false; (*this)[__i] = false;
else else
@@ -1060,7 +1025,7 @@ operator^(const bitset<_Size>& __x, const bitset<_Size>& __y) _NOEXCEPT
} }
template <size_t _Size> template <size_t _Size>
struct _LIBCPP_TYPE_VIS hash<bitset<_Size> > struct _LIBCPP_VISIBLE hash<bitset<_Size> >
: public unary_function<bitset<_Size>, size_t> : public unary_function<bitset<_Size>, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY

View File

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

View File

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

View File

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

View File

@@ -26,9 +26,7 @@ Macros:
#include <__config> #include <__config>
#include <errno.h> #include <errno.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE) #if !defined(EOWNERDEAD) || !defined(ENOTRECOVERABLE)

View File

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

View File

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

View File

@@ -20,7 +20,6 @@ namespace chrono
{ {
template <class ToDuration, class Rep, class Period> template <class ToDuration, class Rep, class Period>
constexpr
ToDuration ToDuration
duration_cast(const duration<Rep, Period>& fd); duration_cast(const duration<Rep, Period>& fd);
@@ -30,9 +29,9 @@ template <class Rep>
struct duration_values struct duration_values
{ {
public: public:
static constexpr Rep zero(); static Rep zero();
static constexpr Rep max(); static Rep max();
static constexpr Rep min(); static Rep min();
}; };
// duration // duration
@@ -47,9 +46,9 @@ public:
typedef Rep rep; typedef Rep rep;
typedef Period period; typedef Period period;
constexpr duration() = default; duration() = default;
template <class Rep2> template <class Rep2>
constexpr explicit duration(const Rep2& r, explicit duration(const Rep2& r,
typename enable_if typename enable_if
< <
is_convertible<Rep2, rep>::value && is_convertible<Rep2, rep>::value &&
@@ -59,7 +58,7 @@ public:
// conversions // conversions
template <class Rep2, class Period2> template <class Rep2, class Period2>
constexpr duration(const duration<Rep2, Period2>& d, duration(const duration<Rep2, Period2>& d,
typename enable_if typename enable_if
< <
treat_as_floating_point<rep>::value || treat_as_floating_point<rep>::value ||
@@ -68,12 +67,12 @@ public:
// observer // observer
constexpr rep count() const; rep count() const;
// arithmetic // arithmetic
constexpr duration operator+() const; duration operator+() const;
constexpr duration operator-() const; duration operator-() const;
duration& operator++(); duration& operator++();
duration operator++(int); duration operator++(int);
duration& operator--(); duration& operator--();
@@ -87,9 +86,9 @@ public:
// special values // special values
static constexpr duration zero(); static duration zero();
static constexpr duration min(); static duration min();
static constexpr duration max(); static duration max();
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -146,48 +145,36 @@ namespace chrono {
// duration arithmetic // duration arithmetic
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator+(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2>>::type
operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator-(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const duration<Rep1, Period>& d, const Rep2& s); operator*(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator*(const Rep1& s, const duration<Rep2, Period>& d); operator*(const Rep1& s, const duration<Rep2, Period>& d);
template <class Rep1, class Period, class Rep2> template <class Rep1, class Period, class Rep2>
constexpr
duration<typename common_type<Rep1, Rep2>::type, Period> duration<typename common_type<Rep1, Rep2>::type, Period>
operator/(const duration<Rep1, Period>& d, const Rep2& s); operator/(const duration<Rep1, Period>& d, const Rep2& s);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
typename common_type<Rep1, Rep2>::type typename common_type<Rep1, Rep2>::type
operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration comparisons // duration comparisons
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator==(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator!=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator< (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator<=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator> (const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
template <class Rep1, class Period1, class Rep2, class Period2> template <class Rep1, class Period1, class Rep2, class Period2>
constexpr
bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs); bool operator>=(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs);
// duration_cast // duration_cast
@@ -268,18 +255,14 @@ typedef steady_clock high_resolution_clock;
#include <ratio> #include <ratio>
#include <limits> #include <limits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono namespace chrono
{ {
template <class _Rep, class _Period = ratio<1> > class _LIBCPP_TYPE_VIS duration; template <class _Rep, class _Period = ratio<1> > class _LIBCPP_VISIBLE duration;
template <class _Tp> template <class _Tp>
struct __is_duration : false_type {}; struct __is_duration : false_type {};
@@ -299,7 +282,7 @@ struct __is_duration<const volatile duration<_Rep, _Period> > : true_type {};
} // chrono } // chrono
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
struct _LIBCPP_TYPE_VIS common_type<chrono::duration<_Rep1, _Period1>, struct _LIBCPP_VISIBLE common_type<chrono::duration<_Rep1, _Period1>,
chrono::duration<_Rep2, _Period2> > chrono::duration<_Rep2, _Period2> >
{ {
typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type, typedef chrono::duration<typename common_type<_Rep1, _Rep2>::type,
@@ -319,7 +302,7 @@ struct __duration_cast;
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count())); return _ToDuration(static_cast<typename _ToDuration::rep>(__fd.count()));
@@ -329,7 +312,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, true>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -341,7 +324,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, true, false>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -353,7 +336,7 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, true>
template <class _FromDuration, class _ToDuration, class _Period> template <class _FromDuration, class _ToDuration, class _Period>
struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false> struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
_ToDuration operator()(const _FromDuration& __fd) const _ToDuration operator()(const _FromDuration& __fd) const
{ {
typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct; typedef typename common_type<typename _ToDuration::rep, typename _FromDuration::rep, intmax_t>::type _Ct;
@@ -365,7 +348,6 @@ struct __duration_cast<_FromDuration, _ToDuration, _Period, false, false>
template <class _ToDuration, class _Rep, class _Period> template <class _ToDuration, class _Rep, class _Period>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
__is_duration<_ToDuration>::value, __is_duration<_ToDuration>::value,
@@ -377,21 +359,21 @@ duration_cast(const duration<_Rep, _Period>& __fd)
} }
template <class _Rep> template <class _Rep>
struct _LIBCPP_TYPE_VIS treat_as_floating_point : is_floating_point<_Rep> {}; struct _LIBCPP_VISIBLE treat_as_floating_point : is_floating_point<_Rep> {};
template <class _Rep> template <class _Rep>
struct _LIBCPP_TYPE_VIS duration_values struct _LIBCPP_VISIBLE duration_values
{ {
public: public:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep zero() {return _Rep(0);} _LIBCPP_INLINE_VISIBILITY static _Rep zero() {return _Rep(0);}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep max() {return numeric_limits<_Rep>::max();} _LIBCPP_INLINE_VISIBILITY static _Rep max() {return numeric_limits<_Rep>::max();}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR _Rep min() {return numeric_limits<_Rep>::lowest();} _LIBCPP_INLINE_VISIBILITY static _Rep min() {return numeric_limits<_Rep>::lowest();}
}; };
// duration // duration
template <class _Rep, class _Period> template <class _Rep, class _Period>
class _LIBCPP_TYPE_VIS duration class _LIBCPP_VISIBLE duration
{ {
static_assert(!__is_duration<_Rep>::value, "A duration representation can not be a 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(__is_ratio<_Period>::value, "Second template parameter of duration must be a std::ratio");
@@ -403,9 +385,9 @@ private:
rep __rep_; rep __rep_;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration() {} // = default; _LIBCPP_INLINE_VISIBILITY duration() {} // = default;
template <class _Rep2> template <class _Rep2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
explicit duration(const _Rep2& __r, explicit duration(const _Rep2& __r,
typename enable_if typename enable_if
< <
@@ -417,7 +399,7 @@ public:
// conversions // conversions
template <class _Rep2, class _Period2> template <class _Rep2, class _Period2>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
duration(const duration<_Rep2, _Period2>& __d, duration(const duration<_Rep2, _Period2>& __d,
typename enable_if typename enable_if
< <
@@ -429,12 +411,12 @@ public:
// observer // observer
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR rep count() const {return __rep_;} _LIBCPP_INLINE_VISIBILITY rep count() const {return __rep_;}
// arithmetic // arithmetic
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator+() const {return *this;} _LIBCPP_INLINE_VISIBILITY duration operator+() const {return *this;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR duration operator-() const {return duration(-__rep_);} _LIBCPP_INLINE_VISIBILITY duration operator-() const {return duration(-__rep_);}
_LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator++() {++__rep_; return *this;}
_LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);} _LIBCPP_INLINE_VISIBILITY duration operator++(int) {return duration(__rep_++);}
_LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;} _LIBCPP_INLINE_VISIBILITY duration& operator--() {--__rep_; return *this;}
@@ -450,9 +432,9 @@ public:
// special values // special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration zero() {return duration(duration_values<rep>::zero());} _LIBCPP_INLINE_VISIBILITY static duration zero() {return duration(duration_values<rep>::zero());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration min() {return duration(duration_values<rep>::min());} _LIBCPP_INLINE_VISIBILITY static duration min() {return duration(duration_values<rep>::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR duration max() {return duration(duration_values<rep>::max());} _LIBCPP_INLINE_VISIBILITY static duration max() {return duration(duration_values<rep>::max());}
}; };
typedef duration<long long, nano> nanoseconds; typedef duration<long long, nano> nanoseconds;
@@ -467,7 +449,7 @@ typedef duration< long, ratio<3600> > hours;
template <class _LhsDuration, class _RhsDuration> template <class _LhsDuration, class _RhsDuration>
struct __duration_eq struct __duration_eq
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -478,14 +460,13 @@ struct __duration_eq
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_eq<_LhsDuration, _LhsDuration> struct __duration_eq<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() == __rhs.count();} {return __lhs.count() == __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -496,7 +477,6 @@ operator==(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -508,7 +488,7 @@ operator!=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _LhsDuration, class _RhsDuration> template <class _LhsDuration, class _RhsDuration>
struct __duration_lt struct __duration_lt
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _RhsDuration& __rhs)
{ {
typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct; typedef typename common_type<_LhsDuration, _RhsDuration>::type _Ct;
@@ -519,14 +499,13 @@ struct __duration_lt
template <class _LhsDuration> template <class _LhsDuration>
struct __duration_lt<_LhsDuration, _LhsDuration> struct __duration_lt<_LhsDuration, _LhsDuration>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR _LIBCPP_INLINE_VISIBILITY
bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs) bool operator()(const _LhsDuration& __lhs, const _LhsDuration& __rhs)
{return __lhs.count() < __rhs.count();} {return __lhs.count() < __rhs.count();}
}; };
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -537,7 +516,6 @@ operator< (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -548,7 +526,6 @@ operator> (const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -559,7 +536,6 @@ operator<=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
bool bool
operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -570,31 +546,30 @@ operator>=(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator+(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
return _Cd(_Cd(__lhs).count() + _Cd(__rhs).count()); __r += __rhs;
return __r;
} }
// Duration - // Duration -
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator-(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
return _Cd(_Cd(__lhs).count() - _Cd(__rhs).count()); __r -= __rhs;
return __r;
} }
// Duration * // Duration *
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value, is_convertible<_Rep2, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -603,13 +578,13 @@ typename enable_if
operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator*(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() * static_cast<_Cr>(__s)); __r *= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename enable_if typename enable_if
< <
is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value, is_convertible<_Rep1, typename common_type<_Rep1, _Rep2>::type>::value,
@@ -648,18 +623,17 @@ struct __duration_divide_result<duration<_Rep1, _Period>, _Rep2, false>
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator/(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() / static_cast<_Cr>(__s)); __r /= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<_Rep1, _Rep2>::type typename common_type<_Rep1, _Rep2>::type
operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
@@ -671,24 +645,23 @@ operator/(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
template <class _Rep1, class _Period, class _Rep2> template <class _Rep1, class _Period, class _Rep2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type typename __duration_divide_result<duration<_Rep1, _Period>, _Rep2>::type
operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s) operator%(const duration<_Rep1, _Period>& __d, const _Rep2& __s)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typedef typename common_type<_Rep1, _Rep2>::type _Cr;
typedef duration<_Cr, _Period> _Cd; duration<_Cr, _Period> __r = __d;
return _Cd(_Cd(__d).count() % static_cast<_Cr>(__s)); __r %= static_cast<_Cr>(__s);
return __r;
} }
template <class _Rep1, class _Period1, class _Rep2, class _Period2> template <class _Rep1, class _Period1, class _Rep2, class _Period2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type
operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs) operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2>& __rhs)
{ {
typedef typename common_type<_Rep1, _Rep2>::type _Cr; typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type __r = __lhs;
typedef typename common_type<duration<_Rep1, _Period1>, duration<_Rep2, _Period2> >::type _Cd; __r %= __rhs;
return _Cd(static_cast<_Cr>(_Cd(__lhs).count()) % static_cast<_Cr>(_Cd(__rhs).count())); return __r;
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
@@ -696,7 +669,7 @@ operator%(const duration<_Rep1, _Period1>& __lhs, const duration<_Rep2, _Period2
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
template <class _Clock, class _Duration = typename _Clock::duration> template <class _Clock, class _Duration = typename _Clock::duration>
class _LIBCPP_TYPE_VIS time_point class _LIBCPP_VISIBLE time_point
{ {
static_assert(__is_duration<_Duration>::value, static_assert(__is_duration<_Duration>::value,
"Second template parameter of time_point must be a std::chrono::duration"); "Second template parameter of time_point must be a std::chrono::duration");
@@ -728,19 +701,19 @@ public:
// arithmetic // arithmetic
_LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d; return *this;} _LIBCPP_INLINE_VISIBILITY time_point& operator+=(const duration& __d) {__d_ += __d;}
_LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d; return *this;} _LIBCPP_INLINE_VISIBILITY time_point& operator-=(const duration& __d) {__d_ -= __d;}
// special values // special values
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point min() {return time_point(duration::min());} _LIBCPP_INLINE_VISIBILITY static time_point min() {return time_point(duration::min());}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR time_point max() {return time_point(duration::max());} _LIBCPP_INLINE_VISIBILITY static time_point max() {return time_point(duration::max());}
}; };
} // chrono } // chrono
template <class _Clock, class _Duration1, class _Duration2> template <class _Clock, class _Duration1, class _Duration2>
struct _LIBCPP_TYPE_VIS common_type<chrono::time_point<_Clock, _Duration1>, struct _LIBCPP_VISIBLE common_type<chrono::time_point<_Clock, _Duration1>,
chrono::time_point<_Clock, _Duration2> > chrono::time_point<_Clock, _Duration2> >
{ {
typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type; typedef chrono::time_point<_Clock, typename common_type<_Duration1, _Duration2>::type> type;
@@ -863,7 +836,7 @@ operator-(const time_point<_Clock, _Duration1>& __lhs, const time_point<_Clock,
/////////////////////// clocks /////////////////////////// /////////////////////// clocks ///////////////////////////
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
class _LIBCPP_TYPE_VIS system_clock class _LIBCPP_VISIBLE system_clock
{ {
public: public:
typedef microseconds duration; typedef microseconds duration;
@@ -877,7 +850,7 @@ public:
static time_point from_time_t(time_t __t) _NOEXCEPT; static time_point from_time_t(time_t __t) _NOEXCEPT;
}; };
class _LIBCPP_TYPE_VIS steady_clock class _LIBCPP_VISIBLE steady_clock
{ {
public: public:
typedef nanoseconds duration; typedef nanoseconds duration;

View File

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

View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@@ -55,9 +55,7 @@ class codecvt_utf8_utf16
#include <__config> #include <__config>
#include <__locale> #include <__locale>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -179,7 +177,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff, template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0> codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS codecvt_utf8 class _LIBCPP_VISIBLE codecvt_utf8
: public __codecvt_utf8<_Elem> : public __codecvt_utf8<_Elem>
{ {
public: public:
@@ -407,7 +405,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff, template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0> codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS codecvt_utf16 class _LIBCPP_VISIBLE codecvt_utf16
: public __codecvt_utf16<_Elem, _Mode & little_endian> : public __codecvt_utf16<_Elem, _Mode & little_endian>
{ {
public: public:
@@ -530,7 +528,7 @@ protected:
template <class _Elem, unsigned long _Maxcode = 0x10ffff, template <class _Elem, unsigned long _Maxcode = 0x10ffff,
codecvt_mode _Mode = (codecvt_mode)0> codecvt_mode _Mode = (codecvt_mode)0>
class _LIBCPP_TYPE_VIS codecvt_utf8_utf16 class _LIBCPP_VISIBLE codecvt_utf8_utf16
: public __codecvt_utf8_utf16<_Elem> : public __codecvt_utf8_utf16<_Elem>
{ {
public: public:

View File

@@ -249,19 +249,17 @@ template<class T, class charT, class traits>
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template<class _Tp> class _LIBCPP_TYPE_VIS complex; template<class _Tp> class _LIBCPP_VISIBLE complex;
template<class _Tp> complex<_Tp> operator*(const complex<_Tp>& __z, const complex<_Tp>& __w); 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> complex<_Tp> operator/(const complex<_Tp>& __x, const complex<_Tp>& __y);
template<class _Tp> template<class _Tp>
class _LIBCPP_TYPE_VIS complex class _LIBCPP_VISIBLE complex
{ {
public: public:
typedef _Tp value_type; typedef _Tp value_type;
@@ -282,8 +280,7 @@ public:
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (const value_type& __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(const value_type& __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(const value_type& __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(const value_type& __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -319,30 +316,29 @@ public:
} }
}; };
template<> class _LIBCPP_TYPE_VIS complex<double>; template<> class _LIBCPP_VISIBLE complex<double>;
template<> class _LIBCPP_TYPE_VIS complex<long double>; template<> class _LIBCPP_VISIBLE complex<long double>;
template<> template<>
class _LIBCPP_TYPE_VIS complex<float> class _LIBCPP_VISIBLE complex<float>
{ {
float __re_; float __re_;
float __im_; float __im_;
public: public:
typedef float value_type; typedef float value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(float __re = 0.0f, float __im = 0.0f) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(float __re = 0.0f, float __im = 0.0f)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
explicit _LIBCPP_CONSTEXPR complex(const complex<double>& __c); explicit /*constexpr*/ complex(const complex<double>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR float imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY float imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (float __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(float __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(float __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(float __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -379,26 +375,25 @@ public:
}; };
template<> template<>
class _LIBCPP_TYPE_VIS complex<double> class _LIBCPP_VISIBLE complex<double>
{ {
double __re_; double __re_;
double __im_; double __im_;
public: public:
typedef double value_type; typedef double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(double __re = 0.0, double __im = 0.0) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(double __re = 0.0, double __im = 0.0)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c); /*constexpr*/ complex(const complex<float>& __c);
explicit _LIBCPP_CONSTEXPR complex(const complex<long double>& __c); explicit /*constexpr*/ complex(const complex<long double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR double imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (double __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -435,26 +430,25 @@ public:
}; };
template<> template<>
class _LIBCPP_TYPE_VIS complex<long double> class _LIBCPP_VISIBLE complex<long double>
{ {
long double __re_; long double __re_;
long double __im_; long double __im_;
public: public:
typedef long double value_type; typedef long double value_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR complex(long double __re = 0.0L, long double __im = 0.0L) /*constexpr*/ _LIBCPP_INLINE_VISIBILITY complex(long double __re = 0.0L, long double __im = 0.0L)
: __re_(__re), __im_(__im) {} : __re_(__re), __im_(__im) {}
_LIBCPP_CONSTEXPR complex(const complex<float>& __c); /*constexpr*/ complex(const complex<float>& __c);
_LIBCPP_CONSTEXPR complex(const complex<double>& __c); /*constexpr*/ complex(const complex<double>& __c);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double real() const {return __re_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double real() const {return __re_;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR long double imag() const {return __im_;} /*constexpr*/ _LIBCPP_INLINE_VISIBILITY long double imag() const {return __im_;}
_LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;} _LIBCPP_INLINE_VISIBILITY void real(value_type __re) {__re_ = __re;}
_LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;} _LIBCPP_INLINE_VISIBILITY void imag(value_type __im) {__im_ = __im;}
_LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) _LIBCPP_INLINE_VISIBILITY complex& operator= (long double __re) {__re_ = __re; return *this;}
{__re_ = __re; __im_ = value_type(); return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator+=(long double __re) {__re_ += __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator-=(long double __re) {__re_ -= __re; return *this;}
_LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;} _LIBCPP_INLINE_VISIBILITY complex& operator*=(long double __re) {__re_ *= __re; __im_ *= __re; return *this;}
@@ -490,33 +484,33 @@ public:
} }
}; };
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<double>& __c) complex<float>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<float>::complex(const complex<long double>& __c) complex<float>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<float>& __c) complex<double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<double>::complex(const complex<long double>& __c) complex<double>::complex(const complex<long double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<float>& __c) complex<long double>::complex(const complex<float>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
//constexpr
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR
complex<long double>::complex(const complex<double>& __c) complex<long double>::complex(const complex<double>& __c)
: __re_(__c.real()), __im_(__c.imag()) {} : __re_(__c.real()), __im_(__c.imag()) {}
@@ -1249,12 +1243,10 @@ acosh(const complex<_Tp>& __x)
if (isnan(__x.imag())) if (isnan(__x.imag()))
return complex<_Tp>(abs(__x.real()), __x.imag()); return complex<_Tp>(abs(__x.real()), __x.imag());
if (isinf(__x.imag())) if (isinf(__x.imag()))
{
if (__x.real() > 0) if (__x.real() > 0)
return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag())); return complex<_Tp>(__x.real(), copysign(__pi * _Tp(0.25), __x.imag()));
else else
return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi * _Tp(0.75), __x.imag()));
}
if (__x.real() < 0) if (__x.real() < 0)
return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag())); return complex<_Tp>(-__x.real(), copysign(__pi, __x.imag()));
return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag())); return complex<_Tp>(__x.real(), copysign(_Tp(0), __x.imag()));
@@ -1353,11 +1345,7 @@ tanh(const complex<_Tp>& __x)
_Tp __2r(_Tp(2) * __x.real()); _Tp __2r(_Tp(2) * __x.real());
_Tp __2i(_Tp(2) * __x.imag()); _Tp __2i(_Tp(2) * __x.imag());
_Tp __d(cosh(__2r) + cos(__2i)); _Tp __d(cosh(__2r) + cos(__2i));
_Tp __2rsh(sinh(__2r)); return complex<_Tp>(sinh(__2r)/__d, sin(__2i)/__d);
if (isinf(__2rsh) && isinf(__d))
return complex<_Tp>(__2rsh > _Tp(0) ? _Tp(1) : _Tp(-1),
__2i > _Tp(0) ? _Tp(0) : _Tp(-0.));
return complex<_Tp>(__2rsh/__d, sin(__2i)/__d);
} }
// asin // asin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -43,9 +43,7 @@ Types:
#include <stddef.h> #include <stddef.h>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -56,34 +54,33 @@ typedef long double max_align_t;
#ifdef _LIBCPP_HAS_NO_NULLPTR #ifdef _LIBCPP_HAS_NO_NULLPTR
struct _LIBCPP_TYPE_VIS nullptr_t struct _LIBCPP_VISIBLE nullptr_t
{ {
void* __lx; void* _;
struct __nat {int __for_bool_;}; struct __nat {int __for_bool_;};
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t() : __lx(0) {} _LIBCPP_ALWAYS_INLINE nullptr_t(int __nat::*) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t(int __nat::*) : __lx(0) {}
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR operator int __nat::*() const {return 0;} _LIBCPP_ALWAYS_INLINE operator int __nat::*() const {return 0;}
template <class _Tp> template <class _Tp>
_LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR _LIBCPP_ALWAYS_INLINE
operator _Tp* () const {return 0;} operator _Tp* () const {return 0;}
template <class _Tp, class _Up> template <class _Tp, class _Up>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
operator _Tp _Up::* () const {return 0;} operator _Tp _Up::* () const {return 0;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator==(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator==(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator!=(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator!=(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator<(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator<=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator<=(nullptr_t, nullptr_t) {return true;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>(nullptr_t, nullptr_t) {return false;} friend _LIBCPP_ALWAYS_INLINE bool operator>(nullptr_t, nullptr_t) {return false;}
friend _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR bool operator>=(nullptr_t, nullptr_t) {return true;} friend _LIBCPP_ALWAYS_INLINE bool operator>=(nullptr_t, nullptr_t) {return true;}
}; };
inline _LIBCPP_ALWAYS_INLINE _LIBCPP_CONSTEXPR nullptr_t __get_nullptr_t() {return nullptr_t(0);} inline _LIBCPP_ALWAYS_INLINE nullptr_t __get_nullptr_t() {return nullptr_t(0);}
#define nullptr _VSTD::__get_nullptr_t() #define nullptr _VSTD::__get_nullptr_t()

View File

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

View File

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

View File

@@ -74,9 +74,6 @@ int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n);
int wctomb(char* s, wchar_t wchar); int wctomb(char* s, wchar_t wchar);
size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n);
size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n);
int at_quick_exit(void (*func)(void)) // C++11
void quick_exit(int status); // C++11
void *aligned_alloc(size_t alignment, size_t size); // C11
} // std } // std
@@ -84,39 +81,26 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
#include <__config> #include <__config>
#include <stdlib.h> #include <stdlib.h>
#ifdef _MSC_VER
#include "support/win32/locale_win32.h"
#endif // _MSC_VER
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
using ::size_t; using ::size_t;
using ::div_t; using ::div_t;
using ::ldiv_t; using ::ldiv_t;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv_t; using ::lldiv_t;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::atof; using ::atof;
using ::atoi; using ::atoi;
using ::atol; using ::atol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::atoll; using ::atoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtod; using ::strtod;
using ::strtof; using ::strtof;
using ::strtold; using ::strtold;
using ::strtol; using ::strtol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoll; using ::strtoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::strtoul; using ::strtoul;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::strtoull; using ::strtoull;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::rand; using ::rand;
using ::srand; using ::srand;
using ::calloc; using ::calloc;
@@ -133,39 +117,21 @@ using ::bsearch;
using ::qsort; using ::qsort;
using ::abs; using ::abs;
using ::labs; using ::labs;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::llabs; using ::llabs;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::div; using ::div;
using ::ldiv; using ::ldiv;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::lldiv; using ::lldiv;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::mblen; using ::mblen;
using ::mbtowc; using ::mbtowc;
using ::wctomb; using ::wctomb;
using ::mbstowcs; using ::mbstowcs;
using ::wcstombs; using ::wcstombs;
#ifdef _LIBCPP_HAS_QUICK_EXIT
using ::at_quick_exit;
using ::quick_exit;
#endif
#ifdef _LIBCPP_HAS_C11_FEATURES
using ::aligned_alloc;
#endif
// MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);}
#if !defined(_MSC_VER) && !defined(__sun__) inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) _NOEXCEPT {return labs(__x);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) _NOEXCEPT {return llabs(__x);}
#endif // _LIBCPP_HAS_NO_LONG_LONG
inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) _NOEXCEPT {return ldiv(__x, __y);} inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);}
#ifndef _LIBCPP_HAS_NO_LONG_LONG inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
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 // _MSC_VER
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

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

View File

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

View File

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

View File

@@ -106,13 +106,11 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
#include <__config> #include <__config>
#include <cwctype> #include <cwctype>
#include <wchar.h> #include <wchar.h>
#ifdef _WIN32 #if _WIN32
#include <support/win32/support.h> // pull in *swprintf defines #include <support/win32/support.h> // pull in *swprintf defines
#endif // _WIN32 #endif // _WIN32
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -124,15 +122,13 @@ using ::FILE;
using ::fwprintf; using ::fwprintf;
using ::fwscanf; using ::fwscanf;
using ::swprintf; using ::swprintf;
using ::vfwprintf;
using ::vswprintf;
using ::vwprintf;
#ifndef _MSC_VER
using ::swscanf; using ::swscanf;
using ::vfwprintf;
using ::vfwscanf; using ::vfwscanf;
using ::vswprintf;
using ::vswscanf; using ::vswscanf;
using ::vwprintf;
using ::vwscanf; using ::vwscanf;
#endif // _MSC_VER
using ::wprintf; using ::wprintf;
using ::wscanf; using ::wscanf;
using ::fgetwc; using ::fgetwc;
@@ -146,18 +142,12 @@ using ::putwc;
using ::putwchar; using ::putwchar;
using ::ungetwc; using ::ungetwc;
using ::wcstod; using ::wcstod;
#ifndef _MSC_VER
using ::wcstof; using ::wcstof;
using ::wcstold; using ::wcstold;
#endif // _MSC_VER
using ::wcstol; using ::wcstol;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoll; using ::wcstoll;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoul; using ::wcstoul;
#ifndef _LIBCPP_HAS_NO_LONG_LONG
using ::wcstoull; using ::wcstoull;
#endif // _LIBCPP_HAS_NO_LONG_LONG
using ::wcscpy; using ::wcscpy;
using ::wcsncpy; using ::wcsncpy;
using ::wcscat; using ::wcscat;
@@ -167,37 +157,28 @@ using ::wcscoll;
using ::wcsncmp; using ::wcsncmp;
using ::wcsxfrm; using ::wcsxfrm;
#if defined(_WCHAR_H_CPLUSPLUS_98_CONFORMANCE_)
using ::wcschr;
using ::wcspbrk;
using ::wcsrchr;
using ::wcsstr;
using ::wmemchr;
#else
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcschr(const wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcschr( wchar_t* __s, wchar_t __c) {return ::wcschr(__s, __c);}
using ::wcscspn;
using ::wcslen;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcspbrk(const wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcspbrk( wchar_t* __s1, const wchar_t* __s2) {return ::wcspbrk(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);} inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsrchr( wchar_t* __s, wchar_t __c) {return ::wcsrchr(__s, __c);}
using ::wcsspn;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsstr(const wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);} inline _LIBCPP_INLINE_VISIBILITY wchar_t* wcsstr( wchar_t* __s1, const wchar_t* __s2) {return ::wcsstr(__s1, __s2);}
using ::wcstok;
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wmemchr(const wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);} inline _LIBCPP_INLINE_VISIBILITY wchar_t* wmemchr( wchar_t* __s, wchar_t __c, size_t __n) {return ::wmemchr(__s, __c, __n);}
#endif
using ::wcscspn;
using ::wcslen;
using ::wcsspn;
using ::wcstok;
using ::wmemcmp; using ::wmemcmp;
using ::wmemcpy; using ::wmemcpy;
using ::wmemmove; using ::wmemmove;

View File

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

View File

@@ -150,9 +150,7 @@ template <class T, class Allocator>
*/ */
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
#include <__config> #include <__config>
#include <__split_buffer> #include <__split_buffer>
@@ -162,15 +160,13 @@ template <class T, class Allocator>
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <__undef_min_max>
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base; template <class _Tp, class _Allocator> class __deque_base;
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize> class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS __deque_iterator; class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter, template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -262,7 +258,7 @@ move_backward(__deque_iterator<_V1, _P1, _R1, _M1, _D1, _B1> __f,
template <class _ValueType, class _Pointer, class _Reference, class _MapPointer, template <class _ValueType, class _Pointer, class _Reference, class _MapPointer,
class _DiffType, _DiffType _BlockSize> class _DiffType, _DiffType _BlockSize>
class _LIBCPP_TYPE_VIS __deque_iterator class _LIBCPP_VISIBLE __deque_iterator
{ {
typedef _MapPointer __map_iterator; typedef _MapPointer __map_iterator;
public: public:
@@ -280,10 +276,10 @@ public:
_LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {} _LIBCPP_INLINE_VISIBILITY __deque_iterator() _NOEXCEPT {}
template <class _Pp, class _Rp, class _MP> template <class _P, class _R, class _MP>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__deque_iterator(const __deque_iterator<value_type, _Pp, _Rp, _MP, difference_type, __block_size>& __it, __deque_iterator(const __deque_iterator<value_type, _P, _R, _MP, difference_type, __block_size>& __it,
typename enable_if<is_convertible<_Pp, pointer>::value>::type* = 0) _NOEXCEPT typename enable_if<is_convertible<_P, pointer>::value>::type* = 0) _NOEXCEPT
: __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {} : __m_iter_(__it.__m_iter_), __ptr_(__it.__ptr_) {}
_LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;} _LIBCPP_INLINE_VISIBILITY reference operator*() const {return *__ptr_;}
@@ -409,10 +405,10 @@ private:
_LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY __deque_iterator(__map_iterator __m, pointer __p) _NOEXCEPT
: __m_iter_(__m), __ptr_(__p) {} : __m_iter_(__m), __ptr_(__p) {}
template <class _Tp, class _Ap> friend class __deque_base; template <class _Tp, class _A> friend class __deque_base;
template <class _Tp, class _Ap> friend class _LIBCPP_TYPE_VIS deque; template <class _Tp, class _A> friend class _LIBCPP_VISIBLE deque;
template <class _Vp, class _Pp, class _Rp, class _MP, class _Dp, _Dp> template <class _V, class _P, class _R, class _MP, class _D, _D>
friend class _LIBCPP_TYPE_VIS __deque_iterator; friend class _LIBCPP_VISIBLE __deque_iterator;
template <class _RAIter, template <class _RAIter,
class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2> class _V2, class _P2, class _R2, class _M2, class _D2, _D2 _B2>
@@ -988,7 +984,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(__deque_base&, false_type) _NOEXCEPT void __move_assign_alloc(__deque_base& __c, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -1007,7 +1003,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type&, allocator_type&, false_type) static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
}; };
@@ -1167,7 +1163,7 @@ __deque_base<_Tp, _Allocator>::clear() _NOEXCEPT
} }
template <class _Tp, class _Allocator = allocator<_Tp> > template <class _Tp, class _Allocator = allocator<_Tp> >
class _LIBCPP_TYPE_VIS deque class _LIBCPP_VISIBLE deque
: private __deque_base<_Tp, _Allocator> : private __deque_base<_Tp, _Allocator>
{ {
public: public:
@@ -1403,7 +1399,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const deque&, false_type) void __copy_assign_alloc(const deque& __c, false_type)
{} {}
void __move_assign(deque& __c, true_type) void __move_assign(deque& __c, true_type)
@@ -1510,8 +1506,8 @@ deque<_Tp, _Allocator>::deque(deque&& __c, const allocator_type& __a)
{ {
if (__a != __c.__alloc()) if (__a != __c.__alloc())
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__c.begin()), _Ip(__c.end())); assign(_I(__c.begin()), _I(__c.end()));
} }
} }
@@ -1533,8 +1529,8 @@ deque<_Tp, _Allocator>::__move_assign(deque& __c, false_type)
{ {
if (__base::__alloc() != __c.__alloc()) if (__base::__alloc() != __c.__alloc())
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__c.begin()), _Ip(__c.end())); assign(_I(__c.begin()), _I(__c.end()));
} }
else else
__move_assign(__c, true_type()); __move_assign(__c, true_type());
@@ -1966,7 +1962,6 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
} }
else else
{ {
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __b = __base::begin(); iterator __b = __base::begin();
iterator __bm1 = _VSTD::prev(__b); iterator __bm1 = _VSTD::prev(__b);
__alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b)); __alloc_traits::construct(__a, _VSTD::addressof(*__bm1), _VSTD::move(*__b));
@@ -1974,7 +1969,7 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
++__base::size(); ++__base::size();
if (__pos > 1) if (__pos > 1)
__b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b); __b = _VSTD::move(_VSTD::next(__b), __b + __pos, __b);
*__b = _VSTD::move(__tmp); *__b = value_type(_VSTD::forward<_Args>(__args)...);
} }
} }
else else
@@ -1990,14 +1985,13 @@ deque<_Tp, _Allocator>::emplace(const_iterator __p, _Args&&... __args)
} }
else else
{ {
value_type __tmp(_VSTD::forward<_Args>(__args)...);
iterator __e = __base::end(); iterator __e = __base::end();
iterator __em1 = _VSTD::prev(__e); iterator __em1 = _VSTD::prev(__e);
__alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1)); __alloc_traits::construct(__a, _VSTD::addressof(*__e), _VSTD::move(*__em1));
++__base::size(); ++__base::size();
if (__de > 1) if (__de > 1)
__e = _VSTD::move_backward(__e - __de, __em1, __e); __e = _VSTD::move_backward(__e - __de, __em1, __e);
*--__e = _VSTD::move(__tmp); *--__e = value_type(_VSTD::forward<_Args>(__args)...);
} }
} }
return __base::begin() + __pos; return __base::begin() + __pos;

View File

@@ -80,9 +80,7 @@ template <class E> void rethrow_if_nested(const E& e);
#include <cstddef> #include <cstddef>
#include <type_traits> #include <type_traits>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -105,23 +103,23 @@ public:
}; };
typedef void (*unexpected_handler)(); typedef void (*unexpected_handler)();
_LIBCPP_FUNC_VIS unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT; _LIBCPP_VISIBLE unexpected_handler set_unexpected(unexpected_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS unexpected_handler get_unexpected() _NOEXCEPT; _LIBCPP_VISIBLE unexpected_handler get_unexpected() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void unexpected(); _ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void unexpected();
typedef void (*terminate_handler)(); typedef void (*terminate_handler)();
_LIBCPP_FUNC_VIS terminate_handler set_terminate(terminate_handler) _NOEXCEPT; _LIBCPP_VISIBLE terminate_handler set_terminate(terminate_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS terminate_handler get_terminate() _NOEXCEPT; _LIBCPP_VISIBLE terminate_handler get_terminate() _NOEXCEPT;
_LIBCPP_NORETURN _LIBCPP_FUNC_VIS void terminate() _NOEXCEPT; _ATTRIBUTE(noreturn) _LIBCPP_VISIBLE void terminate() _NOEXCEPT;
_LIBCPP_FUNC_VIS bool uncaught_exception() _NOEXCEPT; _LIBCPP_VISIBLE bool uncaught_exception() _NOEXCEPT;
class _LIBCPP_TYPE_VIS exception_ptr; class exception_ptr;
exception_ptr current_exception() _NOEXCEPT; exception_ptr current_exception() _NOEXCEPT;
_LIBCPP_NORETURN void rethrow_exception(exception_ptr); _ATTRIBUTE(noreturn) void rethrow_exception(exception_ptr);
class _LIBCPP_TYPE_VIS exception_ptr class _LIBCPP_VISIBLE exception_ptr
{ {
void* __ptr_; void* __ptr_;
public: public:
@@ -132,7 +130,7 @@ public:
~exception_ptr() _NOEXCEPT; ~exception_ptr() _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT // explicit
operator bool() const _NOEXCEPT {return __ptr_ != nullptr;} operator bool() const _NOEXCEPT {return __ptr_ != nullptr;}
friend _LIBCPP_INLINE_VISIBILITY friend _LIBCPP_INLINE_VISIBILITY
@@ -143,12 +141,12 @@ public:
{return !(__x == __y);} {return !(__x == __y);}
friend exception_ptr current_exception() _NOEXCEPT; friend exception_ptr current_exception() _NOEXCEPT;
friend void rethrow_exception(exception_ptr); _ATTRIBUTE(noreturn) friend void rethrow_exception(exception_ptr);
}; };
template<class _Ep> template<class _E>
exception_ptr exception_ptr
make_exception_ptr(_Ep __e) _NOEXCEPT make_exception_ptr(_E __e) _NOEXCEPT
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
try try
@@ -174,7 +172,7 @@ public:
virtual ~nested_exception() _NOEXCEPT; virtual ~nested_exception() _NOEXCEPT;
// access functions // access functions
_LIBCPP_NORETURN void rethrow_nested() const; _ATTRIBUTE(noreturn) void rethrow_nested() const;
_LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;} _LIBCPP_INLINE_VISIBILITY exception_ptr nested_ptr() const _NOEXCEPT {return __ptr_;}
}; };
@@ -187,7 +185,7 @@ struct __nested
}; };
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN _ATTRIBUTE(noreturn)
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if< throw_with_nested(_Tp&& __t, typename enable_if<
@@ -206,7 +204,7 @@ throw_with_nested (_Tp& __t, typename enable_if<
} }
template <class _Tp> template <class _Tp>
_LIBCPP_NORETURN _ATTRIBUTE(noreturn)
void void
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
throw_with_nested(_Tp&& __t, typename enable_if< throw_with_nested(_Tp&& __t, typename enable_if<
@@ -224,11 +222,11 @@ throw_with_nested (_Tp& __t, typename enable_if<
#endif #endif
} }
template <class _Ep> template <class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep& __e, typename enable_if< rethrow_if_nested(const _E& __e, typename enable_if<
is_polymorphic<_Ep>::value is_polymorphic<_E>::value
>::type* = 0) >::type* = 0)
{ {
const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e); const nested_exception* __nep = dynamic_cast<const nested_exception*>(&__e);
@@ -236,11 +234,11 @@ rethrow_if_nested(const _Ep& __e, typename enable_if<
__nep->rethrow_nested(); __nep->rethrow_nested();
} }
template <class _Ep> template <class _E>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
void void
rethrow_if_nested(const _Ep&, typename enable_if< rethrow_if_nested(const _E& __e, typename enable_if<
!is_polymorphic<_Ep>::value !is_polymorphic<_E>::value
>::type* = 0) >::type* = 0)
{ {
} }

View File

@@ -19,10 +19,10 @@
namespace __gnu_cxx { namespace __gnu_cxx {
using namespace std; using namespace std;
template <typename T> struct _LIBCPP_TYPE_VIS hash : public std::hash<T> template <typename T> struct _LIBCPP_VISIBLE hash : public std::hash<T>
{ }; { };
template <> struct _LIBCPP_TYPE_VIS hash<const char*> template <> struct _LIBCPP_VISIBLE hash<const char*>
: public unary_function<const char*, size_t> : public unary_function<const char*, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -32,7 +32,7 @@ template <> struct _LIBCPP_TYPE_VIS hash<const char*>
} }
}; };
template <> struct _LIBCPP_TYPE_VIS hash<char *> template <> struct _LIBCPP_VISIBLE hash<char *>
: public unary_function<char*, size_t> : public unary_function<char*, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -43,4 +43,4 @@ template <> struct _LIBCPP_TYPE_VIS hash<char *>
}; };
} }
#endif // _LIBCPP_EXT_HASH #endif _LIBCPP_EXT_HASH

View File

@@ -215,11 +215,7 @@ namespace __gnu_cxx {
using namespace std; using namespace std;
template <class _Tp, class _Hash, bool = is_empty<_Hash>::value template <class _Tp, class _Hash, bool = is_empty<_Hash>::value>
#if __has_feature(is_final)
&& !__is_final(_Hash)
#endif
>
class __hash_map_hasher class __hash_map_hasher
: private _Hash : private _Hash
{ {
@@ -251,11 +247,7 @@ public:
{return __hash_(__x);} {return __hash_(__x);}
}; };
template <class _Tp, class _Pred, bool = is_empty<_Pred>::value template <class _Tp, class _Pred, bool = is_empty<_Pred>::value>
#if __has_feature(is_final)
&& !__is_final(_Pred)
#endif
>
class __hash_map_equal class __hash_map_equal
: private _Pred : private _Pred
{ {
@@ -361,7 +353,7 @@ public:
}; };
template <class _HashIterator> template <class _HashIterator>
class _LIBCPP_TYPE_VIS __hash_map_iterator class _LIBCPP_VISIBLE __hash_map_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
@@ -404,15 +396,15 @@ public:
bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y) bool operator!=(const __hash_map_iterator& __x, const __hash_map_iterator& __y)
{return __x.__i_ != __y.__i_;} {return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_map_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_map_const_iterator;
}; };
template <class _HashIterator> template <class _HashIterator>
class _LIBCPP_TYPE_VIS __hash_map_const_iterator class _LIBCPP_VISIBLE __hash_map_const_iterator
{ {
_HashIterator __i_; _HashIterator __i_;
@@ -463,15 +455,15 @@ public:
bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y) bool operator!=(const __hash_map_const_iterator& __x, const __hash_map_const_iterator& __y)
{return __x.__i_ != __y.__i_;} {return __x.__i_ != __y.__i_;}
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_map; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_map;
template <class, class, class, class, class> friend class _LIBCPP_TYPE_VIS hash_multimap; template <class, class, class, class, class> friend class _LIBCPP_VISIBLE hash_multimap;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_iterator;
template <class> friend class _LIBCPP_TYPE_VIS __hash_const_local_iterator; template <class> friend class _LIBCPP_VISIBLE __hash_const_local_iterator;
}; };
template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>, template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > > class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS hash_map class _LIBCPP_VISIBLE hash_map
{ {
public: public:
// types // types
@@ -507,8 +499,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;
@@ -679,7 +671,7 @@ typename hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__node_holder
hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k) hash_map<_Key, _Tp, _Hash, _Pred, _Alloc>::__construct_node(const key_type& __k)
{ {
__node_allocator& __na = __table_.__node_alloc(); __node_allocator& __na = __table_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -750,7 +742,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>, template <class _Key, class _Tp, class _Hash = hash<_Key>, class _Pred = equal_to<_Key>,
class _Alloc = allocator<pair<const _Key, _Tp> > > class _Alloc = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS hash_multimap class _LIBCPP_VISIBLE hash_multimap
{ {
public: public:
// types // types
@@ -784,8 +776,8 @@ private:
typedef typename __table::__node_traits __node_traits; typedef typename __table::__node_traits __node_traits;
typedef typename __table::__node_allocator __node_allocator; typedef typename __table::__node_allocator __node_allocator;
typedef typename __table::__node __node; typedef typename __table::__node __node;
typedef __hash_map_node_destructor<__node_allocator> _Dp; typedef __hash_map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
typedef allocator_traits<allocator_type> __alloc_traits; typedef allocator_traits<allocator_type> __alloc_traits;
public: public:
typedef typename __alloc_traits::pointer pointer; typedef typename __alloc_traits::pointer pointer;

View File

@@ -208,7 +208,7 @@ using namespace std;
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> > class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS hash_set class _LIBCPP_VISIBLE hash_set
{ {
public: public:
// types // types
@@ -429,7 +429,7 @@ operator!=(const hash_set<_Value, _Hash, _Pred, _Alloc>& __x,
template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>, template <class _Value, class _Hash = hash<_Value>, class _Pred = equal_to<_Value>,
class _Alloc = allocator<_Value> > class _Alloc = allocator<_Value> >
class _LIBCPP_TYPE_VIS hash_multiset class _LIBCPP_VISIBLE hash_multiset
{ {
public: public:
// types // types

View File

@@ -174,11 +174,7 @@ template <class T, class Allocator>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -212,11 +208,11 @@ struct __forward_list_node
value_type __value_; value_type __value_;
}; };
template<class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS forward_list; template<class _Tp, class _Alloc> class forward_list;
template<class _NodeConstPtr> class _LIBCPP_TYPE_VIS __forward_list_const_iterator; template<class _NodeConstPtr> class __forward_list_const_iterator;
template <class _NodePtr> template <class _NodePtr>
class _LIBCPP_TYPE_VIS __forward_list_iterator class _LIBCPP_VISIBLE __forward_list_iterator
{ {
typedef _NodePtr __node_pointer; typedef _NodePtr __node_pointer;
@@ -225,8 +221,8 @@ class _LIBCPP_TYPE_VIS __forward_list_iterator
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {} explicit __forward_list_iterator(__node_pointer __p) _NOEXCEPT : __ptr_(__p) {}
template<class, class> friend class _LIBCPP_TYPE_VIS forward_list; template<class, class> friend class forward_list;
template<class> friend class _LIBCPP_TYPE_VIS __forward_list_const_iterator; template<class> friend class __forward_list_const_iterator;
public: public:
typedef forward_iterator_tag iterator_category; typedef forward_iterator_tag iterator_category;
@@ -276,7 +272,7 @@ public:
}; };
template <class _NodeConstPtr> template <class _NodeConstPtr>
class _LIBCPP_TYPE_VIS __forward_list_const_iterator class _LIBCPP_VISIBLE __forward_list_const_iterator
{ {
typedef _NodeConstPtr __node_const_pointer; typedef _NodeConstPtr __node_const_pointer;
@@ -533,7 +529,7 @@ __forward_list_base<_Tp, _Alloc>::clear() _NOEXCEPT
} }
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS forward_list class _LIBCPP_VISIBLE forward_list
: private __forward_list_base<_Tp, _Alloc> : private __forward_list_base<_Tp, _Alloc>
{ {
typedef __forward_list_base<_Tp, _Alloc> base; typedef __forward_list_base<_Tp, _Alloc> base;
@@ -772,8 +768,8 @@ forward_list<_Tp, _Alloc>::forward_list(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __p = base::__before_begin(); __n > 0; --__n, for (__node_pointer __p = base::__before_begin(); __n > 0; --__n,
__p = __p->__next_) __p = __p->__next_)
{ {
@@ -848,8 +844,8 @@ forward_list<_Tp, _Alloc>::forward_list(forward_list&& __x,
{ {
if (base::__alloc() != __x.__alloc()) if (base::__alloc() != __x.__alloc())
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
insert_after(cbefore_begin(), _Ip(__x.begin()), _Ip(__x.end())); insert_after(cbefore_begin(), _I(__x.begin()), _I(__x.end()));
} }
} }
@@ -906,8 +902,8 @@ forward_list<_Tp, _Alloc>::__move_assign(forward_list& __x, false_type)
__move_assign(__x, true_type()); __move_assign(__x, true_type());
else else
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__x.begin()), _Ip(__x.end())); assign(_I(__x.begin()), _I(__x.end()));
} }
} }
@@ -995,8 +991,8 @@ void
forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args) forward_list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...); _VSTD::forward<_Args>(__args)...);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
@@ -1010,8 +1006,8 @@ void
forward_list<_Tp, _Alloc>::push_front(value_type&& __v) forward_list<_Tp, _Alloc>::push_front(value_type&& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
@@ -1024,8 +1020,8 @@ void
forward_list<_Tp, _Alloc>::push_front(const value_type& __v) forward_list<_Tp, _Alloc>::push_front(const value_type& __v)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = base::__before_begin()->__next_; __h->__next_ = base::__before_begin()->__next_;
base::__before_begin()->__next_ = __h.release(); base::__before_begin()->__next_ = __h.release();
@@ -1052,8 +1048,8 @@ forward_list<_Tp, _Alloc>::emplace_after(const_iterator __p, _Args&&... __args)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __node_traits::construct(__a, _VSTD::addressof(__h->__value_),
_VSTD::forward<_Args>(__args)...); _VSTD::forward<_Args>(__args)...);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
@@ -1069,8 +1065,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, value_type&& __v)
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v)); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), _VSTD::move(__v));
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
@@ -1085,8 +1081,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, const value_type& __
{ {
__node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_); __node_pointer const __r = const_cast<__node_pointer>(__p.__ptr_);
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__h->__next_ = __r->__next_; __h->__next_ = __r->__next_;
__r->__next_ = __h.release(); __r->__next_ = __h.release();
@@ -1102,8 +1098,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p, size_type __n,
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), __v);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
@@ -1152,8 +1148,8 @@ forward_list<_Tp, _Alloc>::insert_after(const_iterator __p,
if (__f != __l) if (__f != __l)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(__node_traits::allocate(__a, 1), _Dp(__a, 1)); unique_ptr<__node, _D> __h(__node_traits::allocate(__a, 1), _D(__a, 1));
__node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f); __node_traits::construct(__a, _VSTD::addressof(__h->__value_), *__f);
__node_pointer __first = __h.release(); __node_pointer __first = __h.release();
__node_pointer __last = __first; __node_pointer __last = __first;
@@ -1244,8 +1240,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
@@ -1276,8 +1272,8 @@ forward_list<_Tp, _Alloc>::resize(size_type __n, const value_type& __v)
if (__n > 0) if (__n > 0)
{ {
__node_allocator& __a = base::__alloc(); __node_allocator& __a = base::__alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __h(nullptr, _Dp(__a, 1)); unique_ptr<__node, _D> __h(nullptr, _D(__a, 1));
for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n, for (__node_pointer __ptr = __p.__ptr_; __n > 0; --__n,
__ptr = __ptr->__next_) __ptr = __ptr->__next_)
{ {
@@ -1569,12 +1565,12 @@ template <class _Tp, class _Alloc>
bool operator==(const forward_list<_Tp, _Alloc>& __x, bool operator==(const forward_list<_Tp, _Alloc>& __x,
const forward_list<_Tp, _Alloc>& __y) const forward_list<_Tp, _Alloc>& __y)
{ {
typedef forward_list<_Tp, _Alloc> _Cp; typedef forward_list<_Tp, _Alloc> _C;
typedef typename _Cp::const_iterator _Ip; typedef typename _C::const_iterator _I;
_Ip __ix = __x.begin(); _I __ix = __x.begin();
_Ip __ex = __x.end(); _I __ex = __x.end();
_Ip __iy = __y.begin(); _I __iy = __y.begin();
_Ip __ey = __y.end(); _I __ey = __y.end();
for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy) for (; __ix != __ex && __iy != __ey; ++__ix, ++__iy)
if (!(*__ix == *__iy)) if (!(*__ix == *__iy))
return false; return false;

View File

@@ -171,16 +171,12 @@ typedef basic_fstream<wchar_t> wfstream;
#include <__locale> #include <__locale>
#include <cstdio> #include <cstdio>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_filebuf class _LIBCPP_VISIBLE basic_filebuf
: public basic_streambuf<_CharT, _Traits> : public basic_streambuf<_CharT, _Traits>
{ {
public: public:
@@ -234,7 +230,6 @@ private:
FILE* __file_; FILE* __file_;
const codecvt<char_type, char, state_type>* __cv_; const codecvt<char_type, char, state_type>* __cv_;
state_type __st_; state_type __st_;
state_type __st_last_;
ios_base::openmode __om_; ios_base::openmode __om_;
ios_base::openmode __cm_; ios_base::openmode __cm_;
bool __owns_eb_; bool __owns_eb_;
@@ -254,20 +249,14 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf()
__intbuf_(0), __intbuf_(0),
__ibs_(0), __ibs_(0),
__file_(0), __file_(0),
__cv_(nullptr), __cv_(&use_facet<codecvt<char_type, char, state_type> >(this->getloc())),
__st_(), __st_(),
__st_last_(),
__om_(0), __om_(0),
__cm_(0), __cm_(0),
__owns_eb_(false), __owns_eb_(false),
__owns_ib_(false), __owns_ib_(false),
__always_noconv_(false) __always_noconv_(__cv_->always_noconv())
{ {
if (has_facet<codecvt<char_type, char, state_type> >(this->getloc()))
{
__cv_ = &use_facet<codecvt<char_type, char, state_type> >(this->getloc());
__always_noconv_ = __cv_->always_noconv();
}
setbuf(0, 4096); setbuf(0, 4096);
} }
@@ -295,7 +284,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__file_ = __rhs.__file_; __file_ = __rhs.__file_;
__cv_ = __rhs.__cv_; __cv_ = __rhs.__cv_;
__st_ = __rhs.__st_; __st_ = __rhs.__st_;
__st_last_ = __rhs.__st_last_;
__om_ = __rhs.__om_; __om_ = __rhs.__om_;
__cm_ = __rhs.__cm_; __cm_ = __rhs.__cm_;
__owns_eb_ = __rhs.__owns_eb_; __owns_eb_ = __rhs.__owns_eb_;
@@ -328,7 +316,6 @@ basic_filebuf<_CharT, _Traits>::basic_filebuf(basic_filebuf&& __rhs)
__rhs.__ibs_ = 0; __rhs.__ibs_ = 0;
__rhs.__file_ = 0; __rhs.__file_ = 0;
__rhs.__st_ = state_type(); __rhs.__st_ = state_type();
__rhs.__st_last_ = state_type();
__rhs.__om_ = 0; __rhs.__om_ = 0;
__rhs.__cm_ = 0; __rhs.__cm_ = 0;
__rhs.__owns_eb_ = false; __rhs.__owns_eb_ = false;
@@ -344,7 +331,6 @@ basic_filebuf<_CharT, _Traits>::operator=(basic_filebuf&& __rhs)
{ {
close(); close();
swap(__rhs); swap(__rhs);
return *this;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -407,7 +393,6 @@ basic_filebuf<_CharT, _Traits>::swap(basic_filebuf& __rhs)
_VSTD::swap(__file_, __rhs.__file_); _VSTD::swap(__file_, __rhs.__file_);
_VSTD::swap(__cv_, __rhs.__cv_); _VSTD::swap(__cv_, __rhs.__cv_);
_VSTD::swap(__st_, __rhs.__st_); _VSTD::swap(__st_, __rhs.__st_);
_VSTD::swap(__st_last_, __rhs.__st_last_);
_VSTD::swap(__om_, __rhs.__om_); _VSTD::swap(__om_, __rhs.__om_);
_VSTD::swap(__cm_, __rhs.__cm_); _VSTD::swap(__cm_, __rhs.__cm_);
_VSTD::swap(__owns_eb_, __rhs.__owns_eb_); _VSTD::swap(__owns_eb_, __rhs.__owns_eb_);
@@ -560,7 +545,7 @@ basic_filebuf<_CharT, _Traits>::close()
{ {
__rt = this; __rt = this;
unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose); unique_ptr<FILE, int(*)(FILE*)> __h(__file_, fclose);
if (sync()) if ((__cm_ & ios_base::out) && sync())
__rt = 0; __rt = 0;
if (fclose(__h.release()) == 0) if (fclose(__h.release()) == 0)
__file_ = 0; __file_ = 0;
@@ -602,22 +587,18 @@ basic_filebuf<_CharT, _Traits>::underflow()
memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_); memmove(__extbuf_, __extbufnext_, __extbufend_ - __extbufnext_);
__extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_); __extbufnext_ = __extbuf_ + (__extbufend_ - __extbufnext_);
__extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_); __extbufend_ = __extbuf_ + (__extbuf_ == __extbuf_min_ ? sizeof(__extbuf_min_) : __ebs_);
size_t __nmemb = _VSTD::min(static_cast<size_t>(__ibs_ - __unget_sz), size_t __nmemb = _VSTD::min(static_cast<size_t>(this->egptr() - this->eback() - __unget_sz),
static_cast<size_t>(__extbufend_ - __extbufnext_)); static_cast<size_t>(__extbufend_ - __extbufnext_));
codecvt_base::result __r; codecvt_base::result __r;
__st_last_ = __st_; state_type __svs = __st_;
size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_); size_t __nr = fread((void*)__extbufnext_, 1, __nmemb, __file_);
if (__nr != 0) if (__nr != 0)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
__extbufend_ = __extbufnext_ + __nr; __extbufend_ = __extbufnext_ + __nr;
char_type* __inext; char_type* __inext;
__r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_, __r = __cv_->in(__st_, __extbuf_, __extbufend_, __extbufnext_,
this->eback() + __unget_sz, this->eback() + __unget_sz,
this->eback() + __ibs_, __inext); this->egptr(), __inext);
if (__r == codecvt_base::noconv) if (__r == codecvt_base::noconv)
{ {
this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_); this->setg((char_type*)__extbuf_, (char_type*)__extbuf_, (char_type*)__extbufend_);
@@ -691,10 +672,6 @@ basic_filebuf<_CharT, _Traits>::overflow(int_type __c)
codecvt_base::result __r; codecvt_base::result __r;
do do
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
const char_type* __e; const char_type* __e;
__r = __cv_->out(__st_, this->pbase(), this->pptr(), __e, __r = __cv_->out(__st_, this->pbase(), this->pptr(), __e,
__extbuf_, __extbuf_ + __ebs_, __extbe); __extbuf_, __extbuf_ + __ebs_, __extbe);
@@ -784,10 +761,6 @@ typename basic_filebuf<_CharT, _Traits>::pos_type
basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way, basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode) ios_base::openmode)
{ {
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
int __width = __cv_->encoding(); int __width = __cv_->encoding();
if (__file_ == 0 || (__width <= 0 && __off != 0) || sync()) if (__file_ == 0 || (__width <= 0 && __off != 0) || sync())
return pos_type(off_type(-1)); return pos_type(off_type(-1));
@@ -807,15 +780,9 @@ basic_filebuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
default: default:
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
#if _WIN32
if (fseek(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1));
pos_type __r = ftell(__file_);
#else
if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence)) if (fseeko(__file_, __width > 0 ? __width * __off : 0, __whence))
return pos_type(off_type(-1)); return pos_type(off_type(-1));
pos_type __r = ftello(__file_); pos_type __r = ftello(__file_);
#endif
__r.state(__st_); __r.state(__st_);
return __r; return __r;
} }
@@ -826,14 +793,8 @@ basic_filebuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode)
{ {
if (__file_ == 0 || sync()) if (__file_ == 0 || sync())
return pos_type(off_type(-1)); return pos_type(off_type(-1));
#if _WIN32
if (fseek(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1));
#else
if (fseeko(__file_, __sp, SEEK_SET)) if (fseeko(__file_, __sp, SEEK_SET))
return pos_type(off_type(-1)); return pos_type(off_type(-1));
#endif
__st_ = __sp.state();
return __sp; return __sp;
} }
@@ -843,10 +804,6 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (__file_ == 0) if (__file_ == 0)
return 0; return 0;
#ifndef _LIBCPP_NO_EXCEPTIONS
if (!__cv_)
throw bad_cast();
#endif
if (__cm_ & ios_base::out) if (__cm_ & ios_base::out)
{ {
if (this->pptr() != this->pbase()) if (this->pptr() != this->pbase())
@@ -869,8 +826,6 @@ basic_filebuf<_CharT, _Traits>::sync()
else if (__cm_ & ios_base::in) else if (__cm_ & ios_base::in)
{ {
off_type __c; off_type __c;
state_type __state = __st_last_;
bool __update_st = false;
if (__always_noconv_) if (__always_noconv_)
__c = this->egptr() - this->gptr(); __c = this->egptr() - this->gptr();
else else
@@ -883,24 +838,32 @@ basic_filebuf<_CharT, _Traits>::sync()
{ {
if (this->gptr() != this->egptr()) if (this->gptr() != this->egptr())
{ {
const int __off = __cv_->length(__state, __extbuf_, reverse(this->gptr(), this->egptr());
__extbufnext_, codecvt_base::result __r;
this->gptr() - this->eback()); const char_type* __e = this->gptr();
__c += __extbufnext_ - __extbuf_ - __off; char* __extbe;
__update_st = true; do
} {
} __r = __cv_->out(__st_, __e, this->egptr(), __e,
} __extbuf_, __extbuf_ + __ebs_, __extbe);
#if _WIN32 switch (__r)
if (fseek(__file_, -__c, SEEK_CUR)) {
case codecvt_base::noconv:
__c += this->egptr() - this->gptr();
break;
case codecvt_base::ok:
case codecvt_base::partial:
__c += __extbe - __extbuf_;
break;
default:
return -1; return -1;
#else }
} while (__r == codecvt_base::partial);
}
}
}
if (fseeko(__file_, -__c, SEEK_CUR)) if (fseeko(__file_, -__c, SEEK_CUR))
return -1; return -1;
#endif
if (__update_st)
__st_ = __state;
__extbufnext_ = __extbufend_ = __extbuf_;
this->setg(0, 0, 0); this->setg(0, 0, 0);
__cm_ = 0; __cm_ = 0;
} }
@@ -994,7 +957,7 @@ basic_filebuf<_CharT, _Traits>::__write_mode()
// basic_ifstream // basic_ifstream
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_ifstream class _LIBCPP_VISIBLE basic_ifstream
: public basic_istream<_CharT, _Traits> : public basic_istream<_CharT, _Traits>
{ {
public: public:
@@ -1139,7 +1102,7 @@ basic_ifstream<_CharT, _Traits>::close()
// basic_ofstream // basic_ofstream
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_ofstream class _LIBCPP_VISIBLE basic_ofstream
: public basic_ostream<_CharT, _Traits> : public basic_ostream<_CharT, _Traits>
{ {
public: public:
@@ -1284,7 +1247,7 @@ basic_ofstream<_CharT, _Traits>::close()
// basic_fstream // basic_fstream
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_fstream class _LIBCPP_VISIBLE basic_fstream
: public basic_iostream<_CharT, _Traits> : public basic_iostream<_CharT, _Traits>
{ {
public: public:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

@@ -89,55 +89,53 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
#include <__config> #include <__config>
#include <wchar.h> // for mbstate_t #include <wchar.h> // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS ios_base; class ios_base;
template<class _CharT> struct _LIBCPP_TYPE_VIS char_traits; template<class _CharT> struct _LIBCPP_VISIBLE char_traits;
template<class _Tp> class _LIBCPP_TYPE_VIS allocator; template<class _Tp> class _LIBCPP_VISIBLE allocator;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_ios; class _LIBCPP_VISIBLE basic_ios;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_streambuf; class _LIBCPP_VISIBLE basic_streambuf;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_istream; class _LIBCPP_VISIBLE basic_istream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_ostream; class _LIBCPP_VISIBLE basic_ostream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_iostream; class _LIBCPP_VISIBLE basic_iostream;
template <class _CharT, class _Traits = char_traits<_CharT>, template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS basic_stringbuf; class _LIBCPP_VISIBLE basic_stringbuf;
template <class _CharT, class _Traits = char_traits<_CharT>, template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS basic_istringstream; class _LIBCPP_VISIBLE basic_istringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS basic_ostringstream; class _LIBCPP_VISIBLE basic_ostringstream;
template <class _CharT, class _Traits = char_traits<_CharT>, template <class _CharT, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS basic_stringstream; class _LIBCPP_VISIBLE basic_stringstream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_filebuf; class _LIBCPP_VISIBLE basic_filebuf;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_ifstream; class _LIBCPP_VISIBLE basic_ifstream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_ofstream; class _LIBCPP_VISIBLE basic_ofstream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_fstream; class _LIBCPP_VISIBLE basic_fstream;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS istreambuf_iterator; class _LIBCPP_VISIBLE istreambuf_iterator;
template <class _CharT, class _Traits = char_traits<_CharT> > template <class _CharT, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS ostreambuf_iterator; class _LIBCPP_VISIBLE ostreambuf_iterator;
typedef basic_ios<char> ios; typedef basic_ios<char> ios;
typedef basic_ios<wchar_t> wios; typedef basic_ios<wchar_t> wios;
@@ -172,7 +170,7 @@ typedef basic_ifstream<wchar_t> wifstream;
typedef basic_ofstream<wchar_t> wofstream; typedef basic_ofstream<wchar_t> wofstream;
typedef basic_fstream<wchar_t> wfstream; typedef basic_fstream<wchar_t> wfstream;
template <class _State> class _LIBCPP_TYPE_VIS fpos; template <class _State> class _LIBCPP_VISIBLE fpos;
typedef fpos<mbstate_t> streampos; typedef fpos<mbstate_t> streampos;
typedef fpos<mbstate_t> wstreampos; typedef fpos<mbstate_t> wstreampos;
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
@@ -185,7 +183,7 @@ typedef long long streamoff; // for char_traits in <string>
template <class _CharT, // for <stdexcept> template <class _CharT, // for <stdexcept>
class _Traits = char_traits<_CharT>, class _Traits = char_traits<_CharT>,
class _Allocator = allocator<_CharT> > class _Allocator = allocator<_CharT> >
class _LIBCPP_TYPE_VIS basic_string; class _LIBCPP_VISIBLE basic_string;
typedef basic_string<char, char_traits<char>, allocator<char> > string; typedef basic_string<char, char_traits<char>, allocator<char> > string;
typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring;

View File

@@ -40,20 +40,18 @@ extern wostream wclog;
#include <istream> #include <istream>
#include <ostream> #include <ostream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
extern _LIBCPP_FUNC_VIS istream cin; extern _LIBCPP_VISIBLE istream cin;
extern _LIBCPP_FUNC_VIS ostream cout; extern _LIBCPP_VISIBLE ostream cout;
extern _LIBCPP_FUNC_VIS ostream cerr; extern _LIBCPP_VISIBLE ostream cerr;
extern _LIBCPP_FUNC_VIS ostream clog; extern _LIBCPP_VISIBLE ostream clog;
extern _LIBCPP_FUNC_VIS wistream wcin; extern _LIBCPP_VISIBLE wistream wcin;
extern _LIBCPP_FUNC_VIS wostream wcout; extern _LIBCPP_VISIBLE wostream wcout;
extern _LIBCPP_FUNC_VIS wostream wcerr; extern _LIBCPP_VISIBLE wostream wcerr;
extern _LIBCPP_FUNC_VIS wostream wclog; extern _LIBCPP_VISIBLE wostream wclog;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -155,16 +155,12 @@ template <class charT, class traits, class T>
#include <__config> #include <__config>
#include <ostream> #include <ostream>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_istream class _LIBCPP_VISIBLE basic_istream
: virtual public basic_ios<_CharT, _Traits> : virtual public basic_ios<_CharT, _Traits>
{ {
streamsize __gc_; streamsize __gc_;
@@ -194,7 +190,7 @@ protected:
public: public:
// 27.7.1.1.3 Prefix/suffix: // 27.7.1.1.3 Prefix/suffix:
class _LIBCPP_TYPE_VIS sentry; class sentry;
// 27.7.1.2 Formatted input: // 27.7.1.2 Formatted input:
basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&)); basic_istream& operator>>(basic_istream& (*__pf)(basic_istream&));
@@ -244,7 +240,7 @@ public:
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_istream<_CharT, _Traits>::sentry class _LIBCPP_VISIBLE basic_istream<_CharT, _Traits>::sentry
{ {
bool __ok_; bool __ok_;
@@ -256,7 +252,7 @@ public:
// ~sentry() = default; // ~sentry() = default;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_EXPLICIT // explicit
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -271,10 +267,10 @@ basic_istream<_CharT, _Traits>::sentry::sentry(basic_istream<_CharT, _Traits>& _
__is.tie()->flush(); __is.tie()->flush();
if (!__noskipws && (__is.flags() & ios_base::skipws)) if (!__noskipws && (__is.flags() & ios_base::skipws))
{ {
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc()); const ctype<_CharT>& __ct = use_facet<ctype<_CharT> >(__is.getloc());
_Ip __i(__is); _I __i(__is);
_Ip __eof; _I __eof;
for (; __i != __eof; ++__i) for (; __i != __eof; ++__i)
if (!__ct.is(__ct.space, *__i)) if (!__ct.is(__ct.space, *__i))
break; break;
@@ -342,10 +338,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -369,10 +365,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -396,10 +392,10 @@ basic_istream<_CharT, _Traits>::operator>>(long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -423,10 +419,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -450,10 +446,10 @@ basic_istream<_CharT, _Traits>::operator>>(long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -477,10 +473,10 @@ basic_istream<_CharT, _Traits>::operator>>(unsigned long long& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -504,10 +500,10 @@ basic_istream<_CharT, _Traits>::operator>>(float& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -531,10 +527,10 @@ basic_istream<_CharT, _Traits>::operator>>(double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -558,10 +554,10 @@ basic_istream<_CharT, _Traits>::operator>>(long double& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -585,10 +581,10 @@ basic_istream<_CharT, _Traits>::operator>>(bool& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -612,10 +608,10 @@ basic_istream<_CharT, _Traits>::operator>>(void*& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __n); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __n);
this->setstate(__err); this->setstate(__err);
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
@@ -639,11 +635,11 @@ basic_istream<_CharT, _Traits>::operator>>(short& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<short>::min()) if (__temp < numeric_limits<short>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -679,11 +675,11 @@ basic_istream<_CharT, _Traits>::operator>>(int& __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef istreambuf_iterator<char_type, traits_type> _Ip; typedef istreambuf_iterator<char_type, traits_type> _I;
typedef num_get<char_type, _Ip> _Fp; typedef num_get<char_type, _I> _F;
ios_base::iostate __err = ios_base::goodbit; ios_base::iostate __err = ios_base::goodbit;
long __temp; long __temp;
use_facet<_Fp>(this->getloc()).get(_Ip(*this), _Ip(), *this, __err, __temp); use_facet<_F>(this->getloc()).get(_I(*this), _I(), *this, __err, __temp);
if (__temp < numeric_limits<int>::min()) if (__temp < numeric_limits<int>::min())
{ {
__err |= ios_base::failbit; __err |= ios_base::failbit;
@@ -1145,7 +1141,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
} }
++__gc_; ++__gc_;
char_type __ch = traits_type::to_char_type(__i); char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm))) if (traits_type::eq(__ch, __dlm))
break; break;
} }
} }
@@ -1161,7 +1157,7 @@ basic_istream<_CharT, _Traits>::ignore(streamsize __n, int_type __dlm)
} }
++__gc_; ++__gc_;
char_type __ch = traits_type::to_char_type(__i); char_type __ch = traits_type::to_char_type(__i);
if (traits_type::eq(__ch, static_cast<char_type>(__dlm))) if (traits_type::eq(__ch, __dlm))
break; break;
} }
} }
@@ -1189,11 +1185,7 @@ basic_istream<_CharT, _Traits>::peek()
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{
__r = this->rdbuf()->sgetc(); __r = this->rdbuf()->sgetc();
if (traits_type::eq_int_type(__r, traits_type::eof()))
this->setstate(ios_base::eofbit);
}
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
catch (...) catch (...)
@@ -1216,9 +1208,17 @@ basic_istream<_CharT, _Traits>::read(char_type* __s, streamsize __n)
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
__gc_ = this->rdbuf()->sgetn(__s, __n); ios_base::iostate __err = ios_base::goodbit;
if (__gc_ != __n) for (; __gc_ < __n; ++__gc_)
{
typename traits_type::int_type __i = this->rdbuf()->sbumpc();
if (traits_type::eq_int_type(__i, traits_type::eof()))
{
this->setstate(ios_base::failbit | ios_base::eofbit); this->setstate(ios_base::failbit | ios_base::eofbit);
break;
}
*__s++ = traits_type::to_char_type(__i);
}
} }
else else
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
@@ -1236,7 +1236,6 @@ template<class _CharT, class _Traits>
streamsize streamsize
basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n) basic_istream<_CharT, _Traits>::readsome(char_type* __s, streamsize __n)
{ {
__gc_ = 0;
streamsize __c = this->rdbuf()->in_avail(); streamsize __c = this->rdbuf()->in_avail();
switch (__c) switch (__c)
{ {
@@ -1261,7 +1260,6 @@ basic_istream<_CharT, _Traits>::putback(char_type __c)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1289,7 +1287,6 @@ basic_istream<_CharT, _Traits>::unget()
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
{ {
@@ -1368,7 +1365,6 @@ basic_istream<_CharT, _Traits>::seekg(pos_type __pos)
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
this->clear(this->rdstate() & ~ios_base::eofbit);
sentry __sen(*this, true); sentry __sen(*this, true);
if (__sen) if (__sen)
if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1)) if (this->rdbuf()->pubseekpos(__pos, ios_base::in) == pos_type(-1))
@@ -1453,7 +1449,7 @@ operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_iostream class _LIBCPP_VISIBLE basic_iostream
: public basic_istream<_CharT, _Traits>, : public basic_istream<_CharT, _Traits>,
public basic_ostream<_CharT, _Traits> public basic_ostream<_CharT, _Traits>
{ {
@@ -1704,9 +1700,9 @@ operator>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
return __is; return __is;
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<char>) extern template class basic_istream<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_istream<wchar_t>) extern template class basic_istream<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_iostream<char>) extern template class basic_iostream<char>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -263,10 +263,10 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_istream<charT,traits> istream_type; typedef basic_istream<charT,traits> istream_type;
istreambuf_iterator() noexcept; istreambuf_iterator() throw();
istreambuf_iterator(istream_type& s) noexcept; istreambuf_iterator(istream_type& s) throw();
istreambuf_iterator(streambuf_type* s) noexcept; istreambuf_iterator(streambuf_type* s) throw();
istreambuf_iterator(a-private-type) noexcept; istreambuf_iterator(a-private-type) throw();
charT operator*() const; charT operator*() const;
pointer operator->() const; pointer operator->() const;
@@ -293,13 +293,13 @@ public:
typedef basic_streambuf<charT,traits> streambuf_type; typedef basic_streambuf<charT,traits> streambuf_type;
typedef basic_ostream<charT,traits> ostream_type; typedef basic_ostream<charT,traits> ostream_type;
ostreambuf_iterator(ostream_type& s) noexcept; ostreambuf_iterator(ostream_type& s) throw();
ostreambuf_iterator(streambuf_type* s) noexcept; ostreambuf_iterator(streambuf_type* s) throw();
ostreambuf_iterator& operator=(charT c); ostreambuf_iterator& operator=(charT c);
ostreambuf_iterator& operator*(); ostreambuf_iterator& operator*();
ostreambuf_iterator& operator++(); ostreambuf_iterator& operator++();
ostreambuf_iterator& operator++(int); ostreambuf_iterator& operator++(int);
bool failed() const noexcept; bool failed() const throw();
}; };
template <class C> auto begin(C& c) -> decltype(c.begin()); template <class C> auto begin(C& c) -> decltype(c.begin());
@@ -317,31 +317,25 @@ template <class T, size_t N> T* end(T (&array)[N]);
#include <type_traits> #include <type_traits>
#include <cstddef> #include <cstddef>
#include <iosfwd> #include <iosfwd>
#ifdef __APPLE__
#include <Availability.h>
#endif
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
#include <cassert> #include <cassert>
#endif #endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TYPE_VIS input_iterator_tag {}; struct _LIBCPP_VISIBLE input_iterator_tag {};
struct _LIBCPP_TYPE_VIS output_iterator_tag {}; struct _LIBCPP_VISIBLE output_iterator_tag {};
struct _LIBCPP_TYPE_VIS forward_iterator_tag : public input_iterator_tag {}; struct _LIBCPP_VISIBLE forward_iterator_tag : public input_iterator_tag {};
struct _LIBCPP_TYPE_VIS bidirectional_iterator_tag : public forward_iterator_tag {}; struct _LIBCPP_VISIBLE bidirectional_iterator_tag : public forward_iterator_tag {};
struct _LIBCPP_TYPE_VIS random_access_iterator_tag : public bidirectional_iterator_tag {}; struct _LIBCPP_VISIBLE random_access_iterator_tag : public bidirectional_iterator_tag {};
template <class _Tp> template <class _Tp>
struct __has_iterator_category struct __has_iterator_category
{ {
private: private:
struct __two {char __lx; char __lxx;}; struct __two {char _; char __;};
template <class _Up> static __two __test(...); template <class _Up> static __two __test(...);
template <class _Up> static char __test(typename _Up::iterator_category* = 0); template <class _Up> static char __test(typename _Up::iterator_category* = 0);
public: public:
@@ -378,11 +372,11 @@ struct __iterator_traits<_Iter, true>
// the client expects instead of failing at compile time. // the client expects instead of failing at compile time.
template <class _Iter> template <class _Iter>
struct _LIBCPP_TYPE_VIS iterator_traits struct _LIBCPP_VISIBLE iterator_traits
: __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {}; : __iterator_traits<_Iter, __has_iterator_category<_Iter>::value> {};
template<class _Tp> template<class _Tp>
struct _LIBCPP_TYPE_VIS iterator_traits<_Tp*> struct _LIBCPP_VISIBLE iterator_traits<_Tp*>
{ {
typedef ptrdiff_t difference_type; typedef ptrdiff_t difference_type;
typedef typename remove_const<_Tp>::type value_type; typedef typename remove_const<_Tp>::type value_type;
@@ -413,7 +407,7 @@ struct __is_random_access_iterator : public __has_iterator_category_convertible_
template<class _Category, class _Tp, class _Distance = ptrdiff_t, template<class _Category, class _Tp, class _Distance = ptrdiff_t,
class _Pointer = _Tp*, class _Reference = _Tp&> class _Pointer = _Tp*, class _Reference = _Tp&>
struct _LIBCPP_TYPE_VIS iterator struct _LIBCPP_VISIBLE iterator
{ {
typedef _Tp value_type; typedef _Tp value_type;
typedef _Distance difference_type; typedef _Distance difference_type;
@@ -510,7 +504,7 @@ prev(_BidiretionalIter __x,
} }
template <class _Iter> template <class _Iter>
class _LIBCPP_TYPE_VIS reverse_iterator class _LIBCPP_VISIBLE reverse_iterator
: public iterator<typename iterator_traits<_Iter>::iterator_category, : public iterator<typename iterator_traits<_Iter>::iterator_category,
typename iterator_traits<_Iter>::value_type, typename iterator_traits<_Iter>::value_type,
typename iterator_traits<_Iter>::difference_type, typename iterator_traits<_Iter>::difference_type,
@@ -617,7 +611,7 @@ operator+(typename reverse_iterator<_Iter>::difference_type __n, const reverse_i
} }
template <class _Container> template <class _Container>
class _LIBCPP_TYPE_VIS back_insert_iterator class _LIBCPP_VISIBLE back_insert_iterator
: public iterator<output_iterator_tag, : public iterator<output_iterator_tag,
void, void,
void, void,
@@ -630,11 +624,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit back_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_back(__value_); return *this;} {container->push_back(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_back(_VSTD::move(__value_)); return *this;} {container->push_back(_VSTD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY back_insert_iterator& operator++() {return *this;}
@@ -650,7 +644,7 @@ back_inserter(_Container& __x)
} }
template <class _Container> template <class _Container>
class _LIBCPP_TYPE_VIS front_insert_iterator class _LIBCPP_VISIBLE front_insert_iterator
: public iterator<output_iterator_tag, : public iterator<output_iterator_tag,
void, void,
void, void,
@@ -663,11 +657,11 @@ public:
typedef _Container container_type; typedef _Container container_type;
_LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {} _LIBCPP_INLINE_VISIBILITY explicit front_insert_iterator(_Container& __x) : container(&__x) {}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(const typename _Container::value_type& __value)
{container->push_front(__value_); return *this;} {container->push_front(__value); return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator=(typename _Container::value_type&& __value)
{container->push_front(_VSTD::move(__value_)); return *this;} {container->push_front(_VSTD::move(__value)); return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY front_insert_iterator& operator++() {return *this;}
@@ -683,7 +677,7 @@ front_inserter(_Container& __x)
} }
template <class _Container> template <class _Container>
class _LIBCPP_TYPE_VIS insert_iterator class _LIBCPP_VISIBLE insert_iterator
: public iterator<output_iterator_tag, : public iterator<output_iterator_tag,
void, void,
void, void,
@@ -698,11 +692,11 @@ public:
_LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i) _LIBCPP_INLINE_VISIBILITY insert_iterator(_Container& __x, typename _Container::iterator __i)
: container(&__x), iter(__i) {} : container(&__x), iter(__i) {}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value_) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(const typename _Container::value_type& __value)
{iter = container->insert(iter, __value_); ++iter; return *this;} {iter = container->insert(iter, __value); ++iter; return *this;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value_) _LIBCPP_INLINE_VISIBILITY insert_iterator& operator=(typename _Container::value_type&& __value)
{iter = container->insert(iter, _VSTD::move(__value_)); ++iter; return *this;} {iter = container->insert(iter, _VSTD::move(__value)); ++iter; return *this;}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY insert_iterator& operator++() {return *this;}
@@ -719,7 +713,7 @@ inserter(_Container& __x, typename _Container::iterator __i)
template <class _Tp, class _CharT = char, template <class _Tp, class _CharT = char,
class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t> class _Traits = char_traits<_CharT>, class _Distance = ptrdiff_t>
class _LIBCPP_TYPE_VIS istream_iterator class _LIBCPP_VISIBLE istream_iterator
: public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&> : public iterator<input_iterator_tag, _Tp, _Distance, const _Tp*, const _Tp&>
{ {
public: public:
@@ -758,7 +752,7 @@ public:
}; };
template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> > template <class _Tp, class _CharT = char, class _Traits = char_traits<_CharT> >
class _LIBCPP_TYPE_VIS ostream_iterator class _LIBCPP_VISIBLE ostream_iterator
: public iterator<output_iterator_tag, void, void, void, void> : public iterator<output_iterator_tag, void, void, void, void>
{ {
public: public:
@@ -773,9 +767,9 @@ public:
: __out_stream_(&__s), __delim_(0) {} : __out_stream_(&__s), __delim_(0) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter) _LIBCPP_INLINE_VISIBILITY ostream_iterator(ostream_type& __s, const _CharT* __delimiter)
: __out_stream_(&__s), __delim_(__delimiter) {} : __out_stream_(&__s), __delim_(__delimiter) {}
_LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value_) _LIBCPP_INLINE_VISIBILITY ostream_iterator& operator=(const _Tp& __value)
{ {
*__out_stream_ << __value_; *__out_stream_ << __value;
if (__delim_) if (__delim_)
*__out_stream_ << __delim_; *__out_stream_ << __delim_;
return *this; return *this;
@@ -787,7 +781,7 @@ public:
}; };
template<class _CharT, class _Traits> template<class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS istreambuf_iterator class _LIBCPP_VISIBLE istreambuf_iterator
: public iterator<input_iterator_tag, _CharT, : public iterator<input_iterator_tag, _CharT,
typename _Traits::off_type, _CharT*, typename _Traits::off_type, _CharT*,
_CharT> _CharT>
@@ -799,7 +793,7 @@ public:
typedef basic_streambuf<_CharT,_Traits> streambuf_type; typedef basic_streambuf<_CharT,_Traits> streambuf_type;
typedef basic_istream<_CharT,_Traits> istream_type; typedef basic_istream<_CharT,_Traits> istream_type;
private: private:
mutable streambuf_type* __sbuf_; streambuf_type* __sbuf_;
class __proxy class __proxy
{ {
@@ -813,36 +807,37 @@ private:
}; };
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool __test_for_eof() const void __test_for_eof()
{ {
if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof())) if (__sbuf_ && traits_type::eq_int_type(__sbuf_->sgetc(), traits_type::eof()))
__sbuf_ = 0; __sbuf_ = 0;
return __sbuf_ == 0;
} }
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR istreambuf_iterator() _NOEXCEPT : __sbuf_(0) {} _LIBCPP_INLINE_VISIBILITY istreambuf_iterator() throw() : __sbuf_(0) {}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(istream_type& __s) throw()
: __sbuf_(__s.rdbuf()) {} : __sbuf_(__s.rdbuf()) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(streambuf_type* __s) throw()
: __sbuf_(__s) {} : __sbuf_(__s) {__test_for_eof();}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY istreambuf_iterator(const __proxy& __p) throw()
: __sbuf_(__p.__sbuf_) {} : __sbuf_(__p.__sbuf_) {}
_LIBCPP_INLINE_VISIBILITY char_type operator*() const _LIBCPP_INLINE_VISIBILITY _CharT operator*() const {return __sbuf_->sgetc();}
{return static_cast<char_type>(__sbuf_->sgetc());}
_LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;} _LIBCPP_INLINE_VISIBILITY char_type* operator->() const {return nullptr;}
_LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++() _LIBCPP_INLINE_VISIBILITY istreambuf_iterator& operator++()
{ {
__sbuf_->sbumpc(); if (traits_type::eq_int_type(__sbuf_->snextc(), traits_type::eof()))
__sbuf_ = 0;
return *this; return *this;
} }
_LIBCPP_INLINE_VISIBILITY __proxy operator++(int) _LIBCPP_INLINE_VISIBILITY __proxy operator++(int)
{ {
return __proxy(__sbuf_->sbumpc(), __sbuf_); char_type __c = __sbuf_->sgetc();
++(*this);
return __proxy(__c, __sbuf_);
} }
_LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const _LIBCPP_INLINE_VISIBILITY bool equal(const istreambuf_iterator& __b) const
{return __test_for_eof() == __b.__test_for_eof();} {return (__sbuf_ == 0) == (__b.__sbuf_ == 0);}
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
@@ -858,7 +853,7 @@ bool operator!=(const istreambuf_iterator<_CharT,_Traits>& __a,
{return !__a.equal(__b);} {return !__a.equal(__b);}
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS ostreambuf_iterator class _LIBCPP_VISIBLE ostreambuf_iterator
: public iterator<output_iterator_tag, void, void, void, void> : public iterator<output_iterator_tag, void, void, void, void>
{ {
public: public:
@@ -869,9 +864,9 @@ public:
private: private:
streambuf_type* __sbuf_; streambuf_type* __sbuf_;
public: public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(ostream_type& __s) throw()
: __sbuf_(__s.rdbuf()) {} : __sbuf_(__s.rdbuf()) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) _NOEXCEPT _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator(streambuf_type* __s) throw()
: __sbuf_(__s) {} : __sbuf_(__s) {}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c) _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator=(_CharT __c)
{ {
@@ -882,24 +877,11 @@ public:
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator*() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++() {return *this;}
_LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;} _LIBCPP_INLINE_VISIBILITY ostreambuf_iterator& operator++(int) {return *this;}
_LIBCPP_INLINE_VISIBILITY bool failed() const _NOEXCEPT {return __sbuf_ == 0;} _LIBCPP_INLINE_VISIBILITY bool failed() const throw() {return __sbuf_ == 0;}
#if !defined(__APPLE__) || \
(defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED > __MAC_10_8) || \
(defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED > __IPHONE_6_0)
template <class _Ch, class _Tr>
friend
_LIBCPP_HIDDEN
ostreambuf_iterator<_Ch, _Tr>
__pad_and_output(ostreambuf_iterator<_Ch, _Tr> __s,
const _Ch* __ob, const _Ch* __op, const _Ch* __oe,
ios_base& __iob, _Ch __fl);
#endif
}; };
template <class _Iter> template <class _Iter>
class _LIBCPP_TYPE_VIS move_iterator class _LIBCPP_VISIBLE move_iterator
{ {
private: private:
_Iter __i; _Iter __i;
@@ -1024,52 +1006,43 @@ make_move_iterator(const _Iter& __i)
template <class _Iter> class __wrap_iter; template <class _Iter> class __wrap_iter;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator==(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator!=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator>=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator<=(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT; operator-(const __wrap_iter<_Iter1>&, const __wrap_iter<_Iter2>&) _NOEXCEPT;
template <class _Iter> template <class _Iter>
_LIBCPP_INLINE_VISIBILITY
__wrap_iter<_Iter> __wrap_iter<_Iter>
operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT; operator+(typename __wrap_iter<_Iter>::difference_type, __wrap_iter<_Iter>) _NOEXCEPT;
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY copy(_Ip, _Ip, _Op); template <class _I, class _O> _O copy(_I, _I, _O);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY copy_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 copy_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> _Op _LIBCPP_INLINE_VISIBILITY move(_Ip, _Ip, _Op); template <class _I, class _O> _O move(_I, _I, _O);
template <class _B1, class _B2> _B2 _LIBCPP_INLINE_VISIBILITY move_backward(_B1, _B1, _B2); template <class _B1, class _B2> _B2 move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
_LIBCPP_INLINE_VISIBILITY
typename enable_if typename enable_if
< <
is_trivially_copy_assignable<_Tp>::value, is_trivially_copy_assignable<_Tp>::value,
@@ -1237,9 +1210,9 @@ private:
__wrap_iter<_Iter1> __wrap_iter<_Iter1>
operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT; operator+(typename __wrap_iter<_Iter1>::difference_type, __wrap_iter<_Iter1>) _NOEXCEPT;
template <class _Ip, class _Op> friend _Op copy(_Ip, _Ip, _Op); template <class _I, class _O> friend _O copy(_I, _I, _O);
template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2); template <class _B1, class _B2> friend _B2 copy_backward(_B1, _B1, _B2);
template <class _Ip, class _Op> friend _Op move(_Ip, _Ip, _Op); template <class _I, class _O> friend _O move(_I, _I, _O);
template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2); template <class _B1, class _B2> friend _B2 move_backward(_B1, _B1, _B2);
template <class _Tp> template <class _Tp>
@@ -1308,38 +1281,6 @@ operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter2>& __y) _NOEX
return !(__y < __x); return !(__y < __x);
} }
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator!=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x == __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return __y < __x;
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator>=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__x < __y);
}
template <class _Iter1>
inline _LIBCPP_INLINE_VISIBILITY
bool
operator<=(const __wrap_iter<_Iter1>& __x, const __wrap_iter<_Iter1>& __y) _NOEXCEPT
{
return !(__y < __x);
}
template <class _Iter1, class _Iter2> template <class _Iter1, class _Iter2>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename __wrap_iter<_Iter1>::difference_type typename __wrap_iter<_Iter1>::difference_type
@@ -1369,42 +1310,34 @@ operator+(typename __wrap_iter<_Iter>::difference_type __n,
template <class _Container, class _Iter> class __debug_iter; template <class _Container, class _Iter> class __debug_iter;
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator==(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator!=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator>=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator<=(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter1, class _Iter2> template <class _Container, class _Iter1, class _Iter2>
_LIBCPP_INLINE_VISIBILITY
typename __debug_iter<_Container, _Iter1>::difference_type typename __debug_iter<_Container, _Iter1>::difference_type
operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&); operator-(const __debug_iter<_Container, _Iter1>&, const __debug_iter<_Container, _Iter2>&);
template <class _Container, class _Iter> template <class _Container, class _Iter>
_LIBCPP_INLINE_VISIBILITY
__debug_iter<_Container, _Iter> __debug_iter<_Container, _Iter>
operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&); operator+(typename __debug_iter<_Container, _Iter>::difference_type, const __debug_iter<_Container, _Iter>&);
@@ -1780,88 +1713,88 @@ operator+(typename __debug_iter<_Container, _Iter>::difference_type __n,
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(_Cp& __c) -> decltype(__c.begin()) begin(_C& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
begin(const _Cp& __c) -> decltype(__c.begin()) begin(const _C& __c) -> decltype(__c.begin())
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(_Cp& __c) -> decltype(__c.end()) end(_C& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
auto auto
end(const _Cp& __c) -> decltype(__c.end()) end(const _C& __c) -> decltype(__c.end())
{ {
return __c.end(); return __c.end();
} }
#else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #else // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::iterator typename _C::iterator
begin(_Cp& __c) begin(_C& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::const_iterator typename _C::const_iterator
begin(const _Cp& __c) begin(const _C& __c)
{ {
return __c.begin(); return __c.begin();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::iterator typename _C::iterator
end(_Cp& __c) end(_C& __c)
{ {
return __c.end(); return __c.end();
} }
template <class _Cp> template <class _C>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
typename _Cp::const_iterator typename _C::const_iterator
end(const _Cp& __c) end(const _C& __c)
{ {
return __c.end(); return __c.end();
} }
#endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN) #endif // !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_TRAILING_RETURN)
template <class _Tp, size_t _Np> template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_Tp* _T*
begin(_Tp (&__array)[_Np]) begin(_T (&__array)[_N])
{ {
return __array; return __array;
} }
template <class _Tp, size_t _Np> template <class _T, size_t _N>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_Tp* _T*
end(_Tp (&__array)[_Np]) end(_T (&__array)[_N])
{ {
return __array + _Np; return __array + _N;
} }
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

File diff suppressed because it is too large Load Diff

View File

@@ -176,11 +176,7 @@ template <class T, class Alloc>
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -213,12 +209,12 @@ struct __list_node
_Tp __value_; _Tp __value_;
}; };
template <class _Tp, class _Alloc> class _LIBCPP_TYPE_VIS list; template <class _Tp, class _Alloc> class list;
template <class _Tp, class _Alloc> class __list_imp; template <class _Tp, class _Alloc> class __list_imp;
template <class _Tp, class _VoidPtr> class _LIBCPP_TYPE_VIS __list_const_iterator; template <class _Tp, class _VoidPtr> class __list_const_iterator;
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS __list_iterator class _LIBCPP_VISIBLE __list_iterator
{ {
typedef typename pointer_traits<_VoidPtr>::template typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -348,7 +344,7 @@ public:
}; };
template <class _Tp, class _VoidPtr> template <class _Tp, class _VoidPtr>
class _LIBCPP_TYPE_VIS __list_const_iterator class _LIBCPP_VISIBLE __list_const_iterator
{ {
typedef typename pointer_traits<_VoidPtr>::template typedef typename pointer_traits<_VoidPtr>::template
#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -394,7 +390,7 @@ public:
#endif #endif
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
__list_const_iterator(const __list_iterator<_Tp, _VoidPtr>& __p) _NOEXCEPT __list_const_iterator(__list_iterator<_Tp, _VoidPtr> __p) _NOEXCEPT
: __ptr_(__p.__ptr_) : __ptr_(__p.__ptr_)
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2 #if _LIBCPP_DEBUG_LEVEL >= 2
@@ -767,7 +763,7 @@ __list_imp<_Tp, _Alloc>::swap(__list_imp& __c)
} }
template <class _Tp, class _Alloc = allocator<_Tp> > template <class _Tp, class _Alloc = allocator<_Tp> >
class _LIBCPP_TYPE_VIS list class _LIBCPP_VISIBLE list
: private __list_imp<_Tp, _Alloc> : private __list_imp<_Tp, _Alloc>
{ {
typedef __list_imp<_Tp, _Alloc> base; typedef __list_imp<_Tp, _Alloc> base;
@@ -1195,8 +1191,8 @@ list<_Tp, _Alloc>::list(list&& __c, const allocator_type& __a)
splice(end(), __c); splice(end(), __c);
else else
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__c.begin()), _Ip(__c.end())); assign(_I(__c.begin()), _I(__c.end()));
} }
} }
@@ -1219,8 +1215,8 @@ list<_Tp, _Alloc>::__move_assign(list& __c, false_type)
{ {
if (base::__node_alloc() != __c.__node_alloc()) if (base::__node_alloc() != __c.__node_alloc())
{ {
typedef move_iterator<iterator> _Ip; typedef move_iterator<iterator> _I;
assign(_Ip(__c.begin()), _Ip(__c.end())); assign(_I(__c.begin()), _I(__c.end()));
} }
else else
__move_assign(__c, true_type()); __move_assign(__c, true_type());
@@ -1286,17 +1282,13 @@ list<_Tp, _Alloc>::insert(const_iterator __p, const value_type& __x)
" referring to this list"); " referring to this list");
#endif #endif
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
++base::__sz(); ++base::__sz();
#if _LIBCPP_DEBUG_LEVEL >= 2
return iterator(__hold.release(), this);
#else
return iterator(__hold.release()); return iterator(__hold.release());
#endif
} }
template <class _Tp, class _Alloc> template <class _Tp, class _Alloc>
@@ -1315,8 +1307,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, size_type __n, const value_type& _
{ {
size_type __ds = 0; size_type __ds = 0;
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
++__ds; ++__ds;
@@ -1383,8 +1375,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, _InpIter __f, _InpIter __l,
{ {
size_type __ds = 0; size_type __ds = 0;
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), *__f);
++__ds; ++__ds;
@@ -1438,8 +1430,8 @@ void
list<_Tp, _Alloc>::push_front(const value_type& __x) list<_Tp, _Alloc>::push_front(const value_type& __x)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(*base::__end_.__next_, *__hold, *__hold); __link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1451,8 +1443,8 @@ void
list<_Tp, _Alloc>::push_back(const value_type& __x) list<_Tp, _Alloc>::push_back(const value_type& __x)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1466,8 +1458,8 @@ void
list<_Tp, _Alloc>::push_front(value_type&& __x) list<_Tp, _Alloc>::push_front(value_type&& __x)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(*base::__end_.__next_, *__hold, *__hold); __link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1479,8 +1471,8 @@ void
list<_Tp, _Alloc>::push_back(value_type&& __x) list<_Tp, _Alloc>::push_back(value_type&& __x)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1495,8 +1487,8 @@ void
list<_Tp, _Alloc>::emplace_front(_Args&&... __args) list<_Tp, _Alloc>::emplace_front(_Args&&... __args)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(*base::__end_.__next_, *__hold, *__hold); __link_nodes(*base::__end_.__next_, *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1509,8 +1501,8 @@ void
list<_Tp, _Alloc>::emplace_back(_Args&&... __args) list<_Tp, _Alloc>::emplace_back(_Args&&... __args)
{ {
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold); __link_nodes(static_cast<__node&>(base::__end_), *__hold, *__hold);
++base::__sz(); ++base::__sz();
@@ -1522,14 +1514,9 @@ template <class... _Args>
typename list<_Tp, _Alloc>::iterator typename list<_Tp, _Alloc>::iterator
list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args) list<_Tp, _Alloc>::emplace(const_iterator __p, _Args&&... __args)
{ {
#if _LIBCPP_DEBUG_LEVEL >= 2
_LIBCPP_ASSERT(__get_const_db()->__find_c_from_i(&__p) == this,
"list::emplace(iterator, args...) called with an iterator not"
" referring to this list");
#endif
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::forward<_Args>(__args)...);
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
@@ -1553,8 +1540,8 @@ list<_Tp, _Alloc>::insert(const_iterator __p, value_type&& __x)
" referring to this list"); " referring to this list");
#endif #endif
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), _VSTD::move(__x));
__link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold); __link_nodes(const_cast<__node&>(*__p.__ptr_), *__hold, *__hold);
@@ -1633,8 +1620,6 @@ list<_Tp, _Alloc>::erase(const_iterator __p)
"list::erase(iterator) called with an iterator not" "list::erase(iterator) called with an iterator not"
" referring to this list"); " referring to this list");
#endif #endif
_LIBCPP_ASSERT(__p != end(),
"list::erase(iterator) called with a non-dereferenceable iterator");
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
__node& __n = const_cast<__node&>(*__p.__ptr_); __node& __n = const_cast<__node&>(*__p.__ptr_);
__node_pointer __r = __n.__next_; __node_pointer __r = __n.__next_;
@@ -1719,8 +1704,8 @@ list<_Tp, _Alloc>::resize(size_type __n)
__n -= base::__sz(); __n -= base::__sz();
size_type __ds = 0; size_type __ds = 0;
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_)); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_));
++__ds; ++__ds;
@@ -1778,8 +1763,8 @@ list<_Tp, _Alloc>::resize(size_type __n, const value_type& __x)
__n -= base::__sz(); __n -= base::__sz();
size_type __ds = 0; size_type __ds = 0;
__node_allocator& __na = base::__node_alloc(); __node_allocator& __na = base::__node_alloc();
typedef __allocator_destructor<__node_allocator> _Dp; typedef __allocator_destructor<__node_allocator> _D;
unique_ptr<__node, _Dp> __hold(__node_alloc_traits::allocate(__na, 1), _Dp(__na, 1)); unique_ptr<__node, _D> __hold(__node_alloc_traits::allocate(__na, 1), _D(__na, 1));
__hold->__prev_ = 0; __hold->__prev_ = 0;
__node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x); __node_alloc_traits::construct(__na, _VSTD::addressof(__hold->__value_), __x);
++__ds; ++__ds;

File diff suppressed because it is too large Load Diff

View File

@@ -375,21 +375,15 @@ swap(multimap<Key, T, Compare, Allocator>& x,
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value template <class _Key, class _Tp, class _Compare, bool = is_empty<_Compare>::value>
#if __has_feature(is_final)
&& !__is_final(_Compare)
#endif
>
class __map_value_compare class __map_value_compare
: private _Compare : private _Compare
{ {
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp; typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<const _Key, _Tp> _CP; typedef pair<const _Key, _Tp> _CP;
public: public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -406,25 +400,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const bool operator()(const _CP& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);} {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Pp& __y) const bool operator()(const _CP& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);} {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const bool operator()(const _CP& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);} {return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _CP& __y) const bool operator()(const _P& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);} {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Pp& __y) const bool operator()(const _P& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y.first);} {return static_cast<const _Compare&>(*this)(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Key& __y) const bool operator()(const _P& __x, const _Key& __y) const
{return static_cast<const _Compare&>(*this)(__x.first, __y);} {return static_cast<const _Compare&>(*this)(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const bool operator()(const _Key& __x, const _CP& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);} {return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Pp& __y) const bool operator()(const _Key& __x, const _P& __y) const
{return static_cast<const _Compare&>(*this)(__x, __y.first);} {return static_cast<const _Compare&>(*this)(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const bool operator()(const _Key& __x, const _Key& __y) const
@@ -436,7 +430,7 @@ class __map_value_compare<_Key, _Tp, _Compare, false>
{ {
_Compare comp; _Compare comp;
typedef pair<typename std::remove_const<_Key>::type, _Tp> _Pp; typedef pair<typename std::remove_const<_Key>::type, _Tp> _P;
typedef pair<const _Key, _Tp> _CP; typedef pair<const _Key, _Tp> _CP;
public: public:
@@ -455,25 +449,25 @@ public:
bool operator()(const _CP& __x, const _CP& __y) const bool operator()(const _CP& __x, const _CP& __y) const
{return comp(__x.first, __y.first);} {return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Pp& __y) const bool operator()(const _CP& __x, const _P& __y) const
{return comp(__x.first, __y.first);} {return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _CP& __x, const _Key& __y) const bool operator()(const _CP& __x, const _Key& __y) const
{return comp(__x.first, __y);} {return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _CP& __y) const bool operator()(const _P& __x, const _CP& __y) const
{return comp(__x.first, __y.first);} {return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Pp& __y) const bool operator()(const _P& __x, const _P& __y) const
{return comp(__x.first, __y.first);} {return comp(__x.first, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Pp& __x, const _Key& __y) const bool operator()(const _P& __x, const _Key& __y) const
{return comp(__x.first, __y);} {return comp(__x.first, __y);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _CP& __y) const bool operator()(const _Key& __x, const _CP& __y) const
{return comp(__x, __y.first);} {return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Pp& __y) const bool operator()(const _Key& __x, const _P& __y) const
{return comp(__x, __y.first);} {return comp(__x, __y.first);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool operator()(const _Key& __x, const _Key& __y) const bool operator()(const _Key& __x, const _Key& __y) const
@@ -537,7 +531,7 @@ template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _TreeIterator> class __map_const_iterator; template <class _TreeIterator> class __map_const_iterator;
template <class _TreeIterator> template <class _TreeIterator>
class _LIBCPP_TYPE_VIS __map_iterator class _LIBCPP_VISIBLE __map_iterator
{ {
_TreeIterator __i_; _TreeIterator __i_;
@@ -596,13 +590,13 @@ public:
bool operator!=(const __map_iterator& __x, const __map_iterator& __y) bool operator!=(const __map_iterator& __x, const __map_iterator& __y)
{return __x.__i_ != __y.__i_;} {return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class> friend class _LIBCPP_TYPE_VIS __map_const_iterator; template <class> friend class _LIBCPP_VISIBLE __map_const_iterator;
}; };
template <class _TreeIterator> template <class _TreeIterator>
class _LIBCPP_TYPE_VIS __map_const_iterator class _LIBCPP_VISIBLE __map_const_iterator
{ {
_TreeIterator __i_; _TreeIterator __i_;
@@ -665,14 +659,14 @@ public:
bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y) bool operator!=(const __map_const_iterator& __x, const __map_const_iterator& __y)
{return __x.__i_ != __y.__i_;} {return __x.__i_ != __y.__i_;}
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS map; template <class, class, class, class> friend class _LIBCPP_VISIBLE map;
template <class, class, class, class> friend class _LIBCPP_TYPE_VIS multimap; template <class, class, class, class> friend class _LIBCPP_VISIBLE multimap;
template <class, class, class> friend class _LIBCPP_TYPE_VIS __tree_const_iterator; template <class, class, class> friend class _LIBCPP_VISIBLE __tree_const_iterator;
}; };
template <class _Key, class _Tp, class _Compare = less<_Key>, template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > > class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS map class _LIBCPP_VISIBLE map
{ {
public: public:
// types: // types:
@@ -684,7 +678,7 @@ public:
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
class _LIBCPP_TYPE_VIS value_compare class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool> : public binary_function<value_type, value_type, bool>
{ {
friend class map; friend class map;
@@ -880,29 +874,59 @@ public:
value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());} value_compare value_comp() const {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace() {return __tree_.__emplace_unique();}
template <class _A0,
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool>
emplace(_A0&& __a0)
{return __tree_.__emplace_unique(_VSTD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args> template <class _A0, class ..._Args,
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
pair<iterator, bool> pair<iterator, bool>
emplace(_Args&& ...__args); emplace(_A0&& __a0, _Args&& ...__args);
template <class ..._Args>
iterator
emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_Pp&& __p) iterator
{return __tree_.__insert_unique(_VSTD::forward<_Pp>(__p));} emplace_hint(const_iterator __p)
{return __tree_.__emplace_hint_unique(__p.__i_);}
template <class _Pp, template <class _A0,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _Pp&& __p) iterator
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_Pp>(__p));} emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_unique(__p.__i_, _VSTD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
pair<iterator, bool> insert(_P&& __p)
{return __tree_.__insert_unique(_VSTD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_unique(__pos.__i_, _VSTD::forward<_P>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -980,28 +1004,18 @@ private:
typedef typename __base::__node_const_pointer __node_const_pointer; typedef typename __base::__node_const_pointer __node_const_pointer;
typedef typename __base::__node_base_pointer __node_base_pointer; typedef typename __base::__node_base_pointer __node_base_pointer;
typedef typename __base::__node_base_const_pointer __node_base_const_pointer; typedef typename __base::__node_base_const_pointer __node_base_const_pointer;
typedef __map_node_destructor<__node_allocator> _Dp; typedef __map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(); __node_holder __construct_node();
template <class _A0> template <class _A0,
typename enable_if class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
< __node_holder __construct_node(_A0&& __a0);
is_constructible<value_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<key_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class _A1, class ..._Args> template <class _A0, class ..._Args,
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#else // _LIBCPP_HAS_NO_RVALUE_REFERENCES #else // _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(const key_type& __k); __node_holder __construct_node(const key_type& __k);
@@ -1186,7 +1200,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node() map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1195,53 +1209,32 @@ map<_Key, _Tp, _Compare, _Allocator>::__construct_node()
} }
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0> template <class _A0,
typename enable_if class>
< typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
is_constructible<pair<const _Key, _Tp>, _A0>::value,
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return __h; return __h;
} }
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0>
typename enable_if
<
is_constructible<_Key, _A0>::value,
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class _A1, class ..._Args> template <class _A0, class ..._Args,
class>
typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args) map<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
_VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return __h; return __h;
} }
@@ -1255,7 +1248,7 @@ typename map<_Key, _Tp, _Compare, _Allocator>::__node_holder
map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k) map<_Key, _Tp, _Compare, _Allocator>::__construct_node(const key_type& __k)
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), __k);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1330,11 +1323,14 @@ map<_Key, _Tp, _Compare, _Allocator>::at(const key_type& __k) const
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class ..._Args> template <class _A0, class ..._Args,
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool> pair<typename map<_Key, _Tp, _Compare, _Allocator>::iterator, bool>
map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args) map<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
_VSTD::forward<_Args>(__args)...);
pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get()); pair<iterator, bool> __r = __tree_.__node_insert_unique(__h.get());
if (__r.second) if (__r.second)
__h.release(); __h.release();
@@ -1342,12 +1338,15 @@ map<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args)
} }
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class ..._Args> template <class _A0, class ..._Args,
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename map<_Key, _Tp, _Compare, _Allocator>::iterator typename map<_Key, _Tp, _Compare, _Allocator>::iterator
map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p, map<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
_Args&& ...__args) _A0&& __a0, _Args&& ...__args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get()); iterator __r = __tree_.__node_insert_unique(__p.__i_, __h.get());
if (__r.__i_.__ptr_ == __h.get()) if (__r.__i_.__ptr_ == __h.get())
__h.release(); __h.release();
@@ -1422,7 +1421,7 @@ swap(map<_Key, _Tp, _Compare, _Allocator>& __x,
template <class _Key, class _Tp, class _Compare = less<_Key>, template <class _Key, class _Tp, class _Compare = less<_Key>,
class _Allocator = allocator<pair<const _Key, _Tp> > > class _Allocator = allocator<pair<const _Key, _Tp> > >
class _LIBCPP_TYPE_VIS multimap class _LIBCPP_VISIBLE multimap
{ {
public: public:
// types: // types:
@@ -1434,7 +1433,7 @@ public:
typedef value_type& reference; typedef value_type& reference;
typedef const value_type& const_reference; typedef const value_type& const_reference;
class _LIBCPP_TYPE_VIS value_compare class _LIBCPP_VISIBLE value_compare
: public binary_function<value_type, value_type, bool> : public binary_function<value_type, value_type, bool>
{ {
friend class multimap; friend class multimap;
@@ -1624,29 +1623,57 @@ public:
{return value_compare(__tree_.value_comp().key_comp());} {return value_compare(__tree_.value_comp().key_comp());}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
iterator emplace() {return __tree_.__emplace_multi();}
template <class _A0,
class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator
emplace(_A0&& __a0)
{return __tree_.__emplace_multi(_VSTD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class ..._Args> template <class _A0, class ..._Args,
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator iterator
emplace(_Args&& ...__args); emplace(_A0&& __a0, _Args&& ...__args);
template <class ..._Args>
iterator
emplace_hint(const_iterator __p, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
template <class _Pp,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(_Pp&& __p) iterator emplace_hint(const_iterator __p)
{return __tree_.__insert_multi(_VSTD::forward<_Pp>(__p));} {return __tree_.__emplace_hint_multi(__p.__i_);}
template <class _Pp, template <class _A0,
class = typename enable_if<is_constructible<value_type, _Pp>::value>::type> class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _Pp&& __p) iterator
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_Pp>(__p));} emplace_hint(const_iterator __p, _A0&& __a0)
{return __tree_.__emplace_hint_multi(__p.__i_, _VSTD::forward<_A0>(__a0));}
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class ..._Args,
class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
iterator
emplace_hint(const_iterator __p, _A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS
template <class _P,
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(_P&& __p)
{return __tree_.__insert_multi(_VSTD::forward<_P>(__p));}
template <class _P,
class = typename enable_if<is_constructible<value_type, _P>::value>::type>
_LIBCPP_INLINE_VISIBILITY
iterator insert(const_iterator __pos, _P&& __p)
{return __tree_.__insert_multi(__pos.__i_, _VSTD::forward<_P>(__p));}
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1719,28 +1746,18 @@ private:
typedef typename __base::__node_allocator __node_allocator; typedef typename __base::__node_allocator __node_allocator;
typedef typename __base::__node_pointer __node_pointer; typedef typename __base::__node_pointer __node_pointer;
typedef typename __base::__node_const_pointer __node_const_pointer; typedef typename __base::__node_const_pointer __node_const_pointer;
typedef __map_node_destructor<__node_allocator> _Dp; typedef __map_node_destructor<__node_allocator> _D;
typedef unique_ptr<__node, _Dp> __node_holder; typedef unique_ptr<__node, _D> __node_holder;
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
__node_holder __construct_node(); __node_holder __construct_node();
template <class _A0> template <class _A0,
typename enable_if class = typename enable_if<is_constructible<value_type, _A0>::value>::type>
< __node_holder __construct_node(_A0&& __a0);
is_constructible<value_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
template <class _A0>
typename enable_if
<
is_constructible<key_type, _A0>::value,
__node_holder
>::type
__construct_node(_A0&& __a0);
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _A0, class _A1, class ..._Args> template <class _A0, class ..._Args,
__node_holder __construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args); class = typename enable_if<is_constructible<key_type, _A0>::value>::type>
__node_holder __construct_node(_A0&& __a0, _Args&& ...__args);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
}; };
@@ -1765,7 +1782,7 @@ typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node() multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first));
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
@@ -1774,53 +1791,34 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node()
} }
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0> template <class _A0,
typename enable_if class // = typename enable_if<is_constructible<value_type, _A0>::value>::type
< >
is_constructible<pair<const _Key, _Tp>, _A0>::value, typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0) multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0)); __node_traits::construct(__na, _VSTD::addressof(__h->__value_), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return __h; return __h;
} }
template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0>
typename enable_if
<
is_constructible<_Key, _A0>::value,
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
>::type
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0)
{
__node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
__h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second));
__h.get_deleter().__second_constructed = true;
return __h;
}
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class _A0, class _A1, class ..._Args> template <class _A0, class ..._Args,
class // = typename enable_if<is_constructible<key_type, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder typename multimap<_Key, _Tp, _Compare, _Allocator>::__node_holder
multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __a1, _Args&& ...__args) multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _Args&& ...__args)
{ {
__node_allocator& __na = __tree_.__node_alloc(); __node_allocator& __na = __tree_.__node_alloc();
__node_holder __h(__node_traits::allocate(__na, 1), _Dp(__na)); __node_holder __h(__node_traits::allocate(__na, 1), _D(__na));
__node_traits::construct(__na, _VSTD::addressof(__h->__value_), __node_traits::construct(__na, _VSTD::addressof(__h->__value_.first), _VSTD::forward<_A0>(__a0));
_VSTD::forward<_A0>(__a0), _VSTD::forward<_A1>(__a1),
_VSTD::forward<_Args>(__args)...);
__h.get_deleter().__first_constructed = true; __h.get_deleter().__first_constructed = true;
__node_traits::construct(__na, _VSTD::addressof(__h->__value_.second), _VSTD::forward<_Args>(__args)...);
__h.get_deleter().__second_constructed = true; __h.get_deleter().__second_constructed = true;
return __h; return __h;
} }
@@ -1831,23 +1829,30 @@ multimap<_Key, _Tp, _Compare, _Allocator>::__construct_node(_A0&& __a0, _A1&& __
#if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS) #if !defined(_LIBCPP_HAS_NO_RVALUE_REFERENCES) && !defined(_LIBCPP_HAS_NO_VARIADICS)
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class ..._Args> template <class _A0, class ..._Args,
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_Args&& ...__args) multimap<_Key, _Tp, _Compare, _Allocator>::emplace(_A0&& __a0, _Args&& ...__args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__h.get()); iterator __r = __tree_.__node_insert_multi(__h.get());
__h.release(); __h.release();
return __r; return __r;
} }
template <class _Key, class _Tp, class _Compare, class _Allocator> template <class _Key, class _Tp, class _Compare, class _Allocator>
template <class ..._Args> template <class _A0, class ..._Args,
class //= typename enable_if<is_constructible<_Key, _A0>::value>::type
>
typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator typename multimap<_Key, _Tp, _Compare, _Allocator>::iterator
multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p, multimap<_Key, _Tp, _Compare, _Allocator>::emplace_hint(const_iterator __p,
_A0&& __a0,
_Args&& ...__args) _Args&& ...__args)
{ {
__node_holder __h = __construct_node(_VSTD::forward<_Args>(__args)...); __node_holder __h = __construct_node(_VSTD::forward<_A0>(__a0),
_VSTD::forward<_Args>(__args)...);
iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get()); iterator __r = __tree_.__node_insert_multi(__p.__i_, __h.get());
__h.release(); __h.release();
return __r; return __r;

File diff suppressed because it is too large Load Diff

View File

@@ -20,7 +20,7 @@ namespace std
class mutex class mutex
{ {
public: public:
constexpr mutex() noexcept; mutex();
~mutex(); ~mutex();
mutex(const mutex&) = delete; mutex(const mutex&) = delete;
@@ -44,7 +44,7 @@ public:
recursive_mutex& operator=(const recursive_mutex&) = delete; recursive_mutex& operator=(const recursive_mutex&) = delete;
void lock(); void lock();
bool try_lock() noexcept; bool try_lock();
void unlock(); void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
@@ -79,7 +79,7 @@ public:
recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete; recursive_timed_mutex& operator=(const recursive_timed_mutex&) = delete;
void lock(); void lock();
bool try_lock() noexcept; bool try_lock();
template <class Rep, class Period> template <class Rep, class Period>
bool try_lock_for(const chrono::duration<Rep, Period>& rel_time); bool try_lock_for(const chrono::duration<Rep, Period>& rel_time);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -114,9 +114,9 @@ class unique_lock
{ {
public: public:
typedef Mutex mutex_type; typedef Mutex mutex_type;
unique_lock() noexcept; unique_lock();
explicit unique_lock(mutex_type& m); explicit unique_lock(mutex_type& m);
unique_lock(mutex_type& m, defer_lock_t) noexcept; unique_lock(mutex_type& m, defer_lock_t);
unique_lock(mutex_type& m, try_to_lock_t); unique_lock(mutex_type& m, try_to_lock_t);
unique_lock(mutex_type& m, adopt_lock_t); unique_lock(mutex_type& m, adopt_lock_t);
template <class Clock, class Duration> template <class Clock, class Duration>
@@ -128,8 +128,8 @@ public:
unique_lock(unique_lock const&) = delete; unique_lock(unique_lock const&) = delete;
unique_lock& operator=(unique_lock const&) = delete; unique_lock& operator=(unique_lock const&) = delete;
unique_lock(unique_lock&& u) noexcept; unique_lock(unique_lock&& u);
unique_lock& operator=(unique_lock&& u) noexcept; unique_lock& operator=(unique_lock&& u);
void lock(); void lock();
bool try_lock(); bool try_lock();
@@ -141,16 +141,16 @@ public:
void unlock(); void unlock();
void swap(unique_lock& u) noexcept; void swap(unique_lock& u);
mutex_type* release() noexcept; mutex_type* release();
bool owns_lock() const noexcept; bool owns_lock() const;
explicit operator bool () const noexcept; explicit operator bool () const;
mutex_type* mutex() const noexcept; mutex_type* mutex() const;
}; };
template <class Mutex> template <class Mutex>
void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y) noexcept; void swap(unique_lock<Mutex>& x, unique_lock<Mutex>& y);
template <class L1, class L2, class... L3> template <class L1, class L2, class... L3>
int try_lock(L1&, L2&, L3&...); int try_lock(L1&, L2&, L3&...);
@@ -159,7 +159,7 @@ template <class L1, class L2, class... L3>
struct once_flag struct once_flag
{ {
constexpr once_flag() noexcept; constexpr once_flag();
once_flag(const once_flag&) = delete; once_flag(const once_flag&) = delete;
once_flag& operator=(const once_flag&) = delete; once_flag& operator=(const once_flag&) = delete;
@@ -179,15 +179,11 @@ template<class Callable, class ...Args>
#include <tuple> #include <tuple>
#endif #endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS recursive_mutex class _LIBCPP_VISIBLE recursive_mutex
{ {
pthread_mutex_t __m_; pthread_mutex_t __m_;
@@ -201,15 +197,15 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
void unlock() _NOEXCEPT; void unlock();
typedef pthread_mutex_t* native_handle_type; typedef pthread_mutex_t* native_handle_type;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
native_handle_type native_handle() {return &__m_;} native_handle_type native_handle() {return &__m_;}
}; };
class _LIBCPP_TYPE_VIS timed_mutex class _LIBCPP_VISIBLE timed_mutex
{ {
mutex __m_; mutex __m_;
condition_variable __cv_; condition_variable __cv_;
@@ -224,14 +220,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock();
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -251,7 +247,7 @@ timed_mutex::try_lock_until(const chrono::time_point<_Clock, _Duration>& __t)
return false; return false;
} }
class _LIBCPP_TYPE_VIS recursive_timed_mutex class _LIBCPP_VISIBLE recursive_timed_mutex
{ {
mutex __m_; mutex __m_;
condition_variable __cv_; condition_variable __cv_;
@@ -267,14 +263,14 @@ private:
public: public:
void lock(); void lock();
bool try_lock() _NOEXCEPT; bool try_lock();
template <class _Rep, class _Period> template <class _Rep, class _Period>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
bool try_lock_for(const chrono::duration<_Rep, _Period>& __d) bool try_lock_for(const chrono::duration<_Rep, _Period>& __d)
{return try_lock_until(chrono::steady_clock::now() + __d);} {return try_lock_until(chrono::steady_clock::now() + __d);}
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t); bool try_lock_until(const chrono::time_point<_Clock, _Duration>& __t);
void unlock() _NOEXCEPT; void unlock();
}; };
template <class _Clock, class _Duration> template <class _Clock, class _Duration>
@@ -425,27 +421,25 @@ lock(_L0& __l0, _L1& __l1, _L2& __l2, _L3& ...__l3)
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_TYPE_VIS once_flag; struct once_flag;
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template<class _Callable, class... _Args> template<class _Callable, class... _Args>
_LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable&&, _Args&&...);
void call_once(once_flag&, _Callable&&, _Args&&...);
#else // _LIBCPP_HAS_NO_VARIADICS #else // _LIBCPP_HAS_NO_VARIADICS
template<class _Callable> template<class _Callable>
_LIBCPP_INLINE_VISIBILITY void call_once(once_flag&, _Callable);
void call_once(once_flag&, _Callable);
#endif // _LIBCPP_HAS_NO_VARIADICS #endif // _LIBCPP_HAS_NO_VARIADICS
struct _LIBCPP_TYPE_VIS once_flag struct _LIBCPP_VISIBLE once_flag
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR // constexpr
once_flag() _NOEXCEPT : __state_(0) {} once_flag() {}
private: private:
once_flag(const once_flag&); // = delete; once_flag(const once_flag&); // = delete;
@@ -466,23 +460,23 @@ private:
#ifndef _LIBCPP_HAS_NO_VARIADICS #ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Fp> template <class _F>
class __call_once_param class __call_once_param
{ {
_Fp __f_; _F __f_;
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {} explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
#else #else
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _Fp& __f) : __f_(__f) {} explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void operator()() void operator()()
{ {
typedef typename __make_tuple_indices<tuple_size<_Fp>::value, 1>::type _Index; typedef typename __make_tuple_indices<tuple_size<_F>::value, 1>::type _Index;
__execute(_Index()); __execute(_Index());
} }
@@ -497,17 +491,17 @@ private:
#else #else
template <class _Fp> template <class _F>
class __call_once_param class __call_once_param
{ {
_Fp __f_; _F __f_;
public: public:
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(_Fp&& __f) : __f_(_VSTD::move(__f)) {} explicit __call_once_param(_F&& __f) : __f_(_VSTD::move(__f)) {}
#else #else
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
explicit __call_once_param(const _Fp& __f) : __f_(__f) {} explicit __call_once_param(const _F& __f) : __f_(__f) {}
#endif #endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -519,11 +513,11 @@ public:
#endif #endif
template <class _Fp> template <class _F>
void void
__call_once_proxy(void* __vp) __call_once_proxy(void* __vp)
{ {
__call_once_param<_Fp>* __p = static_cast<__call_once_param<_Fp>*>(__vp); __call_once_param<_F>* __p = static_cast<__call_once_param<_F>*>(__vp);
(*__p)(); (*__p)();
} }
@@ -536,12 +530,12 @@ inline _LIBCPP_INLINE_VISIBILITY
void void
call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args) call_once(once_flag& __flag, _Callable&& __func, _Args&&... __args)
{ {
if (__flag.__state_ != ~0ul) if (__builtin_expect(__flag.__state_ , ~0ul) != ~0ul)
{ {
typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _Gp; typedef tuple<typename decay<_Callable>::type, typename decay<_Args>::type...> _G;
__call_once_param<_Gp> __p(_Gp(__decay_copy(_VSTD::forward<_Callable>(__func)), __call_once_param<_G> __p(_G(__decay_copy(_VSTD::forward<_Callable>(__func)),
__decay_copy(_VSTD::forward<_Args>(__args))...)); __decay_copy(_VSTD::forward<_Args>(__args))...));
__call_once(__flag.__state_, &__p, &__call_once_proxy<_Gp>); __call_once(__flag.__state_, &__p, &__call_once_proxy<_G>);
} }
} }

View File

@@ -56,9 +56,7 @@ void operator delete[](void* ptr, void*) noexcept;
#include <exception> #include <exception>
#include <cstddef> #include <cstddef>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {
@@ -83,31 +81,31 @@ public:
void __throw_bad_alloc(); // not in C++ spec void __throw_bad_alloc(); // not in C++ spec
struct _LIBCPP_TYPE_VIS nothrow_t {}; struct _LIBCPP_VISIBLE nothrow_t {};
extern _LIBCPP_FUNC_VIS const nothrow_t nothrow; extern _LIBCPP_VISIBLE const nothrow_t nothrow;
typedef void (*new_handler)(); typedef void (*new_handler)();
_LIBCPP_FUNC_VIS new_handler set_new_handler(new_handler) _NOEXCEPT; _LIBCPP_VISIBLE new_handler set_new_handler(new_handler) _NOEXCEPT;
_LIBCPP_FUNC_VIS new_handler get_new_handler() _NOEXCEPT; _LIBCPP_VISIBLE new_handler get_new_handler() _NOEXCEPT;
} // std } // std
_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz) _LIBCPP_VISIBLE void* operator new(std::size_t __sz)
#if !__has_feature(cxx_noexcept) #if !__has_feature(cxx_noexcept)
throw(std::bad_alloc) throw(std::bad_alloc)
#endif #endif
; ;
_LIBCPP_FUNC_VIS void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_VISIBLE void* operator new(std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete(void* __p) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete(void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete(void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz) _LIBCPP_VISIBLE void* operator new[](std::size_t __sz)
#if !__has_feature(cxx_noexcept) #if !__has_feature(cxx_noexcept)
throw(std::bad_alloc) throw(std::bad_alloc)
#endif #endif
; ;
_LIBCPP_FUNC_VIS void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT _NOALIAS; _LIBCPP_VISIBLE void* operator new[](std::size_t __sz, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete[](void* __p) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete[](void* __p) _NOEXCEPT;
_LIBCPP_FUNC_VIS void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT; _LIBCPP_VISIBLE void operator delete[](void* __p, const std::nothrow_t&) _NOEXCEPT;
_LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new (std::size_t, void* __p) _NOEXCEPT {return __p;}
_LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;} _LIBCPP_INLINE_VISIBILITY inline void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}

View File

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

View File

@@ -133,14 +133,12 @@ template <class charT, class traits, class T>
#include <iterator> #include <iterator>
#include <bitset> #include <bitset>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_ostream class _LIBCPP_VISIBLE basic_ostream
: virtual public basic_ios<_CharT, _Traits> : virtual public basic_ios<_CharT, _Traits>
{ {
public: public:
@@ -169,7 +167,7 @@ protected:
public: public:
// 27.7.2.4 Prefix/suffix: // 27.7.2.4 Prefix/suffix:
class _LIBCPP_TYPE_VIS sentry; class sentry;
// 27.7.2.6 Formatted output: // 27.7.2.6 Formatted output:
basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&)); basic_ostream& operator<<(basic_ostream& (*__pf)(basic_ostream&));
@@ -207,7 +205,7 @@ protected:
}; };
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_ostream<_CharT, _Traits>::sentry class _LIBCPP_VISIBLE basic_ostream<_CharT, _Traits>::sentry
{ {
bool __ok_; bool __ok_;
basic_ostream<_CharT, _Traits>& __os_; basic_ostream<_CharT, _Traits>& __os_;
@@ -220,7 +218,7 @@ public:
~sentry(); ~sentry();
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT // explicit
operator bool() const {return __ok_;} operator bool() const {return __ok_;}
}; };
@@ -342,11 +340,11 @@ basic_ostream<_CharT, _Traits>::operator<<(basic_streambuf<char_type, traits_typ
try try
{ {
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
typedef istreambuf_iterator<_CharT, _Traits> _Ip; typedef istreambuf_iterator<_CharT, _Traits> _I;
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
_Ip __i(__sb); _I __i(__sb);
_Ip __eof; _I __eof;
_Op __o(*this); _O __o(*this);
size_t __c = 0; size_t __c = 0;
for (; __i != __eof; ++__i, ++__o, ++__c) for (; __i != __eof; ++__i, ++__o, ++__c)
{ {
@@ -388,8 +386,8 @@ basic_ostream<_CharT, _Traits>::operator<<(bool __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -415,8 +413,8 @@ basic_ostream<_CharT, _Traits>::operator<<(short __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned short>(__n)) : static_cast<long>(static_cast<unsigned short>(__n)) :
@@ -444,8 +442,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned short __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -471,8 +469,8 @@ basic_ostream<_CharT, _Traits>::operator<<(int __n)
if (__s) if (__s)
{ {
ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield; ios_base::fmtflags __flags = ios_base::flags() & ios_base::basefield;
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), if (__f.put(*this, *this, this->fill(),
__flags == ios_base::oct || __flags == ios_base::hex ? __flags == ios_base::oct || __flags == ios_base::hex ?
static_cast<long>(static_cast<unsigned int>(__n)) : static_cast<long>(static_cast<unsigned int>(__n)) :
@@ -500,8 +498,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned int __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<unsigned long>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -526,8 +524,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -552,8 +550,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -578,8 +576,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -604,8 +602,8 @@ basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -630,8 +628,8 @@ basic_ostream<_CharT, _Traits>::operator<<(float __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed()) if (__f.put(*this, *this, this->fill(), static_cast<double>(__n)).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -656,8 +654,8 @@ basic_ostream<_CharT, _Traits>::operator<<(double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -682,8 +680,8 @@ basic_ostream<_CharT, _Traits>::operator<<(long double __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -708,8 +706,8 @@ basic_ostream<_CharT, _Traits>::operator<<(const void* __n)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _Fp; typedef num_put<char_type, ostreambuf_iterator<char_type, traits_type> > _F;
const _Fp& __f = use_facet<_Fp>(this->getloc()); const _F& __f = use_facet<_F>(this->getloc());
if (__f.put(*this, *this, this->fill(), __n).failed()) if (__f.put(*this, *this, this->fill(), __n).failed())
this->setstate(ios_base::badbit | ios_base::failbit); this->setstate(ios_base::badbit | ios_base::failbit);
} }
@@ -734,8 +732,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, _CharT __c)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -767,8 +765,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, char __cn)
if (__s) if (__s)
{ {
_CharT __c = __os.widen(__cn); _CharT __c = __os.widen(__cn);
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -799,8 +797,8 @@ operator<<(basic_ostream<char, _Traits>& __os, char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
&__c, &__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
&__c + 1 : &__c + 1 :
@@ -831,8 +829,8 @@ operator<<(basic_ostream<char, _Traits>& __os, signed char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -863,8 +861,8 @@ operator<<(basic_ostream<char, _Traits>& __os, unsigned char __c)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(char*)&__c, (char*)&__c,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(char*)&__c + 1 : (char*)&__c + 1 :
@@ -895,9 +893,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const _CharT* __str)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -928,7 +926,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = char_traits<char>::length(__strn); size_t __len = char_traits<char>::length(__strn);
const int __bs = 100; const int __bs = 100;
_CharT __wbb[__bs]; _CharT __wbb[__bs];
@@ -943,7 +941,7 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const char* __strn)
} }
for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p) for (_CharT* __p = __wb; *__strn != '\0'; ++__strn, ++__p)
*__p = __os.widen(*__strn); *__p = __os.widen(*__strn);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__wb, __wb,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__wb + __len : __wb + __len :
@@ -974,9 +972,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length(__str); size_t __len = _Traits::length(__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str, __str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str + __len : __str + __len :
@@ -1007,9 +1005,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const signed char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1040,9 +1038,9 @@ operator<<(basic_ostream<char, _Traits>& __os, const unsigned char* __str)
typename basic_ostream<char, _Traits>::sentry __s(__os); typename basic_ostream<char, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<char, _Traits> _Ip; typedef ostreambuf_iterator<char, _Traits> _I;
size_t __len = _Traits::length((const char*)__str); size_t __len = _Traits::length((const char*)__str);
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
(const char*)__str, (const char*)__str,
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
(const char*)__str + __len : (const char*)__str + __len :
@@ -1073,8 +1071,8 @@ basic_ostream<_CharT, _Traits>::put(char_type __c)
sentry __s(*this); sentry __s(*this);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Op; typedef ostreambuf_iterator<_CharT, _Traits> _O;
_Op __o(*this); _O __o(*this);
*__o = __c; *__o = __c;
if (__o.failed()) if (__o.failed())
this->setstate(ios_base::badbit); this->setstate(ios_base::badbit);
@@ -1100,8 +1098,17 @@ basic_ostream<_CharT, _Traits>::write(const char_type* __s, streamsize __n)
sentry __sen(*this); sentry __sen(*this);
if (__sen && __n) if (__sen && __n)
{ {
if (this->rdbuf()->sputn(__s, __n) != __n) typedef ostreambuf_iterator<_CharT, _Traits> _O;
_O __o(*this);
for (; __n; --__n, ++__o, ++__s)
{
*__o = *__s;
if (__o.failed())
{
this->setstate(ios_base::badbit); this->setstate(ios_base::badbit);
break;
}
}
} }
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
} }
@@ -1209,12 +1216,12 @@ typename enable_if
< <
!is_lvalue_reference<_Stream>::value && !is_lvalue_reference<_Stream>::value &&
is_base_of<ios_base, _Stream>::value, is_base_of<ios_base, _Stream>::value,
_Stream&& _Stream&
>::type >::type
operator<<(_Stream&& __os, const _Tp& __x) operator<<(_Stream&& __os, const _Tp& __x)
{ {
__os << __x; __os << __x;
return _VSTD::move(__os); return __os;
} }
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1231,9 +1238,9 @@ operator<<(basic_ostream<_CharT, _Traits>& __os,
typename basic_ostream<_CharT, _Traits>::sentry __s(__os); typename basic_ostream<_CharT, _Traits>::sentry __s(__os);
if (__s) if (__s)
{ {
typedef ostreambuf_iterator<_CharT, _Traits> _Ip; typedef ostreambuf_iterator<_CharT, _Traits> _I;
size_t __len = __str.size(); size_t __len = __str.size();
if (__pad_and_output(_Ip(__os), if (__pad_and_output(_I(__os),
__str.data(), __str.data(),
(__os.flags() & ios_base::adjustfield) == ios_base::left ? (__os.flags() & ios_base::adjustfield) == ios_base::left ?
__str.data() + __len : __str.data() + __len :
@@ -1261,10 +1268,10 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __ec)
return __os << __ec.category().name() << ':' << __ec.value(); return __os << __ec.category().name() << ':' << __ec.value();
} }
template<class _CharT, class _Traits, class _Yp> template<class _CharT, class _Traits, class _Y>
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
basic_ostream<_CharT, _Traits>& basic_ostream<_CharT, _Traits>&
operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Yp> const& __p) operator<<(basic_ostream<_CharT, _Traits>& __os, shared_ptr<_Y> const& __p)
{ {
return __os << __p.get(); return __os << __p.get();
} }
@@ -1278,8 +1285,8 @@ operator<<(basic_ostream<_CharT, _Traits>& __os, const bitset<_Size>& __x)
use_facet<ctype<_CharT> >(__os.getloc()).widen('1')); use_facet<ctype<_CharT> >(__os.getloc()).widen('1'));
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<char>) extern template class basic_ostream<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ostream<wchar_t>) extern template class basic_ostream<wchar_t>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -171,26 +171,22 @@ template <class T, class Container, class Compare>
#include <functional> #include <functional>
#include <algorithm> #include <algorithm>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS queue; template <class _Tp, class _Container> class queue;
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator==(const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y); operator< (const queue<_Tp, _Container>& __x,const queue<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> > template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_TYPE_VIS queue class _LIBCPP_VISIBLE queue
{ {
public: public:
typedef _Container container_type; typedef _Container container_type;
@@ -376,14 +372,14 @@ swap(queue<_Tp, _Container>& __x, queue<_Tp, _Container>& __y)
} }
template <class _Tp, class _Container, class _Alloc> template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<queue<_Tp, _Container>, _Alloc> struct _LIBCPP_VISIBLE uses_allocator<queue<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc> : public uses_allocator<_Container, _Alloc>
{ {
}; };
template <class _Tp, class _Container = vector<_Tp>, template <class _Tp, class _Container = vector<_Tp>,
class _Compare = less<typename _Container::value_type> > class _Compare = less<typename _Container::value_type> >
class _LIBCPP_TYPE_VIS priority_queue class _LIBCPP_VISIBLE priority_queue
{ {
public: public:
typedef _Container container_type; typedef _Container container_type;
@@ -707,7 +703,7 @@ swap(priority_queue<_Tp, _Container, _Compare>& __x,
} }
template <class _Tp, class _Container, class _Compare, class _Alloc> template <class _Tp, class _Container, class _Compare, class _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc> struct _LIBCPP_VISIBLE uses_allocator<priority_queue<_Tp, _Container, _Compare>, _Alloc>
: public uses_allocator<_Container, _Alloc> : public uses_allocator<_Container, _Alloc>
{ {
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -70,11 +70,7 @@ typedef ratio<1000000000000000000000000, 1> yotta; // not supported
#include <climits> #include <climits>
#include <type_traits> #include <type_traits>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -92,12 +88,6 @@ struct __static_gcd<_Xp, 0>
static const intmax_t value = _Xp; static const intmax_t value = _Xp;
}; };
template <>
struct __static_gcd<0, 0>
{
static const intmax_t value = 1;
};
// __static_lcm // __static_lcm
template <intmax_t _Xp, intmax_t _Yp> template <intmax_t _Xp, intmax_t _Yp>
@@ -231,7 +221,7 @@ public:
}; };
template <intmax_t _Num, intmax_t _Den = 1> template <intmax_t _Num, intmax_t _Den = 1>
class _LIBCPP_TYPE_VIS ratio class _LIBCPP_VISIBLE ratio
{ {
static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range"); static_assert(__static_abs<_Num>::value >= 0, "ratio numerator is out of range");
static_assert(_Den != 0, "ratio divide by 0"); static_assert(_Den != 0, "ratio divide by 0");
@@ -292,7 +282,7 @@ template <class _R1, class _R2> using ratio_multiply
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_multiply struct _LIBCPP_VISIBLE ratio_multiply
: public __ratio_multiply<_R1, _R2>::type {}; : public __ratio_multiply<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -319,7 +309,7 @@ template <class _R1, class _R2> using ratio_divide
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_divide struct _LIBCPP_VISIBLE ratio_divide
: public __ratio_divide<_R1, _R2>::type {}; : public __ratio_divide<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -354,7 +344,7 @@ template <class _R1, class _R2> using ratio_add
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_add struct _LIBCPP_VISIBLE ratio_add
: public __ratio_add<_R1, _R2>::type {}; : public __ratio_add<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -389,7 +379,7 @@ template <class _R1, class _R2> using ratio_subtract
#else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_subtract struct _LIBCPP_VISIBLE ratio_subtract
: public __ratio_subtract<_R1, _R2>::type {}; : public __ratio_subtract<_R1, _R2>::type {};
#endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES #endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES
@@ -397,11 +387,11 @@ struct _LIBCPP_TYPE_VIS ratio_subtract
// ratio_equal // ratio_equal
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_equal struct _LIBCPP_VISIBLE ratio_equal
: public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {}; : public integral_constant<bool, _R1::num == _R2::num && _R1::den == _R2::den> {};
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_not_equal struct _LIBCPP_VISIBLE ratio_not_equal
: public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {}; : public integral_constant<bool, !ratio_equal<_R1, _R2>::value> {};
// ratio_less // ratio_less
@@ -414,27 +404,27 @@ struct __ratio_less1
static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2; static const bool value = _Odd ? _Q2 < _Q1 : _Q1 < _Q2;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp> template <class _R1, class _R2, bool _Odd, intmax_t _Q>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, 0> struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, 0>
{ {
static const bool value = false; static const bool value = false;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M2> template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, 0, _Qp, _M2> struct __ratio_less1<_R1, _R2, _Odd, _Q, 0, _Q, _M2>
{ {
static const bool value = !_Odd; static const bool value = !_Odd;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1> template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, 0> struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, 0>
{ {
static const bool value = _Odd; static const bool value = _Odd;
}; };
template <class _R1, class _R2, bool _Odd, intmax_t _Qp, intmax_t _M1, template <class _R1, class _R2, bool _Odd, intmax_t _Q, intmax_t _M1,
intmax_t _M2> intmax_t _M2>
struct __ratio_less1<_R1, _R2, _Odd, _Qp, _M1, _Qp, _M2> struct __ratio_less1<_R1, _R2, _Odd, _Q, _M1, _Q, _M2>
{ {
static const bool value = __ratio_less1<ratio<_R1::den, _M1>, static const bool value = __ratio_less1<ratio<_R1::den, _M1>,
ratio<_R2::den, _M2>, !_Odd>::value; ratio<_R2::den, _M2>, !_Odd>::value;
@@ -460,19 +450,19 @@ struct __ratio_less<_R1, _R2, -1LL, -1LL>
}; };
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_less struct _LIBCPP_VISIBLE ratio_less
: public integral_constant<bool, __ratio_less<_R1, _R2>::value> {}; : public integral_constant<bool, __ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_less_equal struct _LIBCPP_VISIBLE ratio_less_equal
: public integral_constant<bool, !ratio_less<_R2, _R1>::value> {}; : public integral_constant<bool, !ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_greater struct _LIBCPP_VISIBLE ratio_greater
: public integral_constant<bool, ratio_less<_R2, _R1>::value> {}; : public integral_constant<bool, ratio_less<_R2, _R1>::value> {};
template <class _R1, class _R2> template <class _R1, class _R2>
struct _LIBCPP_TYPE_VIS ratio_greater_equal struct _LIBCPP_VISIBLE ratio_greater_equal
: public integral_constant<bool, !ratio_less<_R1, _R2>::value> {}; : public integral_constant<bool, !ratio_less<_R1, _R2>::value> {};
template <class _R1, class _R2> template <class _R1, class _R2>

View File

@@ -147,7 +147,7 @@ public:
explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript); explicit basic_regex(const charT* p, flag_type f = regex_constants::ECMAScript);
basic_regex(const charT* p, size_t len, flag_type f); basic_regex(const charT* p, size_t len, flag_type f);
basic_regex(const basic_regex&); basic_regex(const basic_regex&);
basic_regex(basic_regex&&) noexcept; basic_regex(basic_regex&&);
template <class ST, class SA> template <class ST, class SA>
explicit basic_regex(const basic_string<charT, ST, SA>& p, explicit basic_regex(const basic_string<charT, ST, SA>& p,
flag_type f = regex_constants::ECMAScript); flag_type f = regex_constants::ECMAScript);
@@ -159,7 +159,7 @@ public:
~basic_regex(); ~basic_regex();
basic_regex& operator=(const basic_regex&); basic_regex& operator=(const basic_regex&);
basic_regex& operator=(basic_regex&&) noexcept; basic_regex& operator=(basic_regex&&);
basic_regex& operator=(const charT* ptr); basic_regex& operator=(const charT* ptr);
basic_regex& operator=(initializer_list<charT> il); basic_regex& operator=(initializer_list<charT> il);
template <class ST, class SA> template <class ST, class SA>
@@ -167,7 +167,7 @@ public:
// assign: // assign:
basic_regex& assign(const basic_regex& that); basic_regex& assign(const basic_regex& that);
basic_regex& assign(basic_regex&& that) noexcept; basic_regex& assign(basic_regex&& that);
basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript); basic_regex& assign(const charT* ptr, flag_type f = regex_constants::ECMAScript);
basic_regex& assign(const charT* p, size_t len, flag_type f); basic_regex& assign(const charT* p, size_t len, flag_type f);
template <class string_traits, class A> template <class string_traits, class A>
@@ -449,7 +449,7 @@ public:
// construct/copy/destroy: // construct/copy/destroy:
explicit match_results(const Allocator& a = Allocator()); explicit match_results(const Allocator& a = Allocator());
match_results(const match_results& m); match_results(const match_results& m);
match_results(match_results&& m) noexcept; match_results(match_results&& m);
match_results& operator=(const match_results& m); match_results& operator=(const match_results& m);
match_results& operator=(match_results&& m); match_results& operator=(match_results&& m);
~match_results(); ~match_results();
@@ -732,11 +732,7 @@ typedef regex_token_iterator<wstring::const_iterator> wsregex_token_iterator;
#include <vector> #include <vector>
#include <deque> #include <deque>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -760,15 +756,15 @@ enum syntax_option_type
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
syntax_option_type syntax_option_type
operator~(syntax_option_type __x) operator~(syntax_option_type __x)
{ {
return syntax_option_type(~int(__x) & 0x1FF); return syntax_option_type(~int(__x));
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
syntax_option_type syntax_option_type
operator&(syntax_option_type __x, syntax_option_type __y) operator&(syntax_option_type __x, syntax_option_type __y)
{ {
@@ -776,7 +772,7 @@ operator&(syntax_option_type __x, syntax_option_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
syntax_option_type syntax_option_type
operator|(syntax_option_type __x, syntax_option_type __y) operator|(syntax_option_type __x, syntax_option_type __y)
{ {
@@ -784,7 +780,7 @@ operator|(syntax_option_type __x, syntax_option_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
syntax_option_type syntax_option_type
operator^(syntax_option_type __x, syntax_option_type __y) operator^(syntax_option_type __x, syntax_option_type __y)
{ {
@@ -792,6 +788,7 @@ operator^(syntax_option_type __x, syntax_option_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type& syntax_option_type&
operator&=(syntax_option_type& __x, syntax_option_type __y) operator&=(syntax_option_type& __x, syntax_option_type __y)
{ {
@@ -800,6 +797,7 @@ operator&=(syntax_option_type& __x, syntax_option_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type& syntax_option_type&
operator|=(syntax_option_type& __x, syntax_option_type __y) operator|=(syntax_option_type& __x, syntax_option_type __y)
{ {
@@ -808,6 +806,7 @@ operator|=(syntax_option_type& __x, syntax_option_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
syntax_option_type& syntax_option_type&
operator^=(syntax_option_type& __x, syntax_option_type __y) operator^=(syntax_option_type& __x, syntax_option_type __y)
{ {
@@ -836,15 +835,15 @@ enum match_flag_type
}; };
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
match_flag_type match_flag_type
operator~(match_flag_type __x) operator~(match_flag_type __x)
{ {
return match_flag_type(~int(__x) & 0x0FFF); return match_flag_type(~int(__x));
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
match_flag_type match_flag_type
operator&(match_flag_type __x, match_flag_type __y) operator&(match_flag_type __x, match_flag_type __y)
{ {
@@ -852,7 +851,7 @@ operator&(match_flag_type __x, match_flag_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
match_flag_type match_flag_type
operator|(match_flag_type __x, match_flag_type __y) operator|(match_flag_type __x, match_flag_type __y)
{ {
@@ -860,7 +859,7 @@ operator|(match_flag_type __x, match_flag_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR /*constexpr*/
match_flag_type match_flag_type
operator^(match_flag_type __x, match_flag_type __y) operator^(match_flag_type __x, match_flag_type __y)
{ {
@@ -868,6 +867,7 @@ operator^(match_flag_type __x, match_flag_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type& match_flag_type&
operator&=(match_flag_type& __x, match_flag_type __y) operator&=(match_flag_type& __x, match_flag_type __y)
{ {
@@ -876,6 +876,7 @@ operator&=(match_flag_type& __x, match_flag_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type& match_flag_type&
operator|=(match_flag_type& __x, match_flag_type __y) operator|=(match_flag_type& __x, match_flag_type __y)
{ {
@@ -884,6 +885,7 @@ operator|=(match_flag_type& __x, match_flag_type __y)
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
/*constexpr*/
match_flag_type& match_flag_type&
operator^=(match_flag_type& __x, match_flag_type __y) operator^=(match_flag_type& __x, match_flag_type __y)
{ {
@@ -925,7 +927,7 @@ public:
}; };
template <class _CharT> template <class _CharT>
struct _LIBCPP_TYPE_VIS regex_traits struct _LIBCPP_VISIBLE regex_traits
{ {
public: public:
typedef _CharT char_type; typedef _CharT char_type;
@@ -1008,10 +1010,6 @@ private:
int __value(wchar_t __ch, int __radix) const; int __value(wchar_t __ch, int __radix) const;
}; };
template <class _CharT>
const typename regex_traits<_CharT>::char_class_type
regex_traits<_CharT>::__regex_word;
template <class _CharT> template <class _CharT>
regex_traits<_CharT>::regex_traits() regex_traits<_CharT>::regex_traits()
{ {
@@ -1235,11 +1233,11 @@ regex_traits<_CharT>::__value(wchar_t __ch, int __radix) const
template <class _CharT> class __node; template <class _CharT> class __node;
template <class _BidirectionalIterator> class _LIBCPP_TYPE_VIS sub_match; template <class _BidirectionalIterator> class sub_match;
template <class _BidirectionalIterator, template <class _BidirectionalIterator,
class _Allocator = allocator<sub_match<_BidirectionalIterator> > > class _Allocator = allocator<sub_match<_BidirectionalIterator> > >
class _LIBCPP_TYPE_VIS match_results; class match_results;
template <class _CharT> template <class _CharT>
struct __state struct __state
@@ -2415,7 +2413,7 @@ __exit:
template <class _CharT, class _Traits> class __lookahead; template <class _CharT, class _Traits> class __lookahead;
template <class _CharT, class _Traits = regex_traits<_CharT> > template <class _CharT, class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS basic_regex class _LIBCPP_VISIBLE basic_regex
{ {
public: public:
// types: // types:
@@ -2437,16 +2435,16 @@ private:
public: public:
// constants: // constants:
static const regex_constants::syntax_option_type icase = regex_constants::icase; static const/*expr*/ regex_constants::syntax_option_type icase = regex_constants::icase;
static const regex_constants::syntax_option_type nosubs = regex_constants::nosubs; static const/*expr*/ regex_constants::syntax_option_type nosubs = regex_constants::nosubs;
static const regex_constants::syntax_option_type optimize = regex_constants::optimize; static const/*expr*/ regex_constants::syntax_option_type optimize = regex_constants::optimize;
static const regex_constants::syntax_option_type collate = regex_constants::collate; static const/*expr*/ regex_constants::syntax_option_type collate = regex_constants::collate;
static const regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript; static const/*expr*/ regex_constants::syntax_option_type ECMAScript = regex_constants::ECMAScript;
static const regex_constants::syntax_option_type basic = regex_constants::basic; static const/*expr*/ regex_constants::syntax_option_type basic = regex_constants::basic;
static const regex_constants::syntax_option_type extended = regex_constants::extended; static const/*expr*/ regex_constants::syntax_option_type extended = regex_constants::extended;
static const regex_constants::syntax_option_type awk = regex_constants::awk; static const/*expr*/ regex_constants::syntax_option_type awk = regex_constants::awk;
static const regex_constants::syntax_option_type grep = regex_constants::grep; static const/*expr*/ regex_constants::syntax_option_type grep = regex_constants::grep;
static const regex_constants::syntax_option_type egrep = regex_constants::egrep; static const/*expr*/ regex_constants::syntax_option_type egrep = regex_constants::egrep;
// construct/copy/destroy: // construct/copy/destroy:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -2510,11 +2508,6 @@ public:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const basic_regex& __that) basic_regex& assign(const basic_regex& __that)
{return *this = __that;} {return *this = __that;}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_INLINE_VISIBILITY
basic_regex& assign(basic_regex&& __that) _NOEXCEPT
{return *this = _VSTD::move(__that);}
#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript) basic_regex& assign(const value_type* __p, flag_type __f = regex_constants::ECMAScript)
{return assign(__p, __p + __traits_.length(__p), __f);} {return assign(__p, __p + __traits_.length(__p), __f);}
@@ -2566,7 +2559,6 @@ public:
{ {
__member_init(__f); __member_init(__f);
__parse(__first, __last); __parse(__first, __last);
return *this;
} }
#ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #ifndef _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
@@ -2798,75 +2790,54 @@ private:
match_results<const _CharT*, _Allocator>& __m, match_results<const _CharT*, _Allocator>& __m,
regex_constants::match_flag_type __flags, bool) const; regex_constants::match_flag_type __flags, bool) const;
template <class _Bp, class _Ap, class _Cp, class _Tp> template <class _B, class _A, class _C, class _T>
friend friend
bool bool
regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_search(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type); regex_constants::match_flag_type);
template <class _Ap, class _Cp, class _Tp> template <class _A, class _C, class _T>
friend friend
bool bool
regex_search(const _Cp*, const _Cp*, match_results<const _Cp*, _Ap>&, regex_search(const _C*, const _C*, match_results<const _C*, _A>&,
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); const basic_regex<_C, _T>&, regex_constants::match_flag_type);
template <class _Bp, class _Cp, class _Tp> template <class _B, class _C, class _T>
friend friend
bool bool
regex_search(_Bp, _Bp, const basic_regex<_Cp, _Tp>&, regex_search(_B, _B, const basic_regex<_C, _T>&,
regex_constants::match_flag_type); regex_constants::match_flag_type);
template <class _Cp, class _Tp> template <class _C, class _T>
friend friend
bool bool
regex_search(const _Cp*, const _Cp*, regex_search(const _C*, const _C*,
const basic_regex<_Cp, _Tp>&, regex_constants::match_flag_type); const basic_regex<_C, _T>&, regex_constants::match_flag_type);
template <class _Cp, class _Ap, class _Tp> template <class _C, class _A, class _T>
friend friend
bool bool
regex_search(const _Cp*, match_results<const _Cp*, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_search(const _C*, match_results<const _C*, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type); regex_constants::match_flag_type);
template <class _ST, class _SA, class _Cp, class _Tp> template <class _ST, class _SA, class _C, class _T>
friend friend
bool bool
regex_search(const basic_string<_Cp, _ST, _SA>& __s, regex_search(const basic_string<_C, _ST, _SA>& __s,
const basic_regex<_Cp, _Tp>& __e, const basic_regex<_C, _T>& __e,
regex_constants::match_flag_type __flags); regex_constants::match_flag_type __flags);
template <class _ST, class _SA, class _Ap, class _Cp, class _Tp> template <class _ST, class _SA, class _A, class _C, class _T>
friend friend
bool bool
regex_search(const basic_string<_Cp, _ST, _SA>& __s, regex_search(const basic_string<_C, _ST, _SA>& __s,
match_results<typename basic_string<_Cp, _ST, _SA>::const_iterator, _Ap>&, match_results<typename basic_string<_C, _ST, _SA>::const_iterator, _A>&,
const basic_regex<_Cp, _Tp>& __e, const basic_regex<_C, _T>& __e,
regex_constants::match_flag_type __flags); regex_constants::match_flag_type __flags);
template <class, class> friend class __lookahead; template <class, class> friend class __lookahead;
}; };
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::icase;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::nosubs;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::optimize;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::collate;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::ECMAScript;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::basic;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::extended;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::awk;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::grep;
template <class _CharT, class _Traits>
const regex_constants::syntax_option_type basic_regex<_CharT, _Traits>::egrep;
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
void void
basic_regex<_CharT, _Traits>::swap(basic_regex& __r) basic_regex<_CharT, _Traits>::swap(basic_regex& __r)
@@ -4429,7 +4400,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd); __sum = 16 * __sum + __hd;
++__first; ++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last) if (__first == __last)
@@ -4440,7 +4411,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd); __sum = 16 * __sum + __hd;
// drop through // drop through
case 'x': case 'x':
++__first; ++__first;
@@ -4453,7 +4424,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd); __sum = 16 * __sum + __hd;
++__first; ++__first;
#ifndef _LIBCPP_NO_EXCEPTIONS #ifndef _LIBCPP_NO_EXCEPTIONS
if (__first == __last) if (__first == __last)
@@ -4464,7 +4435,7 @@ basic_regex<_CharT, _Traits>::__parse_character_escape(_ForwardIterator __first,
if (__hd == -1) if (__hd == -1)
throw regex_error(regex_constants::error_escape); throw regex_error(regex_constants::error_escape);
#endif // _LIBCPP_NO_EXCEPTIONS #endif // _LIBCPP_NO_EXCEPTIONS
__sum = 16 * __sum + static_cast<unsigned>(__hd); __sum = 16 * __sum + __hd;
if (__str) if (__str)
*__str = _CharT(__sum); *__str = _CharT(__sum);
else else
@@ -4753,7 +4724,7 @@ typedef basic_regex<wchar_t> wregex;
// sub_match // sub_match
template <class _BidirectionalIterator> template <class _BidirectionalIterator>
class _LIBCPP_TYPE_VIS sub_match class _LIBCPP_VISIBLE sub_match
: public pair<_BidirectionalIterator, _BidirectionalIterator> : public pair<_BidirectionalIterator, _BidirectionalIterator>
{ {
public: public:
@@ -4765,7 +4736,7 @@ public:
bool matched; bool matched;
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR sub_match() : matched() {} /*constexpr*/ sub_match() : matched() {}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
difference_type length() const difference_type length() const
@@ -5176,7 +5147,7 @@ operator<<(basic_ostream<_CharT, _ST>& __os, const sub_match<_BiIter>& __m)
} }
template <class _BidirectionalIterator, class _Allocator> template <class _BidirectionalIterator, class _Allocator>
class _LIBCPP_TYPE_VIS match_results class _LIBCPP_VISIBLE match_results
{ {
public: public:
typedef _Allocator allocator_type; typedef _Allocator allocator_type;
@@ -5288,12 +5259,12 @@ public:
// swap: // swap:
void swap(match_results& __m); void swap(match_results& __m);
template <class _Bp, class _Ap> template <class _B, class _A>
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l, void __assign(_BidirectionalIterator __f, _BidirectionalIterator __l,
const match_results<_Bp, _Ap>& __m, bool __no_update_pos) const match_results<_B, _A>& __m, bool __no_update_pos)
{ {
_Bp __mf = __m.prefix().first; _B __mf = __m.prefix().first;
__matches_.resize(__m.size()); __matches_.resize(__m.size());
for (size_type __i = 0; __i < __matches_.size(); ++__i) for (size_type __i = 0; __i < __matches_.size(); ++__i)
{ {
@@ -5322,16 +5293,16 @@ private:
template <class, class> friend class basic_regex; template <class, class> friend class basic_regex;
template <class _Bp, class _Ap, class _Cp, class _Tp> template <class _B, class _A, class _C, class _T>
friend friend
bool bool
regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, const basic_regex<_Cp, _Tp>&, regex_match(_B, _B, match_results<_B, _A>&, const basic_regex<_C, _T>&,
regex_constants::match_flag_type); regex_constants::match_flag_type);
template <class _Bp, class _Ap> template <class _B, class _A>
friend friend
bool bool
operator==(const match_results<_Bp, _Ap>&, const match_results<_Bp, _Ap>&); operator==(const match_results<_B, _A>&, const match_results<_B, _A>&);
template <class, class> friend class __lookahead; template <class, class> friend class __lookahead;
}; };
@@ -5521,6 +5492,8 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
regex_constants::match_flag_type __flags, bool __at_first) const regex_constants::match_flag_type __flags, bool __at_first) const
{ {
vector<__state> __states; vector<__state> __states;
ptrdiff_t __j = 0;
ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get(); __node* __st = __start_.get();
if (__st) if (__st)
{ {
@@ -5534,6 +5507,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_ecma(
__states.back().__node_ = __st; __states.back().__node_ = __st;
__states.back().__flags_ = __flags; __states.back().__flags_ = __flags;
__states.back().__at_first_ = __at_first; __states.back().__at_first_ = __at_first;
bool __matched = false;
do do
{ {
__state& __s = __states.back(); __state& __s = __states.back();
@@ -5585,7 +5559,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
{ {
deque<__state> __states; deque<__state> __states;
ptrdiff_t __highest_j = 0; ptrdiff_t __highest_j = 0;
ptrdiff_t _Np = _VSTD::distance(__first, __last); ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get(); __node* __st = __start_.get();
if (__st) if (__st)
{ {
@@ -5610,7 +5584,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_nosubs(
if (!__matched || __highest_j < __s.__current_ - __s.__first_) if (!__matched || __highest_j < __s.__current_ - __s.__first_)
__highest_j = __s.__current_ - __s.__first_; __highest_j = __s.__current_ - __s.__first_;
__matched = true; __matched = true;
if (__highest_j == _Np) if (__highest_j == _N)
__states.clear(); __states.clear();
else else
__states.pop_back(); __states.pop_back();
@@ -5665,7 +5639,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__state __best_state; __state __best_state;
ptrdiff_t __j = 0; ptrdiff_t __j = 0;
ptrdiff_t __highest_j = 0; ptrdiff_t __highest_j = 0;
ptrdiff_t _Np = _VSTD::distance(__first, __last); ptrdiff_t _N = _VSTD::distance(__first, __last);
__node* __st = __start_.get(); __node* __st = __start_.get();
if (__st) if (__st)
{ {
@@ -5695,7 +5669,7 @@ basic_regex<_CharT, _Traits>::__match_at_start_posix_subs(
__best_state = __s; __best_state = __s;
} }
__matched = true; __matched = true;
if (__highest_j == _Np) if (__highest_j == _N)
__states.clear(); __states.clear();
else else
__states.pop_back(); __states.pop_back();
@@ -5962,7 +5936,7 @@ regex_match(const basic_string<_CharT, _ST, _SA>& __s,
template <class _BidirectionalIterator, template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type, class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> > class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS regex_iterator class _LIBCPP_VISIBLE regex_iterator
{ {
public: public:
typedef basic_regex<_CharT, _Traits> regex_type; typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6074,7 +6048,7 @@ typedef regex_iterator<wstring::const_iterator> wsregex_iterator;
template <class _BidirectionalIterator, template <class _BidirectionalIterator,
class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type, class _CharT = typename iterator_traits<_BidirectionalIterator>::value_type,
class _Traits = regex_traits<_CharT> > class _Traits = regex_traits<_CharT> >
class _LIBCPP_TYPE_VIS regex_token_iterator class _LIBCPP_VISIBLE regex_token_iterator
{ {
public: public:
typedef basic_regex<_CharT, _Traits> regex_type; typedef basic_regex<_CharT, _Traits> regex_type;
@@ -6110,11 +6084,11 @@ public:
regex_constants::match_flag_type __m = regex_constants::match_flag_type __m =
regex_constants::match_default); regex_constants::match_default);
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <size_t _Np> template <size_t _N>
regex_token_iterator(_BidirectionalIterator __a, regex_token_iterator(_BidirectionalIterator __a,
_BidirectionalIterator __b, _BidirectionalIterator __b,
const regex_type& __re, const regex_type& __re,
const int (&__submatches)[_Np], const int (&__submatches)[_N],
regex_constants::match_flag_type __m = regex_constants::match_flag_type __m =
regex_constants::match_default); regex_constants::match_default);
regex_token_iterator(const regex_token_iterator&); regex_token_iterator(const regex_token_iterator&);
@@ -6216,15 +6190,15 @@ regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
#endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS #endif // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS
template <class _BidirectionalIterator, class _CharT, class _Traits> template <class _BidirectionalIterator, class _CharT, class _Traits>
template <size_t _Np> template <size_t _N>
regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>:: regex_token_iterator<_BidirectionalIterator, _CharT, _Traits>::
regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b, regex_token_iterator(_BidirectionalIterator __a, _BidirectionalIterator __b,
const regex_type& __re, const regex_type& __re,
const int (&__submatches)[_Np], const int (&__submatches)[_N],
regex_constants::match_flag_type __m) regex_constants::match_flag_type __m)
: __position_(__a, __b, __re, __m), : __position_(__a, __b, __re, __m),
_N_(0), _N_(0),
__subs_(__submatches, __submatches + _Np) __subs_(__submatches, __submatches + _N)
{ {
__init(__a, __b); __init(__a, __b);
} }

View File

@@ -106,9 +106,7 @@ template <class OuterA1, class OuterA2, class... InnerAllocs>
#include <__config> #include <__config>
#include <memory> #include <memory>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
@@ -365,7 +363,7 @@ struct __outermost<_Alloc, true>
}; };
template <class _OuterAlloc, class... _InnerAllocs> template <class _OuterAlloc, class... _InnerAllocs>
class _LIBCPP_TYPE_VIS scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...> class _LIBCPP_VISIBLE scoped_allocator_adaptor<_OuterAlloc, _InnerAllocs...>
: public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> : public __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...>
{ {
typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base; typedef __scoped_allocator_storage<_OuterAlloc, _InnerAllocs...> base;

View File

@@ -338,15 +338,13 @@ swap(multiset<Key, Compare, Allocator>& x, multiset<Key, Compare, Allocator>& y)
#include <__tree> #include <__tree>
#include <functional> #include <functional>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _Compare = less<_Key>, template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> > class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS set class _LIBCPP_VISIBLE set
{ {
public: public:
// types: // types:
@@ -685,7 +683,7 @@ swap(set<_Key, _Compare, _Allocator>& __x,
template <class _Key, class _Compare = less<_Key>, template <class _Key, class _Compare = less<_Key>,
class _Allocator = allocator<_Key> > class _Allocator = allocator<_Key> >
class _LIBCPP_TYPE_VIS multiset class _LIBCPP_VISIBLE multiset
{ {
public: public:
// types: // types:

View File

@@ -175,18 +175,14 @@ typedef basic_stringstream<wchar_t> wstringstream;
#include <istream> #include <istream>
#include <string> #include <string>
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
// basic_stringbuf // basic_stringbuf
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS basic_stringbuf class _LIBCPP_VISIBLE basic_stringbuf
: public basic_streambuf<_CharT, _Traits> : public basic_streambuf<_CharT, _Traits>
{ {
public: public:
@@ -260,36 +256,17 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs) basic_stringbuf<_CharT, _Traits, _Allocator>::basic_stringbuf(basic_stringbuf&& __rhs)
: __mode_(__rhs.__mode_) : __mode_(__rhs.__mode_)
{ {
char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __binp = -1; ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
ptrdiff_t __ninp = -1; ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __einp = -1; ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
if (__rhs.eback() != nullptr) ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
{
__binp = __rhs.eback() - __p;
__ninp = __rhs.gptr() - __p;
__einp = __rhs.egptr() - __p;
}
ptrdiff_t __bout = -1;
ptrdiff_t __nout = -1;
ptrdiff_t __eout = -1;
if (__rhs.pbase() != nullptr)
{
__bout = __rhs.pbase() - __p;
__nout = __rhs.pptr() - __p;
__eout = __rhs.epptr() - __p;
}
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__str_ = _VSTD::move(__rhs.__str_); __str_ = _VSTD::move(__rhs.__str_);
__p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
if (__binp != -1) this->setg(__p, __p + __ninp, __p + __einp);
this->setg(__p + __binp, __p + __ninp, __p + __einp); this->setp(__p, __p + __eout);
if (__bout != -1)
{
this->setp(__p + __bout, __p + __eout);
this->pbump(__nout); this->pbump(__nout);
} __hm_ = __p + __hm;
__hm_ = __hm == -1 ? nullptr : __p + __hm;
__p = const_cast<char_type*>(__rhs.__str_.data()); __p = const_cast<char_type*>(__rhs.__str_.data());
__rhs.setg(__p, __p, __p); __rhs.setg(__p, __p, __p);
__rhs.setp(__p, __p); __rhs.setp(__p, __p);
@@ -301,37 +278,18 @@ template <class _CharT, class _Traits, class _Allocator>
basic_stringbuf<_CharT, _Traits, _Allocator>& basic_stringbuf<_CharT, _Traits, _Allocator>&
basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs) basic_stringbuf<_CharT, _Traits, _Allocator>::operator=(basic_stringbuf&& __rhs)
{ {
char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __ninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __binp = -1; ptrdiff_t __einp = __rhs.egptr() - __rhs.eback();
ptrdiff_t __ninp = -1; ptrdiff_t __nout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __einp = -1; ptrdiff_t __eout = __rhs.epptr() - __rhs.pbase();
if (__rhs.eback() != nullptr) ptrdiff_t __hm = __rhs.__hm_ - __rhs.pbase();
{
__binp = __rhs.eback() - __p;
__ninp = __rhs.gptr() - __p;
__einp = __rhs.egptr() - __p;
}
ptrdiff_t __bout = -1;
ptrdiff_t __nout = -1;
ptrdiff_t __eout = -1;
if (__rhs.pbase() != nullptr)
{
__bout = __rhs.pbase() - __p;
__nout = __rhs.pptr() - __p;
__eout = __rhs.epptr() - __p;
}
ptrdiff_t __hm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__str_ = _VSTD::move(__rhs.__str_);
__p = const_cast<char_type*>(__str_.data());
if (__binp != -1)
this->setg(__p + __binp, __p + __ninp, __p + __einp);
if (__bout != -1)
{
this->setp(__p + __bout, __p + __eout);
this->pbump(__nout);
}
__hm_ = __hm == -1 ? nullptr : __p + __hm;
__mode_ = __rhs.__mode_; __mode_ = __rhs.__mode_;
__str_ = _VSTD::move(__rhs.__str_);
char_type* __p = const_cast<char_type*>(__str_.data());
this->setg(__p, __p + __ninp, __p + __einp);
this->setp(__p, __p + __eout);
this->pbump(__nout);
__hm_ = __p + __hm;
__p = const_cast<char_type*>(__rhs.__str_.data()); __p = const_cast<char_type*>(__rhs.__str_.data());
__rhs.setg(__p, __p, __p); __rhs.setg(__p, __p, __p);
__rhs.setp(__p, __p); __rhs.setp(__p, __p);
@@ -346,74 +304,28 @@ template <class _CharT, class _Traits, class _Allocator>
void void
basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs) basic_stringbuf<_CharT, _Traits, _Allocator>::swap(basic_stringbuf& __rhs)
{ {
char_type* __p = const_cast<char_type*>(__rhs.__str_.data()); ptrdiff_t __rninp = __rhs.gptr() - __rhs.eback();
ptrdiff_t __rbinp = -1; ptrdiff_t __reinp = __rhs.egptr() - __rhs.eback();
ptrdiff_t __rninp = -1; ptrdiff_t __rnout = __rhs.pptr() - __rhs.pbase();
ptrdiff_t __reinp = -1; ptrdiff_t __reout = __rhs.epptr() - __rhs.pbase();
if (__rhs.eback() != nullptr) ptrdiff_t __rhm = __rhs.__hm_ - __rhs.pbase();
{ ptrdiff_t __lninp = this->gptr() - this->eback();
__rbinp = __rhs.eback() - __p; ptrdiff_t __leinp = this->egptr() - this->eback();
__rninp = __rhs.gptr() - __p; ptrdiff_t __lnout = this->pptr() - this->pbase();
__reinp = __rhs.egptr() - __p; ptrdiff_t __leout = this->epptr() - this->pbase();
} ptrdiff_t __lhm = this->__hm_ - this->pbase();
ptrdiff_t __rbout = -1;
ptrdiff_t __rnout = -1;
ptrdiff_t __reout = -1;
if (__rhs.pbase() != nullptr)
{
__rbout = __rhs.pbase() - __p;
__rnout = __rhs.pptr() - __p;
__reout = __rhs.epptr() - __p;
}
ptrdiff_t __rhm = __rhs.__hm_ == nullptr ? -1 : __rhs.__hm_ - __p;
__p = const_cast<char_type*>(__str_.data());
ptrdiff_t __lbinp = -1;
ptrdiff_t __lninp = -1;
ptrdiff_t __leinp = -1;
if (this->eback() != nullptr)
{
__lbinp = this->eback() - __p;
__lninp = this->gptr() - __p;
__leinp = this->egptr() - __p;
}
ptrdiff_t __lbout = -1;
ptrdiff_t __lnout = -1;
ptrdiff_t __leout = -1;
if (this->pbase() != nullptr)
{
__lbout = this->pbase() - __p;
__lnout = this->pptr() - __p;
__leout = this->epptr() - __p;
}
ptrdiff_t __lhm = __hm_ == nullptr ? -1 : __hm_ - __p;
_VSTD::swap(__mode_, __rhs.__mode_); _VSTD::swap(__mode_, __rhs.__mode_);
__str_.swap(__rhs.__str_); __str_.swap(__rhs.__str_);
__p = const_cast<char_type*>(__str_.data()); char_type* __p = const_cast<char_type*>(__str_.data());
if (__rbinp != -1) this->setg(__p, __p + __rninp, __p + __reinp);
this->setg(__p + __rbinp, __p + __rninp, __p + __reinp); this->setp(__p, __p + __reout);
else
this->setg(nullptr, nullptr, nullptr);
if (__rbout != -1)
{
this->setp(__p + __rbout, __p + __reout);
this->pbump(__rnout); this->pbump(__rnout);
} __hm_ = __p + __rhm;
else
this->setp(nullptr, nullptr);
__hm_ = __rhm == -1 ? nullptr : __p + __rhm;
__p = const_cast<char_type*>(__rhs.__str_.data()); __p = const_cast<char_type*>(__rhs.__str_.data());
if (__lbinp != -1) __rhs.setg(__p, __p + __lninp, __p + __leinp);
__rhs.setg(__p + __lbinp, __p + __lninp, __p + __leinp); __rhs.setp(__p, __p + __leout);
else
__rhs.setg(nullptr, nullptr, nullptr);
if (__lbout != -1)
{
__rhs.setp(__p + __lbout, __p + __leout);
__rhs.pbump(__lnout); __rhs.pbump(__lnout);
} __rhs.__hm_ = __p + __lhm;
else
__rhs.setp(nullptr, nullptr);
__rhs.__hm_ = __lhm == -1 ? nullptr : __p + __lhm;
locale __tl = __rhs.getloc(); locale __tl = __rhs.getloc();
__rhs.pubimbue(this->getloc()); __rhs.pubimbue(this->getloc());
this->pubimbue(__tl); this->pubimbue(__tl);
@@ -613,7 +525,7 @@ basic_stringbuf<_CharT, _Traits, _Allocator>::seekpos(pos_type __sp,
// basic_istringstream // basic_istringstream
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS basic_istringstream class _LIBCPP_VISIBLE basic_istringstream
: public basic_istream<_CharT, _Traits> : public basic_istream<_CharT, _Traits>
{ {
public: public:
@@ -732,7 +644,7 @@ basic_istringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_ostringstream // basic_ostringstream
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS basic_ostringstream class _LIBCPP_VISIBLE basic_ostringstream
: public basic_ostream<_CharT, _Traits> : public basic_ostream<_CharT, _Traits>
{ {
public: public:
@@ -851,7 +763,7 @@ basic_ostringstream<_CharT, _Traits, _Allocator>::str(const string_type& __s)
// basic_stringstream // basic_stringstream
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS basic_stringstream class _LIBCPP_VISIBLE basic_stringstream
: public basic_iostream<_CharT, _Traits> : public basic_iostream<_CharT, _Traits>
{ {
public: public:

View File

@@ -85,26 +85,22 @@ template <class T, class Container>
#include <__config> #include <__config>
#include <deque> #include <deque>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Container> class _LIBCPP_TYPE_VIS stack; template <class _Tp, class _Container> class stack;
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator==(const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container> template <class _Tp, class _Container>
_LIBCPP_INLINE_VISIBILITY
bool bool
operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y); operator< (const stack<_Tp, _Container>& __x, const stack<_Tp, _Container>& __y);
template <class _Tp, class _Container = deque<_Tp> > template <class _Tp, class _Container = deque<_Tp> >
class _LIBCPP_TYPE_VIS stack class _LIBCPP_VISIBLE stack
{ {
public: public:
typedef _Container container_type; typedef _Container container_type;
@@ -282,7 +278,7 @@ swap(stack<_Tp, _Container>& __x, stack<_Tp, _Container>& __y)
} }
template <class _Tp, class _Container, class _Alloc> template <class _Tp, class _Container, class _Alloc>
struct _LIBCPP_TYPE_VIS uses_allocator<stack<_Tp, _Container>, _Alloc> struct _LIBCPP_VISIBLE uses_allocator<stack<_Tp, _Container>, _Alloc>
: public uses_allocator<_Container, _Alloc> : public uses_allocator<_Container, _Alloc>
{ {
}; };

View File

@@ -46,9 +46,7 @@ public:
#include <exception> #include <exception>
#include <iosfwd> // for string forward decl #include <iosfwd> // for string forward decl
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {

View File

@@ -112,14 +112,12 @@ protected:
#include <iosfwd> #include <iosfwd>
#include <ios> #include <ios>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TYPE_VIS basic_streambuf class _LIBCPP_VISIBLE basic_streambuf
{ {
public: public:
// types: // types:
@@ -461,15 +459,15 @@ basic_streambuf<_CharT, _Traits>::setbuf(char_type*, streamsize)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekoff(off_type, ios_base::seekdir, basic_streambuf<_CharT, _Traits>::seekoff(off_type __off, ios_base::seekdir __way,
ios_base::openmode) ios_base::openmode __which)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::pos_type typename basic_streambuf<_CharT, _Traits>::pos_type
basic_streambuf<_CharT, _Traits>::seekpos(pos_type, ios_base::openmode) basic_streambuf<_CharT, _Traits>::seekpos(pos_type __sp, ios_base::openmode __which)
{ {
return pos_type(off_type(-1)); return pos_type(off_type(-1));
} }
@@ -540,7 +538,7 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
{ {
if (__nout_ < __eout_) if (__nout_ < __eout_)
*__nout_++ = *__s; *__nout_++ = *__s;
else if (overflow(traits_type::to_int_type(*__s)) == __eof) else if (overflow(*__s) == __eof)
break; break;
} }
return __i; return __i;
@@ -548,16 +546,16 @@ basic_streambuf<_CharT, _Traits>::xsputn(const char_type* __s, streamsize __n)
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
typename basic_streambuf<_CharT, _Traits>::int_type typename basic_streambuf<_CharT, _Traits>::int_type
basic_streambuf<_CharT, _Traits>::overflow(int_type) basic_streambuf<_CharT, _Traits>::overflow(int_type __c)
{ {
return traits_type::eof(); return traits_type::eof();
} }
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<char>) extern template class basic_streambuf<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_streambuf<wchar_t>) extern template class basic_streambuf<wchar_t>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<char>) extern template class basic_ios<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_ios<wchar_t>) extern template class basic_ios<wchar_t>;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View File

@@ -51,8 +51,8 @@ struct char_traits
typedef mbstate_t state_type; typedef mbstate_t state_type;
static void assign(char_type& c1, const char_type& c2) noexcept; static void assign(char_type& c1, const char_type& c2) noexcept;
static constexpr bool eq(char_type c1, char_type c2) noexcept; static bool eq(char_type c1, char_type c2) noexcept;
static constexpr bool lt(char_type c1, char_type c2) noexcept; static bool lt(char_type c1, char_type c2) noexcept;
static int compare(const char_type* s1, const char_type* s2, size_t n); static int compare(const char_type* s1, const char_type* s2, size_t n);
static size_t length(const char_type* s); static size_t length(const char_type* s);
@@ -61,11 +61,11 @@ struct char_traits
static char_type* copy(char_type* s1, const char_type* s2, size_t n); static char_type* copy(char_type* s1, const char_type* s2, size_t n);
static char_type* assign(char_type* s, size_t n, char_type a); static char_type* assign(char_type* s, size_t n, char_type a);
static constexpr int_type not_eof(int_type c) noexcept; static int_type not_eof(int_type c) noexcept;
static constexpr char_type to_char_type(int_type c) noexcept; static char_type to_char_type(int_type c) noexcept;
static constexpr int_type to_int_type(char_type c) noexcept; static int_type to_int_type(char_type c) noexcept;
static constexpr bool eq_int_type(int_type c1, int_type c2) noexcept; static bool eq_int_type(int_type c1, int_type c2) noexcept;
static constexpr int_type eof() noexcept; static int_type eof() noexcept;
}; };
template <> struct char_traits<char>; template <> struct char_traits<char>;
@@ -446,18 +446,14 @@ template <> struct hash<wstring>;
#include <cassert> #include <cassert>
#endif #endif
#include <__undef_min_max>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
// fpos // fpos
template <class _StateT> template <class _StateT>
class _LIBCPP_TYPE_VIS fpos class _LIBCPP_VISIBLE fpos
{ {
private: private:
_StateT __st_; _StateT __st_;
@@ -494,7 +490,7 @@ bool operator!=(const fpos<_StateT>& __x, const fpos<_StateT>& __y)
// char_traits // char_traits
template <class _CharT> template <class _CharT>
struct _LIBCPP_TYPE_VIS char_traits struct _LIBCPP_VISIBLE char_traits
{ {
typedef _CharT char_type; typedef _CharT char_type;
typedef int int_type; typedef int int_type;
@@ -506,10 +502,10 @@ struct _LIBCPP_TYPE_VIS char_traits
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;} {__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;} {return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n); static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -519,20 +515,19 @@ struct _LIBCPP_TYPE_VIS char_traits
static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n); static char_type* copy(char_type* __s1, const char_type* __s2, size_t __n);
static char_type* assign(char_type* __s, size_t __n, char_type __a); static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;} {return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT static char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);} {return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT static int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);} {return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static int_type eof() _NOEXCEPT
{return int_type(EOF);} {return int_type(EOF);}
}; };
@@ -620,7 +615,7 @@ char_traits<_CharT>::assign(char_type* __s, size_t __n, char_type __a)
// char_traits<char> // char_traits<char>
template <> template <>
struct _LIBCPP_TYPE_VIS char_traits<char> struct _LIBCPP_VISIBLE char_traits<char>
{ {
typedef char char_type; typedef char char_type;
typedef int int_type; typedef int int_type;
@@ -632,10 +627,10 @@ struct _LIBCPP_TYPE_VIS char_traits<char>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;} {__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return (unsigned char)__c1 < (unsigned char)__c2;} {return (unsigned char)__c1 < (unsigned char)__c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -656,27 +651,26 @@ struct _LIBCPP_TYPE_VIS char_traits<char>
static char_type* assign(char_type* __s, size_t __n, char_type __a) static char_type* assign(char_type* __s, size_t __n, char_type __a)
{return (char_type*)memset(__s, to_int_type(__a), __n);} {return (char_type*)memset(__s, to_int_type(__a), __n);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY static int_type not_eof(int_type __c) _NOEXCEPT
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;} {return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT static char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);} {return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT static int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type((unsigned char)__c);} {return int_type((unsigned char)__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static int_type eof() _NOEXCEPT
{return int_type(EOF);} {return int_type(EOF);}
}; };
// char_traits<wchar_t> // char_traits<wchar_t>
template <> template <>
struct _LIBCPP_TYPE_VIS char_traits<wchar_t> struct _LIBCPP_VISIBLE char_traits<wchar_t>
{ {
typedef wchar_t char_type; typedef wchar_t char_type;
typedef wint_t int_type; typedef wint_t int_type;
@@ -688,10 +682,10 @@ struct _LIBCPP_TYPE_VIS char_traits<wchar_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;} {__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;} {return __c1 < __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -714,26 +708,26 @@ struct _LIBCPP_TYPE_VIS char_traits<wchar_t>
{return (char_type*)wmemset(__s, __a, __n);} {return (char_type*)wmemset(__s, __a, __n);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT static int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;} {return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT static char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);} {return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT static int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);} {return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static int_type eof() _NOEXCEPT
{return int_type(WEOF);} {return int_type(WEOF);}
}; };
#ifndef _LIBCPP_HAS_NO_UNICODE_CHARS #ifndef _LIBCPP_HAS_NO_UNICODE_CHARS
template <> template <>
struct _LIBCPP_TYPE_VIS char_traits<char16_t> struct _LIBCPP_VISIBLE char_traits<char16_t>
{ {
typedef char16_t char_type; typedef char16_t char_type;
typedef uint_least16_t int_type; typedef uint_least16_t int_type;
@@ -745,10 +739,10 @@ struct _LIBCPP_TYPE_VIS char_traits<char16_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;} {__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;} {return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n); static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -759,19 +753,19 @@ struct _LIBCPP_TYPE_VIS char_traits<char16_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a); static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT static int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;} {return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT static char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);} {return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT static int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);} {return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static int_type eof() _NOEXCEPT
{return int_type(0xDFFF);} {return int_type(0xDFFF);}
}; };
@@ -853,7 +847,7 @@ char_traits<char16_t>::assign(char_type* __s, size_t __n, char_type __a)
} }
template <> template <>
struct _LIBCPP_TYPE_VIS char_traits<char32_t> struct _LIBCPP_VISIBLE char_traits<char32_t>
{ {
typedef char32_t char_type; typedef char32_t char_type;
typedef uint_least32_t int_type; typedef uint_least32_t int_type;
@@ -865,10 +859,10 @@ struct _LIBCPP_TYPE_VIS char_traits<char32_t>
static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT static void assign(char_type& __c1, const char_type& __c2) _NOEXCEPT
{__c1 = __c2;} {__c1 = __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq(char_type __c1, char_type __c2) _NOEXCEPT static bool eq(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool lt(char_type __c1, char_type __c2) _NOEXCEPT static bool lt(char_type __c1, char_type __c2) _NOEXCEPT
{return __c1 < __c2;} {return __c1 < __c2;}
static int compare(const char_type* __s1, const char_type* __s2, size_t __n); static int compare(const char_type* __s1, const char_type* __s2, size_t __n);
@@ -879,19 +873,19 @@ struct _LIBCPP_TYPE_VIS char_traits<char32_t>
static char_type* assign(char_type* __s, size_t __n, char_type __a); static char_type* assign(char_type* __s, size_t __n, char_type __a);
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type not_eof(int_type __c) _NOEXCEPT static int_type not_eof(int_type __c) _NOEXCEPT
{return eq_int_type(__c, eof()) ? ~eof() : __c;} {return eq_int_type(__c, eof()) ? ~eof() : __c;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR char_type to_char_type(int_type __c) _NOEXCEPT static char_type to_char_type(int_type __c) _NOEXCEPT
{return char_type(__c);} {return char_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type to_int_type(char_type __c) _NOEXCEPT static int_type to_int_type(char_type __c) _NOEXCEPT
{return int_type(__c);} {return int_type(__c);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT static bool eq_int_type(int_type __c1, int_type __c2) _NOEXCEPT
{return __c1 == __c2;} {return __c1 == __c2;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static _LIBCPP_CONSTEXPR int_type eof() _NOEXCEPT static int_type eof() _NOEXCEPT
{return int_type(0xFFFFFFFF);} {return int_type(0xFFFFFFFF);}
}; };
@@ -1027,32 +1021,10 @@ __basic_string_common<__b>::__throw_out_of_range() const
#endif #endif
} }
#ifdef _MSC_VER extern template class __basic_string_common<true>;
#pragma warning( push )
#pragma warning( disable: 4231 )
#endif // _MSC_VER
_LIBCPP_EXTERN_TEMPLATE(class __basic_string_common<true>)
#ifdef _MSC_VER
#pragma warning( pop )
#endif // _MSC_VER
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
template <class _CharT, size_t = sizeof(_CharT)>
struct __padding
{
unsigned char __xx[sizeof(_CharT)-1];
};
template <class _CharT>
struct __padding<_CharT, 1>
{
};
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
template<class _CharT, class _Traits, class _Allocator> template<class _CharT, class _Traits, class _Allocator>
class _LIBCPP_TYPE_VIS basic_string class _LIBCPP_VISIBLE basic_string
: private __basic_string_common<true> : private __basic_string_common<true>
{ {
public: public:
@@ -1084,39 +1056,6 @@ public:
typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator; typedef _VSTD::reverse_iterator<const_iterator> const_reverse_iterator;
private: private:
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT
struct __long
{
pointer __data_;
size_type __size_;
size_type __cap_;
};
#if _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x01};
enum {__long_mask = 0x1ul};
#else // _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x80};
enum {__long_mask = ~(size_type(~0) >> 1)};
#endif // _LIBCPP_BIG_ENDIAN
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
(sizeof(__long) - 1)/sizeof(value_type) : 2};
struct __short
{
value_type __data_[__min_cap];
struct
: __padding<value_type>
{
unsigned char __size_;
};
};
#else
struct __long struct __long
{ {
size_type __cap_; size_type __cap_;
@@ -1129,9 +1068,11 @@ private:
enum {__long_mask = ~(size_type(~0) >> 1)}; enum {__long_mask = ~(size_type(~0) >> 1)};
#else // _LIBCPP_BIG_ENDIAN #else // _LIBCPP_BIG_ENDIAN
enum {__short_mask = 0x01}; enum {__short_mask = 0x01};
enum {__long_mask = 0x1ul}; enum {__long_mask = 0x1};
#endif // _LIBCPP_BIG_ENDIAN #endif // _LIBCPP_BIG_ENDIAN
enum {__mask = size_type(~0) >> 1};
enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ? enum {__min_cap = (sizeof(__long) - 1)/sizeof(value_type) > 2 ?
(sizeof(__long) - 1)/sizeof(value_type) : 2}; (sizeof(__long) - 1)/sizeof(value_type) : 2};
@@ -1140,16 +1081,14 @@ private:
union union
{ {
unsigned char __size_; unsigned char __size_;
value_type __lx; value_type _;
}; };
value_type __data_[__min_cap]; value_type __data_[__min_cap];
}; };
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT union _{__long _; __short __;};
union __lx{__long __lx; __short __lxx;}; enum {__n_words = sizeof(_) / sizeof(size_type)};
enum {__n_words = sizeof(__lx) / sizeof(size_type)};
struct __raw struct __raw
{ {
@@ -1510,11 +1449,6 @@ public:
int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const; int compare(size_type __pos1, size_type __n1, const_pointer __s, size_type __n2) const;
_LIBCPP_INLINE_VISIBILITY bool __invariants() const; _LIBCPP_INLINE_VISIBILITY bool __invariants() const;
_LIBCPP_INLINE_VISIBILITY
bool __is_long() const _NOEXCEPT
{return bool(__r_.first().__s.__size_ & __short_mask);}
private: private:
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
allocator_type& __alloc() _NOEXCEPT allocator_type& __alloc() _NOEXCEPT
@@ -1523,44 +1457,24 @@ private:
const allocator_type& __alloc() const _NOEXCEPT const allocator_type& __alloc() const _NOEXCEPT
{return __r_.second();} {return __r_.second();}
#ifdef _LIBCPP_ALTERNATE_STRING_LAYOUT _LIBCPP_INLINE_VISIBILITY
bool __is_long() const _NOEXCEPT
{return bool(__r_.first().__s.__size_ & __short_mask);}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT void __set_short_size(size_type __s) _NOEXCEPT
# if _LIBCPP_BIG_ENDIAN #if _LIBCPP_BIG_ENDIAN
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
# else
{__r_.first().__s.__size_ = (unsigned char)(__s);} {__r_.first().__s.__size_ = (unsigned char)(__s);}
# endif #else
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
#endif
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type __get_short_size() const _NOEXCEPT size_type __get_short_size() const _NOEXCEPT
# if _LIBCPP_BIG_ENDIAN #if _LIBCPP_BIG_ENDIAN
{return __r_.first().__s.__size_ >> 1;}
# else
{return __r_.first().__s.__size_;} {return __r_.first().__s.__size_;}
# endif #else
#else // _LIBCPP_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY
void __set_short_size(size_type __s) _NOEXCEPT
# if _LIBCPP_BIG_ENDIAN
{__r_.first().__s.__size_ = (unsigned char)(__s);}
# else
{__r_.first().__s.__size_ = (unsigned char)(__s << 1);}
# endif
_LIBCPP_INLINE_VISIBILITY
size_type __get_short_size() const _NOEXCEPT
# if _LIBCPP_BIG_ENDIAN
{return __r_.first().__s.__size_;}
# else
{return __r_.first().__s.__size_ >> 1;} {return __r_.first().__s.__size_ >> 1;}
# endif #endif
#endif // _LIBCPP_ALTERNATE_STRING_LAYOUT
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __set_long_size(size_type __s) _NOEXCEPT void __set_long_size(size_type __s) _NOEXCEPT
{__r_.first().__l.__size_ = __s;} {__r_.first().__l.__size_ = __s;}
@@ -1576,7 +1490,7 @@ private:
{__r_.first().__l.__cap_ = __long_mask | __s;} {__r_.first().__l.__cap_ = __long_mask | __s;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
size_type __get_long_cap() const _NOEXCEPT size_type __get_long_cap() const _NOEXCEPT
{return __r_.first().__l.__cap_ & size_type(~__long_mask);} {return __r_.first().__l.__cap_ & ~__long_mask;}
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __set_long_pointer(pointer __p) _NOEXCEPT void __set_long_pointer(pointer __p) _NOEXCEPT
@@ -1666,7 +1580,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __copy_assign_alloc(const basic_string&, false_type) _NOEXCEPT void __copy_assign_alloc(const basic_string& __str, false_type) _NOEXCEPT
{} {}
#ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES
@@ -1694,7 +1608,7 @@ private:
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
void __move_assign_alloc(basic_string&, false_type) void __move_assign_alloc(basic_string& __c, false_type)
_NOEXCEPT _NOEXCEPT
{} {}
@@ -1713,7 +1627,7 @@ private:
swap(__x, __y); swap(__x, __y);
} }
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
static void __swap_alloc(allocator_type&, allocator_type&, false_type) _NOEXCEPT static void __swap_alloc(allocator_type& __x, allocator_type& __y, false_type) _NOEXCEPT
{} {}
_LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators(); _LIBCPP_INLINE_VISIBILITY void __invalidate_all_iterators();
@@ -1744,11 +1658,7 @@ template <class _CharT, class _Traits, class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY inline
#endif #endif
void void
basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type basic_string<_CharT, _Traits, _Allocator>::__invalidate_iterators_past(size_type __pos)
#ifdef _LIBCPP_DEBUG
__pos
#endif
)
{ {
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
const_iterator __beg = begin(); const_iterator __beg = begin();
@@ -2281,7 +2191,6 @@ basic_string<_CharT, _Traits, _Allocator>::assign(_InputIterator __first, _Input
clear(); clear();
for (; __first != __last; ++__first) for (; __first != __last; ++__first)
push_back(*__first); push_back(*__first);
return *this;
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -2388,37 +2297,14 @@ template <class _CharT, class _Traits, class _Allocator>
void void
basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c) basic_string<_CharT, _Traits, _Allocator>::push_back(value_type __c)
{ {
bool __is_short = !__is_long(); size_type __cap = capacity();
size_type __cap; size_type __sz = size();
size_type __sz;
if (__is_short)
{
__cap = __min_cap - 1;
__sz = __get_short_size();
}
else
{
__cap = __get_long_cap() - 1;
__sz = __get_long_size();
}
if (__sz == __cap) if (__sz == __cap)
{
__grow_by(__cap, 1, __sz, __sz, 0); __grow_by(__cap, 1, __sz, __sz, 0);
__is_short = !__is_long(); pointer __p = __get_pointer() + __sz;
}
pointer __p;
if (__is_short)
{
__p = __get_short_pointer() + __sz;
__set_short_size(__sz+1);
}
else
{
__p = __get_long_pointer() + __sz;
__set_long_size(__sz+1);
}
traits_type::assign(*__p, __c); traits_type::assign(*__p, __c);
traits_type::assign(*++__p, value_type()); traits_type::assign(*++__p, value_type());
__set_size(__sz+1);
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -2888,7 +2774,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __pos)
iterator __b = begin(); iterator __b = begin();
size_type __r = static_cast<size_type>(__pos - __b); size_type __r = static_cast<size_type>(__pos - __b);
erase(__r, 1); erase(__r, 1);
return __b + static_cast<difference_type>(__r); return __b + __r;
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -2899,7 +2785,7 @@ basic_string<_CharT, _Traits, _Allocator>::erase(const_iterator __first, const_i
iterator __b = begin(); iterator __b = begin();
size_type __r = static_cast<size_type>(__first - __b); size_type __r = static_cast<size_type>(__first - __b);
erase(__r, static_cast<size_type>(__last - __first)); erase(__r, static_cast<size_type>(__last - __first));
return __b + static_cast<difference_type>(__r); return __b + __r;
} }
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
@@ -3470,7 +3356,7 @@ basic_string<_CharT, _Traits, _Allocator>::find_first_not_of(value_type __c,
{ {
const_pointer __p = data(); const_pointer __p = data();
const_pointer __pe = __p + __sz; const_pointer __pe = __p + __sz;
for (const_pointer __ps = __p + __pos; __ps != __pe; ++__ps) for (const_pointer __ps = __p + __pos; __p != __pe; ++__ps)
if (!traits_type::eq(*__ps, __c)) if (!traits_type::eq(*__ps, __c))
return static_cast<size_type>(__ps - __p); return static_cast<size_type>(__ps - __p);
} }
@@ -3586,7 +3472,7 @@ basic_string<_CharT, _Traits, _Allocator>::compare(size_type __pos1,
template <class _CharT, class _Traits, class _Allocator> template <class _CharT, class _Traits, class _Allocator>
int int
basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const _NOEXCEPT basic_string<_CharT, _Traits, _Allocator>::compare(const_pointer __s) const
{ {
#ifdef _LIBCPP_DEBUG #ifdef _LIBCPP_DEBUG
assert(__s != 0); assert(__s != 0);
@@ -3657,29 +3543,9 @@ bool
operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs, operator==(const basic_string<_CharT, _Traits, _Allocator>& __lhs,
const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT const basic_string<_CharT, _Traits, _Allocator>& __rhs) _NOEXCEPT
{ {
size_t __lhs_sz = __lhs.size(); return __lhs.size() == __rhs.size() && _Traits::compare(__lhs.data(),
return __lhs_sz == __rhs.size() && _Traits::compare(__lhs.data(),
__rhs.data(), __rhs.data(),
__lhs_sz) == 0; __lhs.size()) == 0;
}
template<class _Allocator>
_LIBCPP_INLINE_VISIBILITY inline
bool
operator==(const basic_string<char, char_traits<char>, _Allocator>& __lhs,
const basic_string<char, char_traits<char>, _Allocator>& __rhs) _NOEXCEPT
{
size_t __lhs_sz = __lhs.size();
if (__lhs_sz != __rhs.size())
return false;
const char* __lp = __lhs.data();
const char* __rp = __rhs.data();
if (__lhs.__is_long())
return char_traits<char>::compare(__lp, __rp, __lhs_sz) == 0;
for (; __lhs_sz != 0; --__lhs_sz, ++__lp, ++__rp)
if (*__lp != *__rp)
return false;
return true;
} }
template<class _CharT, class _Traits, class _Allocator> template<class _CharT, class _Traits, class _Allocator>
@@ -4034,12 +3900,20 @@ template<class _CharT, class _Traits, class _Allocator>
template<class _Ptr> template<class _Ptr>
size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e) size_t _LIBCPP_INLINE_VISIBILITY __do_string_hash(_Ptr __p, _Ptr __e)
{ {
typedef typename iterator_traits<_Ptr>::value_type value_type; size_t __r = 0;
return __murmur2_or_cityhash<size_t>()(__p, (__e-__p)*sizeof(value_type)); const size_t __sr = __CHAR_BIT__ * sizeof(size_t) - 8;
const size_t __m = size_t(0xF) << (__sr + 4);
for (; __p != __e; ++__p)
{
__r = (__r << 4) + *__p;
size_t __g = __r & __m;
__r ^= __g | (__g >> __sr);
}
return __r;
} }
template<class _CharT, class _Traits, class _Allocator> template<class _CharT, class _Traits, class _Allocator>
struct _LIBCPP_TYPE_VIS hash<basic_string<_CharT, _Traits, _Allocator> > struct _LIBCPP_VISIBLE hash<basic_string<_CharT, _Traits, _Allocator> >
: public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t> : public unary_function<basic_string<_CharT, _Traits, _Allocator>, size_t>
{ {
size_t size_t
@@ -4091,8 +3965,8 @@ getline(basic_istream<_CharT, _Traits>&& __is,
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
_LIBCPP_EXTERN_TEMPLATE(class basic_string<char>) extern template class basic_string<char>;
_LIBCPP_EXTERN_TEMPLATE(class basic_string<wchar_t>) extern template class basic_string<wchar_t>;
extern template extern template
string string

View File

@@ -131,13 +131,11 @@ private:
#include <ostream> #include <ostream>
#include <istream> #include <istream>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS strstreambuf class _LIBCPP_VISIBLE strstreambuf
: public streambuf : public streambuf
{ {
public: public:
@@ -228,7 +226,7 @@ strstreambuf::operator=(strstreambuf&& __rhs)
#endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES
class _LIBCPP_TYPE_VIS istrstream class _LIBCPP_VISIBLE istrstream
: public istream : public istream
{ {
public: public:
@@ -281,7 +279,7 @@ private:
strstreambuf __sb_; strstreambuf __sb_;
}; };
class _LIBCPP_TYPE_VIS ostrstream class _LIBCPP_VISIBLE ostrstream
: public ostream : public ostream
{ {
public: public:
@@ -334,7 +332,7 @@ private:
strstreambuf __sb_; // exposition only strstreambuf __sb_; // exposition only
}; };
class _LIBCPP_TYPE_VIS strstream class _LIBCPP_VISIBLE strstream
: public iostream : public iostream
{ {
public: public:

View File

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

View File

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

View File

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

View File

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

View File

@@ -65,21 +65,8 @@ decltype(MB_CUR_MAX) MB_CUR_MAX_L( locale_t __l )
#define strtoull_l _strtoui64_l #define strtoull_l _strtoui64_l
// FIXME: current msvcrt does not know about long double // FIXME: current msvcrt does not know about long double
#define strtold_l _strtod_l #define strtold_l _strtod_l
#define islower_l _islower_l
inline _LIBCPP_INLINE_VISIBILITY #define isupper_l _isupper_l
int
islower_l(int c, _locale_t loc)
{
return _islower_l((int)c, loc);
}
inline _LIBCPP_INLINE_VISIBILITY
int
isupper_l(int c, _locale_t loc)
{
return _isupper_l((int)c, loc);
}
#define isdigit_l _isdigit_l #define isdigit_l _isdigit_l
#define isxdigit_l _isxdigit_l #define isxdigit_l _isxdigit_l
#define strcoll_l _strcoll_l #define strcoll_l _strcoll_l
@@ -120,10 +107,4 @@ inline int iswblank_l( wint_t c, locale_t /*loc*/ )
return ( c == L' ' || c == L'\t' ); return ( c == L' ' || c == L'\t' );
} }
#ifdef _MSC_VER
inline int isblank( int c, locale_t /*loc*/ )
{ return ( c == ' ' || c == '\t' ); }
inline int iswblank( wint_t c, locale_t /*loc*/ )
{ return ( c == L' ' || c == L'\t' ); }
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H #endif // _LIBCPP_SUPPORT_WIN32_LOCALE_WIN32_H

View File

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

View File

@@ -15,101 +15,17 @@
Functions and constants used in libc++ that are missing from the Windows C library. Functions and constants used in libc++ that are missing from the Windows C library.
*/ */
#include <__config>
#include <wchar.h> // mbstate_t #include <wchar.h> // mbstate_t
#include <stdio.h> // _snwprintf #include <stdio.h> // _snwprintf
#define swprintf _snwprintf #define swprintf _snwprintf
#define vswprintf _vsnwprintf #define vswprintf _vsnwprintf
#define vfscnaf fscanf
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 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 mbsnrtowcs( wchar_t *__restrict__ dst, const char **__restrict__ src,
size_t nmc, size_t len, mbstate_t *__restrict ps ); size_t nmc, size_t len, mbstate_t *__restrict__ ps );
size_t wcsnrtombs( char *__restrict dst, const wchar_t **__restrict src, size_t wcsnrtombs( char *__restrict__ dst, const wchar_t **__restrict__ src,
size_t nwc, size_t len, mbstate_t *__restrict ps ); size_t nwc, size_t len, mbstate_t *__restrict__ ps );
#if defined(_MSC_VER)
#define snprintf _snprintf
#include <xlocinfo.h>
#define atoll _atoi64
#define strtoll _strtoi64
#define strtoull _strtoui64
#define wcstoll _wcstoi64
#define wcstoull _wcstoui64
_LIBCPP_ALWAYS_INLINE float strtof( const char *nptr, char **endptr )
{ return _Stof(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE double strtod( const char *nptr, char **endptr )
{ return _Stod(nptr, endptr, 0); }
_LIBCPP_ALWAYS_INLINE long double strtold( const char *nptr, char **endptr )
{ return _Stold(nptr, endptr, 0); }
#define _Exit _exit
#ifndef __clang__ // MSVC-based Clang also defines _MSC_VER
#include <intrin.h>
_LIBCPP_ALWAYS_INLINE int __builtin_popcount(unsigned int x) {
static const unsigned int m1 = 0x55555555; //binary: 0101...
static const unsigned int m2 = 0x33333333; //binary: 00110011..
static const unsigned int m4 = 0x0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned int h01= 0x01010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return (x * h01) >> 24; //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24)
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountl(unsigned long x) {
return __builtin_popcount(static_cast<int>(x));
}
_LIBCPP_ALWAYS_INLINE int __builtin_popcountll(unsigned long long x) {
static const unsigned long long m1 = 0x5555555555555555; //binary: 0101...
static const unsigned long long m2 = 0x3333333333333333; //binary: 00110011..
static const unsigned long long m4 = 0x0f0f0f0f0f0f0f0f; //binary: 4 zeros, 4 ones ...
static const unsigned long long h01 = 0x0101010101010101; //the sum of 256 to the power of 0,1,2,3...
x -= (x >> 1) & m1; //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2); //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4; //put count of each 8 bits into those 8 bits
return static_cast<int>((x * h01)>>56); //returns left 8 bits of x + (x<<8) + (x<<16) + (x<<24) + ...
}
_LIBCPP_ALWAYS_INLINE int __builtin_ctz( unsigned int x )
{
DWORD r = 0;
_BitScanReverse(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_ctzl( unsigned long x )
{ return __builtin_ctz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_ctzll( unsigned long long x )
{
DWORD r = 0;
_BitScanReverse64(&r, x);
return static_cast<int>(r);
}
_LIBCPP_ALWAYS_INLINE int __builtin_clz( unsigned int x )
{
DWORD r = 0;
_BitScanForward(&r, x);
return static_cast<int>(r);
}
// sizeof(long) == sizeof(int) on Windows
_LIBCPP_ALWAYS_INLINE int __builtin_clzl( unsigned long x )
{ return __builtin_clz( static_cast<int>(x) ); }
_LIBCPP_ALWAYS_INLINE int __builtin_clzll( unsigned long long x )
{
DWORD r = 0;
_BitScanForward64(&r, x);
return static_cast<int>(r);
}
#endif // !__clang__
#endif // _MSC_VER
#endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H #endif // _LIBCPP_SUPPORT_WIN32_SUPPORT_H

View File

@@ -223,30 +223,29 @@ template <> struct hash<std::error_code>;
#include <stdexcept> #include <stdexcept>
#include <__functional_base> #include <__functional_base>
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
// is_error_code_enum // is_error_code_enum
template <class _Tp> template <class _Tp>
struct _LIBCPP_TYPE_VIS is_error_code_enum struct _LIBCPP_VISIBLE is_error_code_enum
: public false_type {}; : public false_type {};
// is_error_condition_enum // is_error_condition_enum
template <class _Tp> template <class _Tp>
struct _LIBCPP_TYPE_VIS is_error_condition_enum struct _LIBCPP_VISIBLE is_error_condition_enum
: public false_type {}; : public false_type {};
// Some error codes are not present on all platforms, so we provide equivalents // Some error codes are not present on all platforms, so we provide equivalents
// for them: // for them:
//enum class errc //enum class errc
_LIBCPP_DECLARE_STRONG_ENUM(errc) struct errc
{ {
enum _ {
address_family_not_supported = EAFNOSUPPORT, address_family_not_supported = EAFNOSUPPORT,
address_in_use = EADDRINUSE, address_in_use = EADDRINUSE,
address_not_available = EADDRNOTAVAIL, address_not_available = EADDRNOTAVAIL,
@@ -342,32 +341,38 @@ _LIBCPP_DECLARE_STRONG_ENUM(errc)
value_too_large = EOVERFLOW, value_too_large = EOVERFLOW,
wrong_protocol_type = EPROTOTYPE wrong_protocol_type = EPROTOTYPE
}; };
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(errc)
_ __v_;
_LIBCPP_ALWAYS_INLINE
errc(_ __v) : __v_(__v) {}
_LIBCPP_ALWAYS_INLINE
operator int() const {return __v_;}
};
template <> template <>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc> struct _LIBCPP_VISIBLE is_error_condition_enum<errc>
: true_type { }; : true_type { };
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
template <> template <>
struct _LIBCPP_TYPE_VIS is_error_condition_enum<errc::__lx> struct _LIBCPP_VISIBLE is_error_condition_enum<errc::_>
: true_type { }; : true_type { };
#endif
class _LIBCPP_TYPE_VIS error_condition; class error_condition;
class _LIBCPP_TYPE_VIS error_code; class error_code;
// class error_category // class error_category
class _LIBCPP_HIDDEN __do_message; class __do_message;
class _LIBCPP_TYPE_VIS error_category class _LIBCPP_VISIBLE error_category
{ {
public: public:
virtual ~error_category() _NOEXCEPT; virtual ~error_category() _NOEXCEPT;
error_category() _NOEXCEPT;
private: private:
error_category() _NOEXCEPT;
error_category(const error_category&);// = delete; error_category(const error_category&);// = delete;
error_category& operator=(const error_category&);// = delete; error_category& operator=(const error_category&);// = delete;
@@ -387,7 +392,7 @@ public:
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;} bool operator< (const error_category& __rhs) const _NOEXCEPT {return this < &__rhs;}
friend class _LIBCPP_HIDDEN __do_message; friend class __do_message;
}; };
class _LIBCPP_HIDDEN __do_message class _LIBCPP_HIDDEN __do_message
@@ -400,7 +405,7 @@ public:
const error_category& generic_category() _NOEXCEPT; const error_category& generic_category() _NOEXCEPT;
const error_category& system_category() _NOEXCEPT; const error_category& system_category() _NOEXCEPT;
class _LIBCPP_TYPE_VIS error_condition class _LIBCPP_VISIBLE error_condition
{ {
int __val_; int __val_;
const error_category* __cat_; const error_category* __cat_;
@@ -412,10 +417,10 @@ public:
error_condition(int __val, const error_category& __cat) _NOEXCEPT error_condition(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_condition(_Ep __e, error_condition(_E __e,
typename enable_if<is_error_condition_enum<_Ep>::value>::type* = 0 typename enable_if<is_error_condition_enum<_E>::value>::type* = 0
) _NOEXCEPT ) _NOEXCEPT
{*this = make_error_condition(__e);} {*this = make_error_condition(__e);}
@@ -426,14 +431,14 @@ public:
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_condition_enum<_Ep>::value, is_error_condition_enum<_E>::value,
error_condition& error_condition&
>::type >::type
operator=(_Ep __e) _NOEXCEPT operator=(_E __e) _NOEXCEPT
{*this = make_error_condition(__e); return *this;} {*this = make_error_condition(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
@@ -451,7 +456,7 @@ public:
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT //explicit
operator bool() const _NOEXCEPT {return __val_ != 0;} operator bool() const _NOEXCEPT {return __val_ != 0;}
}; };
@@ -467,12 +472,12 @@ bool
operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT operator<(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| (__x.category() == __y.category() && __x.value() < __y.value()); || __x.category() == __y.category() && __x.value() < __y.value();
} }
// error_code // error_code
class _LIBCPP_TYPE_VIS error_code class _LIBCPP_VISIBLE error_code
{ {
int __val_; int __val_;
const error_category* __cat_; const error_category* __cat_;
@@ -484,10 +489,10 @@ public:
error_code(int __val, const error_category& __cat) _NOEXCEPT error_code(int __val, const error_category& __cat) _NOEXCEPT
: __val_(__val), __cat_(&__cat) {} : __val_(__val), __cat_(&__cat) {}
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
error_code(_Ep __e, error_code(_E __e,
typename enable_if<is_error_code_enum<_Ep>::value>::type* = 0 typename enable_if<is_error_code_enum<_E>::value>::type* = 0
) _NOEXCEPT ) _NOEXCEPT
{*this = make_error_code(__e);} {*this = make_error_code(__e);}
@@ -498,14 +503,14 @@ public:
__cat_ = &__cat; __cat_ = &__cat;
} }
template <class _Ep> template <class _E>
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
typename enable_if typename enable_if
< <
is_error_code_enum<_Ep>::value, is_error_code_enum<_E>::value,
error_code& error_code&
>::type >::type
operator=(_Ep __e) _NOEXCEPT operator=(_E __e) _NOEXCEPT
{*this = make_error_code(__e); return *this;} {*this = make_error_code(__e); return *this;}
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
@@ -528,7 +533,7 @@ public:
string message() const; string message() const;
_LIBCPP_ALWAYS_INLINE _LIBCPP_ALWAYS_INLINE
_LIBCPP_EXPLICIT //explicit
operator bool() const _NOEXCEPT {return __val_ != 0;} operator bool() const _NOEXCEPT {return __val_ != 0;}
}; };
@@ -544,7 +549,7 @@ bool
operator<(const error_code& __x, const error_code& __y) _NOEXCEPT operator<(const error_code& __x, const error_code& __y) _NOEXCEPT
{ {
return __x.category() < __y.category() return __x.category() < __y.category()
|| (__x.category() == __y.category() && __x.value() < __y.value()); || __x.category() == __y.category() && __x.value() < __y.value();
} }
inline _LIBCPP_INLINE_VISIBILITY inline _LIBCPP_INLINE_VISIBILITY
@@ -597,7 +602,7 @@ operator!=(const error_condition& __x, const error_condition& __y) _NOEXCEPT
{return !(__x == __y);} {return !(__x == __y);}
template <> template <>
struct _LIBCPP_TYPE_VIS hash<error_code> struct _LIBCPP_VISIBLE hash<error_code>
: public unary_function<error_code, size_t> : public unary_function<error_code, size_t>
{ {
_LIBCPP_INLINE_VISIBILITY _LIBCPP_INLINE_VISIBILITY
@@ -609,7 +614,7 @@ struct _LIBCPP_TYPE_VIS hash<error_code>
// system_error // system_error
class _LIBCPP_TYPE_VIS system_error class _LIBCPP_VISIBLE system_error
: public runtime_error : public runtime_error
{ {
error_code __ec_; error_code __ec_;

View File

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

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